Auto merge of #52101 - japaric:linker-flavor, r=alexcrichton
try to infer linker flavor from linker name and vice versa
This is a second take on PR #50359 that implements the logic proposed in https://github.com/rust-lang/rust/pull/50359#pullrequestreview-116663121
With this change it would become possible to link `thumb*` binaries using GNU's LD on stable as `-C linker=arm-none-eabi-ld` would be enough to change both the linker and the linker flavor from their default values of `arm-none-eabi-gcc` and `gcc`.
To link `thumb*` binaries using rustc's LLD on stable `-Z linker-flavor` would need to be stabilized as `-C linker=rust-lld -Z linker-flavor=ld.lld` are both required to change the linker and the linker flavor, but this PR doesn't propose that. We would probably need some sort of stability guarantee around `rust-lld`'s name and availability to make linking with rustc's LLD truly stable.
With this change it would also be possible to link `thumb*` binaries using a system installed LLD on stable using the `-C linker=ld.lld` flag (provided that `ld.lld` is a symlink to the system installed LLD).
r? @alexcrichton
diff --git a/.gitmodules b/.gitmodules
index f3eb902..1631daa 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -56,3 +56,11 @@
[submodule "src/libbacktrace"]
path = src/libbacktrace
url = https://github.com/rust-lang-nursery/libbacktrace
+[submodule "src/tools/lldb"]
+ path = src/tools/lldb
+ url = https://github.com/rust-lang-nursery/lldb/
+ branch = rust-release-70
+[submodule "src/tools/clang"]
+ path = src/tools/clang
+ url = https://github.com/rust-lang-nursery/clang/
+ branch = release_70
diff --git a/.travis.yml b/.travis.yml
index d010a83..b1701e4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -30,7 +30,7 @@
- env: >
RUST_CHECK_TARGET=dist
- RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler"
+ RUST_CONFIGURE_ARGS="--enable-extended --enable-profiler --enable-lldb"
SRC=.
DEPLOY_ALT=1
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
@@ -46,6 +46,8 @@
# slow to run.
# OSX builders running tests, these run the full test suite.
+ # NO_DEBUG_ASSERTIONS=1 to make them go faster, but also do have some
+ # runners that run `//ignore-debug` tests.
#
# Note that the compiler is compiled to target 10.8 here because the Xcode
# version that we're using, 8.2, cannot compile LLVM for OSX 10.7.
@@ -85,7 +87,7 @@
# OSX 10.7 and `xcode7` is the latest Xcode able to compile LLVM for 10.7.
- env: >
RUST_CHECK_TARGET=dist
- RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-full-tools --enable-profiler"
+ RUST_CONFIGURE_ARGS="--build=i686-apple-darwin --enable-full-tools --enable-profiler --enable-lldb"
SRC=.
DEPLOY=1
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
@@ -99,7 +101,7 @@
- env: >
RUST_CHECK_TARGET=dist
- RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler"
+ RUST_CONFIGURE_ARGS="--target=aarch64-apple-ios,armv7-apple-ios,armv7s-apple-ios,i386-apple-ios,x86_64-apple-ios --enable-full-tools --enable-sanitizers --enable-profiler --enable-lldb"
SRC=.
DEPLOY=1
RUSTC_RETRY_LINKER_ON_SEGFAULT=1
@@ -218,10 +220,6 @@
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json;
sudo service docker restart;
fi
- - date
- - sudo atq || true
- - sudo grep -rE 'shutdown|poweroff|halt' /var/spool/cron || true
- - sudo grep -E 'google-clock-skew|ntpd|startup-script' /var/log/syslog || true
install:
- case "$TRAVIS_OS_NAME" in
@@ -233,7 +231,8 @@
osx)
if [[ "$RUST_CHECK_TARGET" == dist ]]; then
travis_retry brew update &&
- travis_retry brew install xz;
+ travis_retry brew install xz &&
+ travis_retry brew install swig;
fi &&
travis_retry curl -fo /usr/local/bin/sccache https://s3-us-west-1.amazonaws.com/rust-lang-ci2/rust-ci-mirror/2018-04-02-sccache-x86_64-apple-darwin &&
chmod +x /usr/local/bin/sccache &&
@@ -277,8 +276,6 @@
du . | sort -nr | head -n100
after_failure:
- # Requested by travis to debug "shutting down NOW" errors
- - sudo tail -n 500 /var/log/syslog
- >
echo "#### Build failed; Disk usage after running script:";
df -h;
diff --git a/config.toml.example b/config.toml.example
index eb7cd61..107375a 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -354,6 +354,10 @@
# sysroot.
#llvm-tools = false
+# Indicates whether LLDB will be made available in the sysroot.
+# This is only built if LLVM is also being built.
+#lldb = false
+
# Whether to deny warnings in crates
#deny-warnings = true
diff --git a/src/Cargo.lock b/src/Cargo.lock
index 2a7dbce..4e16e61 100644
--- a/src/Cargo.lock
+++ b/src/Cargo.lock
@@ -100,7 +100,7 @@
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)",
+ "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)",
"cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -109,7 +109,7 @@
[[package]]
name = "backtrace-sys"
-version = "0.1.23"
+version = "0.1.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -187,7 +187,7 @@
"filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"git2-curl 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -197,7 +197,7 @@
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -234,7 +234,8 @@
"filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fs2 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"git2-curl 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -244,10 +245,11 @@
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazycell 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-workspace-hack 1.0.0",
"rustfix 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"same-file 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -306,7 +308,7 @@
[[package]]
name = "chalk-engine"
-version = "0.6.0"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -616,7 +618,7 @@
dependencies = [
"commoncrypto 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -629,7 +631,7 @@
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
"schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"socket2 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -643,7 +645,7 @@
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -877,21 +879,30 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "fwdansi"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "termcolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "getopts"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "git2"
-version = "0.7.3"
+version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -901,7 +912,7 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"curl 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)",
- "git2 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1015,7 +1026,7 @@
version = "0.0.0"
dependencies = [
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1134,7 +1145,7 @@
[[package]]
name = "libgit2-sys"
-version = "0.7.6"
+version = "0.7.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1143,7 +1154,7 @@
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libssh2-sys 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1155,7 +1166,7 @@
"cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1216,6 +1227,11 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "macro-utils"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "maplit"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1292,10 +1308,10 @@
[[package]]
name = "minifier"
-version = "0.0.14"
+version = "0.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1382,7 +1398,7 @@
[[package]]
name = "openssl"
-version = "0.10.10"
+version = "0.10.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1390,7 +1406,7 @@
"foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -1399,12 +1415,21 @@
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
+name = "openssl-src"
+version = "110.0.6+1.1.0h"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
+[[package]]
name = "openssl-sys"
-version = "0.9.33"
+version = "0.9.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-src 110.0.6+1.1.0h (registry+https://github.com/rust-lang/crates.io-index)",
"pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)",
"vcpkg 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1770,7 +1795,7 @@
[[package]]
name = "rls"
-version = "0.130.4"
+version = "0.130.5"
dependencies = [
"cargo 0.30.0",
"cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1872,7 +1897,7 @@
"backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "chalk-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fmt_macros 0.0.0",
"graphviz 0.0.0",
@@ -1887,6 +1912,7 @@
"rustc_apfloat 0.0.0",
"rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
+ "rustc_fs_util 0.0.0",
"rustc_target 0.0.0",
"scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"serialize 0.0.0",
@@ -2048,6 +2074,7 @@
dependencies = [
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
+ "rustc_data_structures 0.0.0",
"rustc_errors 0.0.0",
"rustc_target 0.0.0",
"syntax 0.0.0",
@@ -2186,6 +2213,10 @@
]
[[package]]
+name = "rustc_fs_util"
+version = "0.0.0"
+
+[[package]]
name = "rustc_incremental"
version = "0.0.0"
dependencies = [
@@ -2194,6 +2225,7 @@
"rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
"rustc_data_structures 0.0.0",
+ "rustc_fs_util 0.0.0",
"serialize 0.0.0",
"syntax 0.0.0",
"syntax_pos 0.0.0",
@@ -2376,7 +2408,7 @@
version = "0.0.0"
dependencies = [
"bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "chalk-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"graphviz 0.0.0",
"log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc 0.0.0",
@@ -2424,7 +2456,7 @@
name = "rustdoc"
version = "0.0.0"
dependencies = [
- "minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
+ "minifier 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)",
"pulldown-cmark 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3093,7 +3125,7 @@
"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51"
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
"checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a"
-"checksum backtrace-sys 0.1.23 (registry+https://github.com/rust-lang/crates.io-index)" = "bff67d0c06556c0b8e6b5f090f0eac52d950d9dfd1d35ba04e4ca3543eaf6a7e"
+"checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0"
"checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5"
"checksum bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "d0c54bb8f454c567f21197eefcdbf5679d0bd99f2ddbe52e84c77061952e6789"
"checksum bufstream 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f382711e76b9de6c744cc00d0497baba02fb00a787f088c879f01d09468e32"
@@ -3103,7 +3135,7 @@
"checksum cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d6809b327f87369e6f3651efd2c5a96c49847a3ed2559477ecba79014751ee1"
"checksum cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "2119ea4867bd2b8ed3aecab467709720b2d55b1bcfe09f772fd68066eaf15275"
"checksum cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "efe5c877e17a9c717a0bf3613b2709f723202c4e4675cc8f12926ded29bcb17e"
-"checksum chalk-engine 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a146c19172c7eea48ea55a7123ac95da786639bc665097f1e14034ee5f1d8699"
+"checksum chalk-engine 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "25ce2f28f55ed544a2a3756b7acf41dd7d6f27acffb2086439950925506af7d0"
"checksum chalk-macros 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "295635afd6853aa9f20baeb7f0204862440c0fe994c5a253d5f479dac41d047e"
"checksum chrono 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6962c635d530328acc53ac6a955e83093fedc91c5809dfac1fa60fa470830a37"
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
@@ -3156,8 +3188,9 @@
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
"checksum futf 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b"
"checksum futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)" = "1a70b146671de62ec8c8ed572219ca5d594d9b06c0b364d5e67b722fc559b48c"
+"checksum fwdansi 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "34dd4c507af68d37ffef962063dfa1944ce0dd4d5b82043dbab1dabe088610c3"
"checksum getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)" = "b900c08c1939860ce8b54dc6a89e26e00c04c380fd0e09796799bd7f12861e05"
-"checksum git2 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b87cffac882c99f9654ca5eb4c6c61527b47bc1e113304f8c57333567cd31f2"
+"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71"
"checksum git2-curl 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b502f6b1b467957403d168f0039e0c46fa6a1220efa2adaef25d5b267b5fe024"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum globset 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "142754da2c9b3722affd909f9e27f2a6700a7a303f362971e0a74c652005a43d"
@@ -3182,7 +3215,7 @@
"checksum lazycell 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a6f08839bc70ef4a3fe1d566d5350f519c5912ea86be0df1740a7d247c7fc0ef"
"checksum lazycell 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d33a48d0365c96081958cc663eef834975cb1e8d8bea3378513fc72bdbf11e50"
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
-"checksum libgit2-sys 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c9051a4b288ba6f8728e9e52bb2510816946b8bcb2e20259e4d4cdc93b9ecafd"
+"checksum libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab62b46003ba97701554631fa570d9f7e7947e2480ae3d941e555a54a2c0f05"
"checksum libssh2-sys 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c628b499e8d1a4f4bd09a95d6cb1f8aeb231b46a9d40959bbd0408f14dd63adf"
"checksum libz-sys 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)" = "87f737ad6cc6fd6eefe3d9dc5412f1573865bded441300904d2f42269e140f16"
"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
@@ -3190,6 +3223,7 @@
"checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd"
"checksum lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d1eaa027402541975218bb0eec67d6b0412f6233af96e0d096d31dbdfd22e614"
"checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4"
+"checksum macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c4deaccc2ead6a28c16c0ba82f07d52b6475397415ce40876e559b0b0ea510"
"checksum maplit 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "08cbb6b4fef96b6d77bfc40ec491b1690c779e77b05cd9f07f787ed376fd4c43"
"checksum markup5ever 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "bfedc97d5a503e96816d10fedcd5b42f760b2e525ce2f7ec71f6a41780548475"
"checksum matches 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "835511bab37c34c47da5cb44844bea2cfde0236db0b506f90ea4224482c9774a"
@@ -3197,7 +3231,7 @@
"checksum memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "796fba70e76612589ed2ce7f45282f5af869e0fdd7cc6199fa1aa1f1d591ba9d"
"checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff"
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
-"checksum minifier 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "78cb57f9a385530d60f2d67f6e108050b478b7a0ffd0bb9c350803e1356535dd"
+"checksum minifier 0.0.19 (registry+https://github.com/rust-lang/crates.io-index)" = "9908ed7c62f990c21ab41fdca53a864a3ada0da69d8729c4de727b397e27bc11"
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
"checksum miow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9224c91f82b3c47cf53dcf78dfaa20d6888fbcc5d272d5f2fcdf8a697f3c987d"
"checksum new_debug_unreachable 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0cdc457076c78ab54d5e0d6fa7c47981757f1e34dc39ff92787f217dede586c4"
@@ -3207,9 +3241,10 @@
"checksum num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe"
"checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30"
"checksum open 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c281318d992e4432cfa799969467003d05921582a7489a8325e37f8a450d5113"
-"checksum openssl 0.10.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ed18a0f40ec4e9a8a81f8865033d823b7195d16a0a5721e10963ee1b0c2980ca"
+"checksum openssl 0.10.11 (registry+https://github.com/rust-lang/crates.io-index)" = "6c24d3508b4fb6da175c10baac54c578b33f09c89ae90c6fe9788b3b4768efdc"
"checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
-"checksum openssl-sys 0.9.33 (registry+https://github.com/rust-lang/crates.io-index)" = "d8abc04833dcedef24221a91852931df2f63e3369ae003134e70aff3645775cc"
+"checksum openssl-src 110.0.6+1.1.0h (registry+https://github.com/rust-lang/crates.io-index)" = "2011250f011d9c0f2e982f36721c9cbf451a9b04f425ea43a6a3f1bfa889a3b4"
+"checksum openssl-sys 0.9.35 (registry+https://github.com/rust-lang/crates.io-index)" = "912f301a749394e1025d9dcddef6106ddee9252620e6d0a0e5f8d0681de9b129"
"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063"
"checksum ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd20eec3dbe4376829cb7d80ae6ac45e0a766831dca50202ff2d40db46a8a024"
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 8294871..d9c66ce 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -721,6 +721,10 @@
config = self.get_toml('lld')
if config is None or config == 'false':
continue
+ if module.endswith("lldb") or module.endswith("clang"):
+ config = self.get_toml('lldb')
+ if config is None or config == 'false':
+ continue
check = self.check_submodule(module, slow_submodules)
filtered_submodules.append((module, check))
submodules_names.append(module)
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index dc0b0aa..12c1972 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -461,6 +461,7 @@
dist::Rustfmt,
dist::Clippy,
dist::LlvmTools,
+ dist::Lldb,
dist::Extended,
dist::HashSign
),
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 1a94d59..4365033 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -87,6 +87,7 @@
pub llvm_link_jobs: Option<u32>,
pub lld_enabled: bool,
+ pub lldb_enabled: bool,
pub llvm_tools_enabled: bool,
// rust codegen options
@@ -310,6 +311,7 @@
codegen_backends_dir: Option<String>,
wasm_syscall: Option<bool>,
lld: Option<bool>,
+ lldb: Option<bool>,
llvm_tools: Option<bool>,
deny_warnings: Option<bool>,
backtrace_on_ice: Option<bool>,
@@ -538,6 +540,7 @@
}
set(&mut config.wasm_syscall, rust.wasm_syscall);
set(&mut config.lld_enabled, rust.lld);
+ set(&mut config.lldb_enabled, rust.lldb);
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
config.rustc_default_linker = rust.default_linker.clone();
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 9fdba04..cf7f78e 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -68,6 +68,7 @@
o("profiler", "build.profiler", "build the profiler runtime")
o("emscripten", None, "compile the emscripten backend as well as LLVM")
o("full-tools", None, "enable all tools")
+o("lldb", "rust.lldb", "build lldb")
# Optimization and debugging options. These may be overridden by the release
# channel, etc.
@@ -350,7 +351,7 @@
# all the various comments and whatnot.
#
# Note that the `target` section is handled separately as we'll duplicate it
-# per configure dtarget, so there's a bit of special handling for that here.
+# per configured target, so there's a bit of special handling for that here.
sections = {}
cur_section = None
sections[None] = []
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index 188e64c..6e473fa 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -47,6 +47,8 @@
format!("{}-{}", component, builder.rustfmt_package_vers())
} else if component == "llvm-tools" {
format!("{}-{}", component, builder.llvm_tools_package_vers())
+ } else if component == "lldb" {
+ format!("{}-{}", component, builder.lldb_package_vers())
} else {
assert!(component.starts_with("rust"));
format!("{}-{}", component, builder.rust_package_vers())
@@ -1396,6 +1398,7 @@
let rls_installer = builder.ensure(Rls { stage, target });
let llvm_tools_installer = builder.ensure(LlvmTools { stage, target });
let clippy_installer = builder.ensure(Clippy { stage, target });
+ let lldb_installer = builder.ensure(Lldb { target });
let mingw_installer = builder.ensure(Mingw { host: target });
let analysis_installer = builder.ensure(Analysis {
compiler: builder.compiler(stage, self.host),
@@ -1435,6 +1438,7 @@
tarballs.extend(clippy_installer.clone());
tarballs.extend(rustfmt_installer.clone());
tarballs.extend(llvm_tools_installer.clone());
+ tarballs.extend(lldb_installer.clone());
tarballs.push(analysis_installer);
tarballs.push(std_installer);
if builder.config.docs {
@@ -1869,6 +1873,7 @@
cmd.arg(builder.package_vers(&builder.release_num("clippy")));
cmd.arg(builder.package_vers(&builder.release_num("rustfmt")));
cmd.arg(builder.llvm_tools_package_vers());
+ cmd.arg(builder.lldb_package_vers());
cmd.arg(addr);
builder.create_dir(&distdir(builder));
@@ -1963,3 +1968,121 @@
Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
}
}
+
+#[derive(Clone, Debug, Eq, Hash, PartialEq)]
+pub struct Lldb {
+ pub target: Interned<String>,
+}
+
+impl Step for Lldb {
+ type Output = Option<PathBuf>;
+ const ONLY_HOSTS: bool = true;
+ const DEFAULT: bool = true;
+
+ fn should_run(run: ShouldRun) -> ShouldRun {
+ run.path("src/tools/lldb")
+ }
+
+ fn make_run(run: RunConfig) {
+ run.builder.ensure(Lldb {
+ target: run.target,
+ });
+ }
+
+ fn run(self, builder: &Builder) -> Option<PathBuf> {
+ let target = self.target;
+
+ if builder.config.dry_run {
+ return None;
+ }
+
+ let bindir = builder
+ .llvm_out(target)
+ .join("bin");
+ let lldb_exe = bindir.join(exe("lldb", &target));
+ if !lldb_exe.exists() {
+ return None;
+ }
+
+ builder.info(&format!("Dist Lldb ({})", target));
+ let src = builder.src.join("src/tools/lldb");
+ let name = pkgname(builder, "lldb");
+
+ let tmp = tmpdir(builder);
+ let image = tmp.join("lldb-image");
+ drop(fs::remove_dir_all(&image));
+
+ // Prepare the image directory
+ let dst = image.join("bin");
+ t!(fs::create_dir_all(&dst));
+ for program in &["lldb", "lldb-argdumper", "lldb-mi", "lldb-server"] {
+ let exe = bindir.join(exe(program, &target));
+ builder.install(&exe, &dst, 0o755);
+ }
+
+ // The libraries.
+ let libdir = builder.llvm_out(target).join("lib");
+ let dst = image.join("lib");
+ t!(fs::create_dir_all(&dst));
+ for entry in t!(fs::read_dir(&libdir)) {
+ // let entry = t!(entry);
+ let entry = entry.unwrap();
+ if let Ok(name) = entry.file_name().into_string() {
+ if name.starts_with("liblldb.") && !name.ends_with(".a") {
+ if t!(entry.file_type()).is_symlink() {
+ builder.copy_to_folder(&entry.path(), &dst);
+ } else {
+ builder.install(&entry.path(), &dst, 0o755);
+ }
+ }
+ }
+ }
+
+ // The lldb scripts might be installed in lib/python$version
+ // or in lib64/python$version. If lib64 exists, use it;
+ // otherwise lib.
+ let libdir = builder.llvm_out(target).join("lib64");
+ let (libdir, libdir_name) = if libdir.exists() {
+ (libdir, "lib64")
+ } else {
+ (builder.llvm_out(target).join("lib"), "lib")
+ };
+ for entry in t!(fs::read_dir(&libdir)) {
+ let entry = t!(entry);
+ if let Ok(name) = entry.file_name().into_string() {
+ if name.starts_with("python") {
+ let dst = image.join(libdir_name)
+ .join(entry.file_name());
+ t!(fs::create_dir_all(&dst));
+ builder.cp_r(&entry.path(), &dst);
+ break;
+ }
+ }
+ }
+
+ // Prepare the overlay
+ let overlay = tmp.join("lldb-overlay");
+ drop(fs::remove_dir_all(&overlay));
+ builder.create_dir(&overlay);
+ builder.install(&src.join("LICENSE.TXT"), &overlay, 0o644);
+ builder.create(&overlay.join("version"), &builder.lldb_vers());
+
+ // Generate the installer tarball
+ let mut cmd = rust_installer(builder);
+ cmd.arg("generate")
+ .arg("--product-name=Rust")
+ .arg("--rel-manifest-dir=rustlib")
+ .arg("--success-message=lldb-installed.")
+ .arg("--image-dir").arg(&image)
+ .arg("--work-dir").arg(&tmpdir(builder))
+ .arg("--output-dir").arg(&distdir(builder))
+ .arg("--non-installed-overlay").arg(&overlay)
+ .arg(format!("--package-name={}-{}", name, target))
+ .arg("--legacy-manifest-dirs=rustlib,cargo")
+ .arg("--component-name=lldb-preview");
+
+
+ builder.run(&mut cmd);
+ Some(distdir(builder).join(format!("{}-{}.tar.gz", name, target)))
+ }
+}
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 3896594..5bb475e 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -151,6 +151,11 @@
use std::slice;
use std::str;
+#[cfg(unix)]
+use std::os::unix::fs::symlink as symlink_file;
+#[cfg(windows)]
+use std::os::windows::fs::symlink_file;
+
use build_helper::{run_silent, run_suppressed, try_run_silent, try_run_suppressed, output, mtime};
use filetime::FileTime;
@@ -1005,6 +1010,14 @@
self.rust_version()
}
+ fn lldb_package_vers(&self) -> String {
+ self.package_vers(&self.rust_version())
+ }
+
+ fn lldb_vers(&self) -> String {
+ self.rust_version()
+ }
+
/// Returns the `version` string associated with this compiler for Rust
/// itself.
///
@@ -1123,20 +1136,24 @@
pub fn copy(&self, src: &Path, dst: &Path) {
if self.config.dry_run { return; }
let _ = fs::remove_file(&dst);
- // Attempt to "easy copy" by creating a hard link (symlinks don't work on
- // windows), but if that fails just fall back to a slow `copy` operation.
- if let Ok(()) = fs::hard_link(src, dst) {
- return
+ let metadata = t!(src.symlink_metadata());
+ if metadata.file_type().is_symlink() {
+ let link = t!(fs::read_link(src));
+ t!(symlink_file(link, dst));
+ } else if let Ok(()) = fs::hard_link(src, dst) {
+ // Attempt to "easy copy" by creating a hard link
+ // (symlinks don't work on windows), but if that fails
+ // just fall back to a slow `copy` operation.
+ } else {
+ if let Err(e) = fs::copy(src, dst) {
+ panic!("failed to copy `{}` to `{}`: {}", src.display(),
+ dst.display(), e)
+ }
+ t!(fs::set_permissions(dst, metadata.permissions()));
+ let atime = FileTime::from_last_access_time(&metadata);
+ let mtime = FileTime::from_last_modification_time(&metadata);
+ t!(filetime::set_file_times(dst, atime, mtime));
}
- if let Err(e) = fs::copy(src, dst) {
- panic!("failed to copy `{}` to `{}`: {}", src.display(),
- dst.display(), e)
- }
- let metadata = t!(src.metadata());
- t!(fs::set_permissions(dst, metadata.permissions()));
- let atime = FileTime::from_last_access_time(&metadata);
- let mtime = FileTime::from_last_modification_time(&metadata);
- t!(filetime::set_file_times(dst, atime, mtime));
}
/// Search-and-replaces within a file. (Not maximally efficiently: allocates a
diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
index 9aeb4e0..c99347a 100644
--- a/src/bootstrap/native.rs
+++ b/src/bootstrap/native.rs
@@ -149,7 +149,6 @@
.define("WITH_POLLY", "OFF")
.define("LLVM_ENABLE_TERMINFO", "OFF")
.define("LLVM_ENABLE_LIBEDIT", "OFF")
- .define("LLVM_ENABLE_LIBXML2", "OFF")
.define("LLVM_PARALLEL_COMPILE_JOBS", builder.jobs().to_string())
.define("LLVM_TARGET_ARCH", target.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target);
@@ -163,6 +162,8 @@
cfg.define("LLVM_OCAML_INSTALL_PATH",
env::var_os("LLVM_OCAML_INSTALL_PATH").unwrap_or_else(|| "usr/lib/ocaml".into()));
+ let want_lldb = builder.config.lldb_enabled && !self.emscripten;
+
// This setting makes the LLVM tools link to the dynamic LLVM library,
// which saves both memory during parallel links and overall disk space
// for the tools. We don't distribute any of those tools, so this is
@@ -170,12 +171,13 @@
//
// If we are shipping llvm tools then we statically link them LLVM
if (target.contains("linux-gnu") || target.contains("apple-darwin")) &&
- !builder.config.llvm_tools_enabled {
+ !builder.config.llvm_tools_enabled &&
+ !want_lldb {
cfg.define("LLVM_LINK_LLVM_DYLIB", "ON");
}
// For distribution we want the LLVM tools to be *statically* linked to libstdc++
- if builder.config.llvm_tools_enabled {
+ if builder.config.llvm_tools_enabled || want_lldb {
if !target.contains("windows") {
if target.contains("apple") {
cfg.define("CMAKE_EXE_LINKER_FLAGS", "-static-libstdc++");
@@ -196,6 +198,17 @@
cfg.define("LLVM_BUILD_32_BITS", "ON");
}
+ if want_lldb {
+ cfg.define("LLVM_EXTERNAL_CLANG_SOURCE_DIR", builder.src.join("src/tools/clang"));
+ cfg.define("LLVM_EXTERNAL_LLDB_SOURCE_DIR", builder.src.join("src/tools/lldb"));
+ // For the time being, disable code signing.
+ cfg.define("LLDB_CODESIGN_IDENTITY", "");
+ } else {
+ // LLDB requires libxml2; but otherwise we want it to be disabled.
+ // See https://github.com/rust-lang/rust/pull/50104
+ cfg.define("LLVM_ENABLE_LIBXML2", "OFF");
+ }
+
if let Some(num_linkers) = builder.config.llvm_link_jobs {
if num_linkers > 0 {
cfg.define("LLVM_PARALLEL_LINK_JOBS", num_linkers.to_string());
@@ -607,6 +620,7 @@
"aarch64-linux-android" => "linux-aarch64",
"aarch64-unknown-linux-gnu" => "linux-aarch64",
"aarch64-unknown-linux-musl" => "linux-aarch64",
+ "aarch64-unknown-netbsd" => "BSD-generic64",
"arm-linux-androideabi" => "android",
"arm-unknown-linux-gnueabi" => "linux-armv4",
"arm-unknown-linux-gnueabihf" => "linux-armv4",
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
index c7f514d..c2610de 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -176,7 +176,7 @@
if target.contains("-none-") {
if build.no_std(*target).is_none() {
let target = build.config.target_config.entry(target.clone())
- .or_insert(Default::default());
+ .or_default();
target.no_std = true;
}
@@ -192,7 +192,7 @@
// fall back to the system toolchain in /usr before giving up
if build.musl_root(*target).is_none() && build.config.build == *target {
let target = build.config.target_config.entry(target.clone())
- .or_insert(Default::default());
+ .or_default();
target.musl_root = Some("/usr".into());
}
match build.musl_root(*target) {
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index c860103..f762d94 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -975,9 +975,19 @@
builder.ensure(compile::Rustc { compiler, target });
}
- if builder.no_std(target) != Some(true) {
+ if builder.no_std(target) == Some(true) {
+ // the `test` doesn't compile for no-std targets
+ builder.ensure(compile::Std { compiler, target });
+ } else {
builder.ensure(compile::Test { compiler, target });
}
+
+ if builder.no_std(target) == Some(true) {
+ // for no_std run-make (e.g. thumb*),
+ // we need a host compiler which is called by cargo.
+ builder.ensure(compile::Std { compiler, target: compiler.host });
+ }
+
builder.ensure(native::TestHelpers { target });
builder.ensure(RemoteCopyLibs { compiler, target });
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index eaa3164..23ef031 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -183,7 +183,7 @@
let mut artifacts = builder.tool_artifacts.borrow_mut();
let prev_artifacts = artifacts
.entry(target)
- .or_insert_with(Default::default);
+ .or_default();
if let Some(prev) = prev_artifacts.get(&*id) {
if prev.1 != val.1 {
duplicates.push((
diff --git a/src/ci/docker/run.sh b/src/ci/docker/run.sh
index b1ee636..3a7714d 100755
--- a/src/ci/docker/run.sh
+++ b/src/ci/docker/run.sh
@@ -119,10 +119,6 @@
# goes ahead and sets it for all builders.
args="$args --privileged"
-if [ "$CI" != "" ]; then
- args="$args --dns 8.8.8.8 --dns 8.8.4.4 --dns 1.1.1.1 --dns 1.0.0.1"
-fi
-
exec docker \
run \
--volume "$root_dir:/checkout:ro" \
diff --git a/src/doc/unstable-book/src/language-features/crate-in-paths.md b/src/doc/unstable-book/src/language-features/crate-in-paths.md
index f165699..9901dc1 100644
--- a/src/doc/unstable-book/src/language-features/crate-in-paths.md
+++ b/src/doc/unstable-book/src/language-features/crate-in-paths.md
@@ -9,10 +9,6 @@
The `crate_in_paths` feature allows to explicitly refer to the crate root in absolute paths
using keyword `crate`.
-`crate` can be used *only* in absolute paths, i.e. either in `::crate::a::b::c` form or in `use`
-items where the starting `::` is added implicitly.
-Paths like `crate::a::b::c` are not accepted currently.
-
This feature is required in `feature(extern_absolute_paths)` mode to refer to any absolute path
in the local crate (absolute paths refer to extern crates by default in that mode), but can be
used without `feature(extern_absolute_paths)` as well.
@@ -39,15 +35,14 @@
use crate as root;
pub fn check() {
assert_eq!(f(), 1);
- // `::` is required in non-import paths
- assert_eq!(::crate::m::g(), 2);
+ assert_eq!(crate::m::g(), 2);
assert_eq!(root::m::h(), 3);
}
}
fn main() {
assert_eq!(f(), 1);
- assert_eq!(::crate::m::g(), 2);
+ assert_eq!(crate::m::g(), 2);
assert_eq!(root::m::h(), 3);
n::check();
}
diff --git a/src/doc/unstable-book/src/language-features/extern-absolute-paths.md b/src/doc/unstable-book/src/language-features/extern-absolute-paths.md
index f45c505..6a22e7e 100644
--- a/src/doc/unstable-book/src/language-features/extern-absolute-paths.md
+++ b/src/doc/unstable-book/src/language-features/extern-absolute-paths.md
@@ -12,7 +12,7 @@
`::my_crate::a::b` will resolve to path `a::b` in crate `my_crate`.
`feature(crate_in_paths)` can be used in `feature(extern_absolute_paths)` mode for referring
-to absolute paths in the local crate (`::crate::a::b`).
+to absolute paths in the local crate (`crate::a::b`).
`feature(extern_in_paths)` provides the same effect by using keyword `extern` to refer to
paths from other crates (`extern::my_crate::a::b`).
diff --git a/src/doc/unstable-book/src/language-features/on-unimplemented.md b/src/doc/unstable-book/src/language-features/on-unimplemented.md
index 70c7c11..f787f62 100644
--- a/src/doc/unstable-book/src/language-features/on-unimplemented.md
+++ b/src/doc/unstable-book/src/language-features/on-unimplemented.md
@@ -8,7 +8,9 @@
The `on_unimplemented` feature provides the `#[rustc_on_unimplemented]`
attribute, which allows trait definitions to add specialized notes to error
-messages when an implementation was expected but not found.
+messages when an implementation was expected but not found. You can refer
+to the trait's generic arguments by name and to the resolved type using
+`Self`.
For example:
@@ -41,7 +43,98 @@
|
= help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
= note: required by `iterate_chars`
-
-error: aborting due to previous error
```
+`on_unimplemented` also supports advanced filtering for better targeting
+of messages, as well as modifying specific parts of the error message. You
+target the text of:
+
+ - the main error message (`message`)
+ - the label (`label`)
+ - an extra note (`note`)
+
+For example, the following attribute
+
+```rust,compile_fail
+#[rustc_on_unimplemented(
+ message="message",
+ label="label",
+ note="note"
+)]
+trait MyIterator<A> {
+ fn next(&mut self) -> A;
+}
+```
+
+Would generate the following output:
+
+```text
+error[E0277]: message
+ --> <anon>:14:5
+ |
+14 | iterate_chars(&[1, 2, 3][..]);
+ | ^^^^^^^^^^^^^ label
+ |
+ = note: note
+ = help: the trait `MyIterator<char>` is not implemented for `&[{integer}]`
+ = note: required by `iterate_chars`
+```
+
+To allow more targeted error messages, it is possible to filter the
+application of these fields based on a variety of attributes when using
+`on`:
+
+ - `crate_local`: whether the code causing the trait bound to not be
+ fulfilled is part of the user's crate. This is used to avoid suggesting
+ code changes that would require modifying a dependency.
+ - Any of the generic arguments that can be substituted in the text can be
+ referred by name as well for filtering, like `Rhs="i32"`, except for
+ `Self`.
+ - `_Self`: to filter only on a particular calculated trait resolution, like
+ `Self="std::iter::Iterator<char>"`. This is needed because `Self` is a
+ keyword which cannot appear in attributes.
+ - `direct`: user-specified rather than derived obligation.
+ - `from_method`: usable both as boolean (whether the flag is present, like
+ `crate_local`) or matching against a particular method. Currently used
+ for `try`.
+ - `from_desugaring`: usable both as boolean (whether the flag is present)
+ or matching against a particular desugaring.
+
+For example, the `Iterator` trait can be annotated in the following way:
+
+```rust,compile_fail
+#[rustc_on_unimplemented(
+ on(
+ _Self="&str",
+ note="call `.chars()` or `.as_bytes()` on `{Self}"
+ ),
+ message="`{Self}` is not an iterator",
+ label="`{Self}` is not an iterator",
+ note="maybe try calling `.iter()` or a similar method"
+)]
+pub trait Iterator {}
+```
+
+Which would produce the following outputs:
+
+```text
+error[E0277]: `Foo` is not an iterator
+ --> src/main.rs:4:16
+ |
+4 | for foo in Foo {}
+ | ^^^ `Foo` is not an iterator
+ |
+ = note: maybe try calling `.iter()` or a similar method
+ = help: the trait `std::iter::Iterator` is not implemented for `Foo`
+ = note: required by `std::iter::IntoIterator::into_iter`
+
+error[E0277]: `&str` is not an iterator
+ --> src/main.rs:5:16
+ |
+5 | for foo in "" {}
+ | ^^ `&str` is not an iterator
+ |
+ = note: call `.chars()` or `.bytes() on `&str`
+ = help: the trait `std::iter::Iterator` is not implemented for `&str`
+ = note: required by `std::iter::IntoIterator::into_iter`
+```
diff --git a/src/doc/unstable-book/src/language-features/self-in-typedefs.md b/src/doc/unstable-book/src/language-features/self-in-typedefs.md
new file mode 100644
index 0000000..2416e85
--- /dev/null
+++ b/src/doc/unstable-book/src/language-features/self-in-typedefs.md
@@ -0,0 +1,24 @@
+# `self_in_typedefs`
+
+The tracking issue for this feature is: [#49303]
+
+[#49303]: https://github.com/rust-lang/rust/issues/49303
+
+------------------------
+
+The `self_in_typedefs` feature gate lets you use the special `Self` identifier
+in `struct`, `enum`, and `union` type definitions.
+
+A simple example is:
+
+```rust
+#![feature(self_in_typedefs)]
+
+enum List<T>
+where
+ Self: PartialOrd<Self> // can write `Self` instead of `List<T>`
+{
+ Nil,
+ Cons(T, Box<Self>) // likewise here
+}
+```
diff --git a/src/doc/unstable-book/src/language-features/unsized-locals.md b/src/doc/unstable-book/src/language-features/unsized-locals.md
new file mode 100644
index 0000000..7a5fe5b
--- /dev/null
+++ b/src/doc/unstable-book/src/language-features/unsized-locals.md
@@ -0,0 +1,180 @@
+# `unsized_locals`
+
+The tracking issue for this feature is: [#48055]
+
+[#48055]: https://github.com/rust-lang/rust/issues/48055
+
+------------------------
+
+This implements [RFC1909]. When turned on, you can have unsized arguments and locals:
+
+[RFC1909]: https://github.com/rust-lang/rfcs/blob/master/text/1909-coercions.md
+
+```rust
+#![feature(unsized_locals)]
+
+use std::any::Any;
+
+fn main() {
+ let x: Box<dyn Any> = Box::new(42);
+ let x: dyn Any = *x;
+ // ^ unsized local variable
+ // ^^ unsized temporary
+ foo(x);
+}
+
+fn foo(_: dyn Any) {}
+// ^^^^^^ unsized argument
+```
+
+The RFC still forbids the following unsized expressions:
+
+```rust,ignore
+#![feature(unsized_locals)]
+
+use std::any::Any;
+
+struct MyStruct<T: ?Sized> {
+ content: T,
+}
+
+struct MyTupleStruct<T: ?Sized>(T);
+
+fn answer() -> Box<dyn Any> {
+ Box::new(42)
+}
+
+fn main() {
+ // You CANNOT have unsized statics.
+ static X: dyn Any = *answer(); // ERROR
+ const Y: dyn Any = *answer(); // ERROR
+
+ // You CANNOT have struct initialized unsized.
+ MyStruct { content: *answer() }; // ERROR
+ MyTupleStruct(*answer()); // ERROR
+ (42, *answer()); // ERROR
+
+ // You CANNOT have unsized return types.
+ fn my_function() -> dyn Any { *answer() } // ERROR
+
+ // You CAN have unsized local variables...
+ let mut x: dyn Any = *answer(); // OK
+ // ...but you CANNOT reassign to them.
+ x = *answer(); // ERROR
+
+ // You CANNOT even initialize them separately.
+ let y: dyn Any; // OK
+ y = *answer(); // ERROR
+
+ // Not mentioned in the RFC, but by-move captured variables are also Sized.
+ let x: dyn Any = *answer();
+ (move || { // ERROR
+ let y = x;
+ })();
+
+ // You CAN create a closure with unsized arguments,
+ // but you CANNOT call it.
+ // This is an implementation detail and may be changed in the future.
+ let f = |x: dyn Any| {};
+ f(*answer()); // ERROR
+}
+```
+
+However, the current implementation allows `MyTupleStruct(..)` to be unsized. This will be fixed in the future.
+
+## By-value trait objects
+
+With this feature, you can have by-value `self` arguments without `Self: Sized` bounds.
+
+```rust
+#![feature(unsized_locals)]
+
+trait Foo {
+ fn foo(self) {}
+}
+
+impl<T: ?Sized> Foo for T {}
+
+fn main() {
+ let slice: Box<[i32]> = Box::new([1, 2, 3]);
+ <[i32] as Foo>::foo(*slice);
+}
+```
+
+And `Foo` will also be object-safe. However, this object-safety is not yet implemented.
+
+```rust,ignore
+#![feature(unsized_locals)]
+
+trait Foo {
+ fn foo(self) {}
+}
+
+impl<T: ?Sized> Foo for T {}
+
+fn main () {
+ let slice: Box<dyn Foo> = Box::new([1, 2, 3]);
+ // doesn't compile yet
+ <dyn Foo as Foo>::foo(*slice);
+}
+```
+
+Unfortunately, this is not implemented yet.
+
+One of the objectives of this feature is to allow `Box<dyn FnOnce>`, instead of `Box<dyn FnBox>` in the future. See [#28796] for details.
+
+[#28796]: https://github.com/rust-lang/rust/issues/28796
+
+## Variable length arrays
+
+The RFC also describes an extension to the array literal syntax: `[e; dyn n]`. In the syntax, `n` isn't necessarily a constant expression. The array is dynamically allocated on the stack and has the type of `[T]`, instead of `[T; n]`.
+
+```rust,ignore
+#![feature(unsized_locals)]
+
+fn mergesort<T: Ord>(a: &mut [T]) {
+ let mut tmp = [T; dyn a.len()];
+ // ...
+}
+
+fn main() {
+ let mut a = [3, 1, 5, 6];
+ mergesort(&mut a);
+ assert_eq!(a, [1, 3, 5, 6]);
+}
+```
+
+VLAs are not implemented yet. The syntax isn't final, either. We may need an alternative syntax for Rust 2015 because, in Rust 2015, expressions like `[e; dyn(1)]` would be ambiguous. One possible alternative proposed in the RFC is `[e; n]`: if `n` captures one or more local variables, then it is considered as `[e; dyn n]`.
+
+## Advisory on stack usage
+
+It's advised not to casually use the `#![feature(unsized_locals)]` feature. Typical use-cases are:
+
+- When you need a by-value trait objects.
+- When you really need a fast allocation of small temporary arrays.
+
+Another pitfall is repetitive allocation and temporaries. Currently the compiler simply extends the stack frame every time it encounters an unsized assignment. So for example, the code
+
+```rust
+#![feature(unsized_locals)]
+
+fn main() {
+ let x: Box<[i32]> = Box::new([1, 2, 3, 4, 5]);
+ let _x = {{{{{{{{{{*x}}}}}}}}}};
+}
+```
+
+and the code
+
+```rust
+#![feature(unsized_locals)]
+
+fn main() {
+ for _ in 0..10 {
+ let x: Box<[i32]> = Box::new([1, 2, 3, 4, 5]);
+ let _x = *x;
+ }
+}
+```
+
+will unnecessarily extend the stack frame.
diff --git a/src/doc/unstable-book/src/library-features/future-atomic-orderings.md b/src/doc/unstable-book/src/library-features/future-atomic-orderings.md
deleted file mode 100644
index 40c2ef2..0000000
--- a/src/doc/unstable-book/src/library-features/future-atomic-orderings.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# `future_atomic_orderings`
-
-This feature is internal to the Rust compiler and is not intended for general use.
-
-------------------------
diff --git a/src/doc/unstable-book/src/library-features/io-error-internals.md b/src/doc/unstable-book/src/library-features/io-error-internals.md
deleted file mode 100644
index 5bee18d..0000000
--- a/src/doc/unstable-book/src/library-features/io-error-internals.md
+++ /dev/null
@@ -1,5 +0,0 @@
-# `io_error_internals`
-
-This feature is internal to the Rust compiler and is not intended for general use.
-
-------------------------
diff --git a/src/etc/debugger_pretty_printers_common.py b/src/etc/debugger_pretty_printers_common.py
index 87c7b21b..1797f67 100644
--- a/src/etc/debugger_pretty_printers_common.py
+++ b/src/etc/debugger_pretty_printers_common.py
@@ -48,6 +48,8 @@
TYPE_KIND_REGULAR_UNION = 17
TYPE_KIND_OS_STRING = 18
TYPE_KIND_STD_VECDEQUE = 19
+TYPE_KIND_STD_BTREESET = 20
+TYPE_KIND_STD_BTREEMAP = 21
ENCODED_ENUM_PREFIX = "RUST$ENCODED$ENUM$"
ENUM_DISR_FIELD_NAME = "RUST$ENUM$DISR"
@@ -71,6 +73,12 @@
STD_VECDEQUE_FIELD_NAME_HEAD,
STD_VECDEQUE_FIELD_NAME_BUF]
+# std::collections::BTreeSet<> related constants
+STD_BTREESET_FIELD_NAMES = ["map"]
+
+# std::collections::BTreeMap<> related constants
+STD_BTREEMAP_FIELD_NAMES = ["root", "length"]
+
# std::String related constants
STD_STRING_FIELD_NAMES = ["vec"]
@@ -175,6 +183,16 @@
self.__conforms_to_field_layout(STD_VECDEQUE_FIELD_NAMES)):
return TYPE_KIND_STD_VECDEQUE
+ # STD COLLECTION BTREESET
+ if (unqualified_type_name.startswith("BTreeSet<") and
+ self.__conforms_to_field_layout(STD_BTREESET_FIELD_NAMES)):
+ return TYPE_KIND_STD_BTREESET
+
+ # STD COLLECTION BTREEMAP
+ if (unqualified_type_name.startswith("BTreeMap<") and
+ self.__conforms_to_field_layout(STD_BTREEMAP_FIELD_NAMES)):
+ return TYPE_KIND_STD_BTREEMAP
+
# STD STRING
if (unqualified_type_name.startswith("String") and
self.__conforms_to_field_layout(STD_STRING_FIELD_NAMES)):
@@ -358,6 +376,31 @@
return (tail, head, data_ptr, capacity)
+def extract_length_and_ptr_from_std_btreeset(vec_val):
+ assert vec_val.type.get_type_kind() == TYPE_KIND_STD_BTREESET
+ map = vec_val.get_child_at_index(0)
+ root = map.get_child_at_index(0)
+ length = map.get_child_at_index(1).as_integer()
+ node = root.get_child_at_index(0)
+ ptr = node.get_child_at_index(0)
+ unique_ptr_val = ptr.get_child_at_index(0)
+ data_ptr = unique_ptr_val.get_child_at_index(0)
+ assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR
+ return (length, data_ptr)
+
+
+def extract_length_and_ptr_from_std_btreemap(vec_val):
+ assert vec_val.type.get_type_kind() == TYPE_KIND_STD_BTREEMAP
+ root = vec_val.get_child_at_index(0)
+ length = vec_val.get_child_at_index(1).as_integer()
+ node = root.get_child_at_index(0)
+ ptr = node.get_child_at_index(0)
+ unique_ptr_val = ptr.get_child_at_index(0)
+ data_ptr = unique_ptr_val.get_child_at_index(0)
+ assert data_ptr.type.get_dwarf_type_kind() == DWARF_TYPE_CODE_PTR
+ return (length, data_ptr)
+
+
def extract_length_and_ptr_from_slice(slice_val):
assert (slice_val.type.get_type_kind() == TYPE_KIND_SLICE or
slice_val.type.get_type_kind() == TYPE_KIND_STR_SLICE)
diff --git a/src/etc/gdb_rust_pretty_printing.py b/src/etc/gdb_rust_pretty_printing.py
index b7de42a..216915d 100755
--- a/src/etc/gdb_rust_pretty_printing.py
+++ b/src/etc/gdb_rust_pretty_printing.py
@@ -127,6 +127,12 @@
if type_kind == rustpp.TYPE_KIND_STD_VECDEQUE:
return RustStdVecDequePrinter(val)
+ if type_kind == rustpp.TYPE_KIND_STD_BTREESET:
+ return RustStdBTreeSetPrinter(val)
+
+ if type_kind == rustpp.TYPE_KIND_STD_BTREEMAP:
+ return RustStdBTreeMapPrinter(val)
+
if type_kind == rustpp.TYPE_KIND_STD_STRING:
return RustStdStringPrinter(val)
@@ -299,6 +305,55 @@
yield (str(index), (gdb_ptr + index).dereference())
+class RustStdBTreeSetPrinter(object):
+ def __init__(self, val):
+ self.__val = val
+
+ @staticmethod
+ def display_hint():
+ return "array"
+
+ def to_string(self):
+ (length, data_ptr) = \
+ rustpp.extract_length_and_ptr_from_std_btreeset(self.__val)
+ return (self.__val.type.get_unqualified_type_name() +
+ ("(len: %i)" % length))
+
+ def children(self):
+ (length, data_ptr) = \
+ rustpp.extract_length_and_ptr_from_std_btreeset(self.__val)
+ val = GdbValue(data_ptr.get_wrapped_value().dereference()).get_child_at_index(3)
+ gdb_ptr = val.get_wrapped_value()
+ for index in xrange(length):
+ yield (str(index), gdb_ptr[index])
+
+
+class RustStdBTreeMapPrinter(object):
+ def __init__(self, val):
+ self.__val = val
+
+ @staticmethod
+ def display_hint():
+ return "map"
+
+ def to_string(self):
+ (length, data_ptr) = \
+ rustpp.extract_length_and_ptr_from_std_btreemap(self.__val)
+ return (self.__val.type.get_unqualified_type_name() +
+ ("(len: %i)" % length))
+
+ def children(self):
+ (length, data_ptr) = \
+ rustpp.extract_length_and_ptr_from_std_btreemap(self.__val)
+ keys = GdbValue(data_ptr.get_wrapped_value().dereference()).get_child_at_index(3)
+ keys_ptr = keys.get_wrapped_value()
+ vals = GdbValue(data_ptr.get_wrapped_value().dereference()).get_child_at_index(4)
+ vals_ptr = vals.get_wrapped_value()
+ for index in xrange(length):
+ yield (str(index), keys_ptr[index])
+ yield (str(index), vals_ptr[index])
+
+
class RustStdStringPrinter(object):
def __init__(self, val):
self.__val = val
@@ -312,6 +367,7 @@
def display_hint(self):
return "string"
+
class RustOsStringPrinter(object):
def __init__(self, val):
self.__val = val
diff --git a/src/liballoc/Cargo.toml b/src/liballoc/Cargo.toml
index ada21e0..1dad323 100644
--- a/src/liballoc/Cargo.toml
+++ b/src/liballoc/Cargo.toml
@@ -23,3 +23,8 @@
[[bench]]
name = "collectionsbenches"
path = "../liballoc/benches/lib.rs"
+
+[[bench]]
+name = "vec_deque_append_bench"
+path = "../liballoc/benches/vec_deque_append.rs"
+harness = false
diff --git a/src/liballoc/alloc.rs b/src/liballoc/alloc.rs
index 84bd275..c69b2fb 100644
--- a/src/liballoc/alloc.rs
+++ b/src/liballoc/alloc.rs
@@ -56,6 +56,22 @@
/// # Safety
///
/// See [`GlobalAlloc::alloc`].
+///
+/// # Examples
+///
+/// ```
+/// use std::alloc::{alloc, dealloc, Layout};
+///
+/// unsafe {
+/// let layout = Layout::new::<u16>();
+/// let ptr = alloc(layout);
+///
+/// *(ptr as *mut u16) = 42;
+/// assert_eq!(*(ptr as *mut u16), 42);
+///
+/// dealloc(ptr, layout);
+/// }
+/// ```
#[stable(feature = "global_alloc", since = "1.28.0")]
#[inline]
pub unsafe fn alloc(layout: Layout) -> *mut u8 {
@@ -110,6 +126,21 @@
/// # Safety
///
/// See [`GlobalAlloc::alloc_zeroed`].
+///
+/// # Examples
+///
+/// ```
+/// use std::alloc::{alloc_zeroed, dealloc, Layout};
+///
+/// unsafe {
+/// let layout = Layout::new::<u16>();
+/// let ptr = alloc_zeroed(layout);
+///
+/// assert_eq!(*(ptr as *mut u16), 0);
+///
+/// dealloc(ptr, layout);
+/// }
+/// ```
#[stable(feature = "global_alloc", since = "1.28.0")]
#[inline]
pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8 {
diff --git a/src/liballoc/benches/vec_deque_append.rs b/src/liballoc/benches/vec_deque_append.rs
new file mode 100644
index 0000000..bd33565
--- /dev/null
+++ b/src/liballoc/benches/vec_deque_append.rs
@@ -0,0 +1,48 @@
+// 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.
+
+#![feature(duration_as_u128)]
+use std::{collections::VecDeque, time::Instant};
+
+const VECDEQUE_LEN: i32 = 100000;
+const WARMUP_N: usize = 100;
+const BENCH_N: usize = 1000;
+
+fn main() {
+ let a: VecDeque<i32> = (0..VECDEQUE_LEN).collect();
+ let b: VecDeque<i32> = (0..VECDEQUE_LEN).collect();
+
+ for _ in 0..WARMUP_N {
+ let mut c = a.clone();
+ let mut d = b.clone();
+ c.append(&mut d);
+ }
+
+ let mut durations = Vec::with_capacity(BENCH_N);
+
+ for _ in 0..BENCH_N {
+ let mut c = a.clone();
+ let mut d = b.clone();
+ let before = Instant::now();
+ c.append(&mut d);
+ let after = Instant::now();
+ durations.push(after.duration_since(before));
+ }
+
+ let l = durations.len();
+ durations.sort();
+
+ assert!(BENCH_N % 2 == 0);
+ let median = (durations[(l / 2) - 1] + durations[l / 2]) / 2;
+ println!(
+ "\ncustom-bench vec_deque_append {:?} ns/iter\n",
+ median.as_nanos()
+ );
+}
diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs
index 7787102..0f759bb 100644
--- a/src/liballoc/collections/vec_deque.rs
+++ b/src/liballoc/collections/vec_deque.rs
@@ -202,6 +202,23 @@
len);
}
+ /// Returns a pair of slices which contain the contents of the buffer not used by the VecDeque.
+ #[inline]
+ unsafe fn unused_as_mut_slices<'a>(&'a mut self) -> (&'a mut [T], &'a mut [T]) {
+ let head = self.head;
+ let tail = self.tail;
+ let buf = self.buffer_as_mut_slice();
+ if head != tail {
+ // In buf, head..tail contains the VecDeque and tail..head is unused.
+ // So calling `ring_slices` with tail and head swapped returns unused slices.
+ RingSlices::ring_slices(buf, tail, head)
+ } else {
+ // Swapping doesn't help when head == tail.
+ let (before, after) = buf.split_at_mut(head);
+ (after, before)
+ }
+ }
+
/// Copies a potentially wrapping block of memory len long from src to dest.
/// (abs(dst - src) + len) must be no larger than cap() (There must be at
/// most one continuous overlapping region between src and dest).
@@ -1834,8 +1851,148 @@
#[inline]
#[stable(feature = "append", since = "1.4.0")]
pub fn append(&mut self, other: &mut Self) {
- // naive impl
- self.extend(other.drain(..));
+ // Copies all values from `src_slice` to the start of `dst_slice`.
+ unsafe fn copy_whole_slice<T>(src_slice: &[T], dst_slice: &mut [T]) {
+ let len = src_slice.len();
+ ptr::copy_nonoverlapping(src_slice.as_ptr(), dst_slice[..len].as_mut_ptr(), len);
+ }
+
+ let src_total = other.len();
+
+ // Guarantees there is space in `self` for `other`.
+ self.reserve(src_total);
+
+ self.head = {
+ let original_head = self.head;
+
+ // The goal is to copy all values from `other` into `self`. To avoid any
+ // mismatch, all valid values in `other` are retrieved...
+ let (src_high, src_low) = other.as_slices();
+ // and unoccupied parts of self are retrieved.
+ let (dst_high, dst_low) = unsafe { self.unused_as_mut_slices() };
+
+ // Then all that is needed is to copy all values from
+ // src (src_high and src_low) to dst (dst_high and dst_low).
+ //
+ // other [o o o . . . . . o o o o]
+ // [5 6 7] [1 2 3 4]
+ // src_low src_high
+ //
+ // self [. . . . . . o o o o . .]
+ // [3 4 5 6 7 .] [1 2]
+ // dst_low dst_high
+ //
+ // Values are not copied one by one but as slices in `copy_whole_slice`.
+ // What slices are used depends on various properties of src and dst.
+ // There are 6 cases in total:
+ // 1. `src` is contiguous and fits in dst_high
+ // 2. `src` is contiguous and does not fit in dst_high
+ // 3. `src` is discontiguous and fits in dst_high
+ // 4. `src` is discontiguous and does not fit in dst_high
+ // + src_high is smaller than dst_high
+ // 5. `src` is discontiguous and does not fit in dst_high
+ // + dst_high is smaller than src_high
+ // 6. `src` is discontiguous and does not fit in dst_high
+ // + dst_high is the same size as src_high
+ let src_contiguous = src_low.is_empty();
+ let dst_high_fits_src = dst_high.len() >= src_total;
+ match (src_contiguous, dst_high_fits_src) {
+ (true, true) => {
+ // 1.
+ // other [. . . o o o . . . . . .]
+ // [] [1 1 1]
+ //
+ // self [. o o o o o . . . . . .]
+ // [.] [1 1 1 . . .]
+
+ unsafe {
+ copy_whole_slice(src_high, dst_high);
+ }
+ original_head + src_total
+ }
+ (true, false) => {
+ // 2.
+ // other [. . . o o o o o . . . .]
+ // [] [1 1 2 2 2]
+ //
+ // self [. . . . . . . o o o . .]
+ // [2 2 2 . . . .] [1 1]
+
+ let (src_1, src_2) = src_high.split_at(dst_high.len());
+ unsafe {
+ copy_whole_slice(src_1, dst_high);
+ copy_whole_slice(src_2, dst_low);
+ }
+ src_total - dst_high.len()
+ }
+ (false, true) => {
+ // 3.
+ // other [o o . . . . . . . o o o]
+ // [2 2] [1 1 1]
+ //
+ // self [. o o . . . . . . . . .]
+ // [.] [1 1 1 2 2 . . . .]
+
+ let (dst_1, dst_2) = dst_high.split_at_mut(src_high.len());
+ unsafe {
+ copy_whole_slice(src_high, dst_1);
+ copy_whole_slice(src_low, dst_2);
+ }
+ original_head + src_total
+ }
+ (false, false) => {
+ if src_high.len() < dst_high.len() {
+ // 4.
+ // other [o o o . . . . . . o o o]
+ // [2 3 3] [1 1 1]
+ //
+ // self [. . . . . . o o . . . .]
+ // [3 3 . . . .] [1 1 1 2]
+
+ let (dst_1, dst_2) = dst_high.split_at_mut(src_high.len());
+ let (src_2, src_3) = src_low.split_at(dst_2.len());
+ unsafe {
+ copy_whole_slice(src_high, dst_1);
+ copy_whole_slice(src_2, dst_2);
+ copy_whole_slice(src_3, dst_low);
+ }
+ src_3.len()
+ } else if src_high.len() > dst_high.len() {
+ // 5.
+ // other [o o o . . . . . o o o o]
+ // [3 3 3] [1 1 2 2]
+ //
+ // self [. . . . . . o o o o . .]
+ // [2 2 3 3 3 .] [1 1]
+
+ let (src_1, src_2) = src_high.split_at(dst_high.len());
+ let (dst_2, dst_3) = dst_low.split_at_mut(src_2.len());
+ unsafe {
+ copy_whole_slice(src_1, dst_high);
+ copy_whole_slice(src_2, dst_2);
+ copy_whole_slice(src_low, dst_3);
+ }
+ dst_2.len() + src_low.len()
+ } else {
+ // 6.
+ // other [o o . . . . . . . o o o]
+ // [2 2] [1 1 1]
+ //
+ // self [. . . . . . . o o . . .]
+ // [2 2 . . . . .] [1 1 1]
+
+ unsafe {
+ copy_whole_slice(src_high, dst_high);
+ copy_whole_slice(src_low, dst_low);
+ }
+ src_low.len()
+ }
+ }
+ }
+ };
+
+ // Some values now exist in both `other` and `self` but are made inaccessible in `other`.
+ other.tail = other.head;
}
/// Retains only the elements specified by the predicate.
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index d1b607b..bcdfd8c 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -76,6 +76,7 @@
#![cfg_attr(not(test), feature(fn_traits))]
#![cfg_attr(not(test), feature(generator_trait))]
+#![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(test, feature(test))]
#![feature(allocator_api)]
diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs
index 631779a..dd559df 100644
--- a/src/liballoc/string.rs
+++ b/src/liballoc/string.rs
@@ -519,10 +519,11 @@
/// between the two. Not all byte slices are valid strings, however: strings
/// are required to be valid UTF-8. During this conversion,
/// `from_utf8_lossy()` will replace any invalid UTF-8 sequences with
- /// `U+FFFD REPLACEMENT CHARACTER`, which looks like this: �
+ /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], which looks like this: �
///
/// [`u8`]: ../../std/primitive.u8.html
/// [byteslice]: ../../std/primitive.slice.html
+ /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
///
/// If you are sure that the byte slice is valid UTF-8, and you don't want
/// to incur the overhead of the conversion, there is an unsafe version
@@ -621,7 +622,7 @@
}
/// Decode a UTF-16 encoded slice `v` into a `String`, replacing
- /// invalid data with the replacement character (U+FFFD).
+ /// invalid data with [the replacement character (`U+FFFD`)][U+FFFD].
///
/// Unlike [`from_utf8_lossy`] which returns a [`Cow<'a, str>`],
/// `from_utf16_lossy` returns a `String` since the UTF-16 to UTF-8
@@ -629,6 +630,7 @@
///
/// [`from_utf8_lossy`]: #method.from_utf8_lossy
/// [`Cow<'a, str>`]: ../borrow/enum.Cow.html
+ /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
///
/// # Examples
///
diff --git a/src/liballoc/tests/vec_deque.rs b/src/liballoc/tests/vec_deque.rs
index 4d55584..3ea6c87 100644
--- a/src/liballoc/tests/vec_deque.rs
+++ b/src/liballoc/tests/vec_deque.rs
@@ -929,6 +929,107 @@
}
#[test]
+fn test_append_permutations() {
+ fn construct_vec_deque(
+ push_back: usize,
+ pop_back: usize,
+ push_front: usize,
+ pop_front: usize,
+ ) -> VecDeque<usize> {
+ let mut out = VecDeque::new();
+ for a in 0..push_back {
+ out.push_back(a);
+ }
+ for b in 0..push_front {
+ out.push_front(push_back + b);
+ }
+ for _ in 0..pop_back {
+ out.pop_back();
+ }
+ for _ in 0..pop_front {
+ out.pop_front();
+ }
+ out
+ }
+
+ const MAX: usize = 5;
+
+ // Many different permutations of both the `VecDeque` getting appended to
+ // and the one getting appended are generated to check `append`.
+ // This ensures all 6 code paths of `append` are tested.
+ for src_push_back in 0..MAX {
+ for src_push_front in 0..MAX {
+ // doesn't pop more values than are pushed
+ for src_pop_back in 0..(src_push_back + src_push_front) {
+ for src_pop_front in 0..(src_push_back + src_push_front - src_pop_back) {
+
+ let src = construct_vec_deque(
+ src_push_back,
+ src_pop_back,
+ src_push_front,
+ src_pop_front,
+ );
+
+ for dst_push_back in 0..MAX {
+ for dst_push_front in 0..MAX {
+ for dst_pop_back in 0..(dst_push_back + dst_push_front) {
+ for dst_pop_front
+ in 0..(dst_push_back + dst_push_front - dst_pop_back)
+ {
+ let mut dst = construct_vec_deque(
+ dst_push_back,
+ dst_pop_back,
+ dst_push_front,
+ dst_pop_front,
+ );
+ let mut src = src.clone();
+
+ // Assert that appending `src` to `dst` gives the same order
+ // of values as iterating over both in sequence.
+ let correct = dst
+ .iter()
+ .chain(src.iter())
+ .cloned()
+ .collect::<Vec<usize>>();
+ dst.append(&mut src);
+ assert_eq!(dst, correct);
+ assert!(src.is_empty());
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+struct DropCounter<'a> {
+ count: &'a mut u32,
+}
+
+impl<'a> Drop for DropCounter<'a> {
+ fn drop(&mut self) {
+ *self.count += 1;
+ }
+}
+
+#[test]
+fn test_append_double_drop() {
+ let (mut count_a, mut count_b) = (0, 0);
+ {
+ let mut a = VecDeque::new();
+ let mut b = VecDeque::new();
+ a.push_back(DropCounter { count: &mut count_a });
+ b.push_back(DropCounter { count: &mut count_b });
+
+ a.append(&mut b);
+ }
+ assert_eq!(count_a, 1);
+ assert_eq!(count_b, 1);
+}
+
+#[test]
fn test_retain() {
let mut buf = VecDeque::new();
buf.extend(1..5);
diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs
index b3b2071..480a24b 100644
--- a/src/liballoc_jemalloc/lib.rs
+++ b/src/liballoc_jemalloc/lib.rs
@@ -16,6 +16,7 @@
#![feature(core_intrinsics)]
#![feature(libc)]
#![feature(linkage)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![cfg_attr(dummy_jemalloc, allow(dead_code, unused_extern_crates))]
diff --git a/src/liballoc_system/lib.rs b/src/liballoc_system/lib.rs
index 8e30b0d..c5e056f 100644
--- a/src/liballoc_system/lib.rs
+++ b/src/liballoc_system/lib.rs
@@ -14,8 +14,10 @@
reason = "this library is unlikely to be stabilized in its current \
form or name",
issue = "32838")]
+
#![feature(allocator_api)]
#![feature(core_intrinsics)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(staged_api)]
#![feature(rustc_attrs)]
#![cfg_attr(any(unix, target_os = "cloudabi", target_os = "redox"), feature(libc))]
diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs
index 0f4a5d1..265721c 100644
--- a/src/libarena/lib.rs
+++ b/src/libarena/lib.rs
@@ -26,6 +26,7 @@
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(dropck_eyepatch)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(raw_vec_internals)]
#![cfg_attr(test, feature(test))]
diff --git a/src/libcore/alloc.rs b/src/libcore/alloc.rs
index 39ec5d6..35e4eea 100644
--- a/src/libcore/alloc.rs
+++ b/src/libcore/alloc.rs
@@ -217,7 +217,7 @@
let len_rounded_up = len.wrapping_add(align).wrapping_sub(1)
& !align.wrapping_sub(1);
- return len_rounded_up.wrapping_sub(len);
+ len_rounded_up.wrapping_sub(len)
}
/// Creates a layout describing the record for `n` instances of
@@ -971,9 +971,9 @@
// _l <= layout.size() [guaranteed by usable_size()]
// layout.size() <= new_layout.size() [required by this method]
if new_size <= u {
- return Ok(());
+ Ok(())
} else {
- return Err(CannotReallocInPlace);
+ Err(CannotReallocInPlace)
}
}
@@ -1026,9 +1026,9 @@
// layout.size() <= _u [guaranteed by usable_size()]
// new_layout.size() <= layout.size() [required by this method]
if l <= new_size {
- return Ok(());
+ Ok(())
} else {
- return Err(CannotReallocInPlace);
+ Err(CannotReallocInPlace)
}
}
diff --git a/src/libcore/char/mod.rs b/src/libcore/char/mod.rs
index 5be673d..7e13137 100644
--- a/src/libcore/char/mod.rs
+++ b/src/libcore/char/mod.rs
@@ -312,8 +312,8 @@
None
}
},
- EscapeDefaultState::Done => return None,
- EscapeDefaultState::Unicode(ref mut i) => return i.nth(n),
+ EscapeDefaultState::Done => None,
+ EscapeDefaultState::Unicode(ref mut i) => i.nth(n),
}
}
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index 3626a26..58d6c4f 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -469,6 +469,7 @@
/// assert_eq!(2, 2.max(2));
/// ```
#[stable(feature = "ord_max_min", since = "1.21.0")]
+ #[inline]
fn max(self, other: Self) -> Self
where Self: Sized {
if other >= self { other } else { self }
@@ -485,6 +486,7 @@
/// assert_eq!(2, 2.min(2));
/// ```
#[stable(feature = "ord_max_min", since = "1.21.0")]
+ #[inline]
fn min(self, other: Self) -> Self
where Self: Sized {
if self <= other { self } else { other }
diff --git a/src/libcore/iter/iterator.rs b/src/libcore/iter/iterator.rs
index 5681cfb..3918529 100644
--- a/src/libcore/iter/iterator.rs
+++ b/src/libcore/iter/iterator.rs
@@ -1110,7 +1110,7 @@
///
/// [`flat_map()`]: #method.flat_map
#[inline]
- #[stable(feature = "iterator_flatten", since = "1.29")]
+ #[stable(feature = "iterator_flatten", since = "1.29.0")]
fn flatten(self) -> Flatten<Self>
where Self: Sized, Self::Item: IntoIterator {
Flatten { inner: flatten_compat(self) }
diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs
index 35ae774..ef3f4ce 100644
--- a/src/libcore/iter/mod.rs
+++ b/src/libcore/iter/mod.rs
@@ -2577,13 +2577,13 @@
/// [`flatten`]: trait.Iterator.html#method.flatten
/// [`Iterator`]: trait.Iterator.html
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
-#[stable(feature = "iterator_flatten", since = "1.29")]
+#[stable(feature = "iterator_flatten", since = "1.29.0")]
pub struct Flatten<I: Iterator>
where I::Item: IntoIterator {
inner: FlattenCompat<I, <I::Item as IntoIterator>::IntoIter>,
}
-#[stable(feature = "iterator_flatten", since = "1.29")]
+#[stable(feature = "iterator_flatten", since = "1.29.0")]
impl<I, U> fmt::Debug for Flatten<I>
where I: Iterator + fmt::Debug, U: Iterator + fmt::Debug,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
@@ -2593,7 +2593,7 @@
}
}
-#[stable(feature = "iterator_flatten", since = "1.29")]
+#[stable(feature = "iterator_flatten", since = "1.29.0")]
impl<I, U> Clone for Flatten<I>
where I: Iterator + Clone, U: Iterator + Clone,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>,
@@ -2601,7 +2601,7 @@
fn clone(&self) -> Self { Flatten { inner: self.inner.clone() } }
}
-#[stable(feature = "iterator_flatten", since = "1.29")]
+#[stable(feature = "iterator_flatten", since = "1.29.0")]
impl<I, U> Iterator for Flatten<I>
where I: Iterator, U: Iterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>
@@ -2629,7 +2629,7 @@
}
}
-#[stable(feature = "iterator_flatten", since = "1.29")]
+#[stable(feature = "iterator_flatten", since = "1.29.0")]
impl<I, U> DoubleEndedIterator for Flatten<I>
where I: DoubleEndedIterator, U: DoubleEndedIterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item>
@@ -2652,7 +2652,7 @@
}
}
-#[stable(feature = "iterator_flatten", since = "1.29")]
+#[stable(feature = "iterator_flatten", since = "1.29.0")]
impl<I, U> FusedIterator for Flatten<I>
where I: FusedIterator, U: Iterator,
I::Item: IntoIterator<IntoIter = U, Item = U::Item> {}
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index dc4a2d7..e85bf1d 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -92,6 +92,7 @@
#![feature(lang_items)]
#![feature(link_llvm_intrinsics)]
#![feature(never_type)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(exhaustive_patterns)]
#![feature(macro_at_most_once_rep)]
#![feature(no_core)]
@@ -119,6 +120,7 @@
#![feature(const_slice_len)]
#![feature(const_str_as_bytes)]
#![feature(const_str_len)]
+#![feature(non_exhaustive)]
#[prelude_import]
#[allow(unused)]
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 83f9dfe..5b3b2d1 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -396,6 +396,7 @@
/// ```
#[macro_export]
#[stable(feature = "rust1", since = "1.0.0")]
+#[allow_internal_unstable]
macro_rules! writeln {
($dst:expr) => (
write!($dst, "\n")
@@ -403,11 +404,8 @@
($dst:expr,) => (
writeln!($dst)
);
- ($dst:expr, $fmt:expr) => (
- write!($dst, concat!($fmt, "\n"))
- );
- ($dst:expr, $fmt:expr, $($arg:tt)*) => (
- write!($dst, concat!($fmt, "\n"), $($arg)*)
+ ($dst:expr, $($arg:tt)*) => (
+ $dst.write_fmt(format_args_nl!($($arg)*))
);
}
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 4f37b46..d18e167 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -95,7 +95,7 @@
message="the size for values of type `{Self}` cannot be known at compilation time",
label="doesn't have a size known at compile-time",
note="to learn more, visit <https://doc.rust-lang.org/book/second-edition/\
- ch19-04-advanced-types.html#dynamically-sized-types-and-sized>",
+ ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>",
)]
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
pub trait Sized {
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 8a74e7c..ea711c6 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -956,7 +956,8 @@
#[stable(feature = "manually_drop", since = "1.20.0")]
#[lang = "manually_drop"]
#[derive(Copy, Clone, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct ManuallyDrop<T> {
+#[repr(transparent)]
+pub struct ManuallyDrop<T: ?Sized> {
value: T,
}
@@ -990,7 +991,9 @@
pub fn into_inner(slot: ManuallyDrop<T>) -> T {
slot.value
}
+}
+impl<T: ?Sized> ManuallyDrop<T> {
/// Manually drops the contained value.
///
/// # Safety
@@ -1006,7 +1009,7 @@
}
#[stable(feature = "manually_drop", since = "1.20.0")]
-impl<T> Deref for ManuallyDrop<T> {
+impl<T: ?Sized> Deref for ManuallyDrop<T> {
type Target = T;
#[inline]
fn deref(&self) -> &Self::Target {
@@ -1015,7 +1018,7 @@
}
#[stable(feature = "manually_drop", since = "1.20.0")]
-impl<T> DerefMut for ManuallyDrop<T> {
+impl<T: ?Sized> DerefMut for ManuallyDrop<T> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.value
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index 44a3b31..37856dc 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -188,7 +188,8 @@
// `Int` + `SignedInt` implemented for signed integers
macro_rules! int_impl {
($SelfT:ty, $ActualT:ident, $UnsignedT:ty, $BITS:expr, $Min:expr, $Max:expr, $Feature:expr,
- $EndFeature:expr) => {
+ $EndFeature:expr, $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
+ $reversed:expr) => {
doc_comment! {
concat!("Returns the smallest value that can be represented by this integer type.
@@ -334,104 +335,94 @@
}
}
- /// Shifts the bits to the left by a specified amount, `n`,
- /// wrapping the truncated bits to the end of the resulting integer.
- ///
- /// Please note this isn't the same operation as `<<`!
- ///
- /// # Examples
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `i64` is used here.
- ///
- /// Basic usage:
- ///
- /// ```
- /// let n = 0x0123456789ABCDEFi64;
- /// let m = -0x76543210FEDCBA99i64;
- ///
- /// assert_eq!(n.rotate_left(32), m);
- /// ```
- #[stable(feature = "rust1", since = "1.0.0")]
- #[inline]
- pub fn rotate_left(self, n: u32) -> Self {
- (self as $UnsignedT).rotate_left(n) as Self
+ doc_comment! {
+ concat!("Shifts the bits to the left by a specified amount, `n`,
+wrapping the truncated bits to the end of the resulting integer.
+
+Please note this isn't the same operation as `<<`!
+
+# Examples
+
+Basic usage:
+
+```
+let n = ", $rot_op, stringify!($SelfT), ";
+let m = ", $rot_result, ";
+
+assert_eq!(n.rotate_left(", $rot, "), m);
+```"),
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[inline]
+ pub fn rotate_left(self, n: u32) -> Self {
+ (self as $UnsignedT).rotate_left(n) as Self
+ }
}
- /// Shifts the bits to the right by a specified amount, `n`,
- /// wrapping the truncated bits to the beginning of the resulting
- /// integer.
- ///
- /// Please note this isn't the same operation as `>>`!
- ///
- /// # Examples
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `i64` is used here.
- ///
- /// Basic usage:
- ///
- /// ```
- /// let n = 0x0123456789ABCDEFi64;
- /// let m = -0xFEDCBA987654322i64;
- ///
- /// assert_eq!(n.rotate_right(4), m);
- /// ```
- #[stable(feature = "rust1", since = "1.0.0")]
- #[inline]
- pub fn rotate_right(self, n: u32) -> Self {
- (self as $UnsignedT).rotate_right(n) as Self
+ doc_comment! {
+ concat!("Shifts the bits to the right by a specified amount, `n`,
+wrapping the truncated bits to the beginning of the resulting
+integer.
+
+Please note this isn't the same operation as `>>`!
+
+# Examples
+
+Basic usage:
+
+```
+let n = ", $rot_result, stringify!($SelfT), ";
+let m = ", $rot_op, ";
+
+assert_eq!(n.rotate_right(", $rot, "), m);
+```"),
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[inline]
+ pub fn rotate_right(self, n: u32) -> Self {
+ (self as $UnsignedT).rotate_right(n) as Self
+ }
+ }
+ doc_comment! {
+ concat!("Reverses the byte order of the integer.
+
+# Examples
+
+Basic usage:
+
+```
+let n = ", $swap_op, stringify!($SelfT), ";
+
+let m = n.swap_bytes();
+
+assert_eq!(m, ", $swapped, ");
+```"),
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_const_unstable(feature = "const_int_ops")]
+ #[inline]
+ pub const fn swap_bytes(self) -> Self {
+ (self as $UnsignedT).swap_bytes() as Self
+ }
}
- /// Reverses the byte order of the integer.
- ///
- /// # Examples
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `i16` is used here.
- ///
- /// Basic usage:
- ///
- /// ```
- /// let n: i16 = 0b0000000_01010101;
- /// assert_eq!(n, 85);
- ///
- /// let m = n.swap_bytes();
- ///
- /// assert_eq!(m, 0b01010101_00000000);
- /// assert_eq!(m, 21760);
- /// ```
- #[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_int_ops")]
- #[inline]
- pub const fn swap_bytes(self) -> Self {
- (self as $UnsignedT).swap_bytes() as Self
- }
+ doc_comment! {
+ concat!("Reverses the bit pattern of the integer.
- /// Reverses the bit pattern of the integer.
- ///
- /// # Examples
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `i16` is used here.
- ///
- /// Basic usage:
- ///
- /// ```
- /// #![feature(reverse_bits)]
- ///
- /// let n: i16 = 0b0000000_01010101;
- /// assert_eq!(n, 85);
- ///
- /// let m = n.reverse_bits();
- ///
- /// assert_eq!(m as u16, 0b10101010_00000000);
- /// assert_eq!(m, -22016);
- /// ```
- #[unstable(feature = "reverse_bits", issue = "48763")]
- #[inline]
- pub fn reverse_bits(self) -> Self {
- (self as $UnsignedT).reverse_bits() as Self
+# Examples
+
+Basic usage:
+
+```
+#![feature(reverse_bits)]
+
+let n = ", $swap_op, stringify!($SelfT), ";
+let m = n.reverse_bits();
+
+assert_eq!(m, ", $reversed, ");
+```"),
+ #[unstable(feature = "reverse_bits", issue = "48763")]
+ #[inline]
+ pub fn reverse_bits(self) -> Self {
+ (self as $UnsignedT).reverse_bits() as Self
+ }
}
doc_comment! {
@@ -1900,7 +1891,7 @@
/// ```
/// #![feature(int_to_from_bytes)]
///
- /// let bytes = 0x12345678i32.to_be_bytes();
+ /// let bytes = 0x12_34_56_78_i32.to_be_bytes();
/// assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);
/// ```
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
@@ -1917,7 +1908,7 @@
/// ```
/// #![feature(int_to_from_bytes)]
///
- /// let bytes = 0x12345678i32.to_le_bytes();
+ /// let bytes = 0x12_34_56_78_i32.to_le_bytes();
/// assert_eq!(bytes, [0x78, 0x56, 0x34, 0x12]);
/// ```
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
@@ -2012,46 +2003,57 @@
#[lang = "i8"]
impl i8 {
- int_impl! { i8, i8, u8, 8, -128, 127, "", "" }
+ int_impl! { i8, i8, u8, 8, -128, 127, "", "", 2, "-0x7e", "0xa", "0x12", "0x12", "0x48" }
}
#[lang = "i16"]
impl i16 {
- int_impl! { i16, i16, u16, 16, -32768, 32767, "", "" }
+ int_impl! { i16, i16, u16, 16, -32768, 32767, "", "", 4, "-0x5ffd", "0x3a", "0x1234", "0x3412",
+ "0x2c48" }
}
#[lang = "i32"]
impl i32 {
- int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, "", "" }
+ int_impl! { i32, i32, u32, 32, -2147483648, 2147483647, "", "", 8, "0x10000b3", "0xb301",
+ "0x12345678", "0x78563412", "0x1e6a2c48" }
}
#[lang = "i64"]
impl i64 {
- int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" }
+ int_impl! { i64, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "", 12,
+ "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
+ "0x6a2c48091e6a2c48" }
}
#[lang = "i128"]
impl i128 {
int_impl! { i128, i128, u128, 128, -170141183460469231731687303715884105728,
- 170141183460469231731687303715884105727, "", "" }
+ 170141183460469231731687303715884105727, "", "", 16,
+ "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
+ "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48"
+ }
}
#[cfg(target_pointer_width = "16")]
#[lang = "isize"]
impl isize {
- int_impl! { isize, i16, u16, 16, -32768, 32767, "", "" }
+ int_impl! { isize, i16, u16, 16, -32768, 32767, "", "", 4, "-0x5ffd", "0x3a", "0x1234",
+ "0x3412", "0x2c48" }
}
#[cfg(target_pointer_width = "32")]
#[lang = "isize"]
impl isize {
- int_impl! { isize, i32, u32, 32, -2147483648, 2147483647, "", "" }
+ int_impl! { isize, i32, u32, 32, -2147483648, 2147483647, "", "", 8, "0x10000b3", "0xb301",
+ "0x12345678", "0x78563412", "0x1e6a2c48" }
}
#[cfg(target_pointer_width = "64")]
#[lang = "isize"]
impl isize {
- int_impl! { isize, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "" }
+ int_impl! { isize, i64, u64, 64, -9223372036854775808, 9223372036854775807, "", "",
+ 12, "0xaa00000000006e1", "0x6e10aa", "0x1234567890123456", "0x5634129078563412",
+ "0x6a2c48091e6a2c48" }
}
// Emits the correct `cttz` call, depending on the size of the type.
@@ -2069,7 +2071,9 @@
// `Int` + `UnsignedInt` implemented for unsigned integers
macro_rules! uint_impl {
- ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr, $Feature:expr, $EndFeature:expr) => {
+ ($SelfT:ty, $ActualT:ty, $BITS:expr, $MaxV:expr, $Feature:expr, $EndFeature:expr,
+ $rot:expr, $rot_op:expr, $rot_result:expr, $swap_op:expr, $swapped:expr,
+ $reversed:expr ) => {
doc_comment! {
concat!("Returns the smallest value that can be represented by this integer type.
@@ -2210,108 +2214,99 @@
}
}
- /// Shifts the bits to the left by a specified amount, `n`,
- /// wrapping the truncated bits to the end of the resulting integer.
- ///
- /// Please note this isn't the same operation as `<<`!
- ///
- /// # Examples
- ///
- /// Basic usage:
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `u64` is used here.
- ///
- /// ```
- /// let n = 0x0123456789ABCDEFu64;
- /// let m = 0x3456789ABCDEF012u64;
- ///
- /// assert_eq!(n.rotate_left(12), m);
- /// ```
- #[stable(feature = "rust1", since = "1.0.0")]
- #[inline]
- pub fn rotate_left(self, n: u32) -> Self {
- // Protect against undefined behaviour for over-long bit shifts
- let n = n % $BITS;
- (self << n) | (self >> (($BITS - n) % $BITS))
+ doc_comment! {
+ concat!("Shifts the bits to the left by a specified amount, `n`,
+wrapping the truncated bits to the end of the resulting integer.
+
+Please note this isn't the same operation as `<<`!
+
+# Examples
+
+Basic usage:
+
+```
+let n = ", $rot_op, stringify!($SelfT), ";
+let m = ", $rot_result, ";
+
+assert_eq!(n.rotate_left(", $rot, "), m);
+```"),
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[inline]
+ pub fn rotate_left(self, n: u32) -> Self {
+ // Protect against undefined behaviour for over-long bit shifts
+ let n = n % $BITS;
+ (self << n) | (self >> (($BITS - n) % $BITS))
+ }
}
- /// Shifts the bits to the right by a specified amount, `n`,
- /// wrapping the truncated bits to the beginning of the resulting
- /// integer.
- ///
- /// Please note this isn't the same operation as `>>`!
- ///
- /// # Examples
- ///
- /// Basic usage:
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `u64` is used here.
- ///
- /// ```
- /// let n = 0x0123456789ABCDEFu64;
- /// let m = 0xDEF0123456789ABCu64;
- ///
- /// assert_eq!(n.rotate_right(12), m);
- /// ```
- #[stable(feature = "rust1", since = "1.0.0")]
- #[inline]
- pub fn rotate_right(self, n: u32) -> Self {
- // Protect against undefined behaviour for over-long bit shifts
- let n = n % $BITS;
- (self >> n) | (self << (($BITS - n) % $BITS))
+ doc_comment! {
+ concat!("Shifts the bits to the right by a specified amount, `n`,
+wrapping the truncated bits to the beginning of the resulting
+integer.
+
+Please note this isn't the same operation as `>>`!
+
+# Examples
+
+Basic usage:
+
+```
+let n = ", $rot_result, stringify!($SelfT), ";
+let m = ", $rot_op, ";
+
+assert_eq!(n.rotate_right(", $rot, "), m);
+```"),
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[inline]
+ pub fn rotate_right(self, n: u32) -> Self {
+ // Protect against undefined behaviour for over-long bit shifts
+ let n = n % $BITS;
+ (self >> n) | (self << (($BITS - n) % $BITS))
+ }
}
- /// Reverses the byte order of the integer.
- ///
- /// # Examples
- ///
- /// Basic usage:
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `u16` is used here.
- ///
- /// ```
- /// let n: u16 = 0b0000000_01010101;
- /// assert_eq!(n, 85);
- ///
- /// let m = n.swap_bytes();
- ///
- /// assert_eq!(m, 0b01010101_00000000);
- /// assert_eq!(m, 21760);
- /// ```
- #[stable(feature = "rust1", since = "1.0.0")]
- #[rustc_const_unstable(feature = "const_int_ops")]
- #[inline]
- pub const fn swap_bytes(self) -> Self {
- unsafe { intrinsics::bswap(self as $ActualT) as Self }
+ doc_comment! {
+ concat!("
+Reverses the byte order of the integer.
+
+# Examples
+
+Basic usage:
+
+```
+let n = ", $swap_op, stringify!($SelfT), ";
+let m = n.swap_bytes();
+
+assert_eq!(m, ", $swapped, ");
+```"),
+ #[stable(feature = "rust1", since = "1.0.0")]
+ #[rustc_const_unstable(feature = "const_int_ops")]
+ #[inline]
+ pub const fn swap_bytes(self) -> Self {
+ unsafe { intrinsics::bswap(self as $ActualT) as Self }
+ }
}
- /// Reverses the bit pattern of the integer.
- ///
- /// # Examples
- ///
- /// Basic usage:
- ///
- /// Please note that this example is shared between integer types.
- /// Which explains why `u16` is used here.
- ///
- /// ```
- /// #![feature(reverse_bits)]
- ///
- /// let n: u16 = 0b0000000_01010101;
- /// assert_eq!(n, 85);
- ///
- /// let m = n.reverse_bits();
- ///
- /// assert_eq!(m, 0b10101010_00000000);
- /// assert_eq!(m, 43520);
- /// ```
- #[unstable(feature = "reverse_bits", issue = "48763")]
- #[inline]
- pub fn reverse_bits(self) -> Self {
- unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
+ doc_comment! {
+ concat!("Reverses the bit pattern of the integer.
+
+# Examples
+
+Basic usage:
+
+```
+#![feature(reverse_bits)]
+
+let n = ", $swap_op, stringify!($SelfT), ";
+let m = n.reverse_bits();
+
+assert_eq!(m, ", $reversed, ");
+```"),
+ #[unstable(feature = "reverse_bits", issue = "48763")]
+ #[inline]
+ pub fn reverse_bits(self) -> Self {
+ unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
+ }
}
doc_comment! {
@@ -3573,47 +3568,119 @@
}
}
- /// Return the memory representation of this integer as a byte array.
- ///
- /// The target platform’s native endianness is used.
- /// Portable code likely wants to use this after [`to_be`] or [`to_le`].
- ///
- /// [`to_be`]: #method.to_be
- /// [`to_le`]: #method.to_le
+ /// Return the memory representation of this integer as a byte array in
+ /// big-endian (network) byte order.
///
/// # Examples
///
/// ```
/// #![feature(int_to_from_bytes)]
///
- /// let bytes = 0x1234_5678_u32.to_be().to_bytes();
+ /// let bytes = 0x12_34_56_78_i32.to_be_bytes();
/// assert_eq!(bytes, [0x12, 0x34, 0x56, 0x78]);
/// ```
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
#[inline]
- pub fn to_bytes(self) -> [u8; mem::size_of::<Self>()] {
- unsafe { mem::transmute(self) }
+ pub fn to_be_bytes(self) -> [u8; mem::size_of::<Self>()] {
+ self.to_be().to_ne_bytes()
}
- /// Create an integer value from its memory representation as a byte array.
- ///
- /// The target platform’s native endianness is used.
- /// Portable code likely wants to use [`to_be`] or [`to_le`] after this.
- ///
- /// [`to_be`]: #method.to_be
- /// [`to_le`]: #method.to_le
+ /// Return the memory representation of this integer as a byte array in
+ /// little-endian byte order.
///
/// # Examples
///
/// ```
/// #![feature(int_to_from_bytes)]
///
- /// let int = u32::from_be(u32::from_bytes([0x12, 0x34, 0x56, 0x78]));
- /// assert_eq!(int, 0x1234_5678_u32);
+ /// let bytes = 0x12_34_56_78_i32.to_le_bytes();
+ /// assert_eq!(bytes, [0x78, 0x56, 0x34, 0x12]);
/// ```
#[unstable(feature = "int_to_from_bytes", issue = "52963")]
#[inline]
- pub fn from_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
+ pub fn to_le_bytes(self) -> [u8; mem::size_of::<Self>()] {
+ self.to_le().to_ne_bytes()
+ }
+
+ /// Return the memory representation of this integer as a byte array in
+ /// native byte order.
+ ///
+ /// As the target platform's native endianness is used, portable code
+ /// should use [`to_be_bytes`] or [`to_le_bytes`], as appropriate,
+ /// instead.
+ ///
+ /// [`to_be_bytes`]: #method.to_be_bytes
+ /// [`to_le_bytes`]: #method.to_le_bytes
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(int_to_from_bytes)]
+ ///
+ /// let bytes = i32::min_value().to_be().to_ne_bytes();
+ /// assert_eq!(bytes, [0x80, 0, 0, 0]);
+ /// ```
+ #[unstable(feature = "int_to_from_bytes", issue = "52963")]
+ #[inline]
+ pub fn to_ne_bytes(self) -> [u8; mem::size_of::<Self>()] {
+ unsafe { mem::transmute(self) }
+ }
+
+ /// Create an integer value from its representation as a byte array in
+ /// big endian.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(int_to_from_bytes)]
+ ///
+ /// let int = i32::from_be_bytes([0x12, 0x34, 0x56, 0x78]);
+ /// assert_eq!(int, 0x12_34_56_78);
+ /// ```
+ #[unstable(feature = "int_to_from_bytes", issue = "52963")]
+ #[inline]
+ pub fn from_be_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
+ Self::from_be(Self::from_ne_bytes(bytes))
+ }
+
+ /// Create an integer value from its representation as a byte array in
+ /// little endian.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(int_to_from_bytes)]
+ ///
+ /// let int = i32::from_le_bytes([0x12, 0x34, 0x56, 0x78]);
+ /// assert_eq!(int, 0x78_56_34_12);
+ /// ```
+ #[unstable(feature = "int_to_from_bytes", issue = "52963")]
+ #[inline]
+ pub fn from_le_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
+ Self::from_le(Self::from_ne_bytes(bytes))
+ }
+
+ /// Create an integer value from its memory representation as a byte
+ /// array in native endianness.
+ ///
+ /// As the target platform's native endianness is used, portable code
+ /// likely wants to use [`from_be_bytes`] or [`from_le_bytes`], as
+ /// appropriate instead.
+ ///
+ /// [`from_be_bytes`]: #method.from_be_bytes
+ /// [`from_le_bytes`]: #method.from_le_bytes
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// #![feature(int_to_from_bytes)]
+ ///
+ /// let int = i32::from_be(i32::from_ne_bytes([0x80, 0, 0, 0]));
+ /// assert_eq!(int, i32::min_value());
+ /// ```
+ #[unstable(feature = "int_to_from_bytes", issue = "52963")]
+ #[inline]
+ pub fn from_ne_bytes(bytes: [u8; mem::size_of::<Self>()]) -> Self {
unsafe { mem::transmute(bytes) }
}
}
@@ -3621,7 +3688,7 @@
#[lang = "u8"]
impl u8 {
- uint_impl! { u8, u8, 8, 255, "", "" }
+ uint_impl! { u8, u8, 8, 255, "", "", 2, "0x82", "0xa", "0x12", "0x12", "0x48" }
/// Checks if the value is within the ASCII range.
@@ -4147,39 +4214,45 @@
#[lang = "u16"]
impl u16 {
- uint_impl! { u16, u16, 16, 65535, "", "" }
+ uint_impl! { u16, u16, 16, 65535, "", "", 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48" }
}
#[lang = "u32"]
impl u32 {
- uint_impl! { u32, u32, 32, 4294967295, "", "" }
+ uint_impl! { u32, u32, 32, 4294967295, "", "", 8, "0x10000b3", "0xb301", "0x12345678",
+ "0x78563412", "0x1e6a2c48" }
}
#[lang = "u64"]
impl u64 {
- uint_impl! { u64, u64, 64, 18446744073709551615, "", "" }
+ uint_impl! { u64, u64, 64, 18446744073709551615, "", "", 12, "0xaa00000000006e1", "0x6e10aa",
+ "0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48" }
}
#[lang = "u128"]
impl u128 {
- uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "", "" }
+ uint_impl! { u128, u128, 128, 340282366920938463463374607431768211455, "", "", 16,
+ "0x13f40000000000000000000000004f76", "0x4f7613f4", "0x12345678901234567890123456789012",
+ "0x12907856341290785634129078563412", "0x48091e6a2c48091e6a2c48091e6a2c48" }
}
#[cfg(target_pointer_width = "16")]
#[lang = "usize"]
impl usize {
- uint_impl! { usize, u16, 16, 65536, "", "" }
+ uint_impl! { usize, u16, 16, 65536, "", "", 4, "0xa003", "0x3a", "0x1234", "0x3412", "0x2c48" }
}
#[cfg(target_pointer_width = "32")]
#[lang = "usize"]
impl usize {
- uint_impl! { usize, u32, 32, 4294967295, "", "" }
+ uint_impl! { usize, u32, 32, 4294967295, "", "", 8, "0x10000b3", "0xb301", "0x12345678",
+ "0x78563412", "0x1e6a2c48" }
}
#[cfg(target_pointer_width = "64")]
#[lang = "usize"]
impl usize {
- uint_impl! { usize, u64, 64, 18446744073709551615, "", "" }
+ uint_impl! { usize, u64, 64, 18446744073709551615, "", "", 12, "0xaa00000000006e1", "0x6e10aa",
+ "0x1234567890123456", "0x5634129078563412", "0x6a2c48091e6a2c48" }
}
/// A classification of floating point numbers.
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 2b6c376..f743fbf 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -1141,6 +1141,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, A> Clone for Iter<'a, A> {
+ #[inline]
fn clone(&self) -> Iter<'a, A> {
Iter { inner: self.inner.clone() }
}
@@ -1307,14 +1308,17 @@
type Ok = T;
type Error = NoneError;
+ #[inline]
fn into_result(self) -> Result<T, NoneError> {
self.ok_or(NoneError)
}
+ #[inline]
fn from_ok(v: T) -> Self {
Some(v)
}
+ #[inline]
fn from_error(_: NoneError) -> Self {
None
}
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index c8670e5..61033e7 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2318,7 +2318,7 @@
let table_inverse = INV_TABLE_MOD_16[(x & (INV_TABLE_MOD - 1)) >> 1];
if m <= INV_TABLE_MOD {
- return table_inverse & (m - 1);
+ table_inverse & (m - 1)
} else {
// We iterate "up" using the following formula:
//
@@ -2405,7 +2405,7 @@
}
// Cannot be aligned at all.
- return usize::max_value();
+ usize::max_value()
}
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index fb49683..ac90834 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -1084,6 +1084,7 @@
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> {
+ #[inline]
fn clone(&self) -> Iter<'a, T> { Iter { inner: self.inner } }
}
@@ -1235,14 +1236,17 @@
type Ok = T;
type Error = E;
+ #[inline]
fn into_result(self) -> Self {
self
}
+ #[inline]
fn from_ok(v: T) -> Self {
Ok(v)
}
+ #[inline]
fn from_error(v: E) -> Self {
Err(v)
}
diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs
index 187ac3c..a396055 100644
--- a/src/libcore/slice/mod.rs
+++ b/src/libcore/slice/mod.rs
@@ -1727,7 +1727,7 @@
ctz_b = ::intrinsics::cttz_nonzero(b);
}
}
- return a << k;
+ a << k
}
let gcd: usize = gcd(::mem::size_of::<T>(), ::mem::size_of::<U>());
let ts: usize = ::mem::size_of::<U>() / gcd;
@@ -1737,7 +1737,7 @@
let us_len = self.len() / ts * us;
// And how many `T`s will be in the trailing slice!
let ts_len = self.len() % ts;
- return (us_len, ts_len);
+ (us_len, ts_len)
}
/// Transmute the slice to a slice of another type, ensuring aligment of the types is
@@ -1782,13 +1782,14 @@
let ptr = self.as_ptr();
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
if offset > self.len() {
- return (self, &[], &[]);
+ (self, &[], &[])
} else {
let (left, rest) = self.split_at(offset);
+ // now `rest` is definitely aligned, so `from_raw_parts_mut` below is okay
let (us_len, ts_len) = rest.align_to_offsets::<U>();
- return (left,
- from_raw_parts(rest.as_ptr() as *const U, us_len),
- from_raw_parts(rest.as_ptr().offset((rest.len() - ts_len) as isize), ts_len))
+ (left,
+ from_raw_parts(rest.as_ptr() as *const U, us_len),
+ from_raw_parts(rest.as_ptr().offset((rest.len() - ts_len) as isize), ts_len))
}
}
@@ -1834,14 +1835,15 @@
let ptr = self.as_ptr();
let offset = ::ptr::align_offset(ptr, ::mem::align_of::<U>());
if offset > self.len() {
- return (self, &mut [], &mut []);
+ (self, &mut [], &mut [])
} else {
let (left, rest) = self.split_at_mut(offset);
+ // now `rest` is definitely aligned, so `from_raw_parts_mut` below is okay
let (us_len, ts_len) = rest.align_to_offsets::<U>();
let mut_ptr = rest.as_mut_ptr();
- return (left,
- from_raw_parts_mut(mut_ptr as *mut U, us_len),
- from_raw_parts_mut(mut_ptr.offset((rest.len() - ts_len) as isize), ts_len))
+ (left,
+ from_raw_parts_mut(mut_ptr as *mut U, us_len),
+ from_raw_parts_mut(mut_ptr.offset((rest.len() - ts_len) as isize), ts_len))
}
}
}
@@ -3878,6 +3880,7 @@
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts<'a, T>(data: *const T, len: usize) -> &'a [T] {
+ debug_assert!(data as usize % mem::align_of::<T>() == 0, "attempt to create unaligned slice");
Repr { raw: FatPtr { data, len } }.rust
}
@@ -3891,6 +3894,7 @@
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub unsafe fn from_raw_parts_mut<'a, T>(data: *mut T, len: usize) -> &'a mut [T] {
+ debug_assert!(data as usize % mem::align_of::<T>() == 0, "attempt to create unaligned slice");
Repr { raw: FatPtr { data, len} }.rust_mut
}
diff --git a/src/libcore/str/lossy.rs b/src/libcore/str/lossy.rs
index 5cfb36d..186d6ad 100644
--- a/src/libcore/str/lossy.rs
+++ b/src/libcore/str/lossy.rs
@@ -146,7 +146,7 @@
broken: &[],
};
self.source = &[];
- return Some(r);
+ Some(r)
}
}
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs
index 356534a..810d19d 100644
--- a/src/libcore/str/mod.rs
+++ b/src/libcore/str/mod.rs
@@ -244,7 +244,10 @@
/// The length provided is that of the invalid byte sequence
/// that starts at the index given by `valid_up_to()`.
/// Decoding should resume after that sequence
- /// (after inserting a U+FFFD REPLACEMENT CHARACTER) in case of lossy decoding.
+ /// (after inserting a [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD]) in case of
+ /// lossy decoding.
+ ///
+ /// [U+FFFD]: ../../std/char/constant.REPLACEMENT_CHARACTER.html
#[stable(feature = "utf8_error_error_len", since = "1.20.0")]
pub fn error_len(&self) -> Option<usize> {
self.error_len.map(|len| len as usize)
@@ -1567,7 +1570,7 @@
#[unstable(feature = "str_internals", issue = "0")]
#[inline]
pub fn utf8_char_width(b: u8) -> usize {
- return UTF8_CHAR_WIDTH[b as usize] as usize;
+ UTF8_CHAR_WIDTH[b as usize] as usize
}
/// Mask of the value bits of a continuation byte.
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index e98194c..617e067 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -29,7 +29,7 @@
//!
//! [`Ordering`]: enum.Ordering.html
//!
-//! [1]: http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
+//! [1]: https://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations
//! [2]: ../../../nomicon/atomics.html
//!
//! Atomic variables are safe to share between threads (they implement [`Sync`])
@@ -178,53 +178,85 @@
/// "relaxed" atomics allow all reorderings.
///
/// Rust's memory orderings are [the same as
-/// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations).
+/// LLVM's](https://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations).
///
/// For more information see the [nomicon].
///
/// [nomicon]: ../../../nomicon/atomics.html
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone, Debug)]
+#[non_exhaustive]
pub enum Ordering {
/// No ordering constraints, only atomic operations.
///
/// Corresponds to LLVM's [`Monotonic`] ordering.
///
- /// [`Monotonic`]: http://llvm.org/docs/Atomics.html#monotonic
+ /// [`Monotonic`]: https://llvm.org/docs/Atomics.html#monotonic
#[stable(feature = "rust1", since = "1.0.0")]
Relaxed,
- /// When coupled with a store, all previous writes become visible
- /// to the other threads that perform a load with [`Acquire`] ordering
- /// on the same value.
+ /// When coupled with a store, all previous operations become ordered
+ /// before any load of this value with [`Acquire`] (or stronger) ordering.
+ /// In particular, all previous writes become visible to all threads
+ /// that perform an [`Acquire`] (or stronger) load of this value.
///
- /// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
+ /// Notice that using this ordering for an operation that combines loads
+ /// and stores leads to a [`Relaxed`] load operation!
+ ///
+ /// This ordering is only applicable for operations that can perform a store.
+ ///
+ /// Corresponds to LLVM's [`Release`] ordering.
+ ///
+ /// [`Release`]: https://llvm.org/docs/Atomics.html#release
+ /// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
+ /// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
#[stable(feature = "rust1", since = "1.0.0")]
Release,
- /// When coupled with a load, all subsequent loads will see data
- /// written before a store with [`Release`] ordering on the same value
- /// in other threads.
+ /// When coupled with a load, if the loaded value was written by a store operation with
+ /// [`Release`] (or stronger) ordering, then all subsequent operations
+ /// become ordered after that store. In particular, all subsequent loads will see data
+ /// written before the store.
///
- /// [`Release`]: http://llvm.org/docs/Atomics.html#release
+ /// Notice that using this ordering for an operation that combines loads
+ /// and stores leads to a [`Relaxed`] store operation!
+ ///
+ /// This ordering is only applicable for operations that can perform a load.
+ ///
+ /// Corresponds to LLVM's [`Acquire`] ordering.
+ ///
+ /// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
+ /// [`Release`]: https://llvm.org/docs/Atomics.html#release
+ /// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
#[stable(feature = "rust1", since = "1.0.0")]
Acquire,
- /// Has the effects of both [`Acquire`] and [`Release`] together.
+ /// Has the effects of both [`Acquire`] and [`Release`] together:
+ /// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering.
+ ///
+ /// Notice that in the case of `compare_and_swap`, it is possible that the operation ends up
+ /// not performing any store and hence it has just `Acquire` ordering. However,
+ /// `AcqRel` will never perform [`Relaxed`] accesses.
///
/// This ordering is only applicable for operations that combine both loads and stores.
///
- /// For loads it uses [`Acquire`] ordering. For stores it uses the [`Release`] ordering.
+ /// Corresponds to LLVM's [`AcquireRelease`] ordering.
///
- /// [`Acquire`]: http://llvm.org/docs/Atomics.html#acquire
- /// [`Release`]: http://llvm.org/docs/Atomics.html#release
+ /// [`AcquireRelease`]: https://llvm.org/docs/Atomics.html#acquirerelease
+ /// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
+ /// [`Release`]: https://llvm.org/docs/Atomics.html#release
+ /// [`Relaxed`]: https://llvm.org/docs/Atomics.html#monotonic
#[stable(feature = "rust1", since = "1.0.0")]
AcqRel,
- /// Like `AcqRel` with the additional guarantee that all threads see all
+ /// Like [`Acquire`]/[`Release`]/[`AcqRel`] (for load, store, and load-with-store
+ /// operations, respectively) with the additional guarantee that all threads see all
/// sequentially consistent operations in the same order.
+ ///
+ /// Corresponds to LLVM's [`SequentiallyConsistent`] ordering.
+ ///
+ /// [`SequentiallyConsistent`]: https://llvm.org/docs/Atomics.html#sequentiallyconsistent
+ /// [`Acquire`]: https://llvm.org/docs/Atomics.html#acquire
+ /// [`Release`]: https://llvm.org/docs/Atomics.html#release
+ /// [`AcqRel`]: https://llvm.org/docs/Atomics.html#acquirerelease
#[stable(feature = "rust1", since = "1.0.0")]
SeqCst,
- // Prevent exhaustive matching to allow for future extension
- #[doc(hidden)]
- #[unstable(feature = "future_atomic_orderings", issue = "0")]
- __Nonexhaustive,
}
/// An [`AtomicBool`] initialized to `false`.
@@ -297,15 +329,18 @@
/// Loads a value from the bool.
///
/// `load` takes an [`Ordering`] argument which describes the memory ordering
- /// of this operation.
+ /// of this operation. Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
///
/// # Panics
///
/// Panics if `order` is [`Release`] or [`AcqRel`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
/// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -325,9 +360,18 @@
/// Stores a value into the bool.
///
/// `store` takes an [`Ordering`] argument which describes the memory ordering
- /// of this operation.
+ /// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
+ ///
+ /// # Panics
+ ///
+ /// Panics if `order` is [`Acquire`] or [`AcqRel`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -339,13 +383,6 @@
/// some_bool.store(false, Ordering::Relaxed);
/// assert_eq!(some_bool.load(Ordering::Relaxed), false);
/// ```
- ///
- /// # Panics
- ///
- /// Panics if `order` is [`Acquire`] or [`AcqRel`].
- ///
- /// [`Acquire`]: enum.Ordering.html#variant.Acquire
- /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn store(&self, val: bool, order: Ordering) {
@@ -357,9 +394,14 @@
/// Stores a value into the bool, returning the previous value.
///
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
- /// of this operation.
+ /// of this operation. All ordering modes are possible. Note that using
+ /// [`Acquire`] makes the store part of this operation [`Relaxed`], and
+ /// using [`Release`] makes the load part [`Relaxed`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
///
/// # Examples
///
@@ -384,9 +426,16 @@
/// was updated.
///
/// `compare_and_swap` also takes an [`Ordering`] argument which describes the memory
- /// ordering of this operation.
+ /// ordering of this operation. Notice that even when using [`AcqRel`], the operation
+ /// might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
+ /// Using [`Acquire`] makes the store part of this operation [`Relaxed`] if it
+ /// happens, and using [`Release`] makes the load part [`Relaxed`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
/// [`bool`]: ../../../std/primitive.bool.html
///
/// # Examples
@@ -420,13 +469,18 @@
/// `compare_exchange` takes two [`Ordering`] arguments to describe the memory
/// ordering of this operation. The first describes the required ordering if the
/// operation succeeds while the second describes the required ordering when the
- /// operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and must
- /// be equivalent or weaker than the success ordering.
+ /// operation fails. Using [`Acquire`] as success ordering makes the store part
+ /// of this operation [`Relaxed`], and using [`Release`] makes the successful load
+ /// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+ /// and must be equivalent to or weaker than the success ordering.
+ ///
///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
/// [`Release`]: enum.Ordering.html#variant.Release
- /// [`AcqRel`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -473,16 +527,20 @@
/// previous value.
///
/// `compare_exchange_weak` takes two [`Ordering`] arguments to describe the memory
- /// ordering of this operation. The first describes the required ordering if the operation
- /// succeeds while the second describes the required ordering when the operation fails. The
- /// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
- /// weaker than the success ordering.
+ /// ordering of this operation. The first describes the required ordering if the
+ /// operation succeeds while the second describes the required ordering when the
+ /// operation fails. Using [`Acquire`] as success ordering makes the store part
+ /// of this operation [`Relaxed`], and using [`Release`] makes the successful load
+ /// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+ /// and must be equivalent to or weaker than the success ordering.
///
/// [`bool`]: ../../../std/primitive.bool.html
/// [`compare_exchange`]: #method.compare_exchange
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
/// [`Release`]: enum.Ordering.html#variant.Release
- /// [`AcqRel`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -523,6 +581,16 @@
///
/// Returns the previous value.
///
+ /// `fetch_and` takes an [`Ordering`] argument which describes the memory ordering
+ /// of this operation. All ordering modes are possible. Note that using
+ /// [`Acquire`] makes the store part of this operation [`Relaxed`], and
+ /// using [`Release`] makes the load part [`Relaxed`].
+ ///
+ /// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ ///
/// # Examples
///
/// ```
@@ -554,6 +622,16 @@
///
/// Returns the previous value.
///
+ /// `fetch_nand` takes an [`Ordering`] argument which describes the memory ordering
+ /// of this operation. All ordering modes are possible. Note that using
+ /// [`Acquire`] makes the store part of this operation [`Relaxed`], and
+ /// using [`Release`] makes the load part [`Relaxed`].
+ ///
+ /// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ ///
/// # Examples
///
/// ```
@@ -598,6 +676,16 @@
///
/// Returns the previous value.
///
+ /// `fetch_or` takes an [`Ordering`] argument which describes the memory ordering
+ /// of this operation. All ordering modes are possible. Note that using
+ /// [`Acquire`] makes the store part of this operation [`Relaxed`], and
+ /// using [`Release`] makes the load part [`Relaxed`].
+ ///
+ /// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ ///
/// # Examples
///
/// ```
@@ -629,6 +717,16 @@
///
/// Returns the previous value.
///
+ /// `fetch_xor` takes an [`Ordering`] argument which describes the memory ordering
+ /// of this operation. All ordering modes are possible. Note that using
+ /// [`Acquire`] makes the store part of this operation [`Relaxed`], and
+ /// using [`Release`] makes the load part [`Relaxed`].
+ ///
+ /// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ ///
/// # Examples
///
/// ```
@@ -714,15 +812,18 @@
/// Loads a value from the pointer.
///
/// `load` takes an [`Ordering`] argument which describes the memory ordering
- /// of this operation.
+ /// of this operation. Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
///
/// # Panics
///
/// Panics if `order` is [`Release`] or [`AcqRel`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
/// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
/// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -743,9 +844,18 @@
/// Stores a value into the pointer.
///
/// `store` takes an [`Ordering`] argument which describes the memory ordering
- /// of this operation.
+ /// of this operation. Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
+ ///
+ /// # Panics
+ ///
+ /// Panics if `order` is [`Acquire`] or [`AcqRel`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -759,13 +869,6 @@
///
/// some_ptr.store(other_ptr, Ordering::Relaxed);
/// ```
- ///
- /// # Panics
- ///
- /// Panics if `order` is [`Acquire`] or [`AcqRel`].
- ///
- /// [`Acquire`]: enum.Ordering.html#variant.Acquire
- /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn store(&self, ptr: *mut T, order: Ordering) {
@@ -777,9 +880,14 @@
/// Stores a value into the pointer, returning the previous value.
///
/// `swap` takes an [`Ordering`] argument which describes the memory ordering
- /// of this operation.
+ /// of this operation. All ordering modes are possible. Note that using
+ /// [`Acquire`] makes the store part of this operation [`Relaxed`], and
+ /// using [`Release`] makes the load part [`Relaxed`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
///
/// # Examples
///
@@ -806,9 +914,16 @@
/// was updated.
///
/// `compare_and_swap` also takes an [`Ordering`] argument which describes the memory
- /// ordering of this operation.
+ /// ordering of this operation. Notice that even when using [`AcqRel`], the operation
+ /// might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
+ /// Using [`Acquire`] makes the store part of this operation [`Relaxed`] if it
+ /// happens, and using [`Release`] makes the load part [`Relaxed`].
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
+ /// [`Release`]: enum.Ordering.html#variant.Release
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
///
/// # Examples
///
@@ -839,14 +954,18 @@
/// the previous value. On success this value is guaranteed to be equal to `current`.
///
/// `compare_exchange` takes two [`Ordering`] arguments to describe the memory
- /// ordering of this operation. The first describes the required ordering if
- /// the operation succeeds while the second describes the required ordering when
- /// the operation fails. The failure ordering can't be [`Release`] or [`AcqRel`]
- /// and must be equivalent or weaker than the success ordering.
+ /// ordering of this operation. The first describes the required ordering if the
+ /// operation succeeds while the second describes the required ordering when the
+ /// operation fails. Using [`Acquire`] as success ordering makes the store part
+ /// of this operation [`Relaxed`], and using [`Release`] makes the successful load
+ /// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+ /// and must be equivalent to or weaker than the success ordering.
///
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
/// [`Release`]: enum.Ordering.html#variant.Release
- /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -892,15 +1011,19 @@
/// previous value.
///
/// `compare_exchange_weak` takes two [`Ordering`] arguments to describe the memory
- /// ordering of this operation. The first describes the required ordering if the operation
- /// succeeds while the second describes the required ordering when the operation fails. The
- /// failure ordering can't be [`Release`] or [`AcqRel`] and must be equivalent or
- /// weaker than the success ordering.
+ /// ordering of this operation. The first describes the required ordering if the
+ /// operation succeeds while the second describes the required ordering when the
+ /// operation fails. Using [`Acquire`] as success ordering makes the store part
+ /// of this operation [`Relaxed`], and using [`Release`] makes the successful load
+ /// [`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+ /// and must be equivalent to or weaker than the success ordering.
///
/// [`compare_exchange`]: #method.compare_exchange
/// [`Ordering`]: enum.Ordering.html
+ /// [`Relaxed`]: enum.Ordering.html#variant.Relaxed
/// [`Release`]: enum.Ordering.html#variant.Release
- /// [`AcqRel`]: enum.Ordering.html#variant.AcqRel
+ /// [`Acquire`]: enum.Ordering.html#variant.Acquire
+ /// [`SeqCst`]: enum.Ordering.html#variant.SeqCst
///
/// # Examples
///
@@ -1077,14 +1200,18 @@
concat!("Loads a value from the atomic integer.
`load` takes an [`Ordering`] argument which describes the memory ordering of this operation.
+Possible values are [`SeqCst`], [`Acquire`] and [`Relaxed`].
# Panics
Panics if `order` is [`Release`] or [`AcqRel`].
[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
[`AcqRel`]: enum.Ordering.html#variant.AcqRel
+[`SeqCst`]: enum.Ordering.html#variant.SeqCst
# Examples
@@ -1106,8 +1233,18 @@
concat!("Stores a value into the atomic integer.
`store` takes an [`Ordering`] argument which describes the memory ordering of this operation.
+ Possible values are [`SeqCst`], [`Release`] and [`Relaxed`].
+
+# Panics
+
+Panics if `order` is [`Acquire`] or [`AcqRel`].
[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+[`AcqRel`]: enum.Ordering.html#variant.AcqRel
+[`SeqCst`]: enum.Ordering.html#variant.SeqCst
# Examples
@@ -1118,14 +1255,7 @@
some_var.store(10, Ordering::Relaxed);
assert_eq!(some_var.load(Ordering::Relaxed), 10);
-```
-
-# Panics
-
-Panics if `order` is [`Acquire`] or [`AcqRel`].
-
-[`Acquire`]: enum.Ordering.html#variant.Acquire
-[`AcqRel`]: enum.Ordering.html#variant.AcqRel"),
+```"),
#[inline]
#[$stable]
pub fn store(&self, val: $int_type, order: Ordering) {
@@ -1136,9 +1266,15 @@
doc_comment! {
concat!("Stores a value into the atomic integer, returning the previous value.
-`swap` takes an [`Ordering`] argument which describes the memory ordering of this operation.
+`swap` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
# Examples
@@ -1165,9 +1301,16 @@
value was updated.
`compare_and_swap` also takes an [`Ordering`] argument which describes the memory
-ordering of this operation.
+ordering of this operation. Notice that even when using [`AcqRel`], the operation
+might fail and hence just perform an `Acquire` load, but not have `Release` semantics.
+Using [`Acquire`] makes the store part of this operation [`Relaxed`] if it
+happens, and using [`Release`] makes the load part [`Relaxed`].
[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+[`AcqRel`]: enum.Ordering.html#variant.AcqRel
# Examples
@@ -1208,14 +1351,18 @@
`current`.
`compare_exchange` takes two [`Ordering`] arguments to describe the memory
-ordering of this operation. The first describes the required ordering if
-the operation succeeds while the second describes the required ordering when
-the operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and
-must be equivalent or weaker than the success ordering.
+ordering of this operation. The first describes the required ordering if the
+operation succeeds while the second describes the required ordering when the
+operation fails. Using [`Acquire`] as success ordering makes the store part
+of this operation [`Relaxed`], and using [`Release`] makes the successful load
+[`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+and must be equivalent to or weaker than the success ordering.
[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
[`Release`]: enum.Ordering.html#variant.Release
-[`AcqRel`]: enum.Ordering.html#variant.AcqRel
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+[`SeqCst`]: enum.Ordering.html#variant.SeqCst
# Examples
@@ -1260,13 +1407,17 @@
`compare_exchange_weak` takes two [`Ordering`] arguments to describe the memory
ordering of this operation. The first describes the required ordering if the
operation succeeds while the second describes the required ordering when the
-operation fails. The failure ordering can't be [`Release`] or [`AcqRel`] and
-must be equivalent or weaker than the success ordering.
+operation fails. Using [`Acquire`] as success ordering makes the store part
+of this operation [`Relaxed`], and using [`Release`] makes the successful load
+[`Relaxed`]. The failure ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+and must be equivalent to or weaker than the success ordering.
[`compare_exchange`]: #method.compare_exchange
[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
[`Release`]: enum.Ordering.html#variant.Release
-[`AcqRel`]: enum.Ordering.html#variant.AcqRel
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+[`SeqCst`]: enum.Ordering.html#variant.SeqCst
# Examples
@@ -1302,6 +1453,16 @@
This operation wraps around on overflow.
+`fetch_add` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1323,6 +1484,16 @@
This operation wraps around on overflow.
+`fetch_sub` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1347,6 +1518,16 @@
Returns the previous value.
+`fetch_and` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1371,6 +1552,16 @@
Returns the previous value.
+`fetch_nand` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1396,6 +1587,16 @@
Returns the previous value.
+`fetch_or` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1420,6 +1621,16 @@
Returns the previous value.
+`fetch_xor` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1445,6 +1656,25 @@
the meantime, as long as the function returns `Some(_)`, but the function will have been applied
but once to the stored value.
+`fetch_update` takes two [`Ordering`] arguments to describe the memory
+ordering of this operation. The first describes the required ordering for loads
+and failed updates while the second describes the required ordering when the
+operation finally succeeds. Beware that this is different from the two
+modes in [`compare_exchange`]!
+
+Using [`Acquire`] as success ordering makes the store part
+of this operation [`Relaxed`], and using [`Release`] makes the final successful load
+[`Relaxed`]. The (failed) load ordering can only be [`SeqCst`], [`Acquire`] or [`Relaxed`]
+and must be equivalent to or weaker than the success ordering.
+
+[`bool`]: ../../../std/primitive.bool.html
+[`compare_exchange`]: #method.compare_exchange
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+[`SeqCst`]: enum.Ordering.html#variant.SeqCst
+
# Examples
```rust
@@ -1485,6 +1715,16 @@
Returns the previous value.
+`fetch_max` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1524,6 +1764,16 @@
Returns the previous value.
+`fetch_min` takes an [`Ordering`] argument which describes the memory ordering
+of this operation. All ordering modes are possible. Note that using
+[`Acquire`] makes the store part of this operation [`Relaxed`], and
+using [`Release`] makes the load part [`Relaxed`].
+
+[`Ordering`]: enum.Ordering.html
+[`Relaxed`]: enum.Ordering.html#variant.Relaxed
+[`Release`]: enum.Ordering.html#variant.Release
+[`Acquire`]: enum.Ordering.html#variant.Acquire
+
# Examples
```
@@ -1701,7 +1951,6 @@
SeqCst => SeqCst,
Acquire => Acquire,
AcqRel => Acquire,
- __Nonexhaustive => __Nonexhaustive,
}
}
@@ -1713,7 +1962,6 @@
SeqCst => intrinsics::atomic_store(dst, val),
Acquire => panic!("there is no such thing as an acquire store"),
AcqRel => panic!("there is no such thing as an acquire/release store"),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1725,7 +1973,6 @@
SeqCst => intrinsics::atomic_load(dst),
Release => panic!("there is no such thing as a release load"),
AcqRel => panic!("there is no such thing as an acquire/release load"),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1738,7 +1985,6 @@
AcqRel => intrinsics::atomic_xchg_acqrel(dst, val),
Relaxed => intrinsics::atomic_xchg_relaxed(dst, val),
SeqCst => intrinsics::atomic_xchg(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1751,7 +1997,6 @@
AcqRel => intrinsics::atomic_xadd_acqrel(dst, val),
Relaxed => intrinsics::atomic_xadd_relaxed(dst, val),
SeqCst => intrinsics::atomic_xadd(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1764,7 +2009,6 @@
AcqRel => intrinsics::atomic_xsub_acqrel(dst, val),
Relaxed => intrinsics::atomic_xsub_relaxed(dst, val),
SeqCst => intrinsics::atomic_xsub(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1786,8 +2030,6 @@
(AcqRel, Relaxed) => intrinsics::atomic_cxchg_acqrel_failrelaxed(dst, old, new),
(SeqCst, Relaxed) => intrinsics::atomic_cxchg_failrelaxed(dst, old, new),
(SeqCst, Acquire) => intrinsics::atomic_cxchg_failacq(dst, old, new),
- (__Nonexhaustive, _) => panic!("invalid memory ordering"),
- (_, __Nonexhaustive) => panic!("invalid memory ordering"),
(_, AcqRel) => panic!("there is no such thing as an acquire/release failure ordering"),
(_, Release) => panic!("there is no such thing as a release failure ordering"),
_ => panic!("a failure ordering can't be stronger than a success ordering"),
@@ -1812,8 +2054,6 @@
(AcqRel, Relaxed) => intrinsics::atomic_cxchgweak_acqrel_failrelaxed(dst, old, new),
(SeqCst, Relaxed) => intrinsics::atomic_cxchgweak_failrelaxed(dst, old, new),
(SeqCst, Acquire) => intrinsics::atomic_cxchgweak_failacq(dst, old, new),
- (__Nonexhaustive, _) => panic!("invalid memory ordering"),
- (_, __Nonexhaustive) => panic!("invalid memory ordering"),
(_, AcqRel) => panic!("there is no such thing as an acquire/release failure ordering"),
(_, Release) => panic!("there is no such thing as a release failure ordering"),
_ => panic!("a failure ordering can't be stronger than a success ordering"),
@@ -1829,7 +2069,6 @@
AcqRel => intrinsics::atomic_and_acqrel(dst, val),
Relaxed => intrinsics::atomic_and_relaxed(dst, val),
SeqCst => intrinsics::atomic_and(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1841,7 +2080,6 @@
AcqRel => intrinsics::atomic_nand_acqrel(dst, val),
Relaxed => intrinsics::atomic_nand_relaxed(dst, val),
SeqCst => intrinsics::atomic_nand(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1853,7 +2091,6 @@
AcqRel => intrinsics::atomic_or_acqrel(dst, val),
Relaxed => intrinsics::atomic_or_relaxed(dst, val),
SeqCst => intrinsics::atomic_or(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1865,7 +2102,6 @@
AcqRel => intrinsics::atomic_xor_acqrel(dst, val),
Relaxed => intrinsics::atomic_xor_relaxed(dst, val),
SeqCst => intrinsics::atomic_xor(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1878,7 +2114,6 @@
AcqRel => intrinsics::atomic_max_acqrel(dst, val),
Relaxed => intrinsics::atomic_max_relaxed(dst, val),
SeqCst => intrinsics::atomic_max(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1891,7 +2126,6 @@
AcqRel => intrinsics::atomic_min_acqrel(dst, val),
Relaxed => intrinsics::atomic_min_relaxed(dst, val),
SeqCst => intrinsics::atomic_min(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1904,7 +2138,6 @@
AcqRel => intrinsics::atomic_umax_acqrel(dst, val),
Relaxed => intrinsics::atomic_umax_relaxed(dst, val),
SeqCst => intrinsics::atomic_umax(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -1917,7 +2150,6 @@
AcqRel => intrinsics::atomic_umin_acqrel(dst, val),
Relaxed => intrinsics::atomic_umin_relaxed(dst, val),
SeqCst => intrinsics::atomic_umin(dst, val),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
@@ -2007,7 +2239,6 @@
AcqRel => intrinsics::atomic_fence_acqrel(),
SeqCst => intrinsics::atomic_fence(),
Relaxed => panic!("there is no such thing as a relaxed fence"),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
}
@@ -2097,7 +2328,6 @@
AcqRel => intrinsics::atomic_singlethreadfence_acqrel(),
SeqCst => intrinsics::atomic_singlethreadfence(),
Relaxed => panic!("there is no such thing as a relaxed compiler fence"),
- __Nonexhaustive => panic!("invalid memory ordering"),
}
}
}
diff --git a/src/libcore/tests/manually_drop.rs b/src/libcore/tests/manually_drop.rs
index 96bc924..82dfb8d 100644
--- a/src/libcore/tests/manually_drop.rs
+++ b/src/libcore/tests/manually_drop.rs
@@ -21,4 +21,9 @@
let x = ManuallyDrop::new(TypeWithDrop);
drop(x);
+
+ // also test unsizing
+ let x : Box<ManuallyDrop<[TypeWithDrop]>> =
+ Box::new(ManuallyDrop::new([TypeWithDrop, TypeWithDrop]));
+ drop(x);
}
diff --git a/src/libcore/tests/slice.rs b/src/libcore/tests/slice.rs
index 7968521..b087ec8 100644
--- a/src/libcore/tests/slice.rs
+++ b/src/libcore/tests/slice.rs
@@ -986,3 +986,17 @@
assert_eq!(aligned.len(), 4);
assert_eq!(prefix.len() + suffix.len(), 2);
}
+
+#[test]
+fn test_align_to_empty_mid() {
+ use core::mem;
+
+ // Make sure that we do not create empty unaligned slices for the mid part, even when the
+ // overall slice is too short to contain an aligned address.
+ let bytes = [1, 2, 3, 4, 5, 6, 7];
+ type Chunk = u32;
+ for offset in 0..4 {
+ let (_, mid, _) = unsafe { bytes[offset..offset+1].align_to::<Chunk>() };
+ assert_eq!(mid.as_ptr() as usize % mem::align_of::<Chunk>(), 0);
+ }
+}
diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs
index 373db1f..e2380f0 100644
--- a/src/libfmt_macros/lib.rs
+++ b/src/libfmt_macros/lib.rs
@@ -20,6 +20,8 @@
html_playground_url = "https://play.rust-lang.org/",
test(attr(deny(warnings))))]
+#![cfg_attr(not(stage0), feature(nll))]
+
pub use self::Piece::*;
pub use self::Position::*;
pub use self::Alignment::*;
@@ -409,7 +411,7 @@
// fill character
if let Some(&(_, c)) = self.cur.peek() {
- match self.cur.clone().skip(1).next() {
+ match self.cur.clone().nth(1) {
Some((_, '>')) | Some((_, '<')) | Some((_, '^')) => {
spec.fill = Some(c);
self.cur.next();
@@ -502,13 +504,11 @@
if word.is_empty() {
self.cur = tmp;
CountImplied
+ } else if self.consume('$') {
+ CountIsName(word)
} else {
- if self.consume('$') {
- CountIsName(word)
- } else {
- self.cur = tmp;
- CountImplied
- }
+ self.cur = tmp;
+ CountImplied
}
}
}
diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs
index 158d0101..9fa48ad 100644
--- a/src/libgraphviz/lib.rs
+++ b/src/libgraphviz/lib.rs
@@ -288,6 +288,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/",
test(attr(allow(unused_variables), deny(warnings))))]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(str_escape)]
use self::LabelText::*;
@@ -419,7 +420,8 @@
if !name.chars().all(|c| c.is_ascii_alphanumeric() || c == '_' ) {
return Err(());
}
- return Ok(Id { name: name });
+
+ Ok(Id { name })
}
pub fn as_slice(&'a self) -> &'a str {
@@ -532,10 +534,10 @@
/// Renders text as string suitable for a label in a .dot file.
/// This includes quotes or suitable delimiters.
pub fn to_dot_string(&self) -> String {
- match self {
- &LabelStr(ref s) => format!("\"{}\"", s.escape_default()),
- &EscStr(ref s) => format!("\"{}\"", LabelText::escape_str(&s)),
- &HtmlStr(ref s) => format!("<{}>", s),
+ match *self {
+ LabelStr(ref s) => format!("\"{}\"", s.escape_default()),
+ EscStr(ref s) => format!("\"{}\"", LabelText::escape_str(&s)),
+ HtmlStr(ref s) => format!("<{}>", s),
}
}
diff --git a/src/libpanic_abort/lib.rs b/src/libpanic_abort/lib.rs
index 392bf17..da568fa 100644
--- a/src/libpanic_abort/lib.rs
+++ b/src/libpanic_abort/lib.rs
@@ -24,6 +24,7 @@
#![feature(core_intrinsics)]
#![feature(libc)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(panic_runtime)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
diff --git a/src/libpanic_unwind/wasm32.rs b/src/libpanic_unwind/dummy.rs
similarity index 100%
rename from src/libpanic_unwind/wasm32.rs
rename to src/libpanic_unwind/dummy.rs
diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs
index 2abdf7c..9c3fc76 100644
--- a/src/libpanic_unwind/lib.rs
+++ b/src/libpanic_unwind/lib.rs
@@ -34,6 +34,7 @@
#![feature(core_intrinsics)]
#![feature(lang_items)]
#![feature(libc)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(panic_unwind)]
#![feature(raw)]
#![feature(staged_api)]
@@ -54,36 +55,33 @@
use core::raw;
use core::panic::BoxMeUp;
-// Rust runtime's startup objects depend on these symbols, so make them public.
-#[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
-pub use imp::eh_frame_registry::*;
+#[macro_use]
+mod macros;
-// *-pc-windows-msvc
-#[cfg(target_env = "msvc")]
-#[path = "seh.rs"]
-mod imp;
-
-// x86_64-pc-windows-gnu
-#[cfg(all(windows, target_arch = "x86_64", target_env = "gnu"))]
-#[path = "seh64_gnu.rs"]
-mod imp;
-
-// i686-pc-windows-gnu and all others
-#[cfg(any(all(unix, not(target_os = "emscripten")),
- target_os = "cloudabi",
- target_os = "redox",
- all(windows, target_arch = "x86", target_env = "gnu")))]
-#[path = "gcc.rs"]
-mod imp;
-
-// emscripten
-#[cfg(target_os = "emscripten")]
-#[path = "emcc.rs"]
-mod imp;
-
-#[cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))]
-#[path = "wasm32.rs"]
-mod imp;
+cfg_if! {
+ if #[cfg(target_os = "emscripten")] {
+ #[path = "emcc.rs"]
+ mod imp;
+ } else if #[cfg(target_arch = "wasm32")] {
+ #[path = "dummy.rs"]
+ mod imp;
+ } else if #[cfg(all(target_env = "msvc", target_arch = "aarch64"))] {
+ #[path = "dummy.rs"]
+ mod imp;
+ } else if #[cfg(target_env = "msvc")] {
+ #[path = "seh.rs"]
+ mod imp;
+ } else if #[cfg(all(windows, target_arch = "x86_64", target_env = "gnu"))] {
+ #[path = "seh64_gnu.rs"]
+ mod imp;
+ } else {
+ // Rust runtime's startup objects depend on these symbols, so make them public.
+ #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))]
+ pub use imp::eh_frame_registry::*;
+ #[path = "gcc.rs"]
+ mod imp;
+ }
+}
mod dwarf;
mod windows;
diff --git a/src/libpanic_unwind/macros.rs b/src/libpanic_unwind/macros.rs
new file mode 100644
index 0000000..6ea79dc
--- /dev/null
+++ b/src/libpanic_unwind/macros.rs
@@ -0,0 +1,45 @@
+// 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.
+
+/// A macro for defining `#[cfg]` if-else statements.
+///
+/// This is similar to the `if/elif` C preprocessor macro by allowing definition
+/// of a cascade of `#[cfg]` cases, emitting the implementation which matches
+/// first.
+///
+/// This allows you to conveniently provide a long list `#[cfg]`'d blocks of code
+/// without having to rewrite each clause multiple times.
+macro_rules! cfg_if {
+ ($(
+ if #[cfg($($meta:meta),*)] { $($it:item)* }
+ ) else * else {
+ $($it2:item)*
+ }) => {
+ __cfg_if_items! {
+ () ;
+ $( ( ($($meta),*) ($($it)*) ), )*
+ ( () ($($it2)*) ),
+ }
+ }
+}
+
+macro_rules! __cfg_if_items {
+ (($($not:meta,)*) ; ) => {};
+ (($($not:meta,)*) ; ( ($($m:meta),*) ($($it:item)*) ), $($rest:tt)*) => {
+ __cfg_if_apply! { cfg(all(not(any($($not),*)), $($m,)*)), $($it)* }
+ __cfg_if_items! { ($($not,)* $($m,)*) ; $($rest)* }
+ }
+}
+
+macro_rules! __cfg_if_apply {
+ ($m:meta, $($it:item)*) => {
+ $(#[$m] $it)*
+ }
+}
diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs
index 51e7647..af77901 100644
--- a/src/libproc_macro/diagnostic.rs
+++ b/src/libproc_macro/diagnostic.rs
@@ -16,6 +16,7 @@
/// An enum representing a diagnostic level.
#[unstable(feature = "proc_macro_diagnostic", issue = "38356")]
#[derive(Copy, Clone, Debug)]
+#[non_exhaustive]
pub enum Level {
/// An error.
Error,
@@ -25,8 +26,6 @@
Note,
/// A help message.
Help,
- #[doc(hidden)]
- __Nonexhaustive,
}
/// A structure representing a diagnostic message and associated children
diff --git a/src/libproc_macro/lib.rs b/src/libproc_macro/lib.rs
index bf6e4a3..0a32963 100644
--- a/src/libproc_macro/lib.rs
+++ b/src/libproc_macro/lib.rs
@@ -31,10 +31,12 @@
test(no_crate_inject, attr(deny(warnings))),
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_private)]
#![feature(staged_api)]
#![feature(lang_items)]
#![feature(optin_builtin_traits)]
+#![feature(non_exhaustive)]
#![recursion_limit="256"]
@@ -61,7 +63,7 @@
use syntax::parse::{self, token};
use syntax::symbol::Symbol;
use syntax::tokenstream;
-use syntax_pos::{FileMap, Pos, FileName};
+use syntax_pos::{Pos, FileName};
/// The main type provided by this crate, representing an abstract stream of
/// tokens, or, more specifically, a sequence of token trees.
@@ -179,6 +181,20 @@
}
}
+#[stable(feature = "token_stream_extend", since = "1.30.0")]
+impl Extend<TokenTree> for TokenStream {
+ fn extend<I: IntoIterator<Item = TokenTree>>(&mut self, trees: I) {
+ self.extend(trees.into_iter().map(TokenStream::from));
+ }
+}
+
+#[stable(feature = "token_stream_extend", since = "1.30.0")]
+impl Extend<TokenStream> for TokenStream {
+ fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, streams: I) {
+ self.0.extend(streams.into_iter().map(|stream| stream.0));
+ }
+}
+
/// Public implementation details for the `TokenStream` type, such as iterators.
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
pub mod token_stream {
@@ -292,7 +308,7 @@
#[unstable(feature = "proc_macro_span", issue = "38356")]
pub fn source_file(&self) -> SourceFile {
SourceFile {
- filemap: __internal::lookup_char_pos(self.0.lo()).file,
+ source_file: __internal::lookup_char_pos(self.0.lo()).file,
}
}
@@ -403,7 +419,7 @@
#[unstable(feature = "proc_macro_span", issue = "38356")]
#[derive(Clone)]
pub struct SourceFile {
- filemap: Lrc<FileMap>,
+ source_file: Lrc<syntax_pos::SourceFile>,
}
#[unstable(feature = "proc_macro_span", issue = "38356")]
@@ -416,7 +432,7 @@
///
/// ### Note
/// If the code span associated with this `SourceFile` was generated by an external macro, this
- /// may not be an actual path on the filesystem. Use [`is_real`] to check.
+ /// macro, this may not be an actual path on the filesystem. Use [`is_real`] to check.
///
/// Also note that even if `is_real` returns `true`, if `--remap-path-prefix` was passed on
/// the command line, the path as given may not actually be valid.
@@ -424,9 +440,9 @@
/// [`is_real`]: #method.is_real
#[unstable(feature = "proc_macro_span", issue = "38356")]
pub fn path(&self) -> PathBuf {
- match self.filemap.name {
+ match self.source_file.name {
FileName::Real(ref path) => path.clone(),
- _ => PathBuf::from(self.filemap.name.to_string())
+ _ => PathBuf::from(self.source_file.name.to_string())
}
}
@@ -437,7 +453,7 @@
// This is a hack until intercrate spans are implemented and we can have real source files
// for spans generated in external macros.
// https://github.com/rust-lang/rust/pull/43604#issuecomment-333334368
- self.filemap.is_real_file()
+ self.source_file.is_real_file()
}
}
@@ -455,7 +471,7 @@
#[unstable(feature = "proc_macro_span", issue = "38356")]
impl PartialEq for SourceFile {
fn eq(&self, other: &Self) -> bool {
- Lrc::ptr_eq(&self.filemap, &other.filemap)
+ Lrc::ptr_eq(&self.source_file, &other.source_file)
}
}
@@ -1170,7 +1186,7 @@
use super::{TokenStream, LexError, Span};
pub fn lookup_char_pos(pos: BytePos) -> Loc {
- with_sess(|sess, _| sess.codemap().lookup_char_pos(pos))
+ with_sess(|sess, _| sess.source_map().lookup_char_pos(pos))
}
pub fn new_token_stream(item: P<ast::Item>) -> TokenStream {
diff --git a/src/libproc_macro/rustc.rs b/src/libproc_macro/rustc.rs
index a54c695..21229d3 100644
--- a/src/libproc_macro/rustc.rs
+++ b/src/libproc_macro/rustc.rs
@@ -278,7 +278,6 @@
Level::Warning => errors::Level::Warning,
Level::Note => errors::Level::Note,
Level::Help => errors::Level::Help,
- Level::__Nonexhaustive => unreachable!("Level::__Nonexhaustive"),
}
}
}
diff --git a/src/libprofiler_builtins/lib.rs b/src/libprofiler_builtins/lib.rs
index 6d0d6d1..a855932 100644
--- a/src/libprofiler_builtins/lib.rs
+++ b/src/libprofiler_builtins/lib.rs
@@ -15,4 +15,5 @@
reason = "internal implementation detail of rustc right now",
issue = "0")]
#![allow(unused_features)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(staged_api)]
diff --git a/src/librustc/Cargo.toml b/src/librustc/Cargo.toml
index 457a9f2..59b5b58 100644
--- a/src/librustc/Cargo.toml
+++ b/src/librustc/Cargo.toml
@@ -31,7 +31,8 @@
backtrace = "0.3.3"
parking_lot = "0.5.5"
byteorder = { version = "1.1", features = ["i128"]}
-chalk-engine = { version = "0.6.0", default-features=false }
+chalk-engine = { version = "0.7.0", default-features=false }
+rustc_fs_util = { path = "../librustc_fs_util" }
# Note that these dependencies are a lie, they're just here to get linkage to
# work.
diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs
index 6b66fd8..b5f5f4d 100644
--- a/src/librustc/hir/lowering.rs
+++ b/src/librustc/hir/lowering.rs
@@ -51,6 +51,8 @@
ELIDED_LIFETIMES_IN_PATHS};
use middle::cstore::CrateStore;
use rustc_data_structures::indexed_vec::IndexVec;
+use rustc_data_structures::small_vec::OneVector;
+use rustc_data_structures::thin_vec::ThinVec;
use session::Session;
use util::common::FN_OUTPUT_NAME;
use util::nodemap::{DefIdMap, NodeMap};
@@ -66,12 +68,11 @@
use syntax::ext::hygiene::{Mark, SyntaxContext};
use syntax::print::pprust;
use syntax::ptr::P;
-use syntax::codemap::{self, respan, CompilerDesugaringKind, Spanned};
+use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned};
use syntax::std_inject;
use syntax::symbol::{keywords, Symbol};
use syntax::tokenstream::{Delimited, TokenStream, TokenTree};
use syntax::parse::token::Token;
-use syntax::util::small_vector::SmallVector;
use syntax::visit::{self, Visitor};
use syntax_pos::{Span, MultiSpan};
@@ -613,14 +614,14 @@
fn allow_internal_unstable(&self, reason: CompilerDesugaringKind, span: Span) -> Span {
let mark = Mark::fresh(Mark::root());
- mark.set_expn_info(codemap::ExpnInfo {
+ mark.set_expn_info(source_map::ExpnInfo {
call_site: span,
def_site: Some(span),
- format: codemap::CompilerDesugaring(reason),
+ format: source_map::CompilerDesugaring(reason),
allow_internal_unstable: true,
allow_internal_unsafe: false,
local_inner_macros: false,
- edition: codemap::hygiene::default_edition(),
+ edition: source_map::hygiene::default_edition(),
});
span.with_ctxt(SyntaxContext::empty().apply_mark(mark))
}
@@ -2333,7 +2334,7 @@
// FIXME: This could probably be done with less rightward drift. Also looks like two control
// paths where report_error is called are also the only paths that advance to after
// the match statement, so the error reporting could probably just be moved there.
- let mut add_bounds = NodeMap();
+ let mut add_bounds: NodeMap<Vec<_>> = NodeMap();
for pred in &generics.where_clause.predicates {
if let WherePredicate::BoundPredicate(ref bound_pred) = *pred {
'next_bound: for bound in &bound_pred.bounds {
@@ -2363,7 +2364,7 @@
GenericParamKind::Type { .. } => {
if node_id == param.id {
add_bounds.entry(param.id)
- .or_insert(Vec::new())
+ .or_default()
.push(bound.clone());
continue 'next_bound;
}
@@ -2729,7 +2730,7 @@
if let Some(ref trait_ref) = trait_ref {
if let Def::Trait(def_id) = trait_ref.path.def {
- this.trait_impls.entry(def_id).or_insert(vec![]).push(id);
+ this.trait_impls.entry(def_id).or_default().push(id);
}
}
@@ -3136,12 +3137,12 @@
&mut self,
decl: &FnDecl,
header: &FnHeader,
- ids: &mut SmallVector<hir::ItemId>,
+ ids: &mut OneVector<hir::ItemId>,
) {
if let Some(id) = header.asyncness.opt_return_id() {
ids.push(hir::ItemId { id });
}
- struct IdVisitor<'a> { ids: &'a mut SmallVector<hir::ItemId> }
+ struct IdVisitor<'a> { ids: &'a mut OneVector<hir::ItemId> }
impl<'a, 'b> Visitor<'a> for IdVisitor<'b> {
fn visit_ty(&mut self, ty: &'a Ty) {
match ty.node {
@@ -3174,21 +3175,21 @@
}
}
- fn lower_item_id(&mut self, i: &Item) -> SmallVector<hir::ItemId> {
+ fn lower_item_id(&mut self, i: &Item) -> OneVector<hir::ItemId> {
match i.node {
ItemKind::Use(ref use_tree) => {
- let mut vec = SmallVector::one(hir::ItemId { id: i.id });
+ let mut vec = OneVector::one(hir::ItemId { id: i.id });
self.lower_item_id_use_tree(use_tree, i.id, &mut vec);
vec
}
- ItemKind::MacroDef(..) => SmallVector::new(),
+ ItemKind::MacroDef(..) => OneVector::new(),
ItemKind::Fn(ref decl, ref header, ..) => {
- let mut ids = SmallVector::one(hir::ItemId { id: i.id });
+ let mut ids = OneVector::one(hir::ItemId { id: i.id });
self.lower_impl_trait_ids(decl, header, &mut ids);
ids
},
ItemKind::Impl(.., None, _, ref items) => {
- let mut ids = SmallVector::one(hir::ItemId { id: i.id });
+ let mut ids = OneVector::one(hir::ItemId { id: i.id });
for item in items {
if let ImplItemKind::Method(ref sig, _) = item.node {
self.lower_impl_trait_ids(&sig.decl, &sig.header, &mut ids);
@@ -3196,14 +3197,14 @@
}
ids
},
- _ => SmallVector::one(hir::ItemId { id: i.id }),
+ _ => OneVector::one(hir::ItemId { id: i.id }),
}
}
fn lower_item_id_use_tree(&mut self,
tree: &UseTree,
base_id: NodeId,
- vec: &mut SmallVector<hir::ItemId>)
+ vec: &mut OneVector<hir::ItemId>)
{
match tree.kind {
UseTreeKind::Nested(ref nested_vec) => for &(ref nested, id) in nested_vec {
@@ -3620,7 +3621,7 @@
let tail = block.expr.take().map_or_else(
|| {
let LoweredNodeId { node_id, hir_id } = this.next_id();
- let span = this.sess.codemap().end_point(unstable_span);
+ let span = this.sess.source_map().end_point(unstable_span);
hir::Expr {
id: node_id,
span,
@@ -4295,8 +4296,8 @@
}
}
- fn lower_stmt(&mut self, s: &Stmt) -> SmallVector<hir::Stmt> {
- SmallVector::one(match s.node {
+ fn lower_stmt(&mut self, s: &Stmt) -> OneVector<hir::Stmt> {
+ OneVector::one(match s.node {
StmtKind::Local(ref l) => Spanned {
node: hir::StmtKind::Decl(
P(Spanned {
diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs
index 0150ba6..a14745a 100644
--- a/src/librustc/hir/map/collector.rs
+++ b/src/librustc/hir/map/collector.rs
@@ -12,13 +12,13 @@
use dep_graph::{DepGraph, DepKind, DepNodeIndex};
use hir::def_id::{LOCAL_CRATE, CrateNum};
use hir::intravisit::{Visitor, NestedVisitorMap};
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use ich::Fingerprint;
use middle::cstore::CrateStore;
use session::CrateDisambiguator;
use std::iter::repeat;
use syntax::ast::{NodeId, CRATE_NODE_ID};
-use syntax::codemap::CodeMap;
+use syntax::source_map::SourceMap;
use syntax_pos::Span;
use ich::StableHashingContext;
@@ -122,7 +122,7 @@
pub(super) fn finalize_and_compute_crate_hash(mut self,
crate_disambiguator: CrateDisambiguator,
cstore: &dyn CrateStore,
- codemap: &CodeMap,
+ source_map: &SourceMap,
commandline_args_hash: u64)
-> (Vec<MapEntry<'hir>>, Svh) {
self
@@ -155,11 +155,11 @@
// If we included the full mapping in the SVH, we could only have
// reproducible builds by compiling from the same directory. So we just
// hash the result of the mapping instead of the mapping itself.
- let mut source_file_names: Vec<_> = codemap
+ let mut source_file_names: Vec<_> = source_map
.files()
.iter()
- .filter(|filemap| CrateNum::from_u32(filemap.crate_of_origin) == LOCAL_CRATE)
- .map(|filemap| filemap.name_hash)
+ .filter(|source_file| CrateNum::from_u32(source_file.crate_of_origin) == LOCAL_CRATE)
+ .map(|source_file| source_file.name_hash)
.collect();
source_file_names.sort_unstable();
diff --git a/src/librustc/hir/map/definitions.rs b/src/librustc/hir/map/definitions.rs
index c4b28fe..7ecbf7e 100644
--- a/src/librustc/hir/map/definitions.rs
+++ b/src/librustc/hir/map/definitions.rs
@@ -739,7 +739,7 @@
LangItems,
LangItemsMissing,
NativeLibraries,
- CodeMap,
+ SourceMap,
Impls,
ExportedSymbols
});
diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs
index b05bcad..ebda91c 100644
--- a/src/librustc/hir/map/mod.rs
+++ b/src/librustc/hir/map/mod.rs
@@ -22,14 +22,14 @@
use middle::cstore::CrateStore;
use rustc_target::spec::abi::Abi;
+use rustc_data_structures::svh::Svh;
use syntax::ast::{self, Name, NodeId, CRATE_NODE_ID};
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::ext::base::MacroKind;
use syntax_pos::{Span, DUMMY_SP};
use hir::*;
use hir::print::Nested;
-use hir::svh::Svh;
use util::nodemap::FxHashMap;
use std::io;
@@ -1202,7 +1202,7 @@
let cmdline_args = sess.opts.dep_tracking_hash();
collector.finalize_and_compute_crate_hash(crate_disambiguator,
cstore,
- sess.codemap(),
+ sess.source_map(),
cmdline_args)
};
diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs
index 0003790..795dba9 100644
--- a/src/librustc/hir/mod.rs
+++ b/src/librustc/hir/mod.rs
@@ -24,7 +24,7 @@
use mir::mono::Linkage;
use syntax_pos::{Span, DUMMY_SP, symbol::InternedString};
-use syntax::codemap::{self, Spanned};
+use syntax::source_map::{self, Spanned};
use rustc_target::spec::abi::Abi;
use syntax::ast::{self, CrateSugar, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
@@ -33,13 +33,13 @@
use syntax::ptr::P;
use syntax::symbol::{Symbol, keywords};
use syntax::tokenstream::TokenStream;
-use syntax::util::ThinVec;
use syntax::util::parser::ExprPrecedence;
use ty::AdtKind;
use ty::query::Providers;
use rustc_data_structures::indexed_vec;
use rustc_data_structures::sync::{ParallelIterator, par_iter, Send, Sync, scope};
+use rustc_data_structures::thin_vec::ThinVec;
use serialize::{self, Encoder, Encodable, Decoder, Decodable};
use std::collections::BTreeMap;
@@ -70,7 +70,6 @@
pub mod map;
pub mod pat_util;
pub mod print;
-pub mod svh;
/// A HirId uniquely identifies a node in the HIR of the current crate. It is
/// composed of the `owner`, which is the DefIndex of the directly enclosing
@@ -1101,7 +1100,7 @@
impl fmt::Debug for StmtKind {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// Sadness.
- let spanned = codemap::dummy_spanned(self.clone());
+ let spanned = source_map::dummy_spanned(self.clone());
write!(f,
"stmt({}: {})",
spanned.node.id(),
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index 4499a37..9fe462e 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -12,7 +12,7 @@
use rustc_target::spec::abi::Abi;
use syntax::ast;
-use syntax::codemap::{CodeMap, Spanned};
+use syntax::source_map::{SourceMap, Spanned};
use syntax::parse::ParseSess;
use syntax::parse::lexer::comments;
use syntax::print::pp::{self, Breaks};
@@ -85,7 +85,7 @@
pub struct State<'a> {
pub s: pp::Printer<'a>,
- cm: Option<&'a CodeMap>,
+ cm: Option<&'a SourceMap>,
comments: Option<Vec<comments::Comment>>,
literals: Peekable<vec::IntoIter<comments::Literal>>,
cur_cmnt: usize,
@@ -129,7 +129,7 @@
/// Requires you to pass an input filename and reader so that
/// it can scan the input text for comments and literals to
/// copy forward.
-pub fn print_crate<'a>(cm: &'a CodeMap,
+pub fn print_crate<'a>(cm: &'a SourceMap,
sess: &ParseSess,
krate: &hir::Crate,
filename: FileName,
@@ -149,7 +149,7 @@
}
impl<'a> State<'a> {
- pub fn new_from_input(cm: &'a CodeMap,
+ pub fn new_from_input(cm: &'a SourceMap,
sess: &ParseSess,
filename: FileName,
input: &mut dyn Read,
@@ -173,7 +173,7 @@
})
}
- pub fn new(cm: &'a CodeMap,
+ pub fn new(cm: &'a SourceMap,
out: Box<dyn Write + 'a>,
ann: &'a dyn PpAnn,
comments: Option<Vec<comments::Comment>>,
diff --git a/src/librustc/hir/svh.rs b/src/librustc/hir/svh.rs
deleted file mode 100644
index a6cfcb7..0000000
--- a/src/librustc/hir/svh.rs
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-//! Calculation and management of a Strict Version Hash for crates
-//!
-//! The SVH is used for incremental compilation to track when HIR
-//! nodes have changed between compilations, and also to detect
-//! mismatches where we have two versions of the same crate that were
-//! compiled from distinct sources.
-
-use std::fmt;
-use std::hash::{Hash, Hasher};
-use serialize::{Encodable, Decodable, Encoder, Decoder};
-
-#[derive(Copy, Clone, PartialEq, Eq, Debug)]
-pub struct Svh {
- hash: u64,
-}
-
-impl Svh {
- /// Create a new `Svh` given the hash. If you actually want to
- /// compute the SVH from some HIR, you want the `calculate_svh`
- /// function found in `librustc_incremental`.
- pub fn new(hash: u64) -> Svh {
- Svh { hash: hash }
- }
-
- pub fn as_u64(&self) -> u64 {
- self.hash
- }
-
- pub fn to_string(&self) -> String {
- format!("{:016x}", self.hash)
- }
-}
-
-impl Hash for Svh {
- fn hash<H>(&self, state: &mut H) where H: Hasher {
- self.hash.to_le().hash(state);
- }
-}
-
-impl fmt::Display for Svh {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- f.pad(&self.to_string())
- }
-}
-
-impl Encodable for Svh {
- fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
- s.emit_u64(self.as_u64().to_le())
- }
-}
-
-impl Decodable for Svh {
- fn decode<D: Decoder>(d: &mut D) -> Result<Svh, D::Error> {
- d.read_u64()
- .map(u64::from_le)
- .map(Svh::new)
- }
-}
-
-impl_stable_hash_for!(struct Svh {
- hash
-});
diff --git a/src/librustc/ich/caching_codemap_view.rs b/src/librustc/ich/caching_codemap_view.rs
index e5bf384..9711477 100644
--- a/src/librustc/ich/caching_codemap_view.rs
+++ b/src/librustc/ich/caching_codemap_view.rs
@@ -9,8 +9,8 @@
// except according to those terms.
use rustc_data_structures::sync::Lrc;
-use syntax::codemap::CodeMap;
-use syntax_pos::{BytePos, FileMap};
+use syntax::source_map::SourceMap;
+use syntax_pos::{BytePos, SourceFile};
#[derive(Clone)]
struct CacheEntry {
@@ -18,20 +18,20 @@
line_number: usize,
line_start: BytePos,
line_end: BytePos,
- file: Lrc<FileMap>,
+ file: Lrc<SourceFile>,
file_index: usize,
}
#[derive(Clone)]
-pub struct CachingCodemapView<'cm> {
- codemap: &'cm CodeMap,
+pub struct CachingSourceMapView<'cm> {
+ source_map: &'cm SourceMap,
line_cache: [CacheEntry; 3],
time_stamp: usize,
}
-impl<'cm> CachingCodemapView<'cm> {
- pub fn new(codemap: &'cm CodeMap) -> CachingCodemapView<'cm> {
- let files = codemap.files();
+impl<'cm> CachingSourceMapView<'cm> {
+ pub fn new(source_map: &'cm SourceMap) -> CachingSourceMapView<'cm> {
+ let files = source_map.files();
let first_file = files[0].clone();
let entry = CacheEntry {
time_stamp: 0,
@@ -42,8 +42,8 @@
file_index: 0,
};
- CachingCodemapView {
- codemap,
+ CachingSourceMapView {
+ source_map,
line_cache: [entry.clone(), entry.clone(), entry.clone()],
time_stamp: 0,
}
@@ -51,7 +51,7 @@
pub fn byte_pos_to_line_and_col(&mut self,
pos: BytePos)
- -> Option<(Lrc<FileMap>, usize, BytePos)> {
+ -> Option<(Lrc<SourceFile>, usize, BytePos)> {
self.time_stamp += 1;
// Check if the position is in one of the cached lines
@@ -78,9 +78,9 @@
// If the entry doesn't point to the correct file, fix it up
if pos < cache_entry.file.start_pos || pos >= cache_entry.file.end_pos {
let file_valid;
- if self.codemap.files().len() > 0 {
- let file_index = self.codemap.lookup_filemap_idx(pos);
- let file = self.codemap.files()[file_index].clone();
+ if self.source_map.files().len() > 0 {
+ let file_index = self.source_map.lookup_source_file_idx(pos);
+ let file = self.source_map.files()[file_index].clone();
if pos >= file.start_pos && pos < file.end_pos {
cache_entry.file = file;
diff --git a/src/librustc/ich/fingerprint.rs b/src/librustc/ich/fingerprint.rs
deleted file mode 100644
index a6e35d7..0000000
--- a/src/librustc/ich/fingerprint.rs
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::mem;
-use rustc_data_structures::stable_hasher;
-use serialize;
-use serialize::opaque::{EncodeResult, Encoder, Decoder};
-
-#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
-pub struct Fingerprint(u64, u64);
-
-impl Fingerprint {
-
- pub const ZERO: Fingerprint = Fingerprint(0, 0);
-
- #[inline]
- pub fn from_smaller_hash(hash: u64) -> Fingerprint {
- Fingerprint(hash, hash)
- }
-
- #[inline]
- pub fn to_smaller_hash(&self) -> u64 {
- self.0
- }
-
- #[inline]
- pub fn as_value(&self) -> (u64, u64) {
- (self.0, self.1)
- }
-
- #[inline]
- pub fn combine(self, other: Fingerprint) -> Fingerprint {
- // See https://stackoverflow.com/a/27952689 on why this function is
- // implemented this way.
- Fingerprint(
- self.0.wrapping_mul(3).wrapping_add(other.0),
- self.1.wrapping_mul(3).wrapping_add(other.1)
- )
- }
-
- // Combines two hashes in an order independent way. Make sure this is what
- // you want.
- #[inline]
- pub fn combine_commutative(self, other: Fingerprint) -> Fingerprint {
- let a = (self.1 as u128) << 64 | self.0 as u128;
- let b = (other.1 as u128) << 64 | other.0 as u128;
-
- let c = a.wrapping_add(b);
-
- Fingerprint((c >> 64) as u64, c as u64)
- }
-
- pub fn to_hex(&self) -> String {
- format!("{:x}{:x}", self.0, self.1)
- }
-
- pub fn encode_opaque(&self, encoder: &mut Encoder) -> EncodeResult {
- let bytes: [u8; 16] = unsafe { mem::transmute([self.0.to_le(), self.1.to_le()]) };
-
- encoder.emit_raw_bytes(&bytes);
- Ok(())
- }
-
- pub fn decode_opaque<'a>(decoder: &mut Decoder<'a>) -> Result<Fingerprint, String> {
- let mut bytes = [0; 16];
-
- decoder.read_raw_bytes(&mut bytes)?;
-
- let [l, r]: [u64; 2] = unsafe { mem::transmute(bytes) };
-
- Ok(Fingerprint(u64::from_le(l), u64::from_le(r)))
- }
-}
-
-impl ::std::fmt::Display for Fingerprint {
- fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- write!(formatter, "{:x}-{:x}", self.0, self.1)
- }
-}
-
-impl stable_hasher::StableHasherResult for Fingerprint {
- fn finish(hasher: stable_hasher::StableHasher<Self>) -> Self {
- let (_0, _1) = hasher.finalize();
- Fingerprint(_0, _1)
- }
-}
-
-impl<CTX> stable_hasher::HashStable<CTX> for Fingerprint {
- #[inline]
- fn hash_stable<W: stable_hasher::StableHasherResult>(&self,
- _: &mut CTX,
- hasher: &mut stable_hasher::StableHasher<W>) {
- ::std::hash::Hash::hash(self, hasher);
- }
-}
-
-impl serialize::UseSpecializedEncodable for Fingerprint { }
-
-impl serialize::UseSpecializedDecodable for Fingerprint { }
-
-impl serialize::SpecializedEncoder<Fingerprint> for serialize::opaque::Encoder {
- fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> {
- f.encode_opaque(self)
- }
-}
-
-impl<'a> serialize::SpecializedDecoder<Fingerprint> for serialize::opaque::Decoder<'a> {
- fn specialized_decode(&mut self) -> Result<Fingerprint, Self::Error> {
- Fingerprint::decode_opaque(self)
- }
-}
diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs
index 05361b6..f03ad98 100644
--- a/src/librustc/ich/hcx.rs
+++ b/src/librustc/ich/hcx.rs
@@ -12,7 +12,7 @@
use hir::def_id::{DefId, DefIndex};
use hir::map::DefPathHash;
use hir::map::definitions::Definitions;
-use ich::{self, CachingCodemapView, Fingerprint};
+use ich::{self, CachingSourceMapView, Fingerprint};
use middle::cstore::CrateStore;
use ty::{TyCtxt, fast_reject};
use mir::interpret::AllocId;
@@ -25,7 +25,7 @@
use syntax::ast;
-use syntax::codemap::CodeMap;
+use syntax::source_map::SourceMap;
use syntax::ext::hygiene::SyntaxContext;
use syntax::symbol::Symbol;
use syntax_pos::{Span, DUMMY_SP};
@@ -37,7 +37,7 @@
use rustc_data_structures::accumulate_vec::AccumulateVec;
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
-pub fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
+fn compute_ignored_attr_names() -> FxHashSet<Symbol> {
debug_assert!(ich::IGNORED_ATTRIBUTES.len() > 0);
ich::IGNORED_ATTRIBUTES.iter().map(|&s| Symbol::intern(s)).collect()
}
@@ -57,9 +57,9 @@
node_id_hashing_mode: NodeIdHashingMode,
// Very often, we are hashing something that does not need the
- // CachingCodemapView, so we initialize it lazily.
- raw_codemap: &'a CodeMap,
- caching_codemap: Option<CachingCodemapView<'a>>,
+ // CachingSourceMapView, so we initialize it lazily.
+ raw_source_map: &'a SourceMap,
+ caching_source_map: Option<CachingSourceMapView<'a>>,
pub(super) alloc_id_recursion_tracker: FxHashSet<AllocId>,
}
@@ -100,8 +100,8 @@
body_resolver: BodyResolver(krate),
definitions,
cstore,
- caching_codemap: None,
- raw_codemap: sess.codemap(),
+ caching_source_map: None,
+ raw_source_map: sess.source_map(),
hash_spans: hash_spans_initial,
hash_bodies: true,
node_id_hashing_mode: NodeIdHashingMode::HashDefPath,
@@ -169,13 +169,13 @@
}
#[inline]
- pub fn codemap(&mut self) -> &mut CachingCodemapView<'a> {
- match self.caching_codemap {
+ pub fn source_map(&mut self) -> &mut CachingSourceMapView<'a> {
+ match self.caching_source_map {
Some(ref mut cm) => {
cm
}
ref mut none => {
- *none = Some(CachingCodemapView::new(self.raw_codemap));
+ *none = Some(CachingSourceMapView::new(self.raw_source_map));
none.as_mut().unwrap()
}
}
@@ -183,7 +183,10 @@
#[inline]
pub fn is_ignored_attr(&self, name: Symbol) -> bool {
- self.sess.ignored_attr_names.contains(&name)
+ thread_local! {
+ static IGNORED_ATTRIBUTES: FxHashSet<Symbol> = compute_ignored_attr_names();
+ }
+ IGNORED_ATTRIBUTES.with(|attrs| attrs.contains(&name))
}
pub fn hash_hir_item_like<F: FnOnce(&mut Self)>(&mut self, f: F) {
@@ -305,9 +308,9 @@
// Hash a span in a stable way. We can't directly hash the span's BytePos
// fields (that would be similar to hashing pointers, since those are just
- // offsets into the CodeMap). Instead, we hash the (file name, line, column)
- // triple, which stays the same even if the containing FileMap has moved
- // within the CodeMap.
+ // offsets into the SourceMap). Instead, we hash the (file name, line, column)
+ // triple, which stays the same even if the containing SourceFile has moved
+ // within the SourceMap.
// Also note that we are hashing byte offsets for the column, not unicode
// codepoint offsets. For the purpose of the hash that's sufficient.
// Also, hashing filenames is expensive so we avoid doing it twice when the
@@ -337,7 +340,7 @@
return std_hash::Hash::hash(&TAG_INVALID_SPAN, hasher);
}
- let (file_lo, line_lo, col_lo) = match hcx.codemap()
+ let (file_lo, line_lo, col_lo) = match hcx.source_map()
.byte_pos_to_line_and_col(span.lo) {
Some(pos) => pos,
None => {
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs
index d086d3b..65b84ce 100644
--- a/src/librustc/ich/impls_syntax.rs
+++ b/src/librustc/ich/impls_syntax.rs
@@ -21,7 +21,7 @@
use syntax::parse::token;
use syntax::symbol::{InternedString, LocalInternedString};
use syntax::tokenstream;
-use syntax_pos::FileMap;
+use syntax_pos::SourceFile;
use hir::def_id::{DefId, CrateNum, CRATE_DEF_INDEX};
@@ -427,11 +427,11 @@
Custom(s)
});
-impl<'a> HashStable<StableHashingContext<'a>> for FileMap {
+impl<'a> HashStable<StableHashingContext<'a>> for SourceFile {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
- let FileMap {
+ let SourceFile {
name: _, // We hash the smaller name_hash instead of this
name_hash,
name_was_remapped,
@@ -458,13 +458,13 @@
src_hash.hash_stable(hcx, hasher);
- // We only hash the relative position within this filemap
+ // We only hash the relative position within this source_file
lines.len().hash_stable(hcx, hasher);
for &line in lines.iter() {
stable_byte_pos(line, start_pos).hash_stable(hcx, hasher);
}
- // We only hash the relative position within this filemap
+ // We only hash the relative position within this source_file
multibyte_chars.len().hash_stable(hcx, hasher);
for &char_pos in multibyte_chars.iter() {
stable_multibyte_char(char_pos, start_pos).hash_stable(hcx, hasher);
@@ -478,29 +478,29 @@
}
fn stable_byte_pos(pos: ::syntax_pos::BytePos,
- filemap_start: ::syntax_pos::BytePos)
+ source_file_start: ::syntax_pos::BytePos)
-> u32 {
- pos.0 - filemap_start.0
+ pos.0 - source_file_start.0
}
fn stable_multibyte_char(mbc: ::syntax_pos::MultiByteChar,
- filemap_start: ::syntax_pos::BytePos)
+ source_file_start: ::syntax_pos::BytePos)
-> (u32, u32) {
let ::syntax_pos::MultiByteChar {
pos,
bytes,
} = mbc;
- (pos.0 - filemap_start.0, bytes as u32)
+ (pos.0 - source_file_start.0, bytes as u32)
}
fn stable_non_narrow_char(swc: ::syntax_pos::NonNarrowChar,
- filemap_start: ::syntax_pos::BytePos)
+ source_file_start: ::syntax_pos::BytePos)
-> (u32, u32) {
let pos = swc.pos();
let width = swc.width();
- (pos.0 - filemap_start.0, width as u32)
+ (pos.0 - source_file_start.0, width as u32)
}
diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs
index d58eb64..6e5134c 100644
--- a/src/librustc/ich/mod.rs
+++ b/src/librustc/ich/mod.rs
@@ -10,11 +10,10 @@
//! ICH - Incremental Compilation Hash
-pub use self::fingerprint::Fingerprint;
-pub use self::caching_codemap_view::CachingCodemapView;
+crate use rustc_data_structures::fingerprint::Fingerprint;
+pub use self::caching_codemap_view::CachingSourceMapView;
pub use self::hcx::{StableHashingContextProvider, StableHashingContext, NodeIdHashingMode,
- hash_stable_trait_impls, compute_ignored_attr_names};
-mod fingerprint;
+ hash_stable_trait_impls};
mod caching_codemap_view;
mod hcx;
diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs
index 958b339..9b25727 100644
--- a/src/librustc/infer/canonical/mod.rs
+++ b/src/librustc/infer/canonical/mod.rs
@@ -37,7 +37,7 @@
use rustc_data_structures::sync::Lrc;
use serialize::UseSpecializedDecodable;
use std::ops::Index;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use ty::fold::TypeFoldable;
use ty::subst::Kind;
use ty::{self, CanonicalVar, Lift, Region, Slice, TyCtxt};
diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs
index 212821c..d298711 100644
--- a/src/librustc/infer/error_reporting/mod.rs
+++ b/src/librustc/infer/error_reporting/mod.rs
@@ -189,7 +189,7 @@
self,
region: ty::Region<'tcx>,
) -> (String, Option<Span>) {
- let cm = self.sess.codemap();
+ let cm = self.sess.source_map();
let scope = region.free_region_binding_scope(self);
let node = self.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
@@ -286,7 +286,7 @@
}
fn explain_span(self, heading: &str, span: Span) -> (String, Option<Span>) {
- let lo = self.sess.codemap().lookup_char_pos_adj(span.lo());
+ let lo = self.sess.source_map().lookup_char_pos_adj(span.lo());
(
format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize() + 1),
Some(span),
@@ -502,14 +502,14 @@
ObligationCauseCode::MatchExpressionArm { arm_span, source } => match source {
hir::MatchSource::IfLetDesugar { .. } => {
let msg = "`if let` arm with an incompatible type";
- if self.tcx.sess.codemap().is_multiline(arm_span) {
+ if self.tcx.sess.source_map().is_multiline(arm_span) {
err.span_note(arm_span, msg);
} else {
err.span_label(arm_span, msg);
}
},
hir::MatchSource::TryDesugar => { // Issue #51632
- if let Ok(try_snippet) = self.tcx.sess.codemap().span_to_snippet(arm_span) {
+ if let Ok(try_snippet) = self.tcx.sess.source_map().span_to_snippet(arm_span) {
err.span_suggestion_with_applicability(
arm_span,
"try wrapping with a success variant",
@@ -520,7 +520,7 @@
},
_ => {
let msg = "match arm with an incompatible type";
- if self.tcx.sess.codemap().is_multiline(arm_span) {
+ if self.tcx.sess.source_map().is_multiline(arm_span) {
err.span_note(arm_span, msg);
} else {
err.span_label(arm_span, msg);
@@ -1136,8 +1136,8 @@
let sp = if has_bounds {
sp.to(self.tcx
.sess
- .codemap()
- .next_point(self.tcx.sess.codemap().next_point(sp)))
+ .source_map()
+ .next_point(self.tcx.sess.source_map().next_point(sp)))
} else {
sp
};
diff --git a/src/librustc/infer/error_reporting/need_type_info.rs b/src/librustc/infer/error_reporting/need_type_info.rs
index b71c886..bd2c81c 100644
--- a/src/librustc/infer/error_reporting/need_type_info.rs
+++ b/src/librustc/infer/error_reporting/need_type_info.rs
@@ -13,7 +13,7 @@
use infer::InferCtxt;
use infer::type_variable::TypeVariableOrigin;
use ty::{self, Ty, TyInfer, TyVar};
-use syntax::codemap::CompilerDesugaringKind;
+use syntax::source_map::CompilerDesugaringKind;
use syntax_pos::Span;
use errors::DiagnosticBuilder;
diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs
index ddeb291..0ff5630 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs
@@ -11,7 +11,7 @@
use infer::InferCtxt;
use infer::lexical_region_resolve::RegionResolutionError;
use infer::lexical_region_resolve::RegionResolutionError::*;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use ty::{self, TyCtxt};
use util::common::ErrorReported;
diff --git a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
index ca71b0a..4e26a41 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/named_anon_conflict.rs
@@ -129,7 +129,7 @@
ty::BrNamed(..) => true,
_ => false,
},
- ty::ReEarlyBound(_) => true,
+ ty::ReEarlyBound(ebr) => ebr.has_name(),
_ => false,
}
}
diff --git a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
index 193f86a..d25dcd5 100644
--- a/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
+++ b/src/librustc/infer/error_reporting/nice_region_error/static_impl_trait.rs
@@ -60,7 +60,7 @@
}) => name.to_string(),
_ => "'_".to_owned(),
};
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(return_sp) {
+ if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(return_sp) {
err.span_suggestion(
return_sp,
&format!(
diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs
index 0b84c6a..eed6215 100644
--- a/src/librustc/infer/mod.rs
+++ b/src/librustc/infer/mod.rs
@@ -709,7 +709,7 @@
self.projection_cache
.borrow_mut()
- .commit(projection_cache_snapshot);
+ .commit(&projection_cache_snapshot);
self.type_variables
.borrow_mut()
.commit(type_snapshot);
diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs
index c74783f..3598d66 100644
--- a/src/librustc/infer/outlives/obligations.rs
+++ b/src/librustc/infer/outlives/obligations.rs
@@ -151,12 +151,14 @@
debug!("process_registered_region_obligations()");
// pull out the region obligations with the given `body_id` (leaving the rest)
- let my_region_obligations = {
+ let mut my_region_obligations = Vec::with_capacity(self.region_obligations.borrow().len());
+ {
let mut r_o = self.region_obligations.borrow_mut();
- let my_r_o = r_o.drain_filter(|(ro_body_id, _)| *ro_body_id == body_id)
- .map(|(_, obligation)| obligation).collect::<Vec<_>>();
- my_r_o
- };
+ my_region_obligations.extend(
+ r_o.drain_filter(|(ro_body_id, _)| *ro_body_id == body_id)
+ .map(|(_, obligation)| obligation)
+ );
+ }
let outlives = &mut TypeOutlives::new(
self,
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 8044818..b6f4bd6 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -51,6 +51,7 @@
#![feature(never_type)]
#![feature(exhaustive_patterns)]
#![feature(extern_types)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(non_exhaustive)]
#![feature(proc_macro_internals)]
#![feature(quote)]
@@ -72,6 +73,7 @@
#![feature(in_band_lifetimes)]
#![feature(macro_at_most_once_rep)]
#![feature(crate_in_paths)]
+#![feature(crate_visibility_modifier)]
#![recursion_limit="512"]
@@ -99,6 +101,7 @@
extern crate jobserver;
extern crate proc_macro;
extern crate chalk_engine;
+extern crate rustc_fs_util;
extern crate serialize as rustc_serialize; // used by deriving
@@ -132,7 +135,6 @@
pub mod borrowck;
pub mod expr_use_visitor;
pub mod cstore;
- pub mod dataflow;
pub mod dead;
pub mod dependency_format;
pub mod entry;
@@ -162,9 +164,9 @@
pub mod common;
pub mod ppaux;
pub mod nodemap;
- pub mod fs;
pub mod time_graph;
pub mod profiling;
+ pub mod bug;
}
// A private module so that macro-expanded idents like
diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs
index 590b595..015f755 100644
--- a/src/librustc/lint/builtin.rs
+++ b/src/librustc/lint/builtin.rs
@@ -18,7 +18,7 @@
use lint::{LintPass, LateLintPass, LintArray};
use session::Session;
use syntax::ast;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
declare_lint! {
pub EXCEEDING_BITSHIFTS,
@@ -420,7 +420,7 @@
match self {
BuiltinLintDiagnostics::Normal => (),
BuiltinLintDiagnostics::BareTraitObject(span, is_global) => {
- let (sugg, app) = match sess.codemap().span_to_snippet(span) {
+ let (sugg, app) = match sess.source_map().span_to_snippet(span) {
Ok(ref s) if is_global => (format!("dyn ({})", s),
Applicability::MachineApplicable),
Ok(s) => (format!("dyn {}", s), Applicability::MachineApplicable),
@@ -429,7 +429,7 @@
db.span_suggestion_with_applicability(span, "use `dyn`", sugg, app);
}
BuiltinLintDiagnostics::AbsPathWithModule(span) => {
- let (sugg, app) = match sess.codemap().span_to_snippet(span) {
+ let (sugg, app) = match sess.source_map().span_to_snippet(span) {
Ok(ref s) => {
// FIXME(Manishearth) ideally the emitting code
// can tell us whether or not this is global
@@ -462,7 +462,7 @@
// When possible, prefer a suggestion that replaces the whole
// `Path<T>` expression with `Path<'_, T>`, rather than inserting `'_, `
// at a point (which makes for an ugly/confusing label)
- if let Ok(snippet) = sess.codemap().span_to_snippet(path_span) {
+ if let Ok(snippet) = sess.source_map().span_to_snippet(path_span) {
// But our spans can get out of whack due to macros; if the place we think
// we want to insert `'_` isn't even within the path expression's span, we
// should bail out of making any suggestion rather than panicking on a
diff --git a/src/librustc/lint/levels.rs b/src/librustc/lint/levels.rs
index 483e2ea..5b9ddab 100644
--- a/src/librustc/lint/levels.rs
+++ b/src/librustc/lint/levels.rs
@@ -21,7 +21,7 @@
use session::Session;
use syntax::ast;
use syntax::attr;
-use syntax::codemap::MultiSpan;
+use syntax::source_map::MultiSpan;
use syntax::feature_gate;
use syntax::symbol::Symbol;
use util::nodemap::FxHashMap;
diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs
index 231a70f..5872440 100644
--- a/src/librustc/lint/mod.rs
+++ b/src/librustc/lint/mod.rs
@@ -42,7 +42,7 @@
use session::{Session, DiagnosticMessageId};
use std::{hash, ptr};
use syntax::ast;
-use syntax::codemap::{MultiSpan, ExpnFormat};
+use syntax::source_map::{MultiSpan, ExpnFormat};
use syntax::early_buffered_lints::BufferedEarlyLintId;
use syntax::edition::Edition;
use syntax::symbol::Symbol;
@@ -512,7 +512,7 @@
msg: msg.to_string(),
diagnostic
};
- let arr = self.map.entry(id).or_insert(Vec::new());
+ let arr = self.map.entry(id).or_default();
if !arr.contains(&early_lint) {
arr.push(early_lint);
}
@@ -754,7 +754,7 @@
None => return true,
};
- match sess.codemap().span_to_snippet(def_site) {
+ match sess.source_map().span_to_snippet(def_site) {
Ok(code) => !code.starts_with("macro_rules"),
// no snippet = external macro or compiler-builtin expansion
Err(_) => true,
diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs
index 0bf1f4d..759ac1a7 100644
--- a/src/librustc/macros.rs
+++ b/src/librustc/macros.rs
@@ -51,14 +51,14 @@
macro_rules! bug {
() => ( bug!("impossible case reached") );
($($message:tt)*) => ({
- $crate::session::bug_fmt(file!(), line!(), format_args!($($message)*))
+ $crate::util::bug::bug_fmt(file!(), line!(), format_args!($($message)*))
})
}
#[macro_export]
macro_rules! span_bug {
($span:expr, $($message:tt)*) => ({
- $crate::session::span_bug_fmt(file!(), line!(), $span, format_args!($($message)*))
+ $crate::util::bug::span_bug_fmt(file!(), line!(), $span, format_args!($($message)*))
})
}
@@ -147,7 +147,7 @@
macro_rules! impl_stable_hash_for_spanned {
($T:path) => (
- impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ::syntax::codemap::Spanned<$T>
+ impl<'a, 'tcx> HashStable<StableHashingContext<'a>> for ::syntax::source_map::Spanned<$T>
{
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs
index 0e84104..b91a964 100644
--- a/src/librustc/middle/cstore.rs
+++ b/src/librustc/middle/cstore.rs
@@ -25,7 +25,7 @@
use hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use hir::map as hir_map;
use hir::map::definitions::{DefKey, DefPathTable};
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use ty::{self, TyCtxt};
use session::{Session, CrateDisambiguator};
use session::search_paths::PathKind;
diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs
deleted file mode 100644
index b949fd0..0000000
--- a/src/librustc/middle/dataflow.rs
+++ /dev/null
@@ -1,686 +0,0 @@
-// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-//! A module for propagating forward dataflow information. The analysis
-//! assumes that the items to be propagated can be represented as bits
-//! and thus uses bitvectors. Your job is simply to specify the so-called
-//! GEN and KILL bits for each expression.
-
-use cfg;
-use cfg::CFGIndex;
-use ty::TyCtxt;
-use std::io;
-use std::mem;
-use std::usize;
-use syntax::print::pprust::PrintState;
-
-use rustc_data_structures::graph::implementation::OUTGOING;
-
-use util::nodemap::FxHashMap;
-use hir;
-use hir::intravisit::{self, IdRange};
-use hir::print as pprust;
-
-
-#[derive(Copy, Clone, Debug)]
-pub enum EntryOrExit {
- Entry,
- Exit,
-}
-
-#[derive(Clone)]
-pub struct DataFlowContext<'a, 'tcx: 'a, O> {
- tcx: TyCtxt<'a, 'tcx, 'tcx>,
-
- /// a name for the analysis using this dataflow instance
- analysis_name: &'static str,
-
- /// the data flow operator
- oper: O,
-
- /// number of bits to propagate per id
- bits_per_id: usize,
-
- /// number of words we will use to store bits_per_id.
- /// equal to bits_per_id/usize::BITS rounded up.
- words_per_id: usize,
-
- // mapping from node to cfg node index
- // FIXME (#6298): Shouldn't this go with CFG?
- local_id_to_index: FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>,
-
- // Bit sets per cfg node. The following three fields (`gens`, `kills`,
- // and `on_entry`) all have the same structure. For each id in
- // `id_range`, there is a range of words equal to `words_per_id`.
- // So, to access the bits for any given id, you take a slice of
- // the full vector (see the method `compute_id_range()`).
-
- /// bits generated as we exit the cfg node. Updated by `add_gen()`.
- gens: Vec<usize>,
-
- /// bits killed as we exit the cfg node, or non-locally jump over
- /// it. Updated by `add_kill(KillFrom::ScopeEnd)`.
- scope_kills: Vec<usize>,
-
- /// bits killed as we exit the cfg node directly; if it is jumped
- /// over, e.g. via `break`, the kills are not reflected in the
- /// jump's effects. Updated by `add_kill(KillFrom::Execution)`.
- action_kills: Vec<usize>,
-
- /// bits that are valid on entry to the cfg node. Updated by
- /// `propagate()`.
- on_entry: Vec<usize>,
-}
-
-pub trait BitwiseOperator {
- /// Joins two predecessor bits together, typically either `|` or `&`
- fn join(&self, succ: usize, pred: usize) -> usize;
-}
-
-/// Parameterization for the precise form of data flow that is used.
-pub trait DataFlowOperator : BitwiseOperator {
- /// Specifies the initial value for each bit in the `on_entry` set
- fn initial_value(&self) -> bool;
-}
-
-struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O: 'a> {
- dfcx: &'a mut DataFlowContext<'b, 'tcx, O>,
- changed: bool
-}
-
-fn get_cfg_indices<'a>(id: hir::ItemLocalId,
- index: &'a FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>)
- -> &'a [CFGIndex] {
- index.get(&id).map_or(&[], |v| &v[..])
-}
-
-impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
- fn has_bitset_for_local_id(&self, n: hir::ItemLocalId) -> bool {
- assert!(n != hir::DUMMY_ITEM_LOCAL_ID);
- self.local_id_to_index.contains_key(&n)
- }
-}
-
-impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> {
- fn nested(&self, state: &mut pprust::State, nested: pprust::Nested) -> io::Result<()> {
- pprust::PpAnn::nested(&self.tcx.hir, state, nested)
- }
- fn pre(&self,
- ps: &mut pprust::State,
- node: pprust::AnnNode) -> io::Result<()> {
- let id = match node {
- pprust::NodeName(_) => return Ok(()),
- pprust::NodeExpr(expr) => expr.hir_id.local_id,
- pprust::NodeBlock(blk) => blk.hir_id.local_id,
- pprust::NodeItem(_) |
- pprust::NodeSubItem(_) => return Ok(()),
- pprust::NodePat(pat) => pat.hir_id.local_id
- };
-
- if !self.has_bitset_for_local_id(id) {
- return Ok(());
- }
-
- assert!(self.bits_per_id > 0);
- let indices = get_cfg_indices(id, &self.local_id_to_index);
- for &cfgidx in indices {
- let (start, end) = self.compute_id_range(cfgidx);
- let on_entry = &self.on_entry[start.. end];
- let entry_str = bits_to_string(on_entry);
-
- let gens = &self.gens[start.. end];
- let gens_str = if gens.iter().any(|&u| u != 0) {
- format!(" gen: {}", bits_to_string(gens))
- } else {
- "".to_string()
- };
-
- let action_kills = &self.action_kills[start .. end];
- let action_kills_str = if action_kills.iter().any(|&u| u != 0) {
- format!(" action_kill: {}", bits_to_string(action_kills))
- } else {
- "".to_string()
- };
-
- let scope_kills = &self.scope_kills[start .. end];
- let scope_kills_str = if scope_kills.iter().any(|&u| u != 0) {
- format!(" scope_kill: {}", bits_to_string(scope_kills))
- } else {
- "".to_string()
- };
-
- ps.synth_comment(
- format!("id {}: {}{}{}{}", id.as_usize(), entry_str,
- gens_str, action_kills_str, scope_kills_str))?;
- ps.s.space()?;
- }
- Ok(())
- }
-}
-
-fn build_local_id_to_index(body: Option<&hir::Body>,
- cfg: &cfg::CFG)
- -> FxHashMap<hir::ItemLocalId, Vec<CFGIndex>> {
- let mut index = FxHashMap();
-
- // FIXME(#15020) Would it be better to fold formals from decl
- // into cfg itself? i.e. introduce a fn-based flow-graph in
- // addition to the current block-based flow-graph, rather than
- // have to put traversals like this here?
- if let Some(body) = body {
- add_entries_from_fn_body(&mut index, body, cfg.entry);
- }
-
- cfg.graph.each_node(|node_idx, node| {
- if let cfg::CFGNodeData::AST(id) = node.data {
- index.entry(id).or_insert(vec![]).push(node_idx);
- }
- true
- });
-
- return index;
-
- /// Add mappings from the ast nodes for the formal bindings to
- /// the entry-node in the graph.
- fn add_entries_from_fn_body(index: &mut FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>,
- body: &hir::Body,
- entry: CFGIndex) {
- use hir::intravisit::Visitor;
-
- struct Formals<'a> {
- entry: CFGIndex,
- index: &'a mut FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>,
- }
- let mut formals = Formals { entry: entry, index: index };
- for arg in &body.arguments {
- formals.visit_pat(&arg.pat);
- }
- impl<'a, 'v> Visitor<'v> for Formals<'a> {
- fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'v> {
- intravisit::NestedVisitorMap::None
- }
-
- fn visit_pat(&mut self, p: &hir::Pat) {
- self.index.entry(p.hir_id.local_id).or_insert(vec![]).push(self.entry);
- intravisit::walk_pat(self, p)
- }
- }
- }
-}
-
-/// Flag used by `add_kill` to indicate whether the provided kill
-/// takes effect only when control flows directly through the node in
-/// question, or if the kill's effect is associated with any
-/// control-flow directly through or indirectly over the node.
-#[derive(Copy, Clone, PartialEq, Debug)]
-pub enum KillFrom {
- /// A `ScopeEnd` kill is one that takes effect when any control
- /// flow goes over the node. A kill associated with the end of the
- /// scope of a variable declaration `let x;` is an example of a
- /// `ScopeEnd` kill.
- ScopeEnd,
-
- /// An `Execution` kill is one that takes effect only when control
- /// flow goes through the node to completion. A kill associated
- /// with an assignment statement `x = expr;` is an example of an
- /// `Execution` kill.
- Execution,
-}
-
-impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
- pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- analysis_name: &'static str,
- body: Option<&hir::Body>,
- cfg: &cfg::CFG,
- oper: O,
- id_range: IdRange,
- bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> {
- let usize_bits = mem::size_of::<usize>() * 8;
- let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits;
- let num_nodes = cfg.graph.all_nodes().len();
-
- debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
- bits_per_id={}, words_per_id={}) \
- num_nodes: {}",
- analysis_name, id_range, bits_per_id, words_per_id,
- num_nodes);
-
- let entry = if oper.initial_value() { usize::MAX } else {0};
-
- let zeroes = vec![0; num_nodes * words_per_id];
- let gens = zeroes.clone();
- let kills1 = zeroes.clone();
- let kills2 = zeroes;
- let on_entry = vec![entry; num_nodes * words_per_id];
-
- let local_id_to_index = build_local_id_to_index(body, cfg);
-
- DataFlowContext {
- tcx,
- analysis_name,
- words_per_id,
- local_id_to_index,
- bits_per_id,
- oper,
- gens,
- action_kills: kills1,
- scope_kills: kills2,
- on_entry,
- }
- }
-
- pub fn add_gen(&mut self, id: hir::ItemLocalId, bit: usize) {
- //! Indicates that `id` generates `bit`
- debug!("{} add_gen(id={:?}, bit={})",
- self.analysis_name, id, bit);
- assert!(self.local_id_to_index.contains_key(&id));
- assert!(self.bits_per_id > 0);
-
- let indices = get_cfg_indices(id, &self.local_id_to_index);
- for &cfgidx in indices {
- let (start, end) = self.compute_id_range(cfgidx);
- let gens = &mut self.gens[start.. end];
- set_bit(gens, bit);
- }
- }
-
- pub fn add_kill(&mut self, kind: KillFrom, id: hir::ItemLocalId, bit: usize) {
- //! Indicates that `id` kills `bit`
- debug!("{} add_kill(id={:?}, bit={})",
- self.analysis_name, id, bit);
- assert!(self.local_id_to_index.contains_key(&id));
- assert!(self.bits_per_id > 0);
-
- let indices = get_cfg_indices(id, &self.local_id_to_index);
- for &cfgidx in indices {
- let (start, end) = self.compute_id_range(cfgidx);
- let kills = match kind {
- KillFrom::Execution => &mut self.action_kills[start.. end],
- KillFrom::ScopeEnd => &mut self.scope_kills[start.. end],
- };
- set_bit(kills, bit);
- }
- }
-
- fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [usize]) {
- //! Applies the gen and kill sets for `cfgidx` to `bits`
- debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [before]",
- self.analysis_name, cfgidx, mut_bits_to_string(bits));
- assert!(self.bits_per_id > 0);
-
- let (start, end) = self.compute_id_range(cfgidx);
- let gens = &self.gens[start.. end];
- bitwise(bits, gens, &Union);
- let kills = &self.action_kills[start.. end];
- bitwise(bits, kills, &Subtract);
- let kills = &self.scope_kills[start.. end];
- bitwise(bits, kills, &Subtract);
-
- debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [after]",
- self.analysis_name, cfgidx, mut_bits_to_string(bits));
- }
-
- fn compute_id_range(&self, cfgidx: CFGIndex) -> (usize, usize) {
- let n = cfgidx.node_id();
- let start = n * self.words_per_id;
- let end = start + self.words_per_id;
-
- assert!(start < self.gens.len());
- assert!(end <= self.gens.len());
- assert!(self.gens.len() == self.action_kills.len());
- assert!(self.gens.len() == self.scope_kills.len());
- assert!(self.gens.len() == self.on_entry.len());
-
- (start, end)
- }
-
-
- pub fn each_bit_on_entry<F>(&self, id: hir::ItemLocalId, mut f: F) -> bool where
- F: FnMut(usize) -> bool,
- {
- //! Iterates through each bit that is set on entry to `id`.
- //! Only useful after `propagate()` has been called.
- if !self.has_bitset_for_local_id(id) {
- return true;
- }
- let indices = get_cfg_indices(id, &self.local_id_to_index);
- for &cfgidx in indices {
- if !self.each_bit_for_node(EntryOrExit::Entry, cfgidx, |i| f(i)) {
- return false;
- }
- }
- return true;
- }
-
- pub fn each_bit_for_node<F>(&self, e: EntryOrExit, cfgidx: CFGIndex, f: F) -> bool where
- F: FnMut(usize) -> bool,
- {
- //! Iterates through each bit that is set on entry/exit to `cfgidx`.
- //! Only useful after `propagate()` has been called.
-
- if self.bits_per_id == 0 {
- // Skip the surprisingly common degenerate case. (Note
- // compute_id_range requires self.words_per_id > 0.)
- return true;
- }
-
- let (start, end) = self.compute_id_range(cfgidx);
- let on_entry = &self.on_entry[start.. end];
- let temp_bits;
- let slice = match e {
- EntryOrExit::Entry => on_entry,
- EntryOrExit::Exit => {
- let mut t = on_entry.to_vec();
- self.apply_gen_kill(cfgidx, &mut t);
- temp_bits = t;
- &temp_bits[..]
- }
- };
- debug!("{} each_bit_for_node({:?}, cfgidx={:?}) bits={}",
- self.analysis_name, e, cfgidx, bits_to_string(slice));
- self.each_bit(slice, f)
- }
-
- pub fn each_gen_bit<F>(&self, id: hir::ItemLocalId, mut f: F) -> bool where
- F: FnMut(usize) -> bool,
- {
- //! Iterates through each bit in the gen set for `id`.
- if !self.has_bitset_for_local_id(id) {
- return true;
- }
-
- if self.bits_per_id == 0 {
- // Skip the surprisingly common degenerate case. (Note
- // compute_id_range requires self.words_per_id > 0.)
- return true;
- }
-
- let indices = get_cfg_indices(id, &self.local_id_to_index);
- for &cfgidx in indices {
- let (start, end) = self.compute_id_range(cfgidx);
- let gens = &self.gens[start.. end];
- debug!("{} each_gen_bit(id={:?}, gens={})",
- self.analysis_name, id, bits_to_string(gens));
- if !self.each_bit(gens, |i| f(i)) {
- return false;
- }
- }
- return true;
- }
-
- fn each_bit<F>(&self, words: &[usize], mut f: F) -> bool where
- F: FnMut(usize) -> bool,
- {
- //! Helper for iterating over the bits in a bit set.
- //! Returns false on the first call to `f` that returns false;
- //! if all calls to `f` return true, then returns true.
-
- let usize_bits = mem::size_of::<usize>() * 8;
- for (word_index, &word) in words.iter().enumerate() {
- if word != 0 {
- let base_index = word_index * usize_bits;
- for offset in 0..usize_bits {
- let bit = 1 << offset;
- if (word & bit) != 0 {
- // NB: we round up the total number of bits
- // that we store in any given bit set so that
- // it is an even multiple of usize::BITS. This
- // means that there may be some stray bits at
- // the end that do not correspond to any
- // actual value. So before we callback, check
- // whether the bit_index is greater than the
- // actual value the user specified and stop
- // iterating if so.
- let bit_index = base_index + offset as usize;
- if bit_index >= self.bits_per_id {
- return true;
- } else if !f(bit_index) {
- return false;
- }
- }
- }
- }
- }
- return true;
- }
-
- pub fn add_kills_from_flow_exits(&mut self, cfg: &cfg::CFG) {
- //! Whenever you have a `break` or `continue` statement, flow
- //! exits through any number of enclosing scopes on its way to
- //! the new destination. This function infers the kill bits of
- //! those control operators based on the kill bits associated
- //! with those scopes.
- //!
- //! This is usually called (if it is called at all), after
- //! all add_gen and add_kill calls, but before propagate.
-
- debug!("{} add_kills_from_flow_exits", self.analysis_name);
- if self.bits_per_id == 0 {
- // Skip the surprisingly common degenerate case. (Note
- // compute_id_range requires self.words_per_id > 0.)
- return;
- }
- cfg.graph.each_edge(|_edge_index, edge| {
- let flow_exit = edge.source();
- let (start, end) = self.compute_id_range(flow_exit);
- let mut orig_kills = self.scope_kills[start.. end].to_vec();
-
- let mut changed = false;
- for &id in &edge.data.exiting_scopes {
- let opt_cfg_idx = self.local_id_to_index.get(&id);
- match opt_cfg_idx {
- Some(indices) => {
- for &cfg_idx in indices {
- let (start, end) = self.compute_id_range(cfg_idx);
- let kills = &self.scope_kills[start.. end];
- if bitwise(&mut orig_kills, kills, &Union) {
- debug!("scope exits: scope id={:?} \
- (node={:?} of {:?}) added killset: {}",
- id, cfg_idx, indices,
- bits_to_string(kills));
- changed = true;
- }
- }
- }
- None => {
- debug!("{} add_kills_from_flow_exits flow_exit={:?} \
- no cfg_idx for exiting_scope={:?}",
- self.analysis_name, flow_exit, id);
- }
- }
- }
-
- if changed {
- let bits = &mut self.scope_kills[start.. end];
- debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [before]",
- self.analysis_name, flow_exit, mut_bits_to_string(bits));
- bits.copy_from_slice(&orig_kills[..]);
- debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [after]",
- self.analysis_name, flow_exit, mut_bits_to_string(bits));
- }
- true
- });
- }
-}
-
-impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
-// ^^^^^^^^^^^^^ only needed for pretty printing
- pub fn propagate(&mut self, cfg: &cfg::CFG, body: &hir::Body) {
- //! Performs the data flow analysis.
-
- if self.bits_per_id == 0 {
- // Optimize the surprisingly common degenerate case.
- return;
- }
-
- {
- let words_per_id = self.words_per_id;
- let mut propcx = PropagationContext {
- dfcx: &mut *self,
- changed: true
- };
-
- let nodes_po = cfg.graph.nodes_in_postorder(OUTGOING, cfg.entry);
- let mut temp = vec![0; words_per_id];
- let mut num_passes = 0;
- while propcx.changed {
- num_passes += 1;
- propcx.changed = false;
- propcx.reset(&mut temp);
- propcx.walk_cfg(cfg, &nodes_po, &mut temp);
- }
- debug!("finished in {} iterations", num_passes);
- }
-
- debug!("Dataflow result for {}:", self.analysis_name);
- debug!("{}", pprust::to_string(self, |s| {
- s.cbox(pprust::indent_unit)?;
- s.ibox(0)?;
- s.print_expr(&body.value)
- }));
- }
-}
-
-impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
- fn walk_cfg(&mut self,
- cfg: &cfg::CFG,
- nodes_po: &[CFGIndex],
- in_out: &mut [usize]) {
- debug!("DataFlowContext::walk_cfg(in_out={}) {}",
- bits_to_string(in_out), self.dfcx.analysis_name);
- assert!(self.dfcx.bits_per_id > 0);
-
- // Iterate over nodes in reverse postorder
- for &node_index in nodes_po.iter().rev() {
- let node = cfg.graph.node(node_index);
- debug!("DataFlowContext::walk_cfg idx={:?} id={:?} begin in_out={}",
- node_index, node.data.id(), bits_to_string(in_out));
-
- let (start, end) = self.dfcx.compute_id_range(node_index);
-
- // Initialize local bitvector with state on-entry.
- in_out.copy_from_slice(&self.dfcx.on_entry[start.. end]);
-
- // Compute state on-exit by applying transfer function to
- // state on-entry.
- self.dfcx.apply_gen_kill(node_index, in_out);
-
- // Propagate state on-exit from node into its successors.
- self.propagate_bits_into_graph_successors_of(in_out, cfg, node_index);
- }
- }
-
- fn reset(&mut self, bits: &mut [usize]) {
- let e = if self.dfcx.oper.initial_value() {usize::MAX} else {0};
- for b in bits {
- *b = e;
- }
- }
-
- fn propagate_bits_into_graph_successors_of(&mut self,
- pred_bits: &[usize],
- cfg: &cfg::CFG,
- cfgidx: CFGIndex) {
- for (_, edge) in cfg.graph.outgoing_edges(cfgidx) {
- self.propagate_bits_into_entry_set_for(pred_bits, edge);
- }
- }
-
- fn propagate_bits_into_entry_set_for(&mut self,
- pred_bits: &[usize],
- edge: &cfg::CFGEdge) {
- let source = edge.source();
- let cfgidx = edge.target();
- debug!("{} propagate_bits_into_entry_set_for(pred_bits={}, {:?} to {:?})",
- self.dfcx.analysis_name, bits_to_string(pred_bits), source, cfgidx);
- assert!(self.dfcx.bits_per_id > 0);
-
- let (start, end) = self.dfcx.compute_id_range(cfgidx);
- let changed = {
- // (scoping mutable borrow of self.dfcx.on_entry)
- let on_entry = &mut self.dfcx.on_entry[start.. end];
- bitwise(on_entry, pred_bits, &self.dfcx.oper)
- };
- if changed {
- debug!("{} changed entry set for {:?} to {}",
- self.dfcx.analysis_name, cfgidx,
- bits_to_string(&self.dfcx.on_entry[start.. end]));
- self.changed = true;
- }
- }
-}
-
-fn mut_bits_to_string(words: &mut [usize]) -> String {
- bits_to_string(words)
-}
-
-fn bits_to_string(words: &[usize]) -> String {
- let mut result = String::new();
- let mut sep = '[';
-
- // Note: this is a little endian printout of bytes.
-
- for &word in words {
- let mut v = word;
- for _ in 0..mem::size_of::<usize>() {
- result.push(sep);
- result.push_str(&format!("{:02x}", v & 0xFF));
- v >>= 8;
- sep = '-';
- }
- }
- result.push(']');
- return result
-}
-
-#[inline]
-fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
- in_vec: &[usize],
- op: &Op) -> bool {
- assert_eq!(out_vec.len(), in_vec.len());
- let mut changed = false;
- for (out_elt, in_elt) in out_vec.iter_mut().zip(in_vec) {
- let old_val = *out_elt;
- let new_val = op.join(old_val, *in_elt);
- *out_elt = new_val;
- changed |= old_val != new_val;
- }
- changed
-}
-
-fn set_bit(words: &mut [usize], bit: usize) -> bool {
- debug!("set_bit: words={} bit={}",
- mut_bits_to_string(words), bit_str(bit));
- let usize_bits = mem::size_of::<usize>() * 8;
- let word = bit / usize_bits;
- let bit_in_word = bit % usize_bits;
- let bit_mask = 1 << bit_in_word;
- debug!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, bit_mask);
- let oldv = words[word];
- let newv = oldv | bit_mask;
- words[word] = newv;
- oldv != newv
-}
-
-fn bit_str(bit: usize) -> String {
- let byte = bit >> 3;
- let lobits = 1 << (bit & 0b111);
- format!("[{}:{}-{:02x}]", bit, byte, lobits)
-}
-
-struct Union;
-impl BitwiseOperator for Union {
- fn join(&self, a: usize, b: usize) -> usize { a | b }
-}
-struct Subtract;
-impl BitwiseOperator for Subtract {
- fn join(&self, a: usize, b: usize) -> usize { a & !b }
-}
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index d0e3ae2..8c4c54e 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -24,7 +24,7 @@
use ty::{self, TyCtxt};
use util::nodemap::FxHashSet;
-use syntax::{ast, codemap};
+use syntax::{ast, source_map};
use syntax::attr;
use syntax_pos;
@@ -115,7 +115,7 @@
}
fn handle_field_pattern_match(&mut self, lhs: &hir::Pat, def: Def,
- pats: &[codemap::Spanned<hir::FieldPat>]) {
+ pats: &[source_map::Spanned<hir::FieldPat>]) {
let variant = match self.tables.node_id_to_type(lhs.hir_id).sty {
ty::TyAdt(adt, _) => adt.variant_of_def(def),
_ => span_bug!(lhs.span, "non-ADT in struct pattern")
@@ -551,7 +551,7 @@
hir::ItemKind::Struct(..) |
hir::ItemKind::Union(..) |
hir::ItemKind::Trait(..) |
- hir::ItemKind::Impl(..) => self.tcx.sess.codemap().def_span(item.span),
+ hir::ItemKind::Impl(..) => self.tcx.sess.source_map().def_span(item.span),
_ => item.span,
};
let participle = match item.node {
@@ -612,7 +612,7 @@
}
hir::ImplItemKind::Method(_, body_id) => {
if !self.symbol_is_live(impl_item.id, None) {
- let span = self.tcx.sess.codemap().def_span(impl_item.span);
+ let span = self.tcx.sess.source_map().def_span(impl_item.span);
self.warn_dead_code(impl_item.id, span, impl_item.ident.name, "method", "used");
}
self.visit_nested_body(body_id)
diff --git a/src/librustc/middle/lib_features.rs b/src/librustc/middle/lib_features.rs
index 47c6bfb..c21ac62 100644
--- a/src/librustc/middle/lib_features.rs
+++ b/src/librustc/middle/lib_features.rs
@@ -18,8 +18,7 @@
use syntax::symbol::Symbol;
use syntax::ast::{Attribute, MetaItem, MetaItemKind};
use syntax_pos::{Span, DUMMY_SP};
-use hir;
-use hir::itemlikevisit::ItemLikeVisitor;
+use hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
use errors::DiagnosticId;
@@ -59,47 +58,44 @@
}
}
- fn extract(&self, attrs: &[Attribute]) -> Vec<(Symbol, Option<Symbol>, Span)> {
+ fn extract(&self, attr: &Attribute) -> Option<(Symbol, Option<Symbol>, Span)> {
let stab_attrs = vec!["stable", "unstable", "rustc_const_unstable"];
- let mut features = vec![];
- for attr in attrs {
- // Find a stability attribute (i.e. `#[stable (..)]`, `#[unstable (..)]`,
- // `#[rustc_const_unstable (..)]`).
- if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| {
- attr.check_name(stab_attr)
- }) {
- let meta_item = attr.meta();
- if let Some(MetaItem { node: MetaItemKind::List(ref metas), .. }) = meta_item {
- let mut feature = None;
- let mut since = None;
- for meta in metas {
- if let Some(mi) = meta.meta_item() {
- // Find the `feature = ".."` meta-item.
- match (&*mi.name().as_str(), mi.value_str()) {
- ("feature", val) => feature = val,
- ("since", val) => since = val,
- _ => {}
- }
+ // Find a stability attribute (i.e. `#[stable (..)]`, `#[unstable (..)]`,
+ // `#[rustc_const_unstable (..)]`).
+ if let Some(stab_attr) = stab_attrs.iter().find(|stab_attr| {
+ attr.check_name(stab_attr)
+ }) {
+ let meta_item = attr.meta();
+ if let Some(MetaItem { node: MetaItemKind::List(ref metas), .. }) = meta_item {
+ let mut feature = None;
+ let mut since = None;
+ for meta in metas {
+ if let Some(mi) = meta.meta_item() {
+ // Find the `feature = ".."` meta-item.
+ match (&*mi.name().as_str(), mi.value_str()) {
+ ("feature", val) => feature = val,
+ ("since", val) => since = val,
+ _ => {}
}
}
- if let Some(feature) = feature {
- // This additional check for stability is to make sure we
- // don't emit additional, irrelevant errors for malformed
- // attributes.
- if *stab_attr != "stable" || since.is_some() {
- features.push((feature, since, attr.span));
- }
- }
- // We need to iterate over the other attributes, because
- // `rustc_const_unstable` is not mutually exclusive with
- // the other stability attributes, so we can't just `break`
- // here.
}
+ if let Some(feature) = feature {
+ // This additional check for stability is to make sure we
+ // don't emit additional, irrelevant errors for malformed
+ // attributes.
+ if *stab_attr != "stable" || since.is_some() {
+ return Some((feature, since, attr.span));
+ }
+ }
+ // We need to iterate over the other attributes, because
+ // `rustc_const_unstable` is not mutually exclusive with
+ // the other stability attributes, so we can't just `break`
+ // here.
}
}
- features
+ None
}
fn collect_feature(&mut self, feature: Symbol, since: Option<Symbol>, span: Span) {
@@ -140,25 +136,17 @@
}
}
}
-
- fn collect_from_attrs(&mut self, attrs: &[Attribute]) {
- for (feature, stable, span) in self.extract(attrs) {
- self.collect_feature(feature, stable, span);
- }
- }
}
-impl<'a, 'v, 'tcx> ItemLikeVisitor<'v> for LibFeatureCollector<'a, 'tcx> {
- fn visit_item(&mut self, item: &hir::Item) {
- self.collect_from_attrs(&item.attrs);
+impl<'a, 'tcx> Visitor<'tcx> for LibFeatureCollector<'a, 'tcx> {
+ fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
+ NestedVisitorMap::All(&self.tcx.hir)
}
- fn visit_trait_item(&mut self, trait_item: &hir::TraitItem) {
- self.collect_from_attrs(&trait_item.attrs);
- }
-
- fn visit_impl_item(&mut self, impl_item: &hir::ImplItem) {
- self.collect_from_attrs(&impl_item.attrs);
+ fn visit_attribute(&mut self, attr: &'tcx Attribute) {
+ if let Some((feature, stable, span)) = self.extract(attr) {
+ self.collect_feature(feature, stable, span);
+ }
}
}
@@ -169,10 +157,6 @@
collector.collect_feature(feature, since, DUMMY_SP);
}
}
- collector.collect_from_attrs(&tcx.hir.krate().attrs);
- tcx.hir.krate().visit_all_item_likes(&mut collector);
- for exported_macro in &tcx.hir.krate().exported_macros {
- collector.collect_from_attrs(&exported_macro.attrs);
- }
+ intravisit::walk_crate(&mut collector, tcx.hir.krate());
collector.lib_features
}
diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs
index b828b1b..7d9590e 100644
--- a/src/librustc/middle/liveness.rs
+++ b/src/librustc/middle/liveness.rs
@@ -157,7 +157,7 @@
}
fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt) -> String {
- let cm = tcx.sess.codemap();
+ let cm = tcx.sess.source_map();
match lnk {
FreeVarNode(s) => {
format!("Free var node [{}]", cm.span_to_string(s))
diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs
index ebdc9c9..be1d93d 100644
--- a/src/librustc/middle/region.rs
+++ b/src/librustc/middle/region.rs
@@ -23,7 +23,7 @@
use std::fmt;
use std::mem;
use rustc_data_structures::sync::Lrc;
-use syntax::codemap;
+use syntax::source_map;
use syntax::ast;
use syntax_pos::{Span, DUMMY_SP};
use ty::TyCtxt;
@@ -943,11 +943,15 @@
// scopes, meaning that temporaries cannot outlive them.
// This ensures fixed size stacks.
- hir::ExprKind::Binary(codemap::Spanned { node: hir::BinOpKind::And, .. }, _, ref r) |
- hir::ExprKind::Binary(codemap::Spanned { node: hir::BinOpKind::Or, .. }, _, ref r) => {
- // For shortcircuiting operators, mark the RHS as a terminating
- // scope since it only executes conditionally.
- terminating(r.hir_id.local_id);
+ hir::ExprKind::Binary(
+ source_map::Spanned { node: hir::BinOpKind::And, .. },
+ _, ref r) |
+ hir::ExprKind::Binary(
+ source_map::Spanned { node: hir::BinOpKind::Or, .. },
+ _, ref r) => {
+ // For shortcircuiting operators, mark the RHS as a terminating
+ // scope since it only executes conditionally.
+ terminating(r.hir_id.local_id);
}
hir::ExprKind::If(ref expr, ref then, Some(ref otherwise)) => {
@@ -1310,7 +1314,7 @@
debug!("visit_body(id={:?}, span={:?}, body.id={:?}, cx.parent={:?})",
owner_id,
- self.tcx.sess.codemap().span_to_string(body.value.span),
+ self.tcx.sess.source_map().span_to_string(body.value.span),
body_id,
self.cx.parent);
diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs
index f2d39a9..379f4df 100644
--- a/src/librustc/middle/resolve_lifetime.rs
+++ b/src/librustc/middle/resolve_lifetime.rs
@@ -391,37 +391,33 @@
let named_region_map = krate(tcx);
- let mut defs = FxHashMap();
+ let mut rl = ResolveLifetimes {
+ defs: FxHashMap(),
+ late_bound: FxHashMap(),
+ object_lifetime_defaults: FxHashMap(),
+ };
+
for (k, v) in named_region_map.defs {
let hir_id = tcx.hir.node_to_hir_id(k);
- let map = defs.entry(hir_id.owner_local_def_id())
- .or_insert_with(|| Lrc::new(FxHashMap()));
+ let map = rl.defs.entry(hir_id.owner_local_def_id()).or_default();
Lrc::get_mut(map).unwrap().insert(hir_id.local_id, v);
}
- let mut late_bound = FxHashMap();
for k in named_region_map.late_bound {
let hir_id = tcx.hir.node_to_hir_id(k);
- let map = late_bound
- .entry(hir_id.owner_local_def_id())
- .or_insert_with(|| Lrc::new(FxHashSet()));
+ let map = rl.late_bound.entry(hir_id.owner_local_def_id()).or_default();
Lrc::get_mut(map).unwrap().insert(hir_id.local_id);
}
- let mut object_lifetime_defaults = FxHashMap();
for (k, v) in named_region_map.object_lifetime_defaults {
let hir_id = tcx.hir.node_to_hir_id(k);
- let map = object_lifetime_defaults
+ let map = rl.object_lifetime_defaults
.entry(hir_id.owner_local_def_id())
- .or_insert_with(|| Lrc::new(FxHashMap()));
+ .or_default();
Lrc::get_mut(map)
.unwrap()
.insert(hir_id.local_id, Lrc::new(v));
}
- Lrc::new(ResolveLifetimes {
- defs,
- late_bound,
- object_lifetime_defaults,
- })
+ Lrc::new(rl)
}
fn krate<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>) -> NamedRegionMap {
@@ -2461,7 +2457,7 @@
"insert_lifetime: {} resolved to {:?} span={:?}",
self.tcx.hir.node_to_string(lifetime_ref.id),
def,
- self.tcx.sess.codemap().span_to_string(lifetime_ref.span)
+ self.tcx.sess.source_map().span_to_string(lifetime_ref.span)
);
self.map.defs.insert(lifetime_ref.id, def);
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index 8af8d46..efd568b 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -685,7 +685,7 @@
};
let msp: MultiSpan = span.into();
- let cm = &self.sess.parse_sess.codemap();
+ let cm = &self.sess.parse_sess.source_map();
let span_key = msp.primary_span().and_then(|sp: Span|
if !sp.is_dummy() {
let file = cm.lookup_char_pos(sp.lo()).file;
diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs
index dae5709..8ceff30 100644
--- a/src/librustc/mir/mod.rs
+++ b/src/librustc/mir/mod.rs
@@ -429,8 +429,8 @@
/// Data must be immutable but not aliasable. This kind of borrow
/// cannot currently be expressed by the user and is used only in
- /// implicit closure bindings. It is needed when you the closure
- /// is borrowing or mutating a mutable referent, e.g.:
+ /// implicit closure bindings. It is needed when the closure is
+ /// borrowing or mutating a mutable referent, e.g.:
///
/// let x: &mut isize = ...;
/// let y = || *x += 5;
@@ -443,7 +443,7 @@
/// let y = (&mut Env { &x }, fn_ptr); // Closure is pair of env and fn
/// fn fn_ptr(env: &mut Env) { **env.x += 5; }
///
- /// This is then illegal because you cannot mutate a `&mut` found
+ /// This is then illegal because you cannot mutate an `&mut` found
/// in an aliasable location. To solve, you'd have to translate with
/// an `&mut` borrow:
///
@@ -523,6 +523,8 @@
/// (b) it gives a way to separate this case from the remaining cases
/// for diagnostics.
pub opt_match_place: Option<(Option<Place<'tcx>>, Span)>,
+ /// Span of the pattern in which this variable was bound.
+ pub pat_span: Span,
}
#[derive(Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
@@ -540,7 +542,8 @@
impl_stable_hash_for!(struct self::VarBindingForm<'tcx> {
binding_mode,
opt_ty_info,
- opt_match_place
+ opt_match_place,
+ pat_span
});
mod binding_form_impl {
@@ -673,7 +676,7 @@
/// ROOT SCOPE
/// │{ argument x: &str }
/// │
- /// │ │{ #[allow(unused_mut] } // this is actually split into 2 scopes
+ /// │ │{ #[allow(unused_mut)] } // this is actually split into 2 scopes
/// │ │ // in practice because I'm lazy.
/// │ │
/// │ │← x.source_info.scope
@@ -710,6 +713,7 @@
binding_mode: ty::BindingMode::BindByValue(_),
opt_ty_info: _,
opt_match_place: _,
+ pat_span: _,
}))) => true,
// FIXME: might be able to thread the distinction between
@@ -729,6 +733,7 @@
binding_mode: ty::BindingMode::BindByValue(_),
opt_ty_info: _,
opt_match_place: _,
+ pat_span: _,
}))) => true,
Some(ClearCrossCrate::Set(BindingForm::ImplicitSelf)) => true,
@@ -906,7 +911,7 @@
/// Drop the Place and assign the new value over it. This ensures
/// that the assignment to `P` occurs *even if* the destructor for
- /// place unwinds. Its semantics are best explained by by the
+ /// place unwinds. Its semantics are best explained by the
/// elaboration:
///
/// ```
diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs
index f0d6b81..9d2f62b 100644
--- a/src/librustc/mir/mono.rs
+++ b/src/librustc/mir/mono.rs
@@ -8,15 +8,16 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use hir::def_id::DefId;
+use hir::def_id::{DefId, CrateNum};
use syntax::ast::NodeId;
-use syntax::symbol::InternedString;
+use syntax::symbol::{Symbol, InternedString};
use ty::{Instance, TyCtxt};
use util::nodemap::FxHashMap;
use rustc_data_structures::base_n;
use rustc_data_structures::stable_hasher::{HashStable, StableHasherResult,
StableHasher};
use ich::{Fingerprint, StableHashingContext, NodeIdHashingMode};
+use std::fmt;
use std::hash::Hash;
#[derive(PartialEq, Eq, Clone, Copy, Debug, Hash)]
@@ -239,3 +240,95 @@
self.fn_stats.extend(stats.fn_stats);
}
}
+
+pub struct CodegenUnitNameBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> {
+ tcx: TyCtxt<'a, 'gcx, 'tcx>,
+ cache: FxHashMap<CrateNum, String>,
+}
+
+impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> {
+
+ pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
+ CodegenUnitNameBuilder {
+ tcx,
+ cache: FxHashMap(),
+ }
+ }
+
+ /// CGU names should fulfill the following requirements:
+ /// - They should be able to act as a file name on any kind of file system
+ /// - They should not collide with other CGU names, even for different versions
+ /// of the same crate.
+ ///
+ /// Consequently, we don't use special characters except for '.' and '-' and we
+ /// prefix each name with the crate-name and crate-disambiguator.
+ ///
+ /// This function will build CGU names of the form:
+ ///
+ /// ```
+ /// <crate-name>.<crate-disambiguator>(-<component>)*[.<special-suffix>]
+ /// ```
+ ///
+ /// The '.' before `<special-suffix>` makes sure that names with a special
+ /// suffix can never collide with a name built out of regular Rust
+ /// identifiers (e.g. module paths).
+ pub fn build_cgu_name<I, C, S>(&mut self,
+ cnum: CrateNum,
+ components: I,
+ special_suffix: Option<S>)
+ -> InternedString
+ where I: IntoIterator<Item=C>,
+ C: fmt::Display,
+ S: fmt::Display,
+ {
+ let cgu_name = self.build_cgu_name_no_mangle(cnum,
+ components,
+ special_suffix);
+
+ if self.tcx.sess.opts.debugging_opts.human_readable_cgu_names {
+ cgu_name
+ } else {
+ let cgu_name = &cgu_name.as_str()[..];
+ Symbol::intern(&CodegenUnit::mangle_name(cgu_name)).as_interned_str()
+ }
+ }
+
+ /// Same as `CodegenUnit::build_cgu_name()` but will never mangle the
+ /// resulting name.
+ pub fn build_cgu_name_no_mangle<I, C, S>(&mut self,
+ cnum: CrateNum,
+ components: I,
+ special_suffix: Option<S>)
+ -> InternedString
+ where I: IntoIterator<Item=C>,
+ C: fmt::Display,
+ S: fmt::Display,
+ {
+ use std::fmt::Write;
+
+ let mut cgu_name = String::with_capacity(64);
+
+ // Start out with the crate name and disambiguator
+ let tcx = self.tcx;
+ let crate_prefix = self.cache.entry(cnum).or_insert_with(|| {
+ let crate_disambiguator = format!("{}", tcx.crate_disambiguator(cnum));
+ // Using a shortened disambiguator of about 40 bits
+ format!("{}.{}", tcx.crate_name(cnum), &crate_disambiguator[0 .. 8])
+ });
+
+ write!(cgu_name, "{}", crate_prefix).unwrap();
+
+ // Add the components
+ for component in components {
+ write!(cgu_name, "-{}", component).unwrap();
+ }
+
+ if let Some(special_suffix) = special_suffix {
+ // We add a dot in here so it cannot clash with anything in a regular
+ // Rust identifier
+ write!(cgu_name, ".{}", special_suffix).unwrap();
+ }
+
+ Symbol::intern(&cgu_name[..]).as_interned_str()
+ }
+}
diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs
index b55843a..5991845 100644
--- a/src/librustc/mir/tcx.rs
+++ b/src/librustc/mir/tcx.rs
@@ -127,14 +127,14 @@
/// of a closure type.
pub fn is_upvar_field_projection<'cx, 'gcx>(&self, mir: &'cx Mir<'tcx>,
tcx: &TyCtxt<'cx, 'gcx, 'tcx>) -> Option<Field> {
- let place = if let Place::Projection(ref proj) = self {
+ let (place, by_ref) = if let Place::Projection(ref proj) = self {
if let ProjectionElem::Deref = proj.elem {
- &proj.base
+ (&proj.base, true)
} else {
- self
+ (self, false)
}
} else {
- self
+ (self, false)
};
match place {
@@ -142,14 +142,16 @@
ProjectionElem::Field(field, _ty) => {
let base_ty = proj.base.ty(mir, *tcx).to_ty(*tcx);
- if base_ty.is_closure() || base_ty.is_generator() {
+ if (base_ty.is_closure() || base_ty.is_generator()) &&
+ (!by_ref || mir.upvar_decls[field.index()].by_ref)
+ {
Some(field)
} else {
None
}
},
_ => None,
- },
+ }
_ => None,
}
}
diff --git a/src/librustc/session/code_stats.rs b/src/librustc/session/code_stats.rs
index 1eee650..32865ac 100644
--- a/src/librustc/session/code_stats.rs
+++ b/src/librustc/session/code_stats.rs
@@ -8,11 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use ty::AdtKind;
-use ty::layout::{Align, Size};
-
+use rustc_target::abi::{Align, Size};
use rustc_data_structures::fx::{FxHashSet};
-
use std::cmp::{self, Ordering};
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
@@ -38,16 +35,6 @@
pub align: u64,
}
-impl From<AdtKind> for DataTypeKind {
- fn from(kind: AdtKind) -> Self {
- match kind {
- AdtKind::Struct => DataTypeKind::Struct,
- AdtKind::Enum => DataTypeKind::Enum,
- AdtKind::Union => DataTypeKind::Union,
- }
- }
-}
-
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum DataTypeKind {
Struct,
diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs
index dddf921..d594678 100644
--- a/src/librustc/session/config.rs
+++ b/src/librustc/session/config.rs
@@ -16,15 +16,13 @@
use session::{early_error, early_warn, Session};
use session::search_paths::SearchPaths;
-use ich::StableHashingContext;
use rustc_target::spec::{LinkerFlavor, PanicStrategy, RelroLevel};
use rustc_target::spec::{Target, TargetTriple};
-use rustc_data_structures::stable_hasher::ToStableHashKey;
use lint;
use middle::cstore;
use syntax::ast::{self, IntTy, UintTy};
-use syntax::codemap::{FileName, FilePathMapping};
+use syntax::source_map::{FileName, FilePathMapping};
use syntax::edition::{Edition, EDITION_NAME_LIST, DEFAULT_EDITION};
use syntax::parse::token;
use syntax::parse;
@@ -126,25 +124,7 @@
DepInfo,
}
-
-impl_stable_hash_for!(enum self::OutputType {
- Bitcode,
- Assembly,
- LlvmAssembly,
- Mir,
- Metadata,
- Object,
- Exe,
- DepInfo
-});
-
-impl<'a, 'tcx> ToStableHashKey<StableHashingContext<'a>> for OutputType {
- type KeyType = OutputType;
- #[inline]
- fn to_stable_hash_key(&self, _: &StableHashingContext<'a>) -> Self::KeyType {
- *self
- }
-}
+impl_stable_hash_via_hash!(OutputType);
impl OutputType {
fn is_compatible_with_codegen_units_and_single_output_file(&self) -> bool {
@@ -233,9 +213,7 @@
#[derive(Clone, Hash)]
pub struct OutputTypes(BTreeMap<OutputType, Option<PathBuf>>);
-impl_stable_hash_for!(tuple_struct self::OutputTypes {
- map
-});
+impl_stable_hash_via_hash!(OutputTypes);
impl OutputTypes {
pub fn new(entries: &[(OutputType, Option<PathBuf>)]) -> OutputTypes {
@@ -512,7 +490,7 @@
}
}
-#[derive(Clone)]
+#[derive(Clone, Hash)]
pub struct OutputFilenames {
pub out_directory: PathBuf,
pub out_filestem: String,
@@ -521,13 +499,7 @@
pub outputs: OutputTypes,
}
-impl_stable_hash_for!(struct self::OutputFilenames {
- out_directory,
- out_filestem,
- single_output_file,
- extra,
- outputs
-});
+impl_stable_hash_via_hash!(OutputFilenames);
pub const RUST_CGU_EXT: &str = "rcgu";
@@ -2202,7 +2174,7 @@
);
}
- let mut externs = BTreeMap::new();
+ let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
for arg in &matches.opt_strs("extern") {
let mut parts = arg.splitn(2, '=');
let name = match parts.next() {
@@ -2219,7 +2191,7 @@
externs
.entry(name.to_string())
- .or_insert_with(BTreeSet::new)
+ .or_default()
.insert(location.to_string());
}
diff --git a/src/librustc/session/filesearch.rs b/src/librustc/session/filesearch.rs
index b636fc6..32044fd 100644
--- a/src/librustc/session/filesearch.rs
+++ b/src/librustc/session/filesearch.rs
@@ -19,7 +19,7 @@
use std::path::{Path, PathBuf};
use session::search_paths::{SearchPaths, PathKind};
-use util::fs as rustcfs;
+use rustc_fs_util::fix_windows_verbatim_for_gcc;
#[derive(Copy, Clone)]
pub enum FileMatch {
@@ -151,7 +151,7 @@
// See comments on this target function, but the gist is that
// gcc chokes on verbatim paths which fs::canonicalize generates
// so we try to avoid those kinds of paths.
- Ok(canon) => Some(rustcfs::fix_windows_verbatim_for_gcc(&canon)),
+ Ok(canon) => Some(fix_windows_verbatim_for_gcc(&canon)),
Err(e) => bug!("failed to get realpath: {}", e),
}
})
diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs
index 58df8f3..ef81cd3 100644
--- a/src/librustc/session/mod.rs
+++ b/src/librustc/session/mod.rs
@@ -12,20 +12,19 @@
use self::code_stats::CodeStats;
use hir::def_id::CrateNum;
-use ich::Fingerprint;
+use rustc_data_structures::fingerprint::Fingerprint;
-use ich;
use lint;
use lint::builtin::BuiltinLintDiagnostics;
use middle::allocator::AllocatorKind;
use middle::dependency_format;
use session::search_paths::PathKind;
use session::config::{OutputType, Lto};
-use ty::tls;
use util::nodemap::{FxHashMap, FxHashSet};
use util::common::{duration_to_secs_str, ErrorReported};
use util::common::ProfileQueriesMsg;
+use rustc_data_structures::base_n;
use rustc_data_structures::sync::{self, Lrc, Lock, LockCell, OneThread, Once, RwLock};
use syntax::ast::NodeId;
@@ -34,10 +33,9 @@
use syntax::edition::Edition;
use syntax::json::JsonEmitter;
use syntax::feature_gate;
-use syntax::symbol::Symbol;
use syntax::parse;
use syntax::parse::ParseSess;
-use syntax::{ast, codemap};
+use syntax::{ast, source_map};
use syntax::feature_gate::AttributeType;
use syntax_pos::{MultiSpan, Span};
use util::profiling::SelfProfiler;
@@ -128,9 +126,6 @@
incr_comp_session: OneThread<RefCell<IncrCompSession>>,
- /// A cache of attributes ignored by StableHashingContext
- pub ignored_attr_names: FxHashSet<Symbol>,
-
/// Used by -Z profile-queries in util::common
pub profile_channel: Lock<Option<mpsc::Sender<ProfileQueriesMsg>>>,
@@ -489,8 +484,8 @@
);
}
- pub fn codemap<'a>(&'a self) -> &'a codemap::CodeMap {
- self.parse_sess.codemap()
+ pub fn source_map<'a>(&'a self) -> &'a source_map::SourceMap {
+ self.parse_sess.source_map()
}
pub fn verbose(&self) -> bool {
self.opts.debugging_opts.verbose
@@ -978,20 +973,20 @@
) -> Session {
let file_path_mapping = sopts.file_path_mapping();
- build_session_with_codemap(
+ build_session_with_source_map(
sopts,
local_crate_source_file,
registry,
- Lrc::new(codemap::CodeMap::new(file_path_mapping)),
+ Lrc::new(source_map::SourceMap::new(file_path_mapping)),
None,
)
}
-pub fn build_session_with_codemap(
+pub fn build_session_with_source_map(
sopts: config::Options,
local_crate_source_file: Option<PathBuf>,
registry: errors::registry::Registry,
- codemap: Lrc<codemap::CodeMap>,
+ source_map: Lrc<source_map::SourceMap>,
emitter_dest: Option<Box<dyn Write + Send>>,
) -> Session {
// FIXME: This is not general enough to make the warning lint completely override
@@ -1018,19 +1013,19 @@
(config::ErrorOutputType::HumanReadable(color_config), None) => Box::new(
EmitterWriter::stderr(
color_config,
- Some(codemap.clone()),
+ Some(source_map.clone()),
false,
sopts.debugging_opts.teach,
).ui_testing(sopts.debugging_opts.ui_testing),
),
(config::ErrorOutputType::HumanReadable(_), Some(dst)) => Box::new(
- EmitterWriter::new(dst, Some(codemap.clone()), false, false)
+ EmitterWriter::new(dst, Some(source_map.clone()), false, false)
.ui_testing(sopts.debugging_opts.ui_testing),
),
(config::ErrorOutputType::Json(pretty), None) => Box::new(
JsonEmitter::stderr(
Some(registry),
- codemap.clone(),
+ source_map.clone(),
pretty,
).ui_testing(sopts.debugging_opts.ui_testing),
),
@@ -1038,15 +1033,15 @@
JsonEmitter::new(
dst,
Some(registry),
- codemap.clone(),
+ source_map.clone(),
pretty,
).ui_testing(sopts.debugging_opts.ui_testing),
),
(config::ErrorOutputType::Short(color_config), None) => Box::new(
- EmitterWriter::stderr(color_config, Some(codemap.clone()), true, false),
+ EmitterWriter::stderr(color_config, Some(source_map.clone()), true, false),
),
(config::ErrorOutputType::Short(_), Some(dst)) => {
- Box::new(EmitterWriter::new(dst, Some(codemap.clone()), true, false))
+ Box::new(EmitterWriter::new(dst, Some(source_map.clone()), true, false))
}
};
@@ -1061,14 +1056,14 @@
},
);
- build_session_(sopts, local_crate_source_file, diagnostic_handler, codemap)
+ build_session_(sopts, local_crate_source_file, diagnostic_handler, source_map)
}
pub fn build_session_(
sopts: config::Options,
local_crate_source_file: Option<PathBuf>,
span_diagnostic: errors::Handler,
- codemap: Lrc<codemap::CodeMap>,
+ source_map: Lrc<source_map::SourceMap>,
) -> Session {
let host_triple = TargetTriple::from_triple(config::host_triple());
let host = match Target::search(&host_triple) {
@@ -1081,7 +1076,7 @@
};
let target_cfg = config::build_target_config(&sopts, &span_diagnostic);
- let p_s = parse::ParseSess::with_span_handler(span_diagnostic, codemap);
+ let p_s = parse::ParseSess::with_span_handler(span_diagnostic, source_map);
let default_sysroot = match sopts.maybe_sysroot {
Some(_) => None,
None => Some(filesearch::get_or_default_sysroot()),
@@ -1136,7 +1131,6 @@
injected_panic_runtime: Once::new(),
imported_macro_spans: OneThread::new(RefCell::new(HashMap::new())),
incr_comp_session: OneThread::new(RefCell::new(IncrCompSession::NotInitialized)),
- ignored_attr_names: ich::compute_ignored_attr_names(),
self_profiling: Lock::new(SelfProfiler::new()),
profile_channel: Lock::new(None),
perf_stats: PerfStats {
@@ -1222,13 +1216,21 @@
}
}
+impl fmt::Display for CrateDisambiguator {
+ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+ let (a, b) = self.0.as_value();
+ let as_u128 = a as u128 | ((b as u128) << 64);
+ f.write_str(&base_n::encode(as_u128, base_n::CASE_INSENSITIVE))
+ }
+}
+
impl From<Fingerprint> for CrateDisambiguator {
fn from(fingerprint: Fingerprint) -> CrateDisambiguator {
CrateDisambiguator(fingerprint)
}
}
-impl_stable_hash_for!(tuple_struct CrateDisambiguator { fingerprint });
+impl_stable_hash_via_hash!(CrateDisambiguator);
/// Holds data on the current incremental compilation session, if there is one.
#[derive(Debug)]
@@ -1300,39 +1302,3 @@
Err(CompileIncomplete::Errored(ErrorReported))
}
}
-
-#[cold]
-#[inline(never)]
-pub fn bug_fmt(file: &'static str, line: u32, args: fmt::Arguments) -> ! {
- // this wrapper mostly exists so I don't have to write a fully
- // qualified path of None::<Span> inside the bug!() macro definition
- opt_span_bug_fmt(file, line, None::<Span>, args);
-}
-
-#[cold]
-#[inline(never)]
-pub fn span_bug_fmt<S: Into<MultiSpan>>(
- file: &'static str,
- line: u32,
- span: S,
- args: fmt::Arguments,
-) -> ! {
- opt_span_bug_fmt(file, line, Some(span), args);
-}
-
-fn opt_span_bug_fmt<S: Into<MultiSpan>>(
- file: &'static str,
- line: u32,
- span: Option<S>,
- args: fmt::Arguments,
-) -> ! {
- tls::with_opt(move |tcx| {
- let msg = format!("{}:{}: {}", file, line, args);
- match (tcx, span) {
- (Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, &msg),
- (Some(tcx), None) => tcx.sess.diagnostic().bug(&msg),
- (None, _) => panic!(msg),
- }
- });
- unreachable!();
-}
diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs
index cfe3583..fd8c2d4 100644
--- a/src/librustc/traits/auto_trait.rs
+++ b/src/librustc/traits/auto_trait.rs
@@ -513,26 +513,26 @@
{
let deps1 = vid_map
.entry(RegionTarget::RegionVid(r1))
- .or_insert_with(|| Default::default());
+ .or_default();
deps1.larger.insert(RegionTarget::RegionVid(r2));
}
let deps2 = vid_map
.entry(RegionTarget::RegionVid(r2))
- .or_insert_with(|| Default::default());
+ .or_default();
deps2.smaller.insert(RegionTarget::RegionVid(r1));
}
&Constraint::RegSubVar(region, vid) => {
{
let deps1 = vid_map
.entry(RegionTarget::Region(region))
- .or_insert_with(|| Default::default());
+ .or_default();
deps1.larger.insert(RegionTarget::RegionVid(vid));
}
let deps2 = vid_map
.entry(RegionTarget::RegionVid(vid))
- .or_insert_with(|| Default::default());
+ .or_default();
deps2.smaller.insert(RegionTarget::Region(region));
}
&Constraint::VarSubReg(vid, region) => {
@@ -542,13 +542,13 @@
{
let deps1 = vid_map
.entry(RegionTarget::Region(r1))
- .or_insert_with(|| Default::default());
+ .or_default();
deps1.larger.insert(RegionTarget::Region(r2));
}
let deps2 = vid_map
.entry(RegionTarget::Region(r2))
- .or_insert_with(|| Default::default());
+ .or_default();
deps2.smaller.insert(RegionTarget::Region(r1));
}
}
@@ -681,10 +681,7 @@
}
}
&ty::Predicate::RegionOutlives(ref binder) => {
- if let Err(_) = select
- .infcx()
- .region_outlives_predicate(&dummy_cause, binder)
- {
+ if select.infcx().region_outlives_predicate(&dummy_cause, binder).is_err() {
return false;
}
}
diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs
index c04785a..5d45bad 100644
--- a/src/librustc/traits/error_reporting.rs
+++ b/src/librustc/traits/error_reporting.rs
@@ -57,7 +57,7 @@
index: Option<usize>, // None if this is an old error
}
- let mut error_map : FxHashMap<_, _> =
+ let mut error_map : FxHashMap<_, Vec<_>> =
self.reported_trait_errors.borrow().iter().map(|(&span, predicates)| {
(span, predicates.iter().map(|predicate| ErrorDescriptor {
predicate: predicate.clone(),
@@ -66,14 +66,14 @@
}).collect();
for (index, error) in errors.iter().enumerate() {
- error_map.entry(error.obligation.cause.span).or_insert(Vec::new()).push(
+ error_map.entry(error.obligation.cause.span).or_default().push(
ErrorDescriptor {
predicate: error.obligation.predicate.clone(),
index: Some(index)
});
self.reported_trait_errors.borrow_mut()
- .entry(error.obligation.cause.span).or_insert(Vec::new())
+ .entry(error.obligation.cause.span).or_default()
.push(error.obligation.predicate.clone());
}
@@ -143,7 +143,7 @@
// Eventually I'll need to implement param-env-aware
// `Γ₁ ⊦ φ₁ => Γ₂ ⊦ φ₂` logic.
let param_env = ty::ParamEnv::empty();
- if let Ok(_) = self.can_sub(param_env, error, implication) {
+ if self.can_sub(param_env, error, implication).is_ok() {
debug!("error_implies: {:?} -> {:?} -> {:?}", cond, error, implication);
return true
}
@@ -435,13 +435,14 @@
}
fn report_similar_impl_candidates(&self,
- impl_candidates: Vec<ty::TraitRef<'tcx>>,
+ mut impl_candidates: Vec<ty::TraitRef<'tcx>>,
err: &mut DiagnosticBuilder)
{
if impl_candidates.is_empty() {
return;
}
+ let len = impl_candidates.len();
let end = if impl_candidates.len() <= 5 {
impl_candidates.len()
} else {
@@ -459,10 +460,17 @@
}
});
+ // Sort impl candidates so that ordering is consistent for UI tests.
+ let normalized_impl_candidates = &mut impl_candidates[0..end]
+ .iter()
+ .map(normalize)
+ .collect::<Vec<String>>();
+ normalized_impl_candidates.sort();
+
err.help(&format!("the following implementations were found:{}{}",
- &impl_candidates[0..end].iter().map(normalize).collect::<String>(),
- if impl_candidates.len() > 5 {
- format!("\nand {} others", impl_candidates.len() - 4)
+ normalized_impl_candidates.join(""),
+ if len > 5 {
+ format!("\nand {} others", len - 4)
} else {
"".to_owned()
}
@@ -520,12 +528,12 @@
-> DiagnosticBuilder<'tcx>
{
let msg = "impl has stricter requirements than trait";
- let sp = self.tcx.sess.codemap().def_span(error_span);
+ let sp = self.tcx.sess.source_map().def_span(error_span);
let mut err = struct_span_err!(self.tcx.sess, sp, E0276, "{}", msg);
if let Some(trait_item_span) = self.tcx.hir.span_if_local(trait_item_def_id) {
- let span = self.tcx.sess.codemap().def_span(trait_item_span);
+ let span = self.tcx.sess.source_map().def_span(trait_item_span);
err.span_label(span, format!("definition of `{}` from trait", item_name));
}
@@ -707,7 +715,7 @@
ty::Predicate::ClosureKind(closure_def_id, closure_substs, kind) => {
let found_kind = self.closure_kind(closure_def_id, closure_substs).unwrap();
- let closure_span = self.tcx.sess.codemap()
+ let closure_span = self.tcx.sess.source_map()
.def_span(self.tcx.hir.span_if_local(closure_def_id).unwrap());
let node_id = self.tcx.hir.as_local_node_id(closure_def_id).unwrap();
let mut err = struct_span_err!(
@@ -784,7 +792,7 @@
};
let found_span = found_did.and_then(|did| {
self.tcx.hir.span_if_local(did)
- }).map(|sp| self.tcx.sess.codemap().def_span(sp)); // the sp could be an fn def
+ }).map(|sp| self.tcx.sess.source_map().def_span(sp)); // the sp could be an fn def
let found = match found_trait_ref.skip_binder().substs.type_at(1).sty {
ty::TyTuple(ref tys) => tys.iter()
@@ -859,7 +867,7 @@
if let Some(hir::map::NodeLocal(ref local)) = self.tcx.hir.find(parent_node) {
if let Some(ref expr) = local.init {
if let hir::ExprKind::Index(_, _) = expr.node {
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(expr.span) {
+ if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
err.span_suggestion_with_applicability(
expr.span,
"consider borrowing here",
@@ -882,7 +890,7 @@
let trait_ref = trait_ref.skip_binder();
let span = obligation.cause.span;
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
+ if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
let refs_number = snippet.chars()
.filter(|c| !c.is_whitespace())
.take_while(|c| *c == '&')
@@ -901,7 +909,7 @@
new_trait_ref.to_predicate());
if self.predicate_may_hold(&new_obligation) {
- let sp = self.tcx.sess.codemap()
+ let sp = self.tcx.sess.source_map()
.span_take_while(span, |c| c.is_whitespace() || *c == '&');
let remove_refs = refs_remaining + 1;
@@ -930,7 +938,7 @@
node: hir::ExprKind::Closure(_, ref _decl, id, span, _),
..
}) => {
- (self.tcx.sess.codemap().def_span(span), self.tcx.hir.body(id).arguments.iter()
+ (self.tcx.sess.source_map().def_span(span), self.tcx.hir.body(id).arguments.iter()
.map(|arg| {
if let hir::Pat {
node: hir::PatKind::Tuple(args, _),
@@ -940,13 +948,13 @@
ArgKind::Tuple(
Some(span),
args.iter().map(|pat| {
- let snippet = self.tcx.sess.codemap()
+ let snippet = self.tcx.sess.source_map()
.span_to_snippet(pat.span).unwrap();
(snippet, "_".to_owned())
}).collect::<Vec<_>>(),
)
} else {
- let name = self.tcx.sess.codemap()
+ let name = self.tcx.sess.source_map()
.span_to_snippet(arg.pat.span).unwrap();
ArgKind::Arg(name, "_".to_owned())
}
@@ -968,7 +976,7 @@
node: hir::TraitItemKind::Method(hir::MethodSig { ref decl, .. }, _),
..
}) => {
- (self.tcx.sess.codemap().def_span(span), decl.inputs.iter()
+ (self.tcx.sess.source_map().def_span(span), decl.inputs.iter()
.map(|arg| match arg.clone().node {
hir::TyKind::Tup(ref tys) => ArgKind::Tuple(
Some(arg.span),
@@ -987,13 +995,13 @@
},
..
}) => {
- (self.tcx.sess.codemap().def_span(span),
+ (self.tcx.sess.source_map().def_span(span),
fields.iter().map(|field| {
ArgKind::Arg(field.ident.to_string(), "_".to_string())
}).collect::<Vec<_>>())
}
hir::map::NodeStructCtor(ref variant_data) => {
- (self.tcx.sess.codemap().def_span(self.tcx.hir.span(variant_data.id())),
+ (self.tcx.sess.source_map().def_span(self.tcx.hir.span(variant_data.id())),
variant_data.fields()
.iter().map(|_| ArgKind::Arg("_".to_owned(), "_".to_owned()))
.collect())
@@ -1184,7 +1192,7 @@
{
assert!(type_def_id.is_local());
let span = self.hir.span_if_local(type_def_id).unwrap();
- let span = self.sess.codemap().def_span(span);
+ let span = self.sess.source_map().def_span(span);
let mut err = struct_span_err!(self.sess, span, E0072,
"recursive type `{}` has infinite size",
self.item_path_str(type_def_id));
@@ -1202,7 +1210,7 @@
-> DiagnosticBuilder<'tcx>
{
let trait_str = self.item_path_str(trait_def_id);
- let span = self.sess.codemap().def_span(span);
+ let span = self.sess.source_map().def_span(span);
let mut err = struct_span_err!(
self.sess, span, E0038,
"the trait `{}` cannot be made into an object",
@@ -1430,7 +1438,7 @@
let item_name = tcx.item_path_str(item_def_id);
let msg = format!("required by `{}`", item_name);
if let Some(sp) = tcx.hir.span_if_local(item_def_id) {
- let sp = tcx.sess.codemap().def_span(sp);
+ let sp = tcx.sess.source_map().def_span(sp);
err.span_note(sp, &msg);
} else {
err.note(&msg);
@@ -1446,6 +1454,15 @@
}
ObligationCauseCode::VariableType(_) => {
err.note("all local variables must have a statically known size");
+ if !self.tcx.features().unsized_locals {
+ err.help("unsized locals are gated as an unstable feature");
+ }
+ }
+ ObligationCauseCode::SizedArgumentType => {
+ err.note("all function arguments must have a statically known size");
+ if !self.tcx.features().unsized_locals {
+ err.help("unsized locals are gated as an unstable feature");
+ }
}
ObligationCauseCode::SizedReturnType => {
err.note("the return type of a function must have a \
@@ -1464,11 +1481,16 @@
ObligationCauseCode::StructInitializerSized => {
err.note("structs must have a statically known size to be initialized");
}
- ObligationCauseCode::FieldSized(ref item) => {
+ ObligationCauseCode::FieldSized { adt_kind: ref item, last } => {
match *item {
AdtKind::Struct => {
- err.note("only the last field of a struct may have a dynamically \
- sized type");
+ if last {
+ err.note("the last field of a packed struct may only have a \
+ dynamically sized type if it does not need drop to be run");
+ } else {
+ err.note("only the last field of a struct may have a dynamically \
+ sized type");
+ }
}
AdtKind::Union => {
err.note("no field of a union may have a dynamically sized type");
diff --git a/src/librustc/traits/fulfill.rs b/src/librustc/traits/fulfill.rs
index b7d3ad7..5113f3c 100644
--- a/src/librustc/traits/fulfill.rs
+++ b/src/librustc/traits/fulfill.rs
@@ -146,7 +146,7 @@
debug!("normalize_projection_type(projection_ty={:?})",
projection_ty);
- assert!(!projection_ty.has_escaping_regions());
+ debug_assert!(!projection_ty.has_escaping_regions());
// FIXME(#20304) -- cache
diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs
index 0290f2e..0ba94b5 100644
--- a/src/librustc/traits/mod.rs
+++ b/src/librustc/traits/mod.rs
@@ -142,7 +142,7 @@
ObligationCauseCode::CompareImplMethodObligation { .. } |
ObligationCauseCode::MainFunctionType |
ObligationCauseCode::StartFunctionType => {
- tcx.sess.codemap().def_span(self.span)
+ tcx.sess.source_map().def_span(self.span)
}
_ => self.span,
}
@@ -185,6 +185,8 @@
StructInitializerSized,
/// Type of each variable must be Sized
VariableType(ast::NodeId),
+ /// Argument type must be Sized
+ SizedArgumentType,
/// Return type must be Sized
SizedReturnType,
/// Yield type must be Sized
@@ -192,8 +194,8 @@
/// [T,..n] --> T must be Copy
RepeatVec,
- /// Types of fields (other than the last) in a struct must be sized.
- FieldSized(AdtKind),
+ /// Types of fields (other than the last, except for packed structs) in a struct must be sized.
+ FieldSized { adt_kind: AdtKind, last: bool },
/// Constant expressions must be sized.
ConstSized,
diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs
index e1395c3..280ce75 100644
--- a/src/librustc/traits/on_unimplemented.rs
+++ b/src/librustc/traits/on_unimplemented.rs
@@ -131,7 +131,7 @@
parse_error(tcx, item.span,
"this attribute must have a valid value",
"expected value here",
- Some(r#"eg `#[rustc_on_unimplemented = "foo"]`"#));
+ Some(r#"eg `#[rustc_on_unimplemented(message="foo")]`"#));
}
if errored {
@@ -170,7 +170,7 @@
return Err(parse_error(tcx, attr.span,
"`#[rustc_on_unimplemented]` requires a value",
"value required here",
- Some(r#"eg `#[rustc_on_unimplemented = "foo"]`"#)));
+ Some(r#"eg `#[rustc_on_unimplemented(message="foo")]`"#)));
};
debug!("of_item({:?}/{:?}) = {:?}", trait_def_id, impl_def_id, result);
result
@@ -213,10 +213,13 @@
}
}
+ let options: FxHashMap<String, String> = options.into_iter()
+ .filter_map(|(k, v)| v.as_ref().map(|v| (k.to_owned(), v.to_owned())))
+ .collect();
OnUnimplementedNote {
- label: label.map(|l| l.format(tcx, trait_ref)),
- message: message.map(|m| m.format(tcx, trait_ref)),
- note: note.map(|n| n.format(tcx, trait_ref)),
+ label: label.map(|l| l.format(tcx, trait_ref, &options)),
+ message: message.map(|m| m.format(tcx, trait_ref, &options)),
+ note: note.map(|n| n.format(tcx, trait_ref, &options)),
}
}
}
@@ -251,6 +254,10 @@
Position::ArgumentNamed(s) if s == "Self" => (),
// `{ThisTraitsName}` is allowed
Position::ArgumentNamed(s) if s == name => (),
+ // `{from_method}` is allowed
+ Position::ArgumentNamed(s) if s == "from_method" => (),
+ // `{from_desugaring}` is allowed
+ Position::ArgumentNamed(s) if s == "from_desugaring" => (),
// So is `{A}` if A is a type parameter
Position::ArgumentNamed(s) => match generics.params.iter().find(|param| {
param.name == s
@@ -258,17 +265,14 @@
Some(_) => (),
None => {
span_err!(tcx.sess, span, E0230,
- "there is no parameter \
- {} on trait {}",
- s, name);
+ "there is no parameter `{}` on trait `{}`", s, name);
result = Err(ErrorReported);
}
},
// `{:1}` and `{}` are not to be used
Position::ArgumentIs(_) | Position::ArgumentImplicitlyIs(_) => {
span_err!(tcx.sess, span, E0231,
- "only named substitution \
- parameters are allowed");
+ "only named substitution parameters are allowed");
result = Err(ErrorReported);
}
}
@@ -280,7 +284,8 @@
pub fn format(&self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
- trait_ref: ty::TraitRef<'tcx>)
+ trait_ref: ty::TraitRef<'tcx>,
+ options: &FxHashMap<String, String>)
-> String
{
let name = tcx.item_name(trait_ref.def_id);
@@ -296,6 +301,7 @@
let name = param.name.to_string();
Some((name, value))
}).collect::<FxHashMap<String, String>>();
+ let empty_string = String::new();
let parser = Parser::new(&self.0, None);
parser.map(|p| {
@@ -308,14 +314,20 @@
&trait_str
}
None => {
- bug!("broken on_unimplemented {:?} for {:?}: \
- no argument matching {:?}",
- self.0, trait_ref, s)
+ if let Some(val) = options.get(s) {
+ val
+ } else if s == "from_desugaring" || s == "from_method" {
+ // don't break messages using these two arguments incorrectly
+ &empty_string
+ } else {
+ bug!("broken on_unimplemented {:?} for {:?}: \
+ no argument matching {:?}",
+ self.0, trait_ref, s)
+ }
}
},
_ => {
- bug!("broken on_unimplemented {:?} - bad \
- format arg", self.0)
+ bug!("broken on_unimplemented {:?} - bad format arg", self.0)
}
}
}
diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs
index 1ce60d8..1224cdd 100644
--- a/src/librustc/traits/project.rs
+++ b/src/librustc/traits/project.rs
@@ -1142,7 +1142,7 @@
if !is_default {
true
} else if obligation.param_env.reveal == Reveal::All {
- assert!(!poly_trait_ref.needs_infer());
+ debug_assert!(!poly_trait_ref.needs_infer());
if !poly_trait_ref.needs_subst() {
true
} else {
@@ -1668,15 +1668,15 @@
}
pub fn rollback_to(&mut self, snapshot: ProjectionCacheSnapshot) {
- self.map.rollback_to(snapshot.snapshot);
+ self.map.rollback_to(&snapshot.snapshot);
}
pub fn rollback_skolemized(&mut self, snapshot: &ProjectionCacheSnapshot) {
self.map.partial_rollback(&snapshot.snapshot, &|k| k.ty.has_re_skol());
}
- pub fn commit(&mut self, snapshot: ProjectionCacheSnapshot) {
- self.map.commit(snapshot.snapshot);
+ pub fn commit(&mut self, snapshot: &ProjectionCacheSnapshot) {
+ self.map.commit(&snapshot.snapshot);
}
/// Try to start normalize `key`; returns an error if
diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs
index a48d24b..56484e1 100644
--- a/src/librustc/traits/query/dropck_outlives.rs
+++ b/src/librustc/traits/query/dropck_outlives.rs
@@ -12,7 +12,7 @@
use infer::InferOk;
use rustc_data_structures::small_vec::SmallVec;
use std::iter::FromIterator;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use ty::subst::Kind;
use ty::{self, Ty, TyCtxt};
@@ -242,16 +242,14 @@
.all(|t| trivial_dropck_outlives(tcx, t)),
ty::TyAdt(def, _) => {
- if def.is_union() {
- // Unions never have a dtor.
- true
- } else if Some(def.did) == tcx.lang_items().manually_drop() {
+ if Some(def.did) == tcx.lang_items().manually_drop() {
// `ManuallyDrop` never has a dtor.
true
} else {
// Other types might. Moreover, PhantomData doesn't
// have a dtor, but it is considered to own its
- // content, so it is non-trivial.
+ // content, so it is non-trivial. Unions can have `impl Drop`,
+ // and hence are non-trivial as well.
false
}
}
diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs
index 2203aef..fab7289 100644
--- a/src/librustc/traits/query/normalize.rs
+++ b/src/librustc/traits/query/normalize.rs
@@ -12,15 +12,15 @@
//! which folds deeply, invoking the underlying
//! `normalize_projection_ty` query when it encounters projections.
-use infer::{InferCtxt, InferOk};
use infer::at::At;
-use mir::interpret::{GlobalId, ConstValue};
+use infer::{InferCtxt, InferOk};
+use mir::interpret::{ConstValue, GlobalId};
use rustc_data_structures::small_vec::SmallVec;
-use traits::{Obligation, ObligationCause, PredicateObligation, Reveal};
use traits::project::Normalized;
-use ty::{self, Ty, TyCtxt};
+use traits::{Obligation, ObligationCause, PredicateObligation, Reveal};
use ty::fold::{TypeFoldable, TypeFolder};
use ty::subst::{Subst, Substs};
+use ty::{self, Ty, TyCtxt};
use super::NoSolution;
@@ -121,9 +121,36 @@
let concrete_ty = generic_ty.subst(self.tcx(), substs);
self.anon_depth += 1;
if concrete_ty == ty {
- bug!("infinite recursion generic_ty: {:#?}, substs: {:#?}, \
- concrete_ty: {:#?}, ty: {:#?}", generic_ty, substs, concrete_ty,
- ty);
+ // The type in question can only be inferred in terms of itself. This
+ // is likely a user code issue, not a compiler issue. Thus, we will
+ // induce a cycle error by calling the parent query again on the type.
+ //
+ // FIXME: Perhaps a better solution would be to have fold_ty()
+ // itself be a query. Then, a type fold cycle would be detected
+ // and reported more naturally as part of the query system, rather
+ // than forcing it here.
+ //
+ // FIXME: Need a better span than just one pointing to the type def.
+ // Should point to a defining use of the type that results in this
+ // un-normalizable state.
+ if let Some(param_env_lifted) =
+ self.tcx().lift_to_global(&self.param_env)
+ {
+ if let Some(ty_lifted) = self.tcx().lift_to_global(&concrete_ty) {
+ let span = self.tcx().def_span(def_id);
+ self.tcx()
+ .global_tcx()
+ .at(span)
+ .normalize_ty_after_erasing_regions(
+ param_env_lifted.and(ty_lifted),
+ );
+ self.tcx().sess.abort_if_errors();
+ }
+ }
+ // If a cycle error can't be emitted, indicate a NoSolution error
+ // and let the caller handle it.
+ self.error = true;
+ return concrete_ty;
}
let folded_ty = self.fold_ty(concrete_ty);
self.anon_depth -= 1;
@@ -149,8 +176,8 @@
let gcx = self.infcx.tcx.global_tcx();
let mut orig_values = SmallVec::new();
- let c_data =
- self.infcx.canonicalize_query(&self.param_env.and(*data), &mut orig_values);
+ let c_data = self.infcx
+ .canonicalize_query(&self.param_env.and(*data), &mut orig_values);
debug!("QueryNormalizer: c_data = {:#?}", c_data);
debug!("QueryNormalizer: orig_values = {:#?}", orig_values);
match gcx.normalize_projection_ty(c_data) {
diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs
index f79ce73..868b8df 100644
--- a/src/librustc/traits/query/outlives_bounds.rs
+++ b/src/librustc/traits/query/outlives_bounds.rs
@@ -10,7 +10,7 @@
use infer::InferCtxt;
use syntax::ast;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use rustc_data_structures::small_vec::SmallVec;
use traits::{FulfillmentContext, ObligationCause, TraitEngine, TraitEngineExt};
use traits::query::NoSolution;
@@ -137,7 +137,7 @@
// variables. Process these constraints.
let mut fulfill_cx = FulfillmentContext::new();
fulfill_cx.register_predicate_obligations(self, result.obligations);
- if let Err(_) = fulfill_cx.select_all_or_error(self) {
+ if fulfill_cx.select_all_or_error(self).is_err() {
self.tcx.sess.delay_span_bug(
span,
"implied_outlives_bounds failed to solve obligations from instantiation"
diff --git a/src/librustc/traits/query/type_op/custom.rs b/src/librustc/traits/query/type_op/custom.rs
index cc752d2..737388a 100644
--- a/src/librustc/traits/query/type_op/custom.rs
+++ b/src/librustc/traits/query/type_op/custom.rs
@@ -15,7 +15,7 @@
use infer::canonical::query_result;
use infer::canonical::QueryRegionConstraint;
use std::rc::Rc;
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::DUMMY_SP;
use traits::{ObligationCause, TraitEngine, TraitEngineExt};
pub struct CustomTypeOp<F, G> {
diff --git a/src/librustc/traits/query/type_op/prove_predicate.rs b/src/librustc/traits/query/type_op/prove_predicate.rs
index 33dc321..e1b3b3c 100644
--- a/src/librustc/traits/query/type_op/prove_predicate.rs
+++ b/src/librustc/traits/query/type_op/prove_predicate.rs
@@ -27,9 +27,23 @@
type QueryResult = ();
fn try_fast_path(
- _tcx: TyCtxt<'_, 'gcx, 'tcx>,
- _key: &ParamEnvAnd<'tcx, Self>,
+ tcx: TyCtxt<'_, 'gcx, 'tcx>,
+ key: &ParamEnvAnd<'tcx, Self>,
) -> Option<Self::QueryResult> {
+ // Proving Sized, very often on "obviously sized" types like
+ // `&T`, accounts for about 60% percentage of the predicates
+ // we have to prove. No need to canonicalize and all that for
+ // such cases.
+ if let Predicate::Trait(trait_ref) = key.value.predicate {
+ if let Some(sized_def_id) = tcx.lang_items().sized_trait() {
+ if trait_ref.def_id() == sized_def_id {
+ if trait_ref.skip_binder().self_ty().is_trivially_sized(tcx) {
+ return Some(());
+ }
+ }
+ }
+ }
+
None
}
diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs
index 35184ca..ea96c30 100644
--- a/src/librustc/traits/select.rs
+++ b/src/librustc/traits/select.rs
@@ -226,6 +226,7 @@
/// parameter environment.
#[derive(PartialEq,Eq,Debug,Clone)]
enum SelectionCandidate<'tcx> {
+ /// If has_nested is false, there are no *further* obligations
BuiltinCandidate { has_nested: bool },
ParamCandidate(ty::PolyTraitRef<'tcx>),
ImplCandidate(DefId),
@@ -563,7 +564,7 @@
pub fn select(&mut self, obligation: &TraitObligation<'tcx>)
-> SelectionResult<'tcx, Selection<'tcx>> {
debug!("select({:?})", obligation);
- assert!(!obligation.predicate.has_escaping_regions());
+ debug_assert!(!obligation.predicate.has_escaping_regions());
let stack = self.push_stack(TraitObligationStackList::empty(), obligation);
@@ -662,7 +663,7 @@
match obligation.predicate {
ty::Predicate::Trait(ref t) => {
- assert!(!t.has_escaping_regions());
+ debug_assert!(!t.has_escaping_regions());
let obligation = obligation.with(t.clone());
self.evaluate_trait_predicate_recursively(previous_stack, obligation)
}
@@ -1076,7 +1077,7 @@
debug!("candidate_from_obligation(cache_fresh_trait_pred={:?}, obligation={:?})",
cache_fresh_trait_pred,
stack);
- assert!(!stack.obligation.predicate.has_escaping_regions());
+ debug_assert!(!stack.obligation.predicate.has_escaping_regions());
if let Some(c) = self.check_candidate_cache(stack.obligation.param_env,
&cache_fresh_trait_pred) {
@@ -1586,9 +1587,9 @@
snapshot: &infer::CombinedSnapshot<'cx, 'tcx>)
-> bool
{
- assert!(!skol_trait_ref.has_escaping_regions());
- if let Err(_) = self.infcx.at(&obligation.cause, obligation.param_env)
- .sup(ty::Binder::dummy(skol_trait_ref), trait_bound) {
+ debug_assert!(!skol_trait_ref.has_escaping_regions());
+ if self.infcx.at(&obligation.cause, obligation.param_env)
+ .sup(ty::Binder::dummy(skol_trait_ref), trait_bound).is_err() {
return false;
}
@@ -2039,12 +2040,20 @@
}
match other.candidate {
+ // Prefer BuiltinCandidate { has_nested: false } to anything else.
+ // This is a fix for #53123 and prevents winnowing from accidentally extending the
+ // lifetime of a variable.
+ BuiltinCandidate { has_nested: false } => true,
ParamCandidate(ref cand) => match victim.candidate {
AutoImplCandidate(..) => {
bug!(
"default implementations shouldn't be recorded \
when there are other valid candidates");
}
+ // Prefer BuiltinCandidate { has_nested: false } to anything else.
+ // This is a fix for #53123 and prevents winnowing from accidentally extending the
+ // lifetime of a variable.
+ BuiltinCandidate { has_nested: false } => false,
ImplCandidate(..) |
ClosureCandidate |
GeneratorCandidate |
@@ -2072,6 +2081,10 @@
"default implementations shouldn't be recorded \
when there are other valid candidates");
}
+ // Prefer BuiltinCandidate { has_nested: false } to anything else.
+ // This is a fix for #53123 and prevents winnowing from accidentally extending the
+ // lifetime of a variable.
+ BuiltinCandidate { has_nested: false } => false,
ImplCandidate(..) |
ClosureCandidate |
GeneratorCandidate |
@@ -2115,7 +2128,7 @@
FnPointerCandidate |
BuiltinObjectCandidate |
BuiltinUnsizeCandidate |
- BuiltinCandidate { .. } => {
+ BuiltinCandidate { has_nested: true } => {
match victim.candidate {
ParamCandidate(ref cand) => {
// Prefer these to a global where-clause bound
diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs
index 06f9b44..caebcbe 100644
--- a/src/librustc/traits/specialize/mod.rs
+++ b/src/librustc/traits/specialize/mod.rs
@@ -344,7 +344,7 @@
}),
if used_to_be_allowed { " (E0119)" } else { "" }
);
- let impl_span = tcx.sess.codemap().def_span(
+ let impl_span = tcx.sess.source_map().def_span(
tcx.span_of_impl(impl_def_id).unwrap()
);
let mut err = if used_to_be_allowed {
@@ -363,7 +363,7 @@
match tcx.span_of_impl(overlap.with_impl) {
Ok(span) => {
- err.span_label(tcx.sess.codemap().def_span(span),
+ err.span_label(tcx.sess.source_map().def_span(span),
"first implementation here".to_string());
err.span_label(impl_span,
format!("conflicting implementation{}",
diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs
index f9c0581..a765257 100644
--- a/src/librustc/traits/specialize/specialization_graph.rs
+++ b/src/librustc/traits/specialize/specialization_graph.rs
@@ -49,7 +49,7 @@
/// Children of a given impl, grouped into blanket/non-blanket varieties as is
/// done in `TraitDef`.
-#[derive(RustcEncodable, RustcDecodable)]
+#[derive(Default, RustcEncodable, RustcDecodable)]
struct Children {
// Impls of a trait (or specializations of a given impl). To allow for
// quicker lookup, the impls are indexed by a simplified version of their
@@ -81,13 +81,6 @@
}
impl<'a, 'gcx, 'tcx> Children {
- fn new() -> Children {
- Children {
- nonblanket_impls: FxHashMap(),
- blanket_impls: vec![],
- }
- }
-
/// Insert an impl into this set of children without comparing to any existing impls
fn insert_blindly(&mut self,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
@@ -95,7 +88,7 @@
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) {
debug!("insert_blindly: impl_def_id={:?} sty={:?}", impl_def_id, sty);
- self.nonblanket_impls.entry(sty).or_insert(vec![]).push(impl_def_id)
+ self.nonblanket_impls.entry(sty).or_default().push(impl_def_id)
} else {
debug!("insert_blindly: impl_def_id={:?} sty=None", impl_def_id);
self.blanket_impls.push(impl_def_id)
@@ -230,7 +223,7 @@
}
fn filtered(&mut self, sty: SimplifiedType) -> Box<dyn Iterator<Item = DefId> + '_> {
- let nonblanket = self.nonblanket_impls.entry(sty).or_insert(vec![]).iter();
+ let nonblanket = self.nonblanket_impls.entry(sty).or_default().iter();
Box::new(self.blanket_impls.iter().chain(nonblanket).cloned())
}
}
@@ -268,7 +261,7 @@
trait_ref, impl_def_id, trait_def_id);
self.parent.insert(impl_def_id, trait_def_id);
- self.children.entry(trait_def_id).or_insert(Children::new())
+ self.children.entry(trait_def_id).or_default()
.insert_blindly(tcx, impl_def_id);
return Ok(None);
}
@@ -281,7 +274,7 @@
loop {
use self::Inserted::*;
- let insert_result = self.children.entry(parent).or_insert(Children::new())
+ let insert_result = self.children.entry(parent).or_default()
.insert(tcx, impl_def_id, simplified)?;
match insert_result {
@@ -318,9 +311,8 @@
self.parent.insert(impl_def_id, parent);
// Add G as N's child.
- let mut grand_children = Children::new();
- grand_children.insert_blindly(tcx, grand_child_to_be);
- self.children.insert(impl_def_id, grand_children);
+ self.children.entry(impl_def_id).or_default()
+ .insert_blindly(tcx, grand_child_to_be);
break;
}
ShouldRecurseOn(new_parent) => {
@@ -343,7 +335,7 @@
was already present.");
}
- self.children.entry(parent).or_insert(Children::new()).insert_blindly(tcx, child);
+ self.children.entry(parent).or_default().insert_blindly(tcx, child);
}
/// The parent of a given impl, which is the def id of the trait when the
diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs
index 39e3588..9292b42 100644
--- a/src/librustc/traits/structural_impls.rs
+++ b/src/librustc/traits/structural_impls.rs
@@ -203,10 +203,11 @@
super::StructInitializerSized => Some(super::StructInitializerSized),
super::VariableType(id) => Some(super::VariableType(id)),
super::ReturnType(id) => Some(super::ReturnType(id)),
+ super::SizedArgumentType => Some(super::SizedArgumentType),
super::SizedReturnType => Some(super::SizedReturnType),
super::SizedYieldType => Some(super::SizedYieldType),
super::RepeatVec => Some(super::RepeatVec),
- super::FieldSized(item) => Some(super::FieldSized(item)),
+ super::FieldSized { adt_kind, last } => Some(super::FieldSized { adt_kind, last }),
super::ConstSized => Some(super::ConstSized),
super::SharedStatic => Some(super::SharedStatic),
super::BuiltinDerivedObligation(ref cause) => {
diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs
index 875c719..40f13ac 100644
--- a/src/librustc/traits/util.rs
+++ b/src/librustc/traits/util.rs
@@ -239,6 +239,10 @@
impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> {
type Item = ty::Predicate<'tcx>;
+ fn size_hint(&self) -> (usize, Option<usize>) {
+ (self.stack.len(), None)
+ }
+
fn next(&mut self) -> Option<ty::Predicate<'tcx>> {
// Extract next item from top-most stack frame, if any.
let next_predicate = match self.stack.pop() {
diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs
index bb14af2..ef36345 100644
--- a/src/librustc/ty/context.rs
+++ b/src/librustc/ty/context.rs
@@ -73,7 +73,7 @@
use rustc_target::spec::abi;
use syntax::ast::{self, NodeId};
use syntax::attr;
-use syntax::codemap::MultiSpan;
+use syntax::source_map::MultiSpan;
use syntax::edition::Edition;
use syntax::feature_gate;
use syntax::symbol::{Symbol, keywords, InternedString};
@@ -1132,11 +1132,10 @@
None
};
- let mut trait_map = FxHashMap();
+ let mut trait_map: FxHashMap<_, Lrc<FxHashMap<_, _>>> = FxHashMap();
for (k, v) in resolutions.trait_map {
let hir_id = hir.node_to_hir_id(k);
- let map = trait_map.entry(hir_id.owner)
- .or_insert_with(|| Lrc::new(FxHashMap()));
+ let map = trait_map.entry(hir_id.owner).or_default();
Lrc::get_mut(map).unwrap()
.insert(hir_id.local_id,
Lrc::new(StableVec::new(v)));
@@ -1819,7 +1818,7 @@
/// in librustc otherwise
fn span_debug(span: syntax_pos::Span, f: &mut fmt::Formatter) -> fmt::Result {
with(|tcx| {
- write!(f, "{}", tcx.sess.codemap().span_to_string(span))
+ write!(f, "{}", tcx.sess.source_map().span_to_string(span))
})
}
diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs
index bcbd8a5..e23034b 100644
--- a/src/librustc/ty/error.rs
+++ b/src/librustc/ty/error.rs
@@ -13,7 +13,7 @@
use std::fmt;
use rustc_target::spec::abi;
use syntax::ast;
-use errors::DiagnosticBuilder;
+use errors::{Applicability, DiagnosticBuilder};
use syntax_pos::Span;
use hir;
@@ -250,6 +250,21 @@
db.note("no two closures, even if identical, have the same type");
db.help("consider boxing your closure and/or using it as a trait object");
}
+ match (&values.found.sty, &values.expected.sty) { // Issue #53280
+ (ty::TyInfer(ty::IntVar(_)), ty::TyFloat(_)) => {
+ if let Ok(snippet) = self.sess.source_map().span_to_snippet(sp) {
+ if snippet.chars().all(|c| c.is_digit(10) || c == '-' || c == '_') {
+ db.span_suggestion_with_applicability(
+ sp,
+ "use a float literal",
+ format!("{}.0", snippet),
+ Applicability::MachineApplicable
+ );
+ }
+ }
+ },
+ _ => {}
+ }
},
OldStyleLUB(err) => {
db.note("this was previously accepted by the compiler but has been phased out");
diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs
index 19e5406..0ace44d 100644
--- a/src/librustc/ty/inhabitedness/mod.rs
+++ b/src/librustc/ty/inhabitedness/mod.rs
@@ -228,7 +228,7 @@
match self.sty {
TyAdt(def, substs) => {
{
- let substs_set = visited.entry(def.did).or_insert(FxHashSet::default());
+ let substs_set = visited.entry(def.did).or_default();
if !substs_set.insert(substs) {
// We are already calculating the inhabitedness of this type.
// The type must contain a reference to itself. Break the
diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs
index 66edbef..7329f48 100644
--- a/src/librustc/ty/instance.rs
+++ b/src/librustc/ty/instance.rs
@@ -294,7 +294,7 @@
})
}
traits::VtableBuiltin(..) => {
- if let Some(_) = tcx.lang_items().clone_trait() {
+ if tcx.lang_items().clone_trait().is_some() {
Some(Instance {
def: ty::InstanceDef::CloneShim(def_id, trait_ref.self_ty()),
substs: rcvr_substs
diff --git a/src/librustc/ty/item_path.rs b/src/librustc/ty/item_path.rs
index c44b732..593470b 100644
--- a/src/librustc/ty/item_path.rs
+++ b/src/librustc/ty/item_path.rs
@@ -336,7 +336,7 @@
self.push_item_path(buffer, parent_def_id);
let node_id = self.hir.as_local_node_id(impl_def_id).unwrap();
let item = self.hir.expect_item(node_id);
- let span_str = self.sess.codemap().span_to_string(item.span);
+ let span_str = self.sess.source_map().span_to_string(item.span);
buffer.push(&format!("<impl at {}>", span_str));
}
diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs
index 81cc897..0da4d5d 100644
--- a/src/librustc/ty/layout.rs
+++ b/src/librustc/ty/layout.rs
@@ -466,7 +466,7 @@
let univariant = |fields: &[TyLayout], repr: &ReprOptions, kind| {
Ok(tcx.intern_layout(univariant_uninterned(fields, repr, kind)?))
};
- assert!(!ty.has_infer_types());
+ debug_assert!(!ty.has_infer_types());
Ok(match ty.sty {
// Basic scalars.
@@ -1283,7 +1283,7 @@
tcx: TyCtxt<'a, 'tcx, 'tcx>,
param_env: ty::ParamEnv<'tcx>)
-> Result<SizeSkeleton<'tcx>, LayoutError<'tcx>> {
- assert!(!ty.has_infer_types());
+ debug_assert!(!ty.has_infer_types());
// First try computing a static layout.
let err = match tcx.layout_of(param_env.and(ty)) {
@@ -1300,7 +1300,7 @@
let tail = tcx.struct_tail(pointee);
match tail.sty {
ty::TyParam(_) | ty::TyProjection(_) => {
- assert!(tail.has_param_types() || tail.has_self_ty());
+ debug_assert!(tail.has_param_types() || tail.has_self_ty());
Ok(SizeSkeleton::Pointer {
non_zero,
tail: tcx.erase_regions(&tail)
diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs
index 4fda3bd..6c27d52 100644
--- a/src/librustc/ty/mod.rs
+++ b/src/librustc/ty/mod.rs
@@ -18,7 +18,7 @@
use hir::def::{Def, CtorKind, ExportMap};
use hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
use hir::map::DefPathData;
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use ich::Fingerprint;
use ich::StableHashingContext;
use infer::canonical::Canonical;
@@ -37,6 +37,7 @@
use util::captures::Captures;
use util::nodemap::{NodeSet, DefIdMap, FxHashMap};
use arena::SyncDroplessArena;
+use session::DataTypeKind;
use serialize::{self, Encodable, Encoder};
use std::cell::RefCell;
@@ -51,7 +52,7 @@
use syntax::ast::{self, DUMMY_NODE_ID, Name, Ident, NodeId};
use syntax::attr;
use syntax::ext::hygiene::Mark;
-use syntax::symbol::{Symbol, LocalInternedString, InternedString};
+use syntax::symbol::{keywords, Symbol, LocalInternedString, InternedString};
use syntax_pos::{DUMMY_SP, Span};
use rustc_data_structures::accumulate_vec::IntoIter as AccIntoIter;
@@ -824,6 +825,12 @@
pub fn to_bound_region(&self) -> ty::BoundRegion {
ty::BoundRegion::BrNamed(self.def_id, self.name)
}
+
+ /// Does this early bound region have a name? Early bound regions normally
+ /// always have names except when using anonymous lifetimes (`'_`).
+ pub fn has_name(&self) -> bool {
+ self.name != keywords::UnderscoreLifetime.name().as_interned_str()
+ }
}
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
@@ -1810,6 +1817,16 @@
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum AdtKind { Struct, Union, Enum }
+impl Into<DataTypeKind> for AdtKind {
+ fn into(self) -> DataTypeKind {
+ match self {
+ AdtKind::Struct => DataTypeKind::Struct,
+ AdtKind::Union => DataTypeKind::Union,
+ AdtKind::Enum => DataTypeKind::Enum,
+ }
+ }
+}
+
bitflags! {
#[derive(RustcEncodable, RustcDecodable, Default)]
pub struct ReprFlags: u8 {
diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs
index 3508012..ef22ebe 100644
--- a/src/librustc/ty/query/mod.rs
+++ b/src/librustc/ty/query/mod.rs
@@ -13,7 +13,7 @@
use hir::def_id::{CrateNum, DefId, DefIndex};
use hir::def::{Def, Export};
use hir::{self, TraitCandidate, ItemLocalId, CodegenFnAttrs};
-use hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use infer::canonical::{self, Canonical};
use lint;
use middle::borrowck::BorrowCheckResult;
diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs
index aa42b40..6e16d92 100644
--- a/src/librustc/ty/query/on_disk_cache.rs
+++ b/src/librustc/ty/query/on_disk_cache.rs
@@ -14,7 +14,7 @@
use hir::def_id::{CrateNum, DefIndex, DefId, LocalDefId,
RESERVED_FOR_INCR_COMP_CACHE, LOCAL_CRATE};
use hir::map::definitions::DefPathHash;
-use ich::{CachingCodemapView, Fingerprint};
+use ich::{CachingSourceMapView, Fingerprint};
use mir::{self, interpret};
use mir::interpret::{AllocDecodingSession, AllocDecodingState};
use rustc_data_structures::fx::FxHashMap;
@@ -26,8 +26,8 @@
use session::{CrateDisambiguator, Session};
use std::mem;
use syntax::ast::NodeId;
-use syntax::codemap::{CodeMap, StableFilemapId};
-use syntax_pos::{BytePos, Span, DUMMY_SP, FileMap};
+use syntax::source_map::{SourceMap, StableFilemapId};
+use syntax_pos::{BytePos, Span, DUMMY_SP, SourceFile};
use syntax_pos::hygiene::{Mark, SyntaxContext, ExpnInfo};
use ty;
use ty::codec::{self as ty_codec, TyDecoder, TyEncoder};
@@ -62,11 +62,11 @@
prev_cnums: Vec<(u32, String, CrateDisambiguator)>,
cnum_map: Once<IndexVec<CrateNum, Option<CrateNum>>>,
- codemap: &'sess CodeMap,
- file_index_to_stable_id: FxHashMap<FileMapIndex, StableFilemapId>,
+ source_map: &'sess SourceMap,
+ file_index_to_stable_id: FxHashMap<SourceFileIndex, StableFilemapId>,
// These two fields caches that are populated lazily during decoding.
- file_index_to_file: Lock<FxHashMap<FileMapIndex, Lrc<FileMap>>>,
+ file_index_to_file: Lock<FxHashMap<SourceFileIndex, Lrc<SourceFile>>>,
synthetic_expansion_infos: Lock<FxHashMap<AbsoluteBytePos, SyntaxContext>>,
// A map from dep-node to the position of the cached query result in
@@ -83,7 +83,7 @@
// This type is used only for (de-)serialization.
#[derive(RustcEncodable, RustcDecodable)]
struct Footer {
- file_index_to_stable_id: FxHashMap<FileMapIndex, StableFilemapId>,
+ file_index_to_stable_id: FxHashMap<SourceFileIndex, StableFilemapId>,
prev_cnums: Vec<(u32, String, CrateDisambiguator)>,
query_result_index: EncodedQueryResultIndex,
diagnostics_index: EncodedQueryResultIndex,
@@ -96,7 +96,7 @@
type EncodedDiagnostics = Vec<Diagnostic>;
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug, RustcEncodable, RustcDecodable)]
-struct FileMapIndex(u32);
+struct SourceFileIndex(u32);
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq, RustcEncodable, RustcDecodable)]
struct AbsoluteBytePos(u32);
@@ -140,7 +140,7 @@
file_index_to_file: Lock::new(FxHashMap()),
prev_cnums: footer.prev_cnums,
cnum_map: Once::new(),
- codemap: sess.codemap(),
+ source_map: sess.source_map(),
current_diagnostics: Lock::new(FxHashMap()),
query_result_index: footer.query_result_index.into_iter().collect(),
prev_diagnostics_index: footer.diagnostics_index.into_iter().collect(),
@@ -149,14 +149,14 @@
}
}
- pub fn new_empty(codemap: &'sess CodeMap) -> OnDiskCache<'sess> {
+ pub fn new_empty(source_map: &'sess SourceMap) -> OnDiskCache<'sess> {
OnDiskCache {
serialized_data: Vec::new(),
file_index_to_stable_id: FxHashMap(),
file_index_to_file: Lock::new(FxHashMap()),
prev_cnums: vec![],
cnum_map: Once::new(),
- codemap,
+ source_map,
current_diagnostics: Lock::new(FxHashMap()),
query_result_index: FxHashMap(),
prev_diagnostics_index: FxHashMap(),
@@ -173,14 +173,14 @@
{
// Serializing the DepGraph should not modify it:
tcx.dep_graph.with_ignore(|| {
- // Allocate FileMapIndices
+ // Allocate SourceFileIndices
let (file_to_file_index, file_index_to_stable_id) = {
let mut file_to_file_index = FxHashMap();
let mut file_index_to_stable_id = FxHashMap();
- for (index, file) in tcx.sess.codemap().files().iter().enumerate() {
- let index = FileMapIndex(index as u32);
- let file_ptr: *const FileMap = &**file as *const _;
+ for (index, file) in tcx.sess.source_map().files().iter().enumerate() {
+ let index = SourceFileIndex(index as u32);
+ let file_ptr: *const SourceFile = &**file as *const _;
file_to_file_index.insert(file_ptr, index);
file_index_to_stable_id.insert(index, StableFilemapId::new(&file));
}
@@ -196,7 +196,7 @@
expn_info_shorthands: FxHashMap(),
interpret_allocs: FxHashMap(),
interpret_allocs_inverse: Vec::new(),
- codemap: CachingCodemapView::new(tcx.sess.codemap()),
+ source_map: CachingSourceMapView::new(tcx.sess.source_map()),
file_to_file_index,
};
@@ -413,7 +413,7 @@
let mut decoder = CacheDecoder {
tcx,
opaque: opaque::Decoder::new(&self.serialized_data[..], pos.to_usize()),
- codemap: self.codemap,
+ source_map: self.source_map,
cnum_map: self.cnum_map.get(),
file_index_to_file: &self.file_index_to_file,
file_index_to_stable_id: &self.file_index_to_stable_id,
@@ -475,27 +475,27 @@
struct CacheDecoder<'a, 'tcx: 'a, 'x> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
opaque: opaque::Decoder<'x>,
- codemap: &'x CodeMap,
+ source_map: &'x SourceMap,
cnum_map: &'x IndexVec<CrateNum, Option<CrateNum>>,
synthetic_expansion_infos: &'x Lock<FxHashMap<AbsoluteBytePos, SyntaxContext>>,
- file_index_to_file: &'x Lock<FxHashMap<FileMapIndex, Lrc<FileMap>>>,
- file_index_to_stable_id: &'x FxHashMap<FileMapIndex, StableFilemapId>,
+ file_index_to_file: &'x Lock<FxHashMap<SourceFileIndex, Lrc<SourceFile>>>,
+ file_index_to_stable_id: &'x FxHashMap<SourceFileIndex, StableFilemapId>,
alloc_decoding_session: AllocDecodingSession<'x>,
}
impl<'a, 'tcx, 'x> CacheDecoder<'a, 'tcx, 'x> {
- fn file_index_to_file(&self, index: FileMapIndex) -> Lrc<FileMap> {
+ fn file_index_to_file(&self, index: SourceFileIndex) -> Lrc<SourceFile> {
let CacheDecoder {
ref file_index_to_file,
ref file_index_to_stable_id,
- ref codemap,
+ ref source_map,
..
} = *self;
file_index_to_file.borrow_mut().entry(index).or_insert_with(|| {
let stable_id = file_index_to_stable_id[&index];
- codemap.filemap_by_stable_id(stable_id)
- .expect("Failed to lookup FileMap in new context.")
+ source_map.source_file_by_stable_id(stable_id)
+ .expect("Failed to lookup SourceFile in new context.")
}).clone()
}
}
@@ -617,7 +617,7 @@
debug_assert_eq!(tag, TAG_VALID_SPAN);
}
- let file_lo_index = FileMapIndex::decode(self)?;
+ let file_lo_index = SourceFileIndex::decode(self)?;
let line_lo = usize::decode(self)?;
let col_lo = BytePos::decode(self)?;
let len = BytePos::decode(self)?;
@@ -770,15 +770,15 @@
expn_info_shorthands: FxHashMap<Mark, AbsoluteBytePos>,
interpret_allocs: FxHashMap<interpret::AllocId, usize>,
interpret_allocs_inverse: Vec<interpret::AllocId>,
- codemap: CachingCodemapView<'tcx>,
- file_to_file_index: FxHashMap<*const FileMap, FileMapIndex>,
+ source_map: CachingSourceMapView<'tcx>,
+ file_to_file_index: FxHashMap<*const SourceFile, SourceFileIndex>,
}
impl<'enc, 'a, 'tcx, E> CacheEncoder<'enc, 'a, 'tcx, E>
where E: 'enc + ty_codec::TyEncoder
{
- fn filemap_index(&mut self, filemap: Lrc<FileMap>) -> FileMapIndex {
- self.file_to_file_index[&(&*filemap as *const FileMap)]
+ fn source_file_index(&mut self, source_file: Lrc<SourceFile>) -> SourceFileIndex {
+ self.file_to_file_index[&(&*source_file as *const SourceFile)]
}
/// Encode something with additional information that allows to do some
@@ -836,7 +836,7 @@
return TAG_INVALID_SPAN.encode(self);
}
- let (file_lo, line_lo, col_lo) = match self.codemap
+ let (file_lo, line_lo, col_lo) = match self.source_map
.byte_pos_to_line_and_col(span_data.lo) {
Some(pos) => pos,
None => {
@@ -850,10 +850,10 @@
let len = span_data.hi - span_data.lo;
- let filemap_index = self.filemap_index(file_lo);
+ let source_file_index = self.source_file_index(file_lo);
TAG_VALID_SPAN.encode(self)?;
- filemap_index.encode(self)?;
+ source_file_index.encode(self)?;
line_lo.encode(self)?;
col_lo.encode(self)?;
len.encode(self)?;
diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs
index f59e48c..bf721dd 100644
--- a/src/librustc/ty/query/plumbing.rs
+++ b/src/librustc/ty/query/plumbing.rs
@@ -32,7 +32,7 @@
use std::ptr;
use std::collections::hash_map::Entry;
use syntax_pos::Span;
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::DUMMY_SP;
pub struct QueryCache<'tcx, D: QueryConfig<'tcx> + ?Sized> {
pub(super) results: FxHashMap<D::Key, QueryValue<D::Value>>,
@@ -251,7 +251,7 @@
assert!(!stack.is_empty());
let fix_span = |span: Span, query: &Query<'gcx>| {
- self.sess.codemap().def_span(query.default_span(self, span))
+ self.sess.source_map().def_span(query.default_span(self, span))
};
// Disable naming impls with types in this path, since that
@@ -299,7 +299,7 @@
i,
query.info.query.name(),
query.info.query.describe(icx.tcx)));
- db.set_span(icx.tcx.sess.codemap().def_span(query.info.span));
+ db.set_span(icx.tcx.sess.source_map().def_span(query.info.span));
icx.tcx.sess.diagnostic().force_print_db(db);
current_query = query.parent.clone();
diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs
index 96b4edc..226388c 100644
--- a/src/librustc/ty/sty.rs
+++ b/src/librustc/ty/sty.rs
@@ -708,7 +708,7 @@
pub fn with_self_ty(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>, self_ty: Ty<'tcx>)
-> ty::TraitRef<'tcx> {
// otherwise the escaping regions would be captured by the binder
- assert!(!self_ty.has_escaping_regions());
+ debug_assert!(!self_ty.has_escaping_regions());
ty::TraitRef {
def_id: self.def_id,
@@ -753,7 +753,7 @@
pub fn dummy<'tcx>(value: T) -> Binder<T>
where T: TypeFoldable<'tcx>
{
- assert!(!value.has_escaping_regions());
+ debug_assert!(!value.has_escaping_regions());
Binder(value)
}
@@ -1247,7 +1247,7 @@
-> ty::ProjectionPredicate<'tcx>
{
// otherwise the escaping regions would be captured by the binders
- assert!(!self_ty.has_escaping_regions());
+ debug_assert!(!self_ty.has_escaping_regions());
ty::ProjectionPredicate {
projection_ty: ty::ProjectionTy {
@@ -1852,6 +1852,41 @@
_ => bug!("cannot convert type `{:?}` to a closure kind", self),
}
}
+
+ /// Fast path helper for testing if a type is `Sized`.
+ ///
+ /// Returning true means the type is known to be sized. Returning
+ /// `false` means nothing -- could be sized, might not be.
+ pub fn is_trivially_sized(&self, tcx: TyCtxt<'_, '_, 'tcx>) -> bool {
+ match self.sty {
+ ty::TyInfer(ty::IntVar(_)) | ty::TyInfer(ty::FloatVar(_)) |
+ ty::TyUint(_) | ty::TyInt(_) | ty::TyBool | ty::TyFloat(_) |
+ ty::TyFnDef(..) | ty::TyFnPtr(_) | ty::TyRawPtr(..) |
+ ty::TyChar | ty::TyRef(..) | ty::TyGenerator(..) |
+ ty::TyGeneratorWitness(..) | ty::TyArray(..) | ty::TyClosure(..) |
+ ty::TyNever | ty::TyError =>
+ true,
+
+ ty::TyStr | ty::TySlice(_) | ty::TyDynamic(..) | ty::TyForeign(..) =>
+ false,
+
+ ty::TyTuple(tys) =>
+ tys.iter().all(|ty| ty.is_trivially_sized(tcx)),
+
+ ty::TyAdt(def, _substs) =>
+ def.sized_constraint(tcx).is_empty(),
+
+ ty::TyProjection(_) | ty::TyParam(_) | ty::TyAnon(..) => false,
+
+ ty::TyInfer(ty::TyVar(_)) => false,
+
+ ty::TyInfer(ty::CanonicalTy(_)) |
+ ty::TyInfer(ty::FreshTy(_)) |
+ ty::TyInfer(ty::FreshIntTy(_)) |
+ ty::TyInfer(ty::FreshFloatTy(_)) =>
+ bug!("is_trivially_sized applied to unexpected type: {:?}", self),
+ }
+ }
}
/// Typed constant value.
diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs
index 32f0d33..6332080 100644
--- a/src/librustc/ty/trait_def.rs
+++ b/src/librustc/ty/trait_def.rs
@@ -41,6 +41,7 @@
pub def_path_hash: DefPathHash,
}
+#[derive(Default)]
pub struct TraitImpls {
blanket_impls: Vec<DefId>,
/// Impls indexed by their simplified self-type, for fast lookup.
@@ -143,47 +144,43 @@
pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
trait_id: DefId)
-> Lrc<TraitImpls> {
- let mut remote_impls = Vec::new();
+ let mut impls = TraitImpls::default();
- // Traits defined in the current crate can't have impls in upstream
- // crates, so we don't bother querying the cstore.
- if !trait_id.is_local() {
- for &cnum in tcx.crates().iter() {
- let impls = tcx.implementations_of_trait((cnum, trait_id));
- remote_impls.extend(impls.iter().cloned());
+ {
+ let mut add_impl = |impl_def_id| {
+ let impl_self_ty = tcx.type_of(impl_def_id);
+ if impl_def_id.is_local() && impl_self_ty.references_error() {
+ return;
+ }
+
+ if let Some(simplified_self_ty) =
+ fast_reject::simplify_type(tcx, impl_self_ty, false)
+ {
+ impls.non_blanket_impls
+ .entry(simplified_self_ty)
+ .or_default()
+ .push(impl_def_id);
+ } else {
+ impls.blanket_impls.push(impl_def_id);
+ }
+ };
+
+ // Traits defined in the current crate can't have impls in upstream
+ // crates, so we don't bother querying the cstore.
+ if !trait_id.is_local() {
+ for &cnum in tcx.crates().iter() {
+ for &def_id in tcx.implementations_of_trait((cnum, trait_id)).iter() {
+ add_impl(def_id);
+ }
+ }
+ }
+
+ for &node_id in tcx.hir.trait_impls(trait_id) {
+ add_impl(tcx.hir.local_def_id(node_id));
}
}
- let mut blanket_impls = Vec::new();
- let mut non_blanket_impls = FxHashMap();
-
- let local_impls = tcx.hir
- .trait_impls(trait_id)
- .into_iter()
- .map(|&node_id| tcx.hir.local_def_id(node_id));
-
- for impl_def_id in local_impls.chain(remote_impls.into_iter()) {
- let impl_self_ty = tcx.type_of(impl_def_id);
- if impl_def_id.is_local() && impl_self_ty.references_error() {
- continue
- }
-
- if let Some(simplified_self_ty) =
- fast_reject::simplify_type(tcx, impl_self_ty, false)
- {
- non_blanket_impls
- .entry(simplified_self_ty)
- .or_insert(vec![])
- .push(impl_def_id);
- } else {
- blanket_impls.push(impl_def_id);
- }
- }
-
- Lrc::new(TraitImpls {
- blanket_impls: blanket_impls,
- non_blanket_impls: non_blanket_impls,
- })
+ Lrc::new(impls)
}
impl<'a> HashStable<StableHashingContext<'a>> for TraitImpls {
diff --git a/src/librustc/util/bug.rs b/src/librustc/util/bug.rs
new file mode 100644
index 0000000..f2593e4
--- /dev/null
+++ b/src/librustc/util/bug.rs
@@ -0,0 +1,51 @@
+// 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.
+
+// These functions are used by macro expansion for bug! and span_bug!
+
+use ty::tls;
+use std::fmt;
+use syntax_pos::{Span, MultiSpan};
+
+#[cold]
+#[inline(never)]
+pub fn bug_fmt(file: &'static str, line: u32, args: fmt::Arguments) -> ! {
+ // this wrapper mostly exists so I don't have to write a fully
+ // qualified path of None::<Span> inside the bug!() macro definition
+ opt_span_bug_fmt(file, line, None::<Span>, args);
+}
+
+#[cold]
+#[inline(never)]
+pub fn span_bug_fmt<S: Into<MultiSpan>>(
+ file: &'static str,
+ line: u32,
+ span: S,
+ args: fmt::Arguments,
+) -> ! {
+ opt_span_bug_fmt(file, line, Some(span), args);
+}
+
+fn opt_span_bug_fmt<S: Into<MultiSpan>>(
+ file: &'static str,
+ line: u32,
+ span: Option<S>,
+ args: fmt::Arguments,
+) -> ! {
+ tls::with_opt(move |tcx| {
+ let msg = format!("{}:{}: {}", file, line, args);
+ match (tcx, span) {
+ (Some(tcx), Some(span)) => tcx.sess.diagnostic().span_bug(span, &msg),
+ (Some(tcx), None) => tcx.sess.diagnostic().bug(&msg),
+ (None, _) => panic!(msg),
+ }
+ });
+ unreachable!();
+}
diff --git a/src/librustc/util/common.rs b/src/librustc/util/common.rs
index 990fbc4..1ec025f 100644
--- a/src/librustc/util/common.rs
+++ b/src/librustc/util/common.rs
@@ -14,12 +14,10 @@
use std::cell::{RefCell, Cell};
use std::collections::HashMap;
-use std::ffi::CString;
use std::fmt::Debug;
use std::hash::{Hash, BuildHasher};
use std::panic;
use std::env;
-use std::path::Path;
use std::time::{Duration, Instant};
use std::sync::mpsc::{Sender};
@@ -376,19 +374,6 @@
}
}
-#[cfg(unix)]
-pub fn path2cstr(p: &Path) -> CString {
- use std::os::unix::prelude::*;
- use std::ffi::OsStr;
- let p: &OsStr = p.as_ref();
- CString::new(p.as_bytes()).unwrap()
-}
-#[cfg(windows)]
-pub fn path2cstr(p: &Path) -> CString {
- CString::new(p.to_str().unwrap()).unwrap()
-}
-
-
#[test]
fn test_to_readable_str() {
assert_eq!("0", to_readable_str(0));
diff --git a/src/librustc/util/fs.rs b/src/librustc/util/fs.rs
deleted file mode 100644
index 090753b..0000000
--- a/src/librustc/util/fs.rs
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2015 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.
-
-use std::path::{self, Path, PathBuf};
-use std::ffi::OsString;
-use std::fs;
-use std::io;
-
-// Unfortunately, on windows, it looks like msvcrt.dll is silently translating
-// verbatim paths under the hood to non-verbatim paths! This manifests itself as
-// gcc looking like it cannot accept paths of the form `\\?\C:\...`, but the
-// real bug seems to lie in msvcrt.dll.
-//
-// Verbatim paths are generally pretty rare, but the implementation of
-// `fs::canonicalize` currently generates paths of this form, meaning that we're
-// going to be passing quite a few of these down to gcc, so we need to deal with
-// this case.
-//
-// For now we just strip the "verbatim prefix" of `\\?\` from the path. This
-// will probably lose information in some cases, but there's not a whole lot
-// more we can do with a buggy msvcrt...
-//
-// For some more information, see this comment:
-// https://github.com/rust-lang/rust/issues/25505#issuecomment-102876737
-pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
- if !cfg!(windows) {
- return p.to_path_buf();
- }
- let mut components = p.components();
- let prefix = match components.next() {
- Some(path::Component::Prefix(p)) => p,
- _ => return p.to_path_buf(),
- };
- match prefix.kind() {
- path::Prefix::VerbatimDisk(disk) => {
- let mut base = OsString::from(format!("{}:", disk as char));
- base.push(components.as_path());
- PathBuf::from(base)
- }
- path::Prefix::VerbatimUNC(server, share) => {
- let mut base = OsString::from(r"\\");
- base.push(server);
- base.push(r"\");
- base.push(share);
- base.push(components.as_path());
- PathBuf::from(base)
- }
- _ => p.to_path_buf(),
- }
-}
-
-pub enum LinkOrCopy {
- Link,
- Copy,
-}
-
-/// Copy `p` into `q`, preferring to use hard-linking if possible. If
-/// `q` already exists, it is removed first.
-/// The result indicates which of the two operations has been performed.
-pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<LinkOrCopy> {
- let p = p.as_ref();
- let q = q.as_ref();
- if q.exists() {
- fs::remove_file(&q)?;
- }
-
- match fs::hard_link(p, q) {
- Ok(()) => Ok(LinkOrCopy::Link),
- Err(_) => {
- match fs::copy(p, q) {
- Ok(_) => Ok(LinkOrCopy::Copy),
- Err(e) => Err(e),
- }
- }
- }
-}
-
-#[derive(Debug)]
-pub enum RenameOrCopyRemove {
- Rename,
- CopyRemove,
-}
-
-/// Rename `p` into `q`, preferring to use `rename` if possible.
-/// If `rename` fails (rename may fail for reasons such as crossing
-/// filesystem), fallback to copy & remove
-pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P,
- q: Q)
- -> io::Result<RenameOrCopyRemove> {
- let p = p.as_ref();
- let q = q.as_ref();
- match fs::rename(p, q) {
- Ok(()) => Ok(RenameOrCopyRemove::Rename),
- Err(_) => {
- match fs::copy(p, q) {
- Ok(_) => {
- fs::remove_file(p)?;
- Ok(RenameOrCopyRemove::CopyRemove)
- }
- Err(e) => Err(e),
- }
- }
- }
-}
diff --git a/src/librustc_allocator/Cargo.toml b/src/librustc_allocator/Cargo.toml
index 1cbde18..83a918f 100644
--- a/src/librustc_allocator/Cargo.toml
+++ b/src/librustc_allocator/Cargo.toml
@@ -10,6 +10,7 @@
[dependencies]
rustc = { path = "../librustc" }
+rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_target = { path = "../librustc_target" }
syntax = { path = "../libsyntax" }
diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs
index 0584385..da60f41 100644
--- a/src/librustc_allocator/expand.rs
+++ b/src/librustc_allocator/expand.rs
@@ -9,6 +9,7 @@
// except according to those terms.
use rustc::middle::allocator::AllocatorKind;
+use rustc_data_structures::small_vec::OneVector;
use rustc_errors;
use syntax::{
ast::{
@@ -16,7 +17,7 @@
Mac, Mod, Mutability, Ty, TyKind, Unsafety, VisibilityKind,
},
attr,
- codemap::{
+ source_map::{
respan, ExpnInfo, MacroAttribute,
},
ext::{
@@ -28,8 +29,7 @@
fold::{self, Folder},
parse::ParseSess,
ptr::P,
- symbol::Symbol,
- util::small_vector::SmallVector,
+ symbol::Symbol
};
use syntax_pos::Span;
@@ -65,7 +65,7 @@
}
impl<'a> Folder for ExpandAllocatorDirectives<'a> {
- fn fold_item(&mut self, item: P<Item>) -> SmallVector<P<Item>> {
+ fn fold_item(&mut self, item: P<Item>) -> OneVector<P<Item>> {
debug!("in submodule {}", self.in_submod);
let name = if attr::contains_name(&item.attrs, "global_allocator") {
@@ -78,20 +78,20 @@
_ => {
self.handler
.span_err(item.span, "allocators must be statics");
- return SmallVector::one(item);
+ return OneVector::one(item);
}
}
if self.in_submod > 0 {
self.handler
.span_err(item.span, "`global_allocator` cannot be used in submodules");
- return SmallVector::one(item);
+ return OneVector::one(item);
}
if self.found {
self.handler
.span_err(item.span, "cannot define more than one #[global_allocator]");
- return SmallVector::one(item);
+ return OneVector::one(item);
}
self.found = true;
@@ -152,7 +152,7 @@
let module = f.cx.monotonic_expander().fold_item(module).pop().unwrap();
// Return the item and new submodule
- let mut ret = SmallVector::with_capacity(2);
+ let mut ret = OneVector::with_capacity(2);
ret.push(item);
ret.push(module);
diff --git a/src/librustc_allocator/lib.rs b/src/librustc_allocator/lib.rs
index b217d36..d020fe9 100644
--- a/src/librustc_allocator/lib.rs
+++ b/src/librustc_allocator/lib.rs
@@ -8,10 +8,12 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_private)]
#[macro_use] extern crate log;
extern crate rustc;
+extern crate rustc_data_structures;
extern crate rustc_errors;
extern crate rustc_target;
extern crate syntax;
diff --git a/src/librustc_apfloat/ieee.rs b/src/librustc_apfloat/ieee.rs
index b21448d..87d59d2 100644
--- a/src/librustc_apfloat/ieee.rs
+++ b/src/librustc_apfloat/ieee.rs
@@ -536,23 +536,21 @@
// Check whether we should use scientific notation.
let scientific = if width == 0 {
true
+ } else if exp >= 0 {
+ // 765e3 --> 765000
+ // ^^^
+ // But we shouldn't make the number look more precise than it is.
+ exp as usize > width || digits + exp as usize > precision
} else {
- if exp >= 0 {
- // 765e3 --> 765000
- // ^^^
- // But we shouldn't make the number look more precise than it is.
- exp as usize > width || digits + exp as usize > precision
+ // Power of the most significant digit.
+ let msd = exp + (digits - 1) as ExpInt;
+ if msd >= 0 {
+ // 765e-2 == 7.65
+ false
} else {
- // Power of the most significant digit.
- let msd = exp + (digits - 1) as ExpInt;
- if msd >= 0 {
- // 765e-2 == 7.65
- false
- } else {
- // 765e-5 == 0.00765
- // ^ ^^
- -msd as usize > width
- }
+ // 765e-5 == 0.00765
+ // ^ ^^
+ -msd as usize > width
}
};
@@ -702,7 +700,7 @@
// exponent = 1..10
// significand = 1..1
IeeeFloat {
- sig: [!0 & ((1 << S::PRECISION) - 1)],
+ sig: [(1 << S::PRECISION) - 1],
exp: S::MAX_EXP,
category: Category::Normal,
sign: false,
@@ -1507,10 +1505,11 @@
}
// If this is a truncation, perform the shift.
- let mut loss = Loss::ExactlyZero;
- if shift < 0 && (r.is_finite_non_zero() || r.category == Category::NaN) {
- loss = sig::shift_right(&mut r.sig, &mut 0, -shift as usize);
- }
+ let loss = if shift < 0 && (r.is_finite_non_zero() || r.category == Category::NaN) {
+ sig::shift_right(&mut r.sig, &mut 0, -shift as usize)
+ } else {
+ Loss::ExactlyZero
+ };
// If this is an extension, perform the shift.
if shift > 0 && (r.is_finite_non_zero() || r.category == Category::NaN) {
@@ -1738,27 +1737,25 @@
bit_pos -= 4;
if bit_pos >= 0 {
r.sig[0] |= (hex_value as Limb) << bit_pos;
- } else {
- // If zero or one-half (the hexadecimal digit 8) are followed
- // by non-zero, they're a little more than zero or one-half.
- if let Some(ref mut loss) = loss {
- if hex_value != 0 {
- if *loss == Loss::ExactlyZero {
- *loss = Loss::LessThanHalf;
- }
- if *loss == Loss::ExactlyHalf {
- *loss = Loss::MoreThanHalf;
- }
+ // If zero or one-half (the hexadecimal digit 8) are followed
+ // by non-zero, they're a little more than zero or one-half.
+ } else if let Some(ref mut loss) = loss {
+ if hex_value != 0 {
+ if *loss == Loss::ExactlyZero {
+ *loss = Loss::LessThanHalf;
}
- } else {
- loss = Some(match hex_value {
- 0 => Loss::ExactlyZero,
- 1..=7 => Loss::LessThanHalf,
- 8 => Loss::ExactlyHalf,
- 9..=15 => Loss::MoreThanHalf,
- _ => unreachable!(),
- });
+ if *loss == Loss::ExactlyHalf {
+ *loss = Loss::MoreThanHalf;
+ }
}
+ } else {
+ loss = Some(match hex_value {
+ 0 => Loss::ExactlyZero,
+ 1..=7 => Loss::LessThanHalf,
+ 8 => Loss::ExactlyHalf,
+ 9..=15 => Loss::MoreThanHalf,
+ _ => unreachable!(),
+ });
}
} else if c == 'p' || c == 'P' {
if !any_digits {
@@ -2309,24 +2306,14 @@
/// One, not zero, based LSB. That is, returns 0 for a zeroed significand.
pub(super) fn olsb(limbs: &[Limb]) -> usize {
- for i in 0..limbs.len() {
- if limbs[i] != 0 {
- return i * LIMB_BITS + limbs[i].trailing_zeros() as usize + 1;
- }
- }
-
- 0
+ limbs.iter().enumerate().find(|(_, &limb)| limb != 0).map_or(0,
+ |(i, limb)| i * LIMB_BITS + limb.trailing_zeros() as usize + 1)
}
/// One, not zero, based MSB. That is, returns 0 for a zeroed significand.
pub(super) fn omsb(limbs: &[Limb]) -> usize {
- for i in (0..limbs.len()).rev() {
- if limbs[i] != 0 {
- return (i + 1) * LIMB_BITS - limbs[i].leading_zeros() as usize;
- }
- }
-
- 0
+ limbs.iter().enumerate().rfind(|(_, &limb)| limb != 0).map_or(0,
+ |(i, limb)| (i + 1) * LIMB_BITS - limb.leading_zeros() as usize)
}
/// Comparison (unsigned) of two significands.
@@ -2378,7 +2365,7 @@
limb = dst[i - jump];
if shift > 0 {
limb <<= shift;
- if i >= jump + 1 {
+ if i > jump {
limb |= dst[i - jump - 1] >> (LIMB_BITS - shift);
}
}
@@ -2448,7 +2435,7 @@
let n = dst_limbs * LIMB_BITS - shift;
if n < src_bits {
let mask = (1 << (src_bits - n)) - 1;
- dst[dst_limbs - 1] |= (src[dst_limbs] & mask) << n % LIMB_BITS;
+ dst[dst_limbs - 1] |= (src[dst_limbs] & mask) << (n % LIMB_BITS);
} else if n > src_bits && src_bits % LIMB_BITS > 0 {
dst[dst_limbs - 1] &= (1 << (src_bits % LIMB_BITS)) - 1;
}
diff --git a/src/librustc_apfloat/lib.rs b/src/librustc_apfloat/lib.rs
index 0843880..d6e821d 100644
--- a/src/librustc_apfloat/lib.rs
+++ b/src/librustc_apfloat/lib.rs
@@ -45,6 +45,7 @@
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![forbid(unsafe_code)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(try_from)]
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
#[allow(unused_extern_crates)]
diff --git a/src/librustc_asan/lib.rs b/src/librustc_asan/lib.rs
index 0c78fd7..b3ba86a 100644
--- a/src/librustc_asan/lib.rs
+++ b/src/librustc_asan/lib.rs
@@ -10,6 +10,7 @@
#![sanitizer_runtime]
#![feature(alloc_system)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs
index 49bd69f..dab60ef 100644
--- a/src/librustc_borrowck/borrowck/check_loans.rs
+++ b/src/librustc_borrowck/borrowck/check_loans.rs
@@ -91,7 +91,6 @@
dfcx_loans: &'a LoanDataFlow<'a, 'tcx>,
move_data: &'a move_data::FlowedMoveData<'a, 'tcx>,
all_loans: &'a [Loan<'tcx>],
- param_env: ty::ParamEnv<'tcx>,
movable_generator: bool,
}
@@ -215,7 +214,6 @@
dfcx_loans,
move_data,
all_loans,
- param_env,
movable_generator,
};
let rvalue_promotable_map = bccx.tcx.rvalue_promotable_map(def_id);
@@ -596,7 +594,7 @@
// 3. Where does old loan expire.
let previous_end_span =
- Some(self.tcx().sess.codemap().end_point(
+ Some(self.tcx().sess.source_map().end_point(
old_loan.kill_scope.span(self.tcx(), &self.bccx.region_scope_tree)));
let mut err = match (new_loan.kind, old_loan.kind) {
@@ -801,8 +799,7 @@
use_kind,
&lp,
the_move,
- moved_lp,
- self.param_env);
+ moved_lp);
false
});
}
diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
index 7ce6863a..b76931c 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs
@@ -163,15 +163,11 @@
move_data: &MoveData<'tcx>,
assignment_id: hir::ItemLocalId,
assignment_span: Span,
- assignee_loan_path: Rc<LoanPath<'tcx>>,
- assignee_id: hir::ItemLocalId,
- mode: euv::MutateMode) {
+ assignee_loan_path: Rc<LoanPath<'tcx>>) {
move_data.add_assignment(bccx.tcx,
assignee_loan_path,
assignment_id,
- assignment_span,
- assignee_id,
- mode);
+ assignment_span);
}
// (keep in sync with move_error::report_cannot_move_out_of )
diff --git a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs
index 323e099..c9dcc0d 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs
@@ -28,8 +28,7 @@
span: Span,
cause: euv::LoanCause,
cmt: &'a mc::cmt_<'tcx>,
- loan_region: ty::Region<'tcx>,
- _: ty::BorrowKind)
+ loan_region: ty::Region<'tcx>)
-> Result<(),()> {
//! Reports error if `loan_region` is larger than S
//! where S is `item_scope` if `cmt` is an upvar,
diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs
index d088141..6c83e2d 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs
@@ -145,12 +145,11 @@
assignment_id: ast::NodeId,
assignment_span: Span,
assignee_cmt: &mc::cmt_<'tcx>,
- mode: euv::MutateMode)
+ _: euv::MutateMode)
{
self.guarantee_assignment_valid(assignment_id,
assignment_span,
- assignee_cmt,
- mode);
+ assignee_cmt);
}
fn decl_without_init(&mut self, id: ast::NodeId, _span: Span) {
@@ -246,8 +245,7 @@
fn guarantee_assignment_valid(&mut self,
assignment_id: ast::NodeId,
assignment_span: Span,
- cmt: &mc::cmt_<'tcx>,
- mode: euv::MutateMode) {
+ cmt: &mc::cmt_<'tcx>) {
let opt_lp = opt_loan_path(cmt);
debug!("guarantee_assignment_valid(assignment_id={}, cmt={:?}) opt_lp={:?}",
@@ -282,9 +280,7 @@
self.bccx.tcx.hir.node_to_hir_id(assignment_id)
.local_id,
assignment_span,
- lp,
- cmt.hir_id.local_id,
- mode);
+ lp);
}
None => {
// This can occur with e.g. `*foo() = 5`. In such
@@ -320,7 +316,7 @@
// Check that the lifetime of the borrow does not exceed
// the lifetime of the data being borrowed.
if lifetime::guarantee_lifetime(self.bccx, self.item_ub,
- borrow_span, cause, cmt, loan_region, req_kind).is_err() {
+ borrow_span, cause, cmt, loan_region).is_err() {
return; // reported an error, no sense in reporting more.
}
diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
index b217e6a..e1c3ac8 100644
--- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
+++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs
@@ -79,7 +79,7 @@
// see `get_pattern_source()` for details
let initializer =
e.init.as_ref().expect("should have an initializer to get an error");
- if let Ok(snippet) = bccx.tcx.sess.codemap().span_to_snippet(initializer.span) {
+ if let Ok(snippet) = bccx.tcx.sess.source_map().span_to_snippet(initializer.span) {
err.span_suggestion(initializer.span,
"consider using a reference instead",
format!("&{}", snippet));
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index aef8b58..7208e1c 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -24,10 +24,6 @@
use rustc::hir::map as hir_map;
use rustc::hir::map::blocks::FnLikeNode;
use rustc::cfg;
-use rustc::middle::dataflow::DataFlowContext;
-use rustc::middle::dataflow::BitwiseOperator;
-use rustc::middle::dataflow::DataFlowOperator;
-use rustc::middle::dataflow::KillFrom;
use rustc::middle::borrowck::{BorrowCheckResult, SignalledError};
use rustc::hir::def_id::{DefId, LocalDefId};
use rustc::middle::expr_use_visitor as euv;
@@ -54,6 +50,8 @@
use rustc::hir;
use rustc::hir::intravisit::{self, Visitor};
+use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
+
pub mod check_loans;
pub mod gather_loans;
@@ -640,8 +638,7 @@
use_kind: MovedValueUseKind,
lp: &LoanPath<'tcx>,
the_move: &move_data::Move,
- moved_lp: &LoanPath<'tcx>,
- _param_env: ty::ParamEnv<'tcx>) {
+ moved_lp: &LoanPath<'tcx>) {
let (verb, verb_participle) = match use_kind {
MovedInUse => ("use", "used"),
MovedInCapture => ("capture", "captured"),
@@ -806,23 +803,6 @@
self.signal_error();
}
- pub fn struct_span_err_with_code<S: Into<MultiSpan>>(&self,
- s: S,
- msg: &str,
- code: DiagnosticId)
- -> DiagnosticBuilder<'a> {
- self.tcx.sess.struct_span_err_with_code(s, msg, code)
- }
-
- pub fn span_err_with_code<S: Into<MultiSpan>>(
- &self,
- s: S,
- msg: &str,
- code: DiagnosticId,
- ) {
- self.tcx.sess.span_err_with_code(s, msg, code);
- }
-
fn report_bckerr(&self, err: &BckError<'a, 'tcx>) {
let error_span = err.span.clone();
@@ -868,7 +848,7 @@
let sp = self.tcx.hir.span(node_id);
let fn_closure_msg = "`Fn` closures cannot capture their enclosing \
environment for modifications";
- match (self.tcx.sess.codemap().span_to_snippet(sp), &err.cmt.cat) {
+ match (self.tcx.sess.source_map().span_to_snippet(sp), &err.cmt.cat) {
(_, &Categorization::Upvar(mc::Upvar {
kind: ty::ClosureKind::Fn, ..
})) => {
@@ -898,6 +878,7 @@
}
}
}
+
db
}
BorrowViolation(euv::ClosureCapture(_)) => {
@@ -918,6 +899,28 @@
}
};
+ // We add a special note about `IndexMut`, if the source of this error
+ // is the fact that `Index` is implemented, but `IndexMut` is not. Needing
+ // to implement two traits for "one operator" is not very intuitive for
+ // many programmers.
+ if err.cmt.note == mc::NoteIndex {
+ let node_id = self.tcx.hir.hir_to_node_id(err.cmt.hir_id);
+ let node = self.tcx.hir.get(node_id);
+
+ // This pattern probably always matches.
+ if let hir_map::NodeExpr(
+ hir::Expr { node: hir::ExprKind::Index(lhs, _), ..}
+ ) = node {
+ let ty = self.tables.expr_ty(lhs);
+
+ db.help(&format!(
+ "trait `IndexMut` is required to modify indexed content, but \
+ it is not implemented for `{}`",
+ ty
+ ));
+ }
+ }
+
self.note_and_explain_mutbl_error(&mut db, &err, &error_span);
self.note_immutability_blame(
&mut db,
@@ -1157,13 +1160,13 @@
ref ty
}) = pty.node {
// Account for existing lifetimes when generating the message
- let pointee_snippet = match self.tcx.sess.codemap().span_to_snippet(ty.span) {
+ let pointee_snippet = match self.tcx.sess.source_map().span_to_snippet(ty.span) {
Ok(snippet) => snippet,
_ => return None
};
let lifetime_snippet = if !lifetime.is_elided() {
- format!("{} ", match self.tcx.sess.codemap().span_to_snippet(lifetime.span) {
+ format!("{} ", match self.tcx.sess.source_map().span_to_snippet(lifetime.span) {
Ok(lifetime_snippet) => lifetime_snippet,
_ => return None
})
@@ -1232,7 +1235,7 @@
ty::BindByReference(..) => {
let let_span = self.tcx.hir.span(node_id);
let suggestion = suggest_ref_mut(self.tcx, let_span);
- if let Some((let_span, replace_str)) = suggestion {
+ if let Some(replace_str) = suggestion {
db.span_suggestion(
let_span,
"use a mutable reference instead",
@@ -1274,7 +1277,7 @@
binding_node_id: ast::NodeId) {
let let_span = self.tcx.hir.span(binding_node_id);
if let ty::BindByValue(..) = self.local_binding_mode(binding_node_id) {
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(let_span) {
+ if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(let_span) {
let (ty, is_implicit_self) = self.local_ty(binding_node_id);
if is_implicit_self && snippet != "self" {
// avoid suggesting `mut &self`.
@@ -1312,7 +1315,7 @@
let cmt_path_or_string = self.cmt_to_path_or_string(&err.cmt);
let suggestion =
- match self.tcx.sess.codemap().span_to_snippet(err.span) {
+ match self.tcx.sess.source_map().span_to_snippet(err.span) {
Ok(string) => format!("move {}", string),
Err(_) => "move |<args>| <body>".to_string()
};
@@ -1334,7 +1337,7 @@
fn region_end_span(&self, region: ty::Region<'tcx>) -> Option<Span> {
match *region {
ty::ReScope(scope) => {
- Some(self.tcx.sess.codemap().end_point(
+ Some(self.tcx.sess.source_map().end_point(
scope.span(self.tcx, &self.region_scope_tree)))
}
_ => None
@@ -1365,7 +1368,7 @@
db.span_label(*error_span, "cannot borrow as mutable");
} else if let Categorization::Local(local_id) = err.cmt.cat {
let span = self.tcx.hir.span(local_id);
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
+ if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
if snippet.starts_with("ref mut ") || snippet.starts_with("&mut ") {
db.span_label(*error_span, "cannot reborrow mutably");
db.span_label(*error_span, "try removing `&mut` here");
diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs
index 4091ca04..979d71a 100644
--- a/src/librustc_borrowck/borrowck/move_data.rs
+++ b/src/librustc_borrowck/borrowck/move_data.rs
@@ -13,16 +13,12 @@
pub use self::MoveKind::*;
+use dataflow::{DataFlowContext, BitwiseOperator, DataFlowOperator, KillFrom};
+
use borrowck::*;
use rustc::cfg;
-use rustc::middle::dataflow::DataFlowContext;
-use rustc::middle::dataflow::BitwiseOperator;
-use rustc::middle::dataflow::DataFlowOperator;
-use rustc::middle::dataflow::KillFrom;
-use rustc::middle::expr_use_visitor as euv;
-use rustc::middle::expr_use_visitor::MutateMode;
use rustc::ty::{self, TyCtxt};
-use rustc::util::nodemap::{FxHashMap, FxHashSet};
+use rustc::util::nodemap::FxHashMap;
use std::cell::RefCell;
use std::rc::Rc;
@@ -51,9 +47,6 @@
/// assigned dataflow bits, but we track them because they still
/// kill move bits.
pub path_assignments: RefCell<Vec<Assignment>>,
-
- /// Assignments to a variable or path, like `x = foo`, but not `x += foo`.
- pub assignee_ids: RefCell<FxHashSet<hir::ItemLocalId>>,
}
pub struct FlowedMoveData<'a, 'tcx: 'a> {
@@ -151,9 +144,6 @@
/// span of node where assignment occurs
pub span: Span,
-
- /// id for place expression on lhs of assignment
- pub assignee_id: hir::ItemLocalId,
}
#[derive(Clone, Copy)]
@@ -388,9 +378,7 @@
pub fn add_assignment(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
lp: Rc<LoanPath<'tcx>>,
assign_id: hir::ItemLocalId,
- span: Span,
- assignee_id: hir::ItemLocalId,
- mode: euv::MutateMode) {
+ span: Span) {
// Assigning to one union field automatically assigns to all its fields.
if let LpExtend(ref base_lp, mutbl, LpInterior(opt_variant_id, interior)) = lp.kind {
if let ty::TyAdt(adt_def, _) = base_lp.ty.sty {
@@ -407,39 +395,28 @@
LpInterior(opt_variant_id, field));
let sibling_lp = Rc::new(LoanPath::new(sibling_lp_kind, field_ty));
self.add_assignment_helper(tcx, sibling_lp, assign_id,
- span, assignee_id, mode);
+ span);
}
return;
}
}
}
- self.add_assignment_helper(tcx, lp.clone(), assign_id, span, assignee_id, mode);
+ self.add_assignment_helper(tcx, lp.clone(), assign_id, span);
}
fn add_assignment_helper(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>,
lp: Rc<LoanPath<'tcx>>,
assign_id: hir::ItemLocalId,
- span: Span,
- assignee_id: hir::ItemLocalId,
- mode: euv::MutateMode) {
- debug!("add_assignment(lp={:?}, assign_id={:?}, assignee_id={:?}",
- lp, assign_id, assignee_id);
+ span: Span) {
+ debug!("add_assignment(lp={:?}, assign_id={:?}", lp, assign_id);
let path_index = self.move_path(tcx, lp.clone());
- match mode {
- MutateMode::Init | MutateMode::JustWrite => {
- self.assignee_ids.borrow_mut().insert(assignee_id);
- }
- MutateMode::WriteAndRead => { }
- }
-
let assignment = Assignment {
path: path_index,
id: assign_id,
span,
- assignee_id,
};
if self.is_var_path(path_index) {
diff --git a/src/librustc_borrowck/borrowck/unused.rs b/src/librustc_borrowck/borrowck/unused.rs
index 475ff0b..c5571ec 100644
--- a/src/librustc_borrowck/borrowck/unused.rs
+++ b/src/librustc_borrowck/borrowck/unused.rs
@@ -44,7 +44,7 @@
impl<'a, 'tcx> UnusedMutCx<'a, 'tcx> {
fn check_unused_mut_pat(&self, pats: &[P<hir::Pat>]) {
let tcx = self.bccx.tcx;
- let mut mutables = FxHashMap();
+ let mut mutables: FxHashMap<_, Vec<_>> = FxHashMap();
for p in pats {
p.each_binding(|_, hir_id, span, ident| {
// Skip anything that looks like `_foo`
@@ -60,7 +60,7 @@
_ => return,
}
- mutables.entry(ident.name).or_insert(Vec::new()).push((hir_id, span));
+ mutables.entry(ident.name).or_default().push((hir_id, span));
} else {
tcx.sess.delay_span_bug(span, "missing binding mode");
}
@@ -75,7 +75,7 @@
}
let (hir_id, span) = ids[0];
- let mut_span = tcx.sess.codemap().span_until_non_whitespace(span);
+ let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
// Ok, every name wasn't used mutably, so issue a warning that this
// didn't need to be mutable.
diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs
new file mode 100644
index 0000000..75dee2b
--- /dev/null
+++ b/src/librustc_borrowck/dataflow.rs
@@ -0,0 +1,686 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+//! A module for propagating forward dataflow information. The analysis
+//! assumes that the items to be propagated can be represented as bits
+//! and thus uses bitvectors. Your job is simply to specify the so-called
+//! GEN and KILL bits for each expression.
+
+use rustc::cfg;
+use rustc::cfg::CFGIndex;
+use rustc::ty::TyCtxt;
+use std::io;
+use std::mem;
+use std::usize;
+use syntax::print::pprust::PrintState;
+
+use rustc_data_structures::graph::implementation::OUTGOING;
+
+use rustc::util::nodemap::FxHashMap;
+use rustc::hir;
+use rustc::hir::intravisit::{self, IdRange};
+use rustc::hir::print as pprust;
+
+
+#[derive(Copy, Clone, Debug)]
+pub enum EntryOrExit {
+ Entry,
+ Exit,
+}
+
+#[derive(Clone)]
+pub struct DataFlowContext<'a, 'tcx: 'a, O> {
+ tcx: TyCtxt<'a, 'tcx, 'tcx>,
+
+ /// a name for the analysis using this dataflow instance
+ analysis_name: &'static str,
+
+ /// the data flow operator
+ oper: O,
+
+ /// number of bits to propagate per id
+ bits_per_id: usize,
+
+ /// number of words we will use to store bits_per_id.
+ /// equal to bits_per_id/usize::BITS rounded up.
+ words_per_id: usize,
+
+ // mapping from node to cfg node index
+ // FIXME (#6298): Shouldn't this go with CFG?
+ local_id_to_index: FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>,
+
+ // Bit sets per cfg node. The following three fields (`gens`, `kills`,
+ // and `on_entry`) all have the same structure. For each id in
+ // `id_range`, there is a range of words equal to `words_per_id`.
+ // So, to access the bits for any given id, you take a slice of
+ // the full vector (see the method `compute_id_range()`).
+
+ /// bits generated as we exit the cfg node. Updated by `add_gen()`.
+ gens: Vec<usize>,
+
+ /// bits killed as we exit the cfg node, or non-locally jump over
+ /// it. Updated by `add_kill(KillFrom::ScopeEnd)`.
+ scope_kills: Vec<usize>,
+
+ /// bits killed as we exit the cfg node directly; if it is jumped
+ /// over, e.g. via `break`, the kills are not reflected in the
+ /// jump's effects. Updated by `add_kill(KillFrom::Execution)`.
+ action_kills: Vec<usize>,
+
+ /// bits that are valid on entry to the cfg node. Updated by
+ /// `propagate()`.
+ on_entry: Vec<usize>,
+}
+
+pub trait BitwiseOperator {
+ /// Joins two predecessor bits together, typically either `|` or `&`
+ fn join(&self, succ: usize, pred: usize) -> usize;
+}
+
+/// Parameterization for the precise form of data flow that is used.
+pub trait DataFlowOperator : BitwiseOperator {
+ /// Specifies the initial value for each bit in the `on_entry` set
+ fn initial_value(&self) -> bool;
+}
+
+struct PropagationContext<'a, 'b: 'a, 'tcx: 'b, O: 'a> {
+ dfcx: &'a mut DataFlowContext<'b, 'tcx, O>,
+ changed: bool
+}
+
+fn get_cfg_indices<'a>(id: hir::ItemLocalId,
+ index: &'a FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>)
+ -> &'a [CFGIndex] {
+ index.get(&id).map_or(&[], |v| &v[..])
+}
+
+impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
+ fn has_bitset_for_local_id(&self, n: hir::ItemLocalId) -> bool {
+ assert!(n != hir::DUMMY_ITEM_LOCAL_ID);
+ self.local_id_to_index.contains_key(&n)
+ }
+}
+
+impl<'a, 'tcx, O:DataFlowOperator> pprust::PpAnn for DataFlowContext<'a, 'tcx, O> {
+ fn nested(&self, state: &mut pprust::State, nested: pprust::Nested) -> io::Result<()> {
+ pprust::PpAnn::nested(&self.tcx.hir, state, nested)
+ }
+ fn pre(&self,
+ ps: &mut pprust::State,
+ node: pprust::AnnNode) -> io::Result<()> {
+ let id = match node {
+ pprust::NodeName(_) => return Ok(()),
+ pprust::NodeExpr(expr) => expr.hir_id.local_id,
+ pprust::NodeBlock(blk) => blk.hir_id.local_id,
+ pprust::NodeItem(_) |
+ pprust::NodeSubItem(_) => return Ok(()),
+ pprust::NodePat(pat) => pat.hir_id.local_id
+ };
+
+ if !self.has_bitset_for_local_id(id) {
+ return Ok(());
+ }
+
+ assert!(self.bits_per_id > 0);
+ let indices = get_cfg_indices(id, &self.local_id_to_index);
+ for &cfgidx in indices {
+ let (start, end) = self.compute_id_range(cfgidx);
+ let on_entry = &self.on_entry[start.. end];
+ let entry_str = bits_to_string(on_entry);
+
+ let gens = &self.gens[start.. end];
+ let gens_str = if gens.iter().any(|&u| u != 0) {
+ format!(" gen: {}", bits_to_string(gens))
+ } else {
+ "".to_string()
+ };
+
+ let action_kills = &self.action_kills[start .. end];
+ let action_kills_str = if action_kills.iter().any(|&u| u != 0) {
+ format!(" action_kill: {}", bits_to_string(action_kills))
+ } else {
+ "".to_string()
+ };
+
+ let scope_kills = &self.scope_kills[start .. end];
+ let scope_kills_str = if scope_kills.iter().any(|&u| u != 0) {
+ format!(" scope_kill: {}", bits_to_string(scope_kills))
+ } else {
+ "".to_string()
+ };
+
+ ps.synth_comment(
+ format!("id {}: {}{}{}{}", id.as_usize(), entry_str,
+ gens_str, action_kills_str, scope_kills_str))?;
+ ps.s.space()?;
+ }
+ Ok(())
+ }
+}
+
+fn build_local_id_to_index(body: Option<&hir::Body>,
+ cfg: &cfg::CFG)
+ -> FxHashMap<hir::ItemLocalId, Vec<CFGIndex>> {
+ let mut index = FxHashMap();
+
+ // FIXME(#15020) Would it be better to fold formals from decl
+ // into cfg itself? i.e. introduce a fn-based flow-graph in
+ // addition to the current block-based flow-graph, rather than
+ // have to put traversals like this here?
+ if let Some(body) = body {
+ add_entries_from_fn_body(&mut index, body, cfg.entry);
+ }
+
+ cfg.graph.each_node(|node_idx, node| {
+ if let cfg::CFGNodeData::AST(id) = node.data {
+ index.entry(id).or_default().push(node_idx);
+ }
+ true
+ });
+
+ return index;
+
+ /// Add mappings from the ast nodes for the formal bindings to
+ /// the entry-node in the graph.
+ fn add_entries_from_fn_body(index: &mut FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>,
+ body: &hir::Body,
+ entry: CFGIndex) {
+ use rustc::hir::intravisit::Visitor;
+
+ struct Formals<'a> {
+ entry: CFGIndex,
+ index: &'a mut FxHashMap<hir::ItemLocalId, Vec<CFGIndex>>,
+ }
+ let mut formals = Formals { entry: entry, index: index };
+ for arg in &body.arguments {
+ formals.visit_pat(&arg.pat);
+ }
+ impl<'a, 'v> Visitor<'v> for Formals<'a> {
+ fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'this, 'v> {
+ intravisit::NestedVisitorMap::None
+ }
+
+ fn visit_pat(&mut self, p: &hir::Pat) {
+ self.index.entry(p.hir_id.local_id).or_default().push(self.entry);
+ intravisit::walk_pat(self, p)
+ }
+ }
+ }
+}
+
+/// Flag used by `add_kill` to indicate whether the provided kill
+/// takes effect only when control flows directly through the node in
+/// question, or if the kill's effect is associated with any
+/// control-flow directly through or indirectly over the node.
+#[derive(Copy, Clone, PartialEq, Debug)]
+pub enum KillFrom {
+ /// A `ScopeEnd` kill is one that takes effect when any control
+ /// flow goes over the node. A kill associated with the end of the
+ /// scope of a variable declaration `let x;` is an example of a
+ /// `ScopeEnd` kill.
+ ScopeEnd,
+
+ /// An `Execution` kill is one that takes effect only when control
+ /// flow goes through the node to completion. A kill associated
+ /// with an assignment statement `x = expr;` is an example of an
+ /// `Execution` kill.
+ Execution,
+}
+
+impl<'a, 'tcx, O:DataFlowOperator> DataFlowContext<'a, 'tcx, O> {
+ pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
+ analysis_name: &'static str,
+ body: Option<&hir::Body>,
+ cfg: &cfg::CFG,
+ oper: O,
+ id_range: IdRange,
+ bits_per_id: usize) -> DataFlowContext<'a, 'tcx, O> {
+ let usize_bits = mem::size_of::<usize>() * 8;
+ let words_per_id = (bits_per_id + usize_bits - 1) / usize_bits;
+ let num_nodes = cfg.graph.all_nodes().len();
+
+ debug!("DataFlowContext::new(analysis_name: {}, id_range={:?}, \
+ bits_per_id={}, words_per_id={}) \
+ num_nodes: {}",
+ analysis_name, id_range, bits_per_id, words_per_id,
+ num_nodes);
+
+ let entry = if oper.initial_value() { usize::MAX } else {0};
+
+ let zeroes = vec![0; num_nodes * words_per_id];
+ let gens = zeroes.clone();
+ let kills1 = zeroes.clone();
+ let kills2 = zeroes;
+ let on_entry = vec![entry; num_nodes * words_per_id];
+
+ let local_id_to_index = build_local_id_to_index(body, cfg);
+
+ DataFlowContext {
+ tcx,
+ analysis_name,
+ words_per_id,
+ local_id_to_index,
+ bits_per_id,
+ oper,
+ gens,
+ action_kills: kills1,
+ scope_kills: kills2,
+ on_entry,
+ }
+ }
+
+ pub fn add_gen(&mut self, id: hir::ItemLocalId, bit: usize) {
+ //! Indicates that `id` generates `bit`
+ debug!("{} add_gen(id={:?}, bit={})",
+ self.analysis_name, id, bit);
+ assert!(self.local_id_to_index.contains_key(&id));
+ assert!(self.bits_per_id > 0);
+
+ let indices = get_cfg_indices(id, &self.local_id_to_index);
+ for &cfgidx in indices {
+ let (start, end) = self.compute_id_range(cfgidx);
+ let gens = &mut self.gens[start.. end];
+ set_bit(gens, bit);
+ }
+ }
+
+ pub fn add_kill(&mut self, kind: KillFrom, id: hir::ItemLocalId, bit: usize) {
+ //! Indicates that `id` kills `bit`
+ debug!("{} add_kill(id={:?}, bit={})",
+ self.analysis_name, id, bit);
+ assert!(self.local_id_to_index.contains_key(&id));
+ assert!(self.bits_per_id > 0);
+
+ let indices = get_cfg_indices(id, &self.local_id_to_index);
+ for &cfgidx in indices {
+ let (start, end) = self.compute_id_range(cfgidx);
+ let kills = match kind {
+ KillFrom::Execution => &mut self.action_kills[start.. end],
+ KillFrom::ScopeEnd => &mut self.scope_kills[start.. end],
+ };
+ set_bit(kills, bit);
+ }
+ }
+
+ fn apply_gen_kill(&self, cfgidx: CFGIndex, bits: &mut [usize]) {
+ //! Applies the gen and kill sets for `cfgidx` to `bits`
+ debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [before]",
+ self.analysis_name, cfgidx, mut_bits_to_string(bits));
+ assert!(self.bits_per_id > 0);
+
+ let (start, end) = self.compute_id_range(cfgidx);
+ let gens = &self.gens[start.. end];
+ bitwise(bits, gens, &Union);
+ let kills = &self.action_kills[start.. end];
+ bitwise(bits, kills, &Subtract);
+ let kills = &self.scope_kills[start.. end];
+ bitwise(bits, kills, &Subtract);
+
+ debug!("{} apply_gen_kill(cfgidx={:?}, bits={}) [after]",
+ self.analysis_name, cfgidx, mut_bits_to_string(bits));
+ }
+
+ fn compute_id_range(&self, cfgidx: CFGIndex) -> (usize, usize) {
+ let n = cfgidx.node_id();
+ let start = n * self.words_per_id;
+ let end = start + self.words_per_id;
+
+ assert!(start < self.gens.len());
+ assert!(end <= self.gens.len());
+ assert!(self.gens.len() == self.action_kills.len());
+ assert!(self.gens.len() == self.scope_kills.len());
+ assert!(self.gens.len() == self.on_entry.len());
+
+ (start, end)
+ }
+
+
+ pub fn each_bit_on_entry<F>(&self, id: hir::ItemLocalId, mut f: F) -> bool where
+ F: FnMut(usize) -> bool,
+ {
+ //! Iterates through each bit that is set on entry to `id`.
+ //! Only useful after `propagate()` has been called.
+ if !self.has_bitset_for_local_id(id) {
+ return true;
+ }
+ let indices = get_cfg_indices(id, &self.local_id_to_index);
+ for &cfgidx in indices {
+ if !self.each_bit_for_node(EntryOrExit::Entry, cfgidx, |i| f(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ pub fn each_bit_for_node<F>(&self, e: EntryOrExit, cfgidx: CFGIndex, f: F) -> bool where
+ F: FnMut(usize) -> bool,
+ {
+ //! Iterates through each bit that is set on entry/exit to `cfgidx`.
+ //! Only useful after `propagate()` has been called.
+
+ if self.bits_per_id == 0 {
+ // Skip the surprisingly common degenerate case. (Note
+ // compute_id_range requires self.words_per_id > 0.)
+ return true;
+ }
+
+ let (start, end) = self.compute_id_range(cfgidx);
+ let on_entry = &self.on_entry[start.. end];
+ let temp_bits;
+ let slice = match e {
+ EntryOrExit::Entry => on_entry,
+ EntryOrExit::Exit => {
+ let mut t = on_entry.to_vec();
+ self.apply_gen_kill(cfgidx, &mut t);
+ temp_bits = t;
+ &temp_bits[..]
+ }
+ };
+ debug!("{} each_bit_for_node({:?}, cfgidx={:?}) bits={}",
+ self.analysis_name, e, cfgidx, bits_to_string(slice));
+ self.each_bit(slice, f)
+ }
+
+ pub fn each_gen_bit<F>(&self, id: hir::ItemLocalId, mut f: F) -> bool where
+ F: FnMut(usize) -> bool,
+ {
+ //! Iterates through each bit in the gen set for `id`.
+ if !self.has_bitset_for_local_id(id) {
+ return true;
+ }
+
+ if self.bits_per_id == 0 {
+ // Skip the surprisingly common degenerate case. (Note
+ // compute_id_range requires self.words_per_id > 0.)
+ return true;
+ }
+
+ let indices = get_cfg_indices(id, &self.local_id_to_index);
+ for &cfgidx in indices {
+ let (start, end) = self.compute_id_range(cfgidx);
+ let gens = &self.gens[start.. end];
+ debug!("{} each_gen_bit(id={:?}, gens={})",
+ self.analysis_name, id, bits_to_string(gens));
+ if !self.each_bit(gens, |i| f(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ fn each_bit<F>(&self, words: &[usize], mut f: F) -> bool where
+ F: FnMut(usize) -> bool,
+ {
+ //! Helper for iterating over the bits in a bit set.
+ //! Returns false on the first call to `f` that returns false;
+ //! if all calls to `f` return true, then returns true.
+
+ let usize_bits = mem::size_of::<usize>() * 8;
+ for (word_index, &word) in words.iter().enumerate() {
+ if word != 0 {
+ let base_index = word_index * usize_bits;
+ for offset in 0..usize_bits {
+ let bit = 1 << offset;
+ if (word & bit) != 0 {
+ // NB: we round up the total number of bits
+ // that we store in any given bit set so that
+ // it is an even multiple of usize::BITS. This
+ // means that there may be some stray bits at
+ // the end that do not correspond to any
+ // actual value. So before we callback, check
+ // whether the bit_index is greater than the
+ // actual value the user specified and stop
+ // iterating if so.
+ let bit_index = base_index + offset as usize;
+ if bit_index >= self.bits_per_id {
+ return true;
+ } else if !f(bit_index) {
+ return false;
+ }
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ pub fn add_kills_from_flow_exits(&mut self, cfg: &cfg::CFG) {
+ //! Whenever you have a `break` or `continue` statement, flow
+ //! exits through any number of enclosing scopes on its way to
+ //! the new destination. This function infers the kill bits of
+ //! those control operators based on the kill bits associated
+ //! with those scopes.
+ //!
+ //! This is usually called (if it is called at all), after
+ //! all add_gen and add_kill calls, but before propagate.
+
+ debug!("{} add_kills_from_flow_exits", self.analysis_name);
+ if self.bits_per_id == 0 {
+ // Skip the surprisingly common degenerate case. (Note
+ // compute_id_range requires self.words_per_id > 0.)
+ return;
+ }
+ cfg.graph.each_edge(|_edge_index, edge| {
+ let flow_exit = edge.source();
+ let (start, end) = self.compute_id_range(flow_exit);
+ let mut orig_kills = self.scope_kills[start.. end].to_vec();
+
+ let mut changed = false;
+ for &id in &edge.data.exiting_scopes {
+ let opt_cfg_idx = self.local_id_to_index.get(&id);
+ match opt_cfg_idx {
+ Some(indices) => {
+ for &cfg_idx in indices {
+ let (start, end) = self.compute_id_range(cfg_idx);
+ let kills = &self.scope_kills[start.. end];
+ if bitwise(&mut orig_kills, kills, &Union) {
+ debug!("scope exits: scope id={:?} \
+ (node={:?} of {:?}) added killset: {}",
+ id, cfg_idx, indices,
+ bits_to_string(kills));
+ changed = true;
+ }
+ }
+ }
+ None => {
+ debug!("{} add_kills_from_flow_exits flow_exit={:?} \
+ no cfg_idx for exiting_scope={:?}",
+ self.analysis_name, flow_exit, id);
+ }
+ }
+ }
+
+ if changed {
+ let bits = &mut self.scope_kills[start.. end];
+ debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [before]",
+ self.analysis_name, flow_exit, mut_bits_to_string(bits));
+ bits.copy_from_slice(&orig_kills[..]);
+ debug!("{} add_kills_from_flow_exits flow_exit={:?} bits={} [after]",
+ self.analysis_name, flow_exit, mut_bits_to_string(bits));
+ }
+ true
+ });
+ }
+}
+
+impl<'a, 'tcx, O:DataFlowOperator+Clone+'static> DataFlowContext<'a, 'tcx, O> {
+// ^^^^^^^^^^^^^ only needed for pretty printing
+ pub fn propagate(&mut self, cfg: &cfg::CFG, body: &hir::Body) {
+ //! Performs the data flow analysis.
+
+ if self.bits_per_id == 0 {
+ // Optimize the surprisingly common degenerate case.
+ return;
+ }
+
+ {
+ let words_per_id = self.words_per_id;
+ let mut propcx = PropagationContext {
+ dfcx: &mut *self,
+ changed: true
+ };
+
+ let nodes_po = cfg.graph.nodes_in_postorder(OUTGOING, cfg.entry);
+ let mut temp = vec![0; words_per_id];
+ let mut num_passes = 0;
+ while propcx.changed {
+ num_passes += 1;
+ propcx.changed = false;
+ propcx.reset(&mut temp);
+ propcx.walk_cfg(cfg, &nodes_po, &mut temp);
+ }
+ debug!("finished in {} iterations", num_passes);
+ }
+
+ debug!("Dataflow result for {}:", self.analysis_name);
+ debug!("{}", pprust::to_string(self, |s| {
+ s.cbox(pprust::indent_unit)?;
+ s.ibox(0)?;
+ s.print_expr(&body.value)
+ }));
+ }
+}
+
+impl<'a, 'b, 'tcx, O:DataFlowOperator> PropagationContext<'a, 'b, 'tcx, O> {
+ fn walk_cfg(&mut self,
+ cfg: &cfg::CFG,
+ nodes_po: &[CFGIndex],
+ in_out: &mut [usize]) {
+ debug!("DataFlowContext::walk_cfg(in_out={}) {}",
+ bits_to_string(in_out), self.dfcx.analysis_name);
+ assert!(self.dfcx.bits_per_id > 0);
+
+ // Iterate over nodes in reverse postorder
+ for &node_index in nodes_po.iter().rev() {
+ let node = cfg.graph.node(node_index);
+ debug!("DataFlowContext::walk_cfg idx={:?} id={:?} begin in_out={}",
+ node_index, node.data.id(), bits_to_string(in_out));
+
+ let (start, end) = self.dfcx.compute_id_range(node_index);
+
+ // Initialize local bitvector with state on-entry.
+ in_out.copy_from_slice(&self.dfcx.on_entry[start.. end]);
+
+ // Compute state on-exit by applying transfer function to
+ // state on-entry.
+ self.dfcx.apply_gen_kill(node_index, in_out);
+
+ // Propagate state on-exit from node into its successors.
+ self.propagate_bits_into_graph_successors_of(in_out, cfg, node_index);
+ }
+ }
+
+ fn reset(&mut self, bits: &mut [usize]) {
+ let e = if self.dfcx.oper.initial_value() {usize::MAX} else {0};
+ for b in bits {
+ *b = e;
+ }
+ }
+
+ fn propagate_bits_into_graph_successors_of(&mut self,
+ pred_bits: &[usize],
+ cfg: &cfg::CFG,
+ cfgidx: CFGIndex) {
+ for (_, edge) in cfg.graph.outgoing_edges(cfgidx) {
+ self.propagate_bits_into_entry_set_for(pred_bits, edge);
+ }
+ }
+
+ fn propagate_bits_into_entry_set_for(&mut self,
+ pred_bits: &[usize],
+ edge: &cfg::CFGEdge) {
+ let source = edge.source();
+ let cfgidx = edge.target();
+ debug!("{} propagate_bits_into_entry_set_for(pred_bits={}, {:?} to {:?})",
+ self.dfcx.analysis_name, bits_to_string(pred_bits), source, cfgidx);
+ assert!(self.dfcx.bits_per_id > 0);
+
+ let (start, end) = self.dfcx.compute_id_range(cfgidx);
+ let changed = {
+ // (scoping mutable borrow of self.dfcx.on_entry)
+ let on_entry = &mut self.dfcx.on_entry[start.. end];
+ bitwise(on_entry, pred_bits, &self.dfcx.oper)
+ };
+ if changed {
+ debug!("{} changed entry set for {:?} to {}",
+ self.dfcx.analysis_name, cfgidx,
+ bits_to_string(&self.dfcx.on_entry[start.. end]));
+ self.changed = true;
+ }
+ }
+}
+
+fn mut_bits_to_string(words: &mut [usize]) -> String {
+ bits_to_string(words)
+}
+
+fn bits_to_string(words: &[usize]) -> String {
+ let mut result = String::new();
+ let mut sep = '[';
+
+ // Note: this is a little endian printout of bytes.
+
+ for &word in words {
+ let mut v = word;
+ for _ in 0..mem::size_of::<usize>() {
+ result.push(sep);
+ result.push_str(&format!("{:02x}", v & 0xFF));
+ v >>= 8;
+ sep = '-';
+ }
+ }
+ result.push(']');
+ return result
+}
+
+#[inline]
+fn bitwise<Op:BitwiseOperator>(out_vec: &mut [usize],
+ in_vec: &[usize],
+ op: &Op) -> bool {
+ assert_eq!(out_vec.len(), in_vec.len());
+ let mut changed = false;
+ for (out_elt, in_elt) in out_vec.iter_mut().zip(in_vec) {
+ let old_val = *out_elt;
+ let new_val = op.join(old_val, *in_elt);
+ *out_elt = new_val;
+ changed |= old_val != new_val;
+ }
+ changed
+}
+
+fn set_bit(words: &mut [usize], bit: usize) -> bool {
+ debug!("set_bit: words={} bit={}",
+ mut_bits_to_string(words), bit_str(bit));
+ let usize_bits = mem::size_of::<usize>() * 8;
+ let word = bit / usize_bits;
+ let bit_in_word = bit % usize_bits;
+ let bit_mask = 1 << bit_in_word;
+ debug!("word={} bit_in_word={} bit_mask={}", word, bit_in_word, bit_mask);
+ let oldv = words[word];
+ let newv = oldv | bit_mask;
+ words[word] = newv;
+ oldv != newv
+}
+
+fn bit_str(bit: usize) -> String {
+ let byte = bit >> 3;
+ let lobits = 1 << (bit & 0b111);
+ format!("[{}:{}-{:02x}]", bit, byte, lobits)
+}
+
+struct Union;
+impl BitwiseOperator for Union {
+ fn join(&self, a: usize, b: usize) -> usize { a | b }
+}
+struct Subtract;
+impl BitwiseOperator for Subtract {
+ fn join(&self, a: usize, b: usize) -> usize { a & !b }
+}
diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs
index 22867ba..dddd6a3 100644
--- a/src/librustc_borrowck/graphviz.rs
+++ b/src/librustc_borrowck/graphviz.rs
@@ -21,7 +21,7 @@
use borrowck::{BorrowckCtxt, LoanPath};
use dot;
use rustc::cfg::CFGIndex;
-use rustc::middle::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
+use dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
use std::rc::Rc;
use dot::IntoCow;
diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs
index c7e7465..16da8c8 100644
--- a/src/librustc_borrowck/lib.rs
+++ b/src/librustc_borrowck/lib.rs
@@ -14,6 +14,7 @@
#![allow(non_camel_case_types)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(quote)]
#![recursion_limit="256"]
@@ -38,4 +39,6 @@
pub mod graphviz;
+mod dataflow;
+
pub use borrowck::provide;
diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs
index 44982ee..7934350 100644
--- a/src/librustc_codegen_llvm/abi.rs
+++ b/src/librustc_codegen_llvm/abi.rs
@@ -187,8 +187,10 @@
return;
}
let cx = bx.cx;
- if self.is_indirect() {
- OperandValue::Ref(val, self.layout.align).store(bx, dst)
+ if self.is_sized_indirect() {
+ OperandValue::Ref(val, None, self.layout.align).store(bx, dst)
+ } else if self.is_unsized_indirect() {
+ bug!("unsized ArgType must be handled through store_fn_arg");
} else if let PassMode::Cast(cast) = self.mode {
// FIXME(eddyb): Figure out when the simpler Store is safe, clang
// uses it for i16 -> {i8, i8}, but not for i24 -> {i8, i8, i8}.
@@ -246,7 +248,10 @@
PassMode::Pair(..) => {
OperandValue::Pair(next(), next()).store(bx, dst);
}
- PassMode::Direct(_) | PassMode::Indirect(_) | PassMode::Cast(_) => {
+ PassMode::Indirect(_, Some(_)) => {
+ OperandValue::Ref(next(), Some(next()), self.layout.align).store(bx, dst);
+ }
+ PassMode::Direct(_) | PassMode::Indirect(_, None) | PassMode::Cast(_) => {
self.store(bx, next(), dst);
}
}
@@ -302,6 +307,10 @@
// Don't pass the vtable, it's not an argument of the virtual fn.
// Instead, pass just the (thin pointer) first field of `*dyn Trait`.
if arg_idx == Some(0) {
+ if layout.is_unsized() {
+ unimplemented!("by-value trait object is not \
+ yet implemented in #![feature(unsized_locals)]");
+ }
// FIXME(eddyb) `layout.field(cx, 0)` is not enough because e.g.
// `Box<dyn Trait>` has a few newtype wrappers around the raw
// pointer, so we'd have to "dig down" to find `*dyn Trait`.
@@ -538,7 +547,7 @@
}
let size = arg.layout.size;
- if size > layout::Pointer.size(cx) {
+ if arg.layout.is_unsized() || size > layout::Pointer.size(cx) {
arg.make_indirect();
} else {
// We want to pass small aggregates as immediates, but using
@@ -554,7 +563,7 @@
for arg in &mut self.args {
fixup(arg);
}
- if let PassMode::Indirect(ref mut attrs) = self.ret.mode {
+ if let PassMode::Indirect(ref mut attrs, _) = self.ret.mode {
attrs.set(ArgAttribute::StructRet);
}
return;
@@ -571,7 +580,7 @@
if let PassMode::Pair(_, _) = arg.mode { 2 } else { 1 }
).sum();
let mut llargument_tys = Vec::with_capacity(
- if let PassMode::Indirect(_) = self.ret.mode { 1 } else { 0 } + args_capacity
+ if let PassMode::Indirect(..) = self.ret.mode { 1 } else { 0 } + args_capacity
);
let llreturn_ty = match self.ret.mode {
@@ -580,7 +589,7 @@
self.ret.layout.immediate_llvm_type(cx)
}
PassMode::Cast(cast) => cast.llvm_type(cx),
- PassMode::Indirect(_) => {
+ PassMode::Indirect(..) => {
llargument_tys.push(self.ret.memory_ty(cx).ptr_to());
Type::void(cx)
}
@@ -600,8 +609,15 @@
llargument_tys.push(arg.layout.scalar_pair_element_llvm_type(cx, 1, true));
continue;
}
+ PassMode::Indirect(_, Some(_)) => {
+ let ptr_ty = cx.tcx.mk_mut_ptr(arg.layout.ty);
+ let ptr_layout = cx.layout_of(ptr_ty);
+ llargument_tys.push(ptr_layout.scalar_pair_element_llvm_type(cx, 0, true));
+ llargument_tys.push(ptr_layout.scalar_pair_element_llvm_type(cx, 1, true));
+ continue;
+ }
PassMode::Cast(cast) => cast.llvm_type(cx),
- PassMode::Indirect(_) => arg.memory_ty(cx).ptr_to(),
+ PassMode::Indirect(_, None) => arg.memory_ty(cx).ptr_to(),
};
llargument_tys.push(llarg_ty);
}
@@ -640,7 +656,7 @@
PassMode::Direct(ref attrs) => {
attrs.apply_llfn(llvm::AttributePlace::ReturnValue, llfn);
}
- PassMode::Indirect(ref attrs) => apply(attrs),
+ PassMode::Indirect(ref attrs, _) => apply(attrs),
_ => {}
}
for arg in &self.args {
@@ -650,7 +666,11 @@
match arg.mode {
PassMode::Ignore => {}
PassMode::Direct(ref attrs) |
- PassMode::Indirect(ref attrs) => apply(attrs),
+ PassMode::Indirect(ref attrs, None) => apply(attrs),
+ PassMode::Indirect(ref attrs, Some(ref extra_attrs)) => {
+ apply(attrs);
+ apply(extra_attrs);
+ }
PassMode::Pair(ref a, ref b) => {
apply(a);
apply(b);
@@ -670,7 +690,7 @@
PassMode::Direct(ref attrs) => {
attrs.apply_callsite(llvm::AttributePlace::ReturnValue, callsite);
}
- PassMode::Indirect(ref attrs) => apply(attrs),
+ PassMode::Indirect(ref attrs, _) => apply(attrs),
_ => {}
}
if let layout::Abi::Scalar(ref scalar) = self.ret.layout.abi {
@@ -694,7 +714,11 @@
match arg.mode {
PassMode::Ignore => {}
PassMode::Direct(ref attrs) |
- PassMode::Indirect(ref attrs) => apply(attrs),
+ PassMode::Indirect(ref attrs, None) => apply(attrs),
+ PassMode::Indirect(ref attrs, Some(ref extra_attrs)) => {
+ apply(attrs);
+ apply(extra_attrs);
+ }
PassMode::Pair(ref a, ref b) => {
apply(a);
apply(b);
diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs
index 714e891..2b64642 100644
--- a/src/librustc_codegen_llvm/attributes.rs
+++ b/src/librustc_codegen_llvm/attributes.rs
@@ -9,9 +9,9 @@
// except according to those terms.
//! Set and unset common attributes on LLVM values.
-use std::ffi::{CStr, CString};
+use std::ffi::CString;
-use rustc::hir::CodegenFnAttrFlags;
+use rustc::hir::{CodegenFnAttrFlags, CodegenFnAttrs};
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::session::Session;
use rustc::session::config::Sanitizer;
@@ -75,7 +75,7 @@
if cx.sess().must_not_eliminate_frame_pointers() {
llvm::AddFunctionAttrStringValue(
llfn, llvm::AttributePlace::Function,
- cstr("no-frame-pointer-elim\0"), cstr("true\0"));
+ const_cstr!("no-frame-pointer-elim"), const_cstr!("true"));
}
}
@@ -108,7 +108,7 @@
// This is defined in the `compiler-builtins` crate for each architecture.
llvm::AddFunctionAttrStringValue(
llfn, llvm::AttributePlace::Function,
- cstr("probe-stack\0"), cstr("__rust_probestack\0"));
+ const_cstr!("probe-stack"), const_cstr!("__rust_probestack"));
}
pub fn llvm_target_features(sess: &Session) -> impl Iterator<Item = &str> {
@@ -128,17 +128,43 @@
llvm::AddFunctionAttrStringValue(
llfn,
llvm::AttributePlace::Function,
- cstr("target-cpu\0"),
+ const_cstr!("target-cpu"),
target_cpu.as_c_str());
}
/// Composite function which sets LLVM attributes for function depending on its AST (#[attribute])
/// attributes.
-pub fn from_fn_attrs(cx: &CodegenCx<'ll, '_>, llfn: &'ll Value, id: DefId) {
- let codegen_fn_attrs = cx.tcx.codegen_fn_attrs(id);
+pub fn from_fn_attrs(
+ cx: &CodegenCx<'ll, '_>,
+ llfn: &'ll Value,
+ id: Option<DefId>,
+) {
+ let codegen_fn_attrs = id.map(|id| cx.tcx.codegen_fn_attrs(id))
+ .unwrap_or(CodegenFnAttrs::new());
inline(llfn, codegen_fn_attrs.inline);
+ // The `uwtable` attribute according to LLVM is:
+ //
+ // This attribute indicates that the ABI being targeted requires that an
+ // unwind table entry be produced for this function even if we can show
+ // that no exceptions passes by it. This is normally the case for the
+ // ELF x86-64 abi, but it can be disabled for some compilation units.
+ //
+ // Typically when we're compiling with `-C panic=abort` (which implies this
+ // `no_landing_pads` check) we don't need `uwtable` because we can't
+ // generate any exceptions! On Windows, however, exceptions include other
+ // events such as illegal instructions, segfaults, etc. This means that on
+ // Windows we end up still needing the `uwtable` attribute even if the `-C
+ // panic=abort` flag is passed.
+ //
+ // You can also find more info on why Windows is whitelisted here in:
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
+ if !cx.sess().no_landing_pads() ||
+ cx.sess().target.target.options.requires_uwtable {
+ attributes::emit_uwtable(llfn, true);
+ }
+
set_frame_pointer_elimination(cx, llfn);
set_probestack(cx, llfn);
@@ -162,7 +188,7 @@
// *in Rust code* may unwind. Foreign items like `extern "C" {
// fn foo(); }` are assumed not to unwind **unless** they have
// a `#[unwind]` attribute.
- } else if !cx.tcx.is_foreign_item(id) {
+ } else if id.map(|id| !cx.tcx.is_foreign_item(id)).unwrap_or(false) {
Some(true)
} else {
None
@@ -202,28 +228,26 @@
let val = CString::new(features).unwrap();
llvm::AddFunctionAttrStringValue(
llfn, llvm::AttributePlace::Function,
- cstr("target-features\0"), &val);
+ const_cstr!("target-features"), &val);
}
// Note that currently the `wasm-import-module` doesn't do anything, but
// eventually LLVM 7 should read this and ferry the appropriate import
// module to the output file.
- if cx.tcx.sess.target.target.arch == "wasm32" {
- if let Some(module) = wasm_import_module(cx.tcx, id) {
- llvm::AddFunctionAttrStringValue(
- llfn,
- llvm::AttributePlace::Function,
- cstr("wasm-import-module\0"),
- &module,
- );
+ if let Some(id) = id {
+ if cx.tcx.sess.target.target.arch == "wasm32" {
+ if let Some(module) = wasm_import_module(cx.tcx, id) {
+ llvm::AddFunctionAttrStringValue(
+ llfn,
+ llvm::AttributePlace::Function,
+ const_cstr!("wasm-import-module"),
+ &module,
+ );
+ }
}
}
}
-fn cstr(s: &'static str) -> &CStr {
- CStr::from_bytes_with_nul(s.as_bytes()).expect("null-terminated string")
-}
-
pub fn provide(providers: &mut Providers) {
providers.target_features_whitelist = |tcx, cnum| {
assert_eq!(cnum, LOCAL_CRATE);
diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs
index 91515d1..34ddfa9 100644
--- a/src/librustc_codegen_llvm/back/link.rs
+++ b/src/librustc_codegen_llvm/back/link.rs
@@ -26,7 +26,7 @@
use rustc::middle::dependency_format::Linkage;
use {CodegenResults, CrateInfo};
use rustc::util::common::time;
-use rustc::util::fs::fix_windows_verbatim_for_gcc;
+use rustc_fs_util::fix_windows_verbatim_for_gcc;
use rustc::hir::def_id::CrateNum;
use tempfile::{Builder as TempFileBuilder, TempDir};
use rustc_target::spec::{PanicStrategy, RelroLevel, LinkerFlavor};
@@ -46,13 +46,6 @@
use std::str;
use syntax::attr;
-/// The LLVM module name containing crate-metadata. This includes a `.` on
-/// purpose, so it cannot clash with the name of a user-defined module.
-pub const METADATA_MODULE_NAME: &'static str = "crate.metadata";
-
-// same as for metadata above, but for allocator shim
-pub const ALLOCATOR_MODULE_NAME: &'static str = "crate.allocator";
-
pub use rustc_codegen_utils::link::{find_crate_name, filename_for_input, default_output_for_target,
invalid_output_for_target, build_link_meta, out_filename,
check_file_is_writeable};
diff --git a/src/librustc_codegen_llvm/back/linker.rs b/src/librustc_codegen_llvm/back/linker.rs
index efa4b4d5..a429e8f 100644
--- a/src/librustc_codegen_llvm/back/linker.rs
+++ b/src/librustc_codegen_llvm/back/linker.rs
@@ -1007,18 +1007,6 @@
OptLevel::Size => "-O2",
OptLevel::SizeMin => "-O2"
});
- match self.sess.opts.optimize {
- OptLevel::No => (),
- OptLevel::Less |
- OptLevel::Default |
- OptLevel::Aggressive |
- OptLevel::Size |
- OptLevel::SizeMin => {
- // LLD generates incorrect debugging information when
- // optimization is applied: strip debug sections.
- self.cmd.arg("--strip-debug");
- }
- }
}
fn pgo_gen(&mut self) {
@@ -1080,6 +1068,9 @@
// For now we just never have an entry symbol
self.cmd.arg("--no-entry");
+ // Make the default table accessible
+ self.cmd.arg("--export-table");
+
let mut cmd = Command::new("");
::std::mem::swap(&mut cmd, &mut self.cmd);
cmd
diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs
index d774123..56858a3 100644
--- a/src/librustc_codegen_llvm/back/lto.rs
+++ b/src/librustc_codegen_llvm/back/lto.rs
@@ -242,7 +242,7 @@
let llvm = module.llvm().expect("can't lto pre-codegened modules");
(&llvm.llcx, llvm.llmod())
};
- info!("using {:?} as a base module", module.llmod_id);
+ info!("using {:?} as a base module", module.name);
// The linking steps below may produce errors and diagnostics within LLVM
// which we'd like to handle and print, so set up our diagnostic handlers
@@ -257,7 +257,7 @@
for module in modules {
let llvm = module.llvm().expect("can't lto pre-codegened modules");
let buffer = ModuleBuffer::new(llvm.llmod());
- let llmod_id = CString::new(&module.llmod_id[..]).unwrap();
+ let llmod_id = CString::new(&module.name[..]).unwrap();
serialized_modules.push((SerializedModule::Local(buffer), llmod_id));
}
@@ -384,9 +384,9 @@
// the most expensive portion of this small bit of global
// analysis!
for (i, module) in modules.iter().enumerate() {
- info!("local module: {} - {}", i, module.llmod_id);
+ info!("local module: {} - {}", i, module.name);
let llvm = module.llvm().expect("can't lto precodegened module");
- let name = CString::new(module.llmod_id.clone()).unwrap();
+ let name = CString::new(module.name.clone()).unwrap();
let buffer = ThinBuffer::new(llvm.llmod());
thin_modules.push(llvm::ThinLTOModule {
identifier: name.as_ptr(),
@@ -395,7 +395,7 @@
});
thin_buffers.push(buffer);
module_names.push(name);
- timeline.record(&module.llmod_id);
+ timeline.record(&module.name);
}
// FIXME: All upstream crates are deserialized internally in the
@@ -668,7 +668,6 @@
llcx,
tm,
}),
- llmod_id: self.name().to_string(),
name: self.name().to_string(),
kind: ModuleKind::Regular,
};
diff --git a/src/librustc_codegen_llvm/back/symbol_export.rs b/src/librustc_codegen_llvm/back/symbol_export.rs
index 02434b7b..edb1da0 100644
--- a/src/librustc_codegen_llvm/back/symbol_export.rs
+++ b/src/librustc_codegen_llvm/back/symbol_export.rs
@@ -15,7 +15,7 @@
use rustc::hir;
use rustc::hir::CodegenFnAttrFlags;
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE, CRATE_DEF_INDEX};
-use rustc::ich::Fingerprint;
+use rustc_data_structures::fingerprint::Fingerprint;
use rustc::middle::exported_symbols::{SymbolExportLevel, ExportedSymbol, metadata_symbol_name};
use rustc::session::config;
use rustc::ty::{TyCtxt, SymbolName};
@@ -299,7 +299,7 @@
let cnums = tcx.all_crate_nums(LOCAL_CRATE);
- let mut instances = DefIdMap();
+ let mut instances: DefIdMap<FxHashMap<_, _>> = DefIdMap();
let cnum_stable_ids: IndexVec<CrateNum, Fingerprint> = {
let mut cnum_stable_ids = IndexVec::from_elem_n(Fingerprint::ZERO,
@@ -318,8 +318,7 @@
for &cnum in cnums.iter() {
for &(ref exported_symbol, _) in tcx.exported_symbols(cnum).iter() {
if let &ExportedSymbol::Generic(def_id, substs) = exported_symbol {
- let substs_map = instances.entry(def_id)
- .or_insert_with(|| FxHashMap());
+ let substs_map = instances.entry(def_id).or_default();
match substs_map.entry(substs) {
Occupied(mut e) => {
diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs
index 14abbe3..462a2c9 100644
--- a/src/librustc_codegen_llvm/back/write.rs
+++ b/src/librustc_codegen_llvm/back/write.rs
@@ -30,8 +30,8 @@
use rustc::hir::def_id::{CrateNum, LOCAL_CRATE};
use rustc::ty::TyCtxt;
use rustc::util::common::{time_ext, time_depth, set_time_depth, print_time_passes_entry};
-use rustc::util::common::path2cstr;
-use rustc::util::fs::{link_or_copy};
+use rustc_fs_util::{path2cstr, link_or_copy};
+use rustc_data_structures::small_c_str::SmallCStr;
use errors::{self, Handler, Level, DiagnosticBuilder, FatalError, DiagnosticId};
use errors::emitter::{Emitter};
use syntax::attr;
@@ -171,11 +171,8 @@
let singlethread = sess.target.target.options.singlethread;
- let triple = &sess.target.target.llvm_target;
-
- let triple = CString::new(triple.as_bytes()).unwrap();
- let cpu = sess.target_cpu();
- let cpu = CString::new(cpu.as_bytes()).unwrap();
+ let triple = SmallCStr::new(&sess.target.target.llvm_target);
+ let cpu = SmallCStr::new(sess.target_cpu());
let features = attributes::llvm_target_features(sess)
.collect::<Vec<_>>()
.join(",");
@@ -183,6 +180,8 @@
let is_pie_binary = !find_features && is_pie_binary(sess);
let trap_unreachable = sess.target.target.options.trap_unreachable;
+ let asm_comments = sess.asm_comments();
+
Arc::new(move || {
let tm = unsafe {
llvm::LLVMRustCreateTargetMachine(
@@ -196,6 +195,7 @@
fdata_sections,
trap_unreachable,
singlethread,
+ asm_comments,
)
};
@@ -523,7 +523,7 @@
// If we're verifying or linting, add them to the function pass
// manager.
let addpass = |pass_name: &str| {
- let pass_name = CString::new(pass_name).unwrap();
+ let pass_name = SmallCStr::new(pass_name);
let pass = match llvm::LLVMRustFindAndCreatePass(pass_name.as_ptr()) {
Some(pass) => pass,
None => return false,
@@ -728,7 +728,7 @@
if config.emit_bc_compressed {
let dst = bc_out.with_extension(RLIB_BYTECODE_EXTENSION);
- let data = bytecode::encode(&module.llmod_id, data);
+ let data = bytecode::encode(&module.name, data);
if let Err(e) = fs::write(&dst, data) {
diag_handler.err(&format!("failed to write bytecode: {}", e));
}
@@ -1338,7 +1338,6 @@
assert_eq!(bytecode_compressed.is_some(), config.emit_bc_compressed);
Ok(WorkItemResult::Compiled(CompiledModule {
- llmod_id: module.llmod_id.clone(),
name: module_name,
kind: ModuleKind::Regular,
pre_existing: true,
diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs
index 54ff5d2..0330a05 100644
--- a/src/librustc_codegen_llvm/base.rs
+++ b/src/librustc_codegen_llvm/base.rs
@@ -36,7 +36,7 @@
use rustc::hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
use rustc::middle::lang_items::StartFnLangItem;
use rustc::middle::weak_lang_items;
-use rustc::mir::mono::{Linkage, Visibility, Stats};
+use rustc::mir::mono::{Linkage, Visibility, Stats, CodegenUnitNameBuilder};
use rustc::middle::cstore::{EncodedMetadata};
use rustc::ty::{self, Ty, TyCtxt};
use rustc::ty::layout::{self, Align, TyLayout, LayoutOf};
@@ -73,6 +73,7 @@
use type_of::LayoutLlvmExt;
use rustc::util::nodemap::{FxHashMap, FxHashSet, DefIdSet};
use CrateInfo;
+use rustc_data_structures::small_c_str::SmallCStr;
use rustc_data_structures::sync::Lrc;
use std::any::Any;
@@ -502,27 +503,6 @@
cx.stats.borrow_mut().n_closures += 1;
- // The `uwtable` attribute according to LLVM is:
- //
- // This attribute indicates that the ABI being targeted requires that an
- // unwind table entry be produced for this function even if we can show
- // that no exceptions passes by it. This is normally the case for the
- // ELF x86-64 abi, but it can be disabled for some compilation units.
- //
- // Typically when we're compiling with `-C panic=abort` (which implies this
- // `no_landing_pads` check) we don't need `uwtable` because we can't
- // generate any exceptions! On Windows, however, exceptions include other
- // events such as illegal instructions, segfaults, etc. This means that on
- // Windows we end up still needing the `uwtable` attribute even if the `-C
- // panic=abort` flag is passed.
- //
- // You can also find more info on why Windows is whitelisted here in:
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1302078
- if !cx.sess().no_landing_pads() ||
- cx.sess().target.target.options.requires_uwtable {
- attributes::emit_uwtable(lldecl, true);
- }
-
let mir = cx.tcx.instance_mir(instance.def);
mir::codegen_mir(cx, lldecl, &mir, instance, sig);
}
@@ -533,7 +513,7 @@
None => return,
};
unsafe {
- let buf = CString::new(sect.as_str().as_bytes()).unwrap();
+ let buf = SmallCStr::new(§.as_str());
llvm::LLVMSetSection(llval, buf.as_ptr());
}
}
@@ -681,7 +661,7 @@
unsafe {
llvm::LLVMSetInitializer(llglobal, llconst);
let section_name = metadata::metadata_section_name(&tcx.sess.target.target);
- let name = CString::new(section_name).unwrap();
+ let name = SmallCStr::new(section_name);
llvm::LLVMSetSection(llglobal, name.as_ptr());
// Also generate a .section directive to force no
@@ -741,19 +721,23 @@
let crate_hash = tcx.crate_hash(LOCAL_CRATE);
let link_meta = link::build_link_meta(crate_hash);
+ let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
// Codegen the metadata.
tcx.sess.profiler(|p| p.start_activity(ProfileCategory::Codegen));
- let llmod_id = "metadata";
- let metadata_llvm_module = ModuleLlvm::new(tcx.sess, llmod_id);
+
+ let metadata_cgu_name = cgu_name_builder.build_cgu_name(LOCAL_CRATE,
+ &["crate"],
+ Some("metadata")).as_str()
+ .to_string();
+ let metadata_llvm_module = ModuleLlvm::new(tcx.sess, &metadata_cgu_name);
let metadata = time(tcx.sess, "write metadata", || {
write_metadata(tcx, &metadata_llvm_module, &link_meta)
});
tcx.sess.profiler(|p| p.end_activity(ProfileCategory::Codegen));
let metadata_module = ModuleCodegen {
- name: link::METADATA_MODULE_NAME.to_string(),
- llmod_id: llmod_id.to_string(),
+ name: metadata_cgu_name,
source: ModuleSource::Codegened(metadata_llvm_module),
kind: ModuleKind::Metadata,
};
@@ -832,20 +816,22 @@
let allocator_module = if any_dynamic_crate {
None
} else if let Some(kind) = *tcx.sess.allocator_kind.get() {
- unsafe {
- let llmod_id = "allocator";
- let modules = ModuleLlvm::new(tcx.sess, llmod_id);
- time(tcx.sess, "write allocator module", || {
+ let llmod_id = cgu_name_builder.build_cgu_name(LOCAL_CRATE,
+ &["crate"],
+ Some("allocator")).as_str()
+ .to_string();
+ let modules = ModuleLlvm::new(tcx.sess, &llmod_id);
+ time(tcx.sess, "write allocator module", || {
+ unsafe {
allocator::codegen(tcx, &modules, kind)
- });
+ }
+ });
- Some(ModuleCodegen {
- name: link::ALLOCATOR_MODULE_NAME.to_string(),
- llmod_id: llmod_id.to_string(),
- source: ModuleSource::Codegened(modules),
- kind: ModuleKind::Allocator,
- })
- }
+ Some(ModuleCodegen {
+ name: llmod_id,
+ source: ModuleSource::Codegened(modules),
+ kind: ModuleKind::Allocator,
+ })
} else {
None
};
@@ -888,21 +874,10 @@
// succeed it means that none of the dependencies has changed
// and we can safely re-use.
if let Some(dep_node_index) = tcx.dep_graph.try_mark_green(tcx, dep_node) {
- // Append ".rs" to LLVM module identifier.
- //
- // LLVM code generator emits a ".file filename" directive
- // for ELF backends. Value of the "filename" is set as the
- // LLVM module identifier. Due to a LLVM MC bug[1], LLVM
- // crashes if the module identifier is same as other symbols
- // such as a function name in the module.
- // 1. http://llvm.org/bugs/show_bug.cgi?id=11479
- let llmod_id = format!("{}.rs", cgu.name());
-
let module = ModuleCodegen {
name: cgu.name().to_string(),
source: ModuleSource::Preexisting(buf),
kind: ModuleKind::Regular,
- llmod_id,
};
tcx.dep_graph.mark_loaded_from_cache(dep_node_index, true);
write::submit_codegened_module_to_llvm(tcx, module, 0);
@@ -1045,12 +1020,12 @@
}).collect();
if tcx.sess.opts.debugging_opts.print_mono_items.is_some() {
- let mut item_to_cgus = FxHashMap();
+ let mut item_to_cgus: FxHashMap<_, Vec<_>> = FxHashMap();
for cgu in &codegen_units {
for (&mono_item, &linkage) in cgu.items() {
item_to_cgus.entry(mono_item)
- .or_insert(Vec::new())
+ .or_default()
.push((cgu.name().clone(), linkage));
}
}
@@ -1211,21 +1186,8 @@
{
let cgu_name = cgu.name().to_string();
- // Append ".rs" to LLVM module identifier.
- //
- // LLVM code generator emits a ".file filename" directive
- // for ELF backends. Value of the "filename" is set as the
- // LLVM module identifier. Due to a LLVM MC bug[1], LLVM
- // crashes if the module identifier is same as other symbols
- // such as a function name in the module.
- // 1. http://llvm.org/bugs/show_bug.cgi?id=11479
- let llmod_id = format!("{}-{}.rs",
- cgu.name(),
- tcx.crate_disambiguator(LOCAL_CRATE)
- .to_fingerprint().to_hex());
-
// Instantiate monomorphizations without filling out definitions yet...
- let llvm_module = ModuleLlvm::new(tcx.sess, &llmod_id);
+ let llvm_module = ModuleLlvm::new(tcx.sess, &cgu_name);
let stats = {
let cx = CodegenCx::new(tcx, cgu, &llvm_module);
let mono_items = cx.codegen_unit
@@ -1255,8 +1217,8 @@
// Create the llvm.used variable
// This variable has type [N x i8*] and is stored in the llvm.metadata section
if !cx.used_statics.borrow().is_empty() {
- let name = CString::new("llvm.used").unwrap();
- let section = CString::new("llvm.metadata").unwrap();
+ let name = const_cstr!("llvm.used");
+ let section = const_cstr!("llvm.metadata");
let array = C_array(Type::i8(&cx).ptr_to(), &*cx.used_statics.borrow());
unsafe {
@@ -1281,7 +1243,6 @@
name: cgu_name,
source: ModuleSource::Codegened(llvm_module),
kind: ModuleKind::Regular,
- llmod_id,
})
}
}
diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs
index b174cd8..cfbc2ab 100644
--- a/src/librustc_codegen_llvm/builder.rs
+++ b/src/librustc_codegen_llvm/builder.rs
@@ -18,9 +18,9 @@
use rustc::ty::TyCtxt;
use rustc::ty::layout::{Align, Size};
use rustc::session::{config, Session};
+use rustc_data_structures::small_c_str::SmallCStr;
use std::borrow::Cow;
-use std::ffi::CString;
use std::ops::Range;
use std::ptr;
@@ -58,7 +58,7 @@
pub fn new_block<'b>(cx: &'a CodegenCx<'ll, 'tcx>, llfn: &'ll Value, name: &'b str) -> Self {
let bx = Builder::with_cx(cx);
let llbb = unsafe {
- let name = CString::new(name).unwrap();
+ let name = SmallCStr::new(name);
llvm::LLVMAppendBasicBlockInContext(
cx.llcx,
llfn,
@@ -118,7 +118,7 @@
}
pub fn set_value_name(&self, value: &'ll Value, name: &str) {
- let cname = CString::new(name.as_bytes()).unwrap();
+ let cname = SmallCStr::new(name);
unsafe {
llvm::LLVMSetValueName(value, cname.as_ptr());
}
@@ -436,7 +436,7 @@
let alloca = if name.is_empty() {
llvm::LLVMBuildAlloca(self.llbuilder, ty, noname())
} else {
- let name = CString::new(name).unwrap();
+ let name = SmallCStr::new(name);
llvm::LLVMBuildAlloca(self.llbuilder, ty,
name.as_ptr())
};
@@ -445,6 +445,25 @@
}
}
+ pub fn array_alloca(&self,
+ ty: &'ll Type,
+ len: &'ll Value,
+ name: &str,
+ align: Align) -> &'ll Value {
+ self.count_insn("alloca");
+ unsafe {
+ let alloca = if name.is_empty() {
+ llvm::LLVMBuildArrayAlloca(self.llbuilder, ty, len, noname())
+ } else {
+ let name = SmallCStr::new(name);
+ llvm::LLVMBuildArrayAlloca(self.llbuilder, ty, len,
+ name.as_ptr())
+ };
+ llvm::LLVMSetAlignment(alloca, align.abi() as c_uint);
+ alloca
+ }
+ }
+
pub fn load(&self, ptr: &'ll Value, align: Align) -> &'ll Value {
self.count_insn("load");
unsafe {
@@ -975,7 +994,7 @@
parent: Option<&'ll Value>,
args: &[&'ll Value]) -> &'ll Value {
self.count_insn("cleanuppad");
- let name = CString::new("cleanuppad").unwrap();
+ let name = const_cstr!("cleanuppad");
let ret = unsafe {
llvm::LLVMRustBuildCleanupPad(self.llbuilder,
parent,
@@ -1001,7 +1020,7 @@
parent: &'ll Value,
args: &[&'ll Value]) -> &'ll Value {
self.count_insn("catchpad");
- let name = CString::new("catchpad").unwrap();
+ let name = const_cstr!("catchpad");
let ret = unsafe {
llvm::LLVMRustBuildCatchPad(self.llbuilder, parent,
args.len() as c_uint, args.as_ptr(),
@@ -1025,7 +1044,7 @@
num_handlers: usize,
) -> &'ll Value {
self.count_insn("catchswitch");
- let name = CString::new("catchswitch").unwrap();
+ let name = const_cstr!("catchswitch");
let ret = unsafe {
llvm::LLVMRustBuildCatchSwitch(self.llbuilder, parent, unwind,
num_handlers as c_uint,
diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs
index 3594351..2e90f95 100644
--- a/src/librustc_codegen_llvm/callee.rs
+++ b/src/librustc_codegen_llvm/callee.rs
@@ -98,7 +98,7 @@
if instance.def.is_inline(tcx) {
attributes::inline(llfn, attributes::InlineAttr::Hint);
}
- attributes::from_fn_attrs(cx, llfn, instance.def.def_id());
+ attributes::from_fn_attrs(cx, llfn, Some(instance.def.def_id()));
let instance_def_id = instance.def_id();
diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs
index fafc0e7..770a22a 100644
--- a/src/librustc_codegen_llvm/consts.rs
+++ b/src/librustc_codegen_llvm/consts.rs
@@ -230,7 +230,6 @@
}
cx.instances.borrow_mut().insert(instance, g);
- cx.statics.borrow_mut().insert(g, def_id);
g
}
@@ -328,7 +327,7 @@
} else {
// If we created the global with the wrong type,
// correct the type.
- let empty_string = CString::new("").unwrap();
+ let empty_string = const_cstr!("");
let name_str_ref = CStr::from_ptr(llvm::LLVMGetValueName(g));
let name_string = CString::new(name_str_ref.to_bytes()).unwrap();
llvm::LLVMSetValueName(g, empty_string.as_ptr());
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs
index 7a308bb..32ea2c5 100644
--- a/src/librustc_codegen_llvm/context.rs
+++ b/src/librustc_codegen_llvm/context.rs
@@ -13,7 +13,6 @@
use llvm;
use rustc::dep_graph::DepGraphSafe;
use rustc::hir;
-use rustc::hir::def_id::DefId;
use debuginfo;
use callee;
use base;
@@ -26,6 +25,7 @@
use type_of::PointeeInfo;
use rustc_data_structures::base_n;
+use rustc_data_structures::small_c_str::SmallCStr;
use rustc::mir::mono::Stats;
use rustc::session::config::{self, DebugInfo};
use rustc::session::Session;
@@ -34,7 +34,7 @@
use rustc::util::nodemap::FxHashMap;
use rustc_target::spec::{HasTargetSpec, Target};
-use std::ffi::{CStr, CString};
+use std::ffi::CStr;
use std::cell::{Cell, RefCell};
use std::iter;
use std::str;
@@ -77,9 +77,6 @@
/// Cache of emitted const globals (value -> global)
pub const_globals: RefCell<FxHashMap<&'a Value, &'a Value>>,
- /// Mapping from static definitions to their DefId's.
- pub statics: RefCell<FxHashMap<&'a Value, DefId>>,
-
/// List of globals for static variables which need to be passed to the
/// LLVM function ReplaceAllUsesWith (RAUW) when codegen is complete.
/// (We have to make sure we don't invalidate any Values referring
@@ -161,7 +158,7 @@
llcx: &'ll llvm::Context,
mod_name: &str,
) -> &'ll llvm::Module {
- let mod_name = CString::new(mod_name).unwrap();
+ let mod_name = SmallCStr::new(mod_name);
let llmod = llvm::LLVMModuleCreateWithNameInContext(mod_name.as_ptr(), llcx);
// Ensure the data-layout values hardcoded remain the defaults.
@@ -201,11 +198,10 @@
}
}
- let data_layout = CString::new(&sess.target.target.data_layout[..]).unwrap();
+ let data_layout = SmallCStr::new(&sess.target.target.data_layout);
llvm::LLVMSetDataLayout(llmod, data_layout.as_ptr());
- let llvm_target = sess.target.target.llvm_target.as_bytes();
- let llvm_target = CString::new(llvm_target).unwrap();
+ let llvm_target = SmallCStr::new(&sess.target.target.llvm_target);
llvm::LLVMRustSetNormalizedTarget(llmod, llvm_target.as_ptr());
if is_pie_binary(sess) {
@@ -297,7 +293,6 @@
const_cstr_cache: RefCell::new(FxHashMap()),
const_unsized: RefCell::new(FxHashMap()),
const_globals: RefCell::new(FxHashMap()),
- statics: RefCell::new(FxHashMap()),
statics_to_rauw: RefCell::new(Vec::new()),
used_statics: RefCell::new(Vec::new()),
lltypes: RefCell::new(FxHashMap()),
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index 69ef92e..cac2ae0 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -28,14 +28,16 @@
use rustc::hir::CodegenFnAttrFlags;
use rustc::hir::def::CtorKind;
use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE};
-use rustc::ich::{Fingerprint, NodeIdHashingMode};
+use rustc::ich::NodeIdHashingMode;
+use rustc_data_structures::fingerprint::Fingerprint;
use rustc::ty::Instance;
use common::CodegenCx;
use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt};
use rustc::ty::layout::{self, Align, LayoutOf, PrimitiveExt, Size, TyLayout};
use rustc::session::config;
use rustc::util::nodemap::FxHashMap;
-use rustc::util::common::path2cstr;
+use rustc_fs_util::path2cstr;
+use rustc_data_structures::small_c_str::SmallCStr;
use libc::{c_uint, c_longlong};
use std::ffi::CString;
@@ -273,7 +275,7 @@
// ... and attach them to the stub to complete it.
set_members_of_composite_type(cx,
metadata_stub,
- &member_descriptions[..]);
+ member_descriptions);
return MetadataCreationResult::new(metadata_stub, true);
}
}
@@ -348,7 +350,7 @@
let (pointer_size, pointer_align) = cx.size_and_align_of(data_ptr_type);
let (usize_size, usize_align) = cx.size_and_align_of(cx.tcx.types.usize);
- let member_descriptions = [
+ let member_descriptions = vec![
MemberDescription {
name: "data_ptr".to_string(),
type_metadata: data_ptr_metadata,
@@ -373,7 +375,7 @@
slice_ptr_type,
&slice_type_name[..],
unique_type_id,
- &member_descriptions,
+ member_descriptions,
NO_SCOPE_METADATA,
file_metadata,
span);
@@ -459,7 +461,7 @@
let data_ptr_field = layout.field(cx, 0);
let vtable_field = layout.field(cx, 1);
- let member_descriptions = [
+ let member_descriptions = vec![
MemberDescription {
name: "pointer".to_string(),
type_metadata: type_metadata(cx,
@@ -484,7 +486,7 @@
trait_object_type,
&trait_type_name[..],
unique_type_id,
- &member_descriptions,
+ member_descriptions,
containing_scope,
file_metadata,
syntax_pos::DUMMY_SP)
@@ -745,8 +747,8 @@
debug!("file_metadata: file_name: {}, directory: {}", file_name, directory);
- let file_name = CString::new(file_name).unwrap();
- let directory = CString::new(directory).unwrap();
+ let file_name = SmallCStr::new(file_name);
+ let directory = SmallCStr::new(directory);
let file_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateFile(DIB(cx),
@@ -781,7 +783,7 @@
};
let (size, align) = cx.size_and_align_of(t);
- let name = CString::new(name).unwrap();
+ let name = SmallCStr::new(name);
let ty_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateBasicType(
DIB(cx),
@@ -812,7 +814,7 @@
) -> &'ll DIType {
let (pointer_size, pointer_align) = cx.size_and_align_of(pointer_type);
let name = compute_debuginfo_type_name(cx, pointer_type, false);
- let name = CString::new(name).unwrap();
+ let name = SmallCStr::new(&name);
unsafe {
llvm::LLVMRustDIBuilderCreatePointerType(
DIB(cx),
@@ -846,9 +848,9 @@
let producer = format!("clang LLVM (rustc version {})",
(option_env!("CFG_VERSION")).expect("CFG_VERSION"));
- let name_in_debuginfo = name_in_debuginfo.to_string_lossy().into_owned();
- let name_in_debuginfo = CString::new(name_in_debuginfo).unwrap();
- let work_dir = CString::new(&tcx.sess.working_dir.0.to_string_lossy()[..]).unwrap();
+ let name_in_debuginfo = name_in_debuginfo.to_string_lossy();
+ let name_in_debuginfo = SmallCStr::new(&name_in_debuginfo);
+ let work_dir = SmallCStr::new(&tcx.sess.working_dir.0.to_string_lossy());
let producer = CString::new(producer).unwrap();
let flags = "\0";
let split_name = "\0";
@@ -882,7 +884,7 @@
gcov_cu_info.as_ptr(),
gcov_cu_info.len() as c_uint);
- let llvm_gcov_ident = CString::new("llvm.gcov").unwrap();
+ let llvm_gcov_ident = const_cstr!("llvm.gcov");
llvm::LLVMAddNamedMetadataOperand(debug_context.llmod,
llvm_gcov_ident.as_ptr(),
gcov_metadata);
@@ -1186,7 +1188,7 @@
set_members_of_composite_type(cx,
variant_type_metadata,
- &member_descriptions[..]);
+ member_descriptions);
vec![
MemberDescription {
name: "".to_string(),
@@ -1216,7 +1218,7 @@
set_members_of_composite_type(cx,
variant_type_metadata,
- &member_descriptions);
+ member_descriptions);
MemberDescription {
name: "".to_string(),
type_metadata: variant_type_metadata,
@@ -1243,7 +1245,7 @@
set_members_of_composite_type(cx,
variant_type_metadata,
- &variant_member_descriptions[..]);
+ variant_member_descriptions);
// Encode the information about the null variant in the union
// member's name.
@@ -1415,8 +1417,7 @@
let enumerators_metadata: Vec<_> = def.discriminants(cx.tcx)
.zip(&def.variants)
.map(|(discr, v)| {
- let token = v.name.as_str();
- let name = CString::new(token.as_bytes()).unwrap();
+ let name = SmallCStr::new(&v.name.as_str());
unsafe {
Some(llvm::LLVMRustDIBuilderCreateEnumerator(
DIB(cx),
@@ -1441,7 +1442,7 @@
type_metadata(cx, discr.to_ty(cx.tcx), syntax_pos::DUMMY_SP);
let discriminant_name = get_enum_discriminant_name(cx, enum_def_id).as_str();
- let name = CString::new(discriminant_name.as_bytes()).unwrap();
+ let name = SmallCStr::new(&discriminant_name);
let discriminant_type_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateEnumerationType(
DIB(cx),
@@ -1481,10 +1482,10 @@
let (enum_type_size, enum_type_align) = layout.size_and_align();
- let enum_name = CString::new(enum_name).unwrap();
- let unique_type_id_str = CString::new(
- debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id).as_bytes()
- ).unwrap();
+ let enum_name = SmallCStr::new(&enum_name);
+ let unique_type_id_str = SmallCStr::new(
+ debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id)
+ );
let enum_metadata = unsafe {
llvm::LLVMRustDIBuilderCreateUnionType(
DIB(cx),
@@ -1530,7 +1531,7 @@
composite_type: Ty<'tcx>,
composite_type_name: &str,
composite_type_unique_id: UniqueTypeId,
- member_descriptions: &[MemberDescription<'ll>],
+ member_descriptions: Vec<MemberDescription<'ll>>,
containing_scope: Option<&'ll DIScope>,
// Ignore source location information as long as it
@@ -1554,7 +1555,7 @@
fn set_members_of_composite_type(cx: &CodegenCx<'ll, '_>,
composite_type_metadata: &'ll DICompositeType,
- member_descriptions: &[MemberDescription<'ll>]) {
+ member_descriptions: Vec<MemberDescription<'ll>>) {
// In some rare cases LLVM metadata uniquing would lead to an existing type
// description being used instead of a new one created in
// create_struct_stub. This would cause a hard to trace assertion in
@@ -1573,10 +1574,9 @@
}
let member_metadata: Vec<_> = member_descriptions
- .iter()
+ .into_iter()
.map(|member_description| {
- let member_name = member_description.name.as_bytes();
- let member_name = CString::new(member_name).unwrap();
+ let member_name = CString::new(member_description.name).unwrap();
unsafe {
Some(llvm::LLVMRustDIBuilderCreateMemberType(
DIB(cx),
@@ -1612,10 +1612,10 @@
) -> &'ll DICompositeType {
let (struct_size, struct_align) = cx.size_and_align_of(struct_type);
- let name = CString::new(struct_type_name).unwrap();
- let unique_type_id = CString::new(
- debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id).as_bytes()
- ).unwrap();
+ let name = SmallCStr::new(struct_type_name);
+ let unique_type_id = SmallCStr::new(
+ debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id)
+ );
let metadata_stub = unsafe {
// LLVMRustDIBuilderCreateStructType() wants an empty array. A null
// pointer will lead to hard to trace and debug LLVM assertions
@@ -1650,10 +1650,10 @@
) -> &'ll DICompositeType {
let (union_size, union_align) = cx.size_and_align_of(union_type);
- let name = CString::new(union_type_name).unwrap();
- let unique_type_id = CString::new(
- debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id).as_bytes()
- ).unwrap();
+ let name = SmallCStr::new(union_type_name);
+ let unique_type_id = SmallCStr::new(
+ debug_context(cx).type_map.borrow().get_unique_type_id_as_string(unique_type_id)
+ );
let metadata_stub = unsafe {
// LLVMRustDIBuilderCreateUnionType() wants an empty array. A null
// pointer will lead to hard to trace and debug LLVM assertions
@@ -1712,13 +1712,12 @@
let is_local_to_unit = is_node_local_to_unit(cx, def_id);
let variable_type = Instance::mono(cx.tcx, def_id).ty(cx.tcx);
let type_metadata = type_metadata(cx, variable_type, span);
- let var_name = tcx.item_name(def_id).to_string();
- let var_name = CString::new(var_name).unwrap();
+ let var_name = SmallCStr::new(&tcx.item_name(def_id).as_str());
let linkage_name = if no_mangle {
None
} else {
let linkage_name = mangled_name_of_instance(cx, Instance::mono(tcx, def_id));
- Some(CString::new(linkage_name.to_string()).unwrap())
+ Some(SmallCStr::new(&linkage_name.as_str()))
};
let global_align = cx.align_of(variable_type);
@@ -1746,7 +1745,7 @@
pub fn extend_scope_to_file(
cx: &CodegenCx<'ll, '_>,
scope_metadata: &'ll DIScope,
- file: &syntax_pos::FileMap,
+ file: &syntax_pos::SourceFile,
defining_crate: CrateNum,
) -> &'ll DILexicalBlock {
let file_metadata = file_metadata(cx, &file.name, defining_crate);
@@ -1779,7 +1778,7 @@
// later on in llvm/lib/IR/Value.cpp.
let empty_array = create_DIArray(DIB(cx), &[]);
- let name = CString::new("vtable").unwrap();
+ let name = const_cstr!("vtable");
// Create a new one each time. We don't want metadata caching
// here, because each vtable will refer to a unique containing
diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs
index d4fb254..fcb8bc3 100644
--- a/src/librustc_codegen_llvm/debuginfo/mod.rs
+++ b/src/librustc_codegen_llvm/debuginfo/mod.rs
@@ -34,6 +34,7 @@
use rustc::mir;
use rustc::session::config::{self, DebugInfo};
use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet};
+use rustc_data_structures::small_c_str::SmallCStr;
use value::Value;
use libc::c_uint;
@@ -265,7 +266,7 @@
let is_local_to_unit = is_node_local_to_unit(cx, def_id);
let function_name = CString::new(name).unwrap();
- let linkage_name = CString::new(linkage_name.to_string()).unwrap();
+ let linkage_name = SmallCStr::new(&linkage_name.as_str());
let mut flags = DIFlags::FlagPrototyped;
@@ -407,7 +408,7 @@
let actual_type = cx.tcx.normalize_erasing_regions(ParamEnv::reveal_all(), ty);
let actual_type_metadata =
type_metadata(cx, actual_type, syntax_pos::DUMMY_SP);
- let name = CString::new(name.as_str().as_bytes()).unwrap();
+ let name = SmallCStr::new(&name.as_str());
Some(unsafe {
Some(llvm::LLVMRustDIBuilderCreateTemplateTypeParameter(
DIB(cx),
@@ -510,7 +511,7 @@
};
let align = cx.align_of(variable_type);
- let name = CString::new(variable_name.as_str().as_bytes()).unwrap();
+ let name = SmallCStr::new(&variable_name.as_str());
match (variable_access, &[][..]) {
(DirectVariable { alloca }, address_operations) |
(IndirectVariable {alloca, address_operations}, _) => {
diff --git a/src/librustc_codegen_llvm/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs
index 9f1141a..06f8a4b 100644
--- a/src/librustc_codegen_llvm/debuginfo/namespace.rs
+++ b/src/librustc_codegen_llvm/debuginfo/namespace.rs
@@ -21,7 +21,7 @@
use rustc::hir::map::DefPathData;
use common::CodegenCx;
-use std::ffi::CString;
+use rustc_data_structures::small_c_str::SmallCStr;
pub fn mangled_name_of_instance<'a, 'tcx>(
cx: &CodegenCx<'a, 'tcx>,
@@ -49,7 +49,7 @@
data => data.as_interned_str().as_str()
};
- let namespace_name = CString::new(namespace_name.as_bytes()).unwrap();
+ let namespace_name = SmallCStr::new(&namespace_name);
let scope = unsafe {
llvm::LLVMRustDIBuilderCreateNameSpace(
diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs
index 55cf139..c59b5e2 100644
--- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs
+++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs
@@ -40,7 +40,7 @@
};
let dbg_loc = if function_debug_context.source_locations_enabled.get() {
- debug!("set_source_location: {}", bx.sess().codemap().span_to_string(span));
+ debug!("set_source_location: {}", bx.sess().source_map().span_to_string(span));
let loc = span_start(bx.cx, span);
InternalDebugLocation::new(scope.unwrap(), loc.line, loc.col.to_usize())
} else {
diff --git a/src/librustc_codegen_llvm/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs
index 9f4a555..19bc4ac 100644
--- a/src/librustc_codegen_llvm/debuginfo/utils.rs
+++ b/src/librustc_codegen_llvm/debuginfo/utils.rs
@@ -47,7 +47,7 @@
/// Return syntax_pos::Loc corresponding to the beginning of the span
pub fn span_start(cx: &CodegenCx, span: Span) -> syntax_pos::Loc {
- cx.sess().codemap().lookup_char_pos(span.lo())
+ cx.sess().source_map().lookup_char_pos(span.lo())
}
#[inline]
diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs
index a0310ee..5e743ac 100644
--- a/src/librustc_codegen_llvm/declare.rs
+++ b/src/librustc_codegen_llvm/declare.rs
@@ -25,6 +25,7 @@
use rustc::ty::{self, Ty};
use rustc::ty::layout::{self, LayoutOf};
use rustc::session::config::Sanitizer;
+use rustc_data_structures::small_c_str::SmallCStr;
use rustc_target::spec::PanicStrategy;
use abi::{Abi, FnType, FnTypeExt};
use attributes;
@@ -33,7 +34,6 @@
use type_::Type;
use value::Value;
-use std::ffi::CString;
/// Declare a global value.
///
@@ -41,9 +41,7 @@
/// return its Value instead.
pub fn declare_global(cx: &CodegenCx<'ll, '_>, name: &str, ty: &'ll Type) -> &'ll Value {
debug!("declare_global(name={:?})", name);
- let namebuf = CString::new(name).unwrap_or_else(|_|{
- bug!("name {:?} contains an interior null byte", name)
- });
+ let namebuf = SmallCStr::new(name);
unsafe {
llvm::LLVMRustGetOrInsertGlobal(cx.llmod, namebuf.as_ptr(), ty)
}
@@ -61,9 +59,7 @@
ty: &'ll Type,
) -> &'ll Value {
debug!("declare_raw_fn(name={:?}, ty={:?})", name, ty);
- let namebuf = CString::new(name).unwrap_or_else(|_|{
- bug!("name {:?} contains an interior null byte", name)
- });
+ let namebuf = SmallCStr::new(name);
let llfn = unsafe {
llvm::LLVMRustGetOrInsertFunction(cx.llmod, namebuf.as_ptr(), ty)
};
@@ -214,9 +210,7 @@
/// Get declared value by name.
pub fn get_declared_value(cx: &CodegenCx<'ll, '_>, name: &str) -> Option<&'ll Value> {
debug!("get_declared_value(name={:?})", name);
- let namebuf = CString::new(name).unwrap_or_else(|_|{
- bug!("name {:?} contains an interior null byte", name)
- });
+ let namebuf = SmallCStr::new(name);
unsafe { llvm::LLVMRustGetNamedValue(cx.llmod, namebuf.as_ptr()) }
}
diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs
index 0b5a675..be3e0d9 100644
--- a/src/librustc_codegen_llvm/intrinsic.rs
+++ b/src/librustc_codegen_llvm/intrinsic.rs
@@ -10,6 +10,7 @@
#![allow(non_upper_case_globals)]
+use attributes;
use intrinsics::{self, Intrinsic};
use llvm::{self, TypeKind};
use abi::{Abi, FnType, LlvmType, PassMode};
@@ -604,7 +605,7 @@
// etc.
assert!(!bx.cx.type_needs_drop(arg.layout.ty));
let (ptr, align) = match arg.val {
- OperandValue::Ref(ptr, align) => (ptr, align),
+ OperandValue::Ref(ptr, None, align) => (ptr, align),
_ => bug!()
};
let arg = PlaceRef::new_sized(ptr, arg.layout, align);
@@ -944,6 +945,7 @@
Abi::Rust
)));
let llfn = declare::define_internal_fn(cx, name, rust_fn_ty);
+ attributes::from_fn_attrs(cx, llfn, None);
let bx = Builder::new_block(cx, llfn, "entry-block");
codegen(bx);
llfn
diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs
index 9599ccf..a65511a 100644
--- a/src/librustc_codegen_llvm/lib.rs
+++ b/src/librustc_codegen_llvm/lib.rs
@@ -26,6 +26,7 @@
#![feature(in_band_lifetimes)]
#![allow(unused_attributes)]
#![feature(libc)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(quote)]
#![feature(range_contains)]
#![feature(rustc_diagnostic_macros)]
@@ -55,6 +56,7 @@
extern crate rustc_llvm;
extern crate rustc_platform_intrinsics as intrinsics;
extern crate rustc_codegen_utils;
+extern crate rustc_fs_util;
#[macro_use] extern crate log;
#[macro_use] extern crate syntax;
@@ -267,8 +269,8 @@
/// unique amongst **all** crates. Therefore, it should contain
/// something unique to this crate (e.g., a module path) as well
/// as the crate name and disambiguator.
+ /// We currently generate these names via CodegenUnit::build_cgu_name().
name: String,
- llmod_id: String,
source: ModuleSource,
kind: ModuleKind,
}
@@ -315,7 +317,6 @@
};
CompiledModule {
- llmod_id: self.llmod_id,
name: self.name.clone(),
kind: self.kind,
pre_existing,
@@ -329,7 +330,6 @@
#[derive(Debug)]
struct CompiledModule {
name: String,
- llmod_id: String,
kind: ModuleKind,
pre_existing: bool,
object: Option<PathBuf>,
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index a894f8e..d3039a0 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -875,6 +875,11 @@
// Memory
pub fn LLVMBuildAlloca(B: &Builder<'a>, Ty: &'a Type, Name: *const c_char) -> &'a Value;
+ pub fn LLVMBuildArrayAlloca(B: &Builder<'a>,
+ Ty: &'a Type,
+ Val: &'a Value,
+ Name: *const c_char)
+ -> &'a Value;
pub fn LLVMBuildLoad(B: &Builder<'a>, PointerVal: &'a Value, Name: *const c_char) -> &'a Value;
pub fn LLVMBuildStore(B: &Builder<'a>, Val: &'a Value, Ptr: &'a Value) -> &'a Value;
@@ -1455,7 +1460,8 @@
FunctionSections: bool,
DataSections: bool,
TrapUnreachable: bool,
- Singlethread: bool)
+ Singlethread: bool,
+ AsmComments: bool)
-> Option<&'static mut TargetMachine>;
pub fn LLVMRustDisposeTargetMachine(T: &'static mut TargetMachine);
pub fn LLVMRustAddAnalysisPasses(T: &'a TargetMachine, PM: &PassManager<'a>, M: &'a Module);
@@ -1564,7 +1570,7 @@
-> LLVMRustResult;
pub fn LLVMRustArchiveMemberNew(Filename: *const c_char,
Name: *const c_char,
- Child: Option<&'a ArchiveChild>)
+ Child: Option<&ArchiveChild<'a>>)
-> &'a mut RustArchiveMember<'a>;
pub fn LLVMRustArchiveMemberFree(Member: &'a mut RustArchiveMember<'a>);
diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs
index 558d2a2..4343c8c 100644
--- a/src/librustc_codegen_llvm/llvm/mod.rs
+++ b/src/librustc_codegen_llvm/llvm/mod.rs
@@ -24,9 +24,10 @@
use std::str::FromStr;
use std::string::FromUtf8Error;
use std::slice;
-use std::ffi::{CString, CStr};
+use std::ffi::CStr;
use std::cell::RefCell;
use libc::{self, c_uint, c_char, size_t};
+use rustc_data_structures::small_c_str::SmallCStr;
pub mod archive_ro;
pub mod diagnostic;
@@ -264,7 +265,7 @@
impl OperandBundleDef<'a> {
pub fn new(name: &str, vals: &[&'a Value]) -> Self {
- let name = CString::new(name).unwrap();
+ let name = SmallCStr::new(name);
let def = unsafe {
LLVMRustBuildOperandBundleDef(name.as_ptr(), vals.as_ptr(), vals.len() as c_uint)
};
diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs
index 441fff5..ff26e0f 100644
--- a/src/librustc_codegen_llvm/llvm_util.rs
+++ b/src/librustc_codegen_llvm/llvm_util.rs
@@ -169,6 +169,10 @@
("msa", Some("mips_target_feature")),
];
+const WASM_WHITELIST: &[(&str, Option<&str>)] = &[
+ ("simd128", Some("wasm_target_feature")),
+];
+
/// When rustdoc is running, provide a list of all known features so that all their respective
/// primtives may be documented.
///
@@ -181,6 +185,7 @@
.chain(HEXAGON_WHITELIST.iter().cloned())
.chain(POWERPC_WHITELIST.iter().cloned())
.chain(MIPS_WHITELIST.iter().cloned())
+ .chain(WASM_WHITELIST.iter().cloned())
}
pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
@@ -228,6 +233,7 @@
"hexagon" => HEXAGON_WHITELIST,
"mips" | "mips64" => MIPS_WHITELIST,
"powerpc" | "powerpc64" => POWERPC_WHITELIST,
+ "wasm32" => WASM_WHITELIST,
_ => &[],
}
}
diff --git a/src/librustc_codegen_llvm/metadata.rs b/src/librustc_codegen_llvm/metadata.rs
index fcb7044..a4526a5 100644
--- a/src/librustc_codegen_llvm/metadata.rs
+++ b/src/librustc_codegen_llvm/metadata.rs
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use rustc::util::common;
use rustc::middle::cstore::MetadataLoader;
use rustc_target::spec::Target;
use llvm;
@@ -19,6 +18,7 @@
use std::path::Path;
use std::ptr;
use std::slice;
+use rustc_fs_util::path2cstr;
pub use rustc_data_structures::sync::MetadataRef;
@@ -57,7 +57,7 @@
filename: &Path)
-> Result<MetadataRef, String> {
unsafe {
- let buf = common::path2cstr(filename);
+ let buf = path2cstr(filename);
let mb = llvm::LLVMRustCreateMemoryBufferWithContentsOfFile(buf.as_ptr())
.ok_or_else(|| format!("error reading library: '{}'", filename.display()))?;
let of = ObjectFile::new(mb)
diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs
index 4e389c3..1104408 100644
--- a/src/librustc_codegen_llvm/mir/block.rs
+++ b/src/librustc_codegen_llvm/mir/block.rs
@@ -225,14 +225,14 @@
mir::TerminatorKind::Return => {
let llval = match self.fn_ty.ret.mode {
- PassMode::Ignore | PassMode::Indirect(_) => {
+ PassMode::Ignore | PassMode::Indirect(..) => {
bx.ret_void();
return;
}
PassMode::Direct(_) | PassMode::Pair(..) => {
let op = self.codegen_consume(&bx, &mir::Place::Local(mir::RETURN_PLACE));
- if let Ref(llval, align) = op.val {
+ if let Ref(llval, _, align) = op.val {
bx.load(llval, align)
} else {
op.immediate_or_packed_pair(&bx)
@@ -245,10 +245,11 @@
LocalRef::Operand(None) => bug!("use of return before def"),
LocalRef::Place(cg_place) => {
OperandRef {
- val: Ref(cg_place.llval, cg_place.align),
+ val: Ref(cg_place.llval, None, cg_place.align),
layout: cg_place.layout
}
}
+ LocalRef::UnsizedPlace(_) => bug!("return type must be sized"),
};
let llslot = match op.val {
Immediate(_) | Pair(..) => {
@@ -256,7 +257,7 @@
op.val.store(&bx, scratch);
scratch.llval
}
- Ref(llval, align) => {
+ Ref(llval, _, align) => {
assert_eq!(align.abi(), op.layout.align.abi(),
"return place is unaligned!");
llval
@@ -358,7 +359,7 @@
self.set_debug_loc(&bx, terminator.source_info);
// Get the location information.
- let loc = bx.sess().codemap().lookup_char_pos(span.lo());
+ let loc = bx.sess().source_map().lookup_char_pos(span.lo());
let filename = Symbol::intern(&loc.file.name.to_string()).as_str();
let filename = C_str_slice(bx.cx, filename);
let line = C_u32(bx.cx, loc.line as u32);
@@ -601,11 +602,11 @@
// The callee needs to own the argument memory if we pass it
// by-ref, so make a local copy of non-immediate constants.
match (arg, op.val) {
- (&mir::Operand::Copy(_), Ref(..)) |
- (&mir::Operand::Constant(_), Ref(..)) => {
+ (&mir::Operand::Copy(_), Ref(_, None, _)) |
+ (&mir::Operand::Constant(_), Ref(_, None, _)) => {
let tmp = PlaceRef::alloca(&bx, op.layout, "const");
op.val.store(&bx, tmp);
- op.val = Ref(tmp.llval, tmp.align);
+ op.val = Ref(tmp.llval, None, tmp.align);
}
_ => {}
}
@@ -657,13 +658,22 @@
}
_ => bug!("codegen_argument: {:?} invalid for pair arugment", op)
}
+ } else if arg.is_unsized_indirect() {
+ match op.val {
+ Ref(a, Some(b), _) => {
+ llargs.push(a);
+ llargs.push(b);
+ return;
+ }
+ _ => bug!("codegen_argument: {:?} invalid for unsized indirect argument", op)
+ }
}
// Force by-ref if we have to load through a cast pointer.
let (mut llval, align, by_ref) = match op.val {
Immediate(_) | Pair(..) => {
match arg.mode {
- PassMode::Indirect(_) | PassMode::Cast(_) => {
+ PassMode::Indirect(..) | PassMode::Cast(_) => {
let scratch = PlaceRef::alloca(bx, arg.layout, "arg");
op.val.store(bx, scratch);
(scratch.llval, scratch.align, true)
@@ -673,7 +683,7 @@
}
}
}
- Ref(llval, align) => {
+ Ref(llval, _, align) => {
if arg.is_indirect() && align.abi() < arg.layout.align.abi() {
// `foo(packed.large_field)`. We can't pass the (unaligned) field directly. I
// think that ATM (Rust 1.16) we only pass temporaries, but we shouldn't
@@ -721,12 +731,14 @@
let tuple = self.codegen_operand(bx, operand);
// Handle both by-ref and immediate tuples.
- if let Ref(llval, align) = tuple.val {
+ if let Ref(llval, None, align) = tuple.val {
let tuple_ptr = PlaceRef::new_sized(llval, tuple.layout, align);
for i in 0..tuple.layout.fields.count() {
let field_ptr = tuple_ptr.project_field(bx, i);
self.codegen_argument(bx, field_ptr.load(bx), llargs, &args[i]);
}
+ } else if let Ref(_, Some(_), _) = tuple.val {
+ bug!("closure arguments must be sized")
} else {
// If the tuple is immediate, the elements are as well.
for i in 0..tuple.layout.fields.count() {
@@ -820,6 +832,7 @@
let dest = if let mir::Place::Local(index) = *dest {
match self.locals[index] {
LocalRef::Place(dest) => dest,
+ LocalRef::UnsizedPlace(_) => bug!("return type must be sized"),
LocalRef::Operand(None) => {
// Handle temporary places, specifically Operand ones, as
// they don't have allocas
@@ -871,6 +884,7 @@
if let mir::Place::Local(index) = *dst {
match self.locals[index] {
LocalRef::Place(place) => self.codegen_transmute_into(bx, src, place),
+ LocalRef::UnsizedPlace(_) => bug!("transmute must not involve unsized locals"),
LocalRef::Operand(None) => {
let dst_layout = bx.cx.layout_of(self.monomorphized_place_ty(dst));
assert!(!dst_layout.ty.has_erasable_regions());
diff --git a/src/librustc_codegen_llvm/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs
index a6e14a9..47fd926 100644
--- a/src/librustc_codegen_llvm/mir/constant.rs
+++ b/src/librustc_codegen_llvm/mir/constant.rs
@@ -25,7 +25,7 @@
use type_of::LayoutLlvmExt;
use type_::Type;
use syntax::ast::Mutability;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use value::Value;
use super::super::callee;
diff --git a/src/librustc_codegen_llvm/mir/mod.rs b/src/librustc_codegen_llvm/mir/mod.rs
index 8fdb67f..d3cb97f 100644
--- a/src/librustc_codegen_llvm/mir/mod.rs
+++ b/src/librustc_codegen_llvm/mir/mod.rs
@@ -166,7 +166,7 @@
let scope_metadata = self.scopes[scope_id].scope_metadata;
if pos < self.scopes[scope_id].file_start_pos ||
pos >= self.scopes[scope_id].file_end_pos {
- let cm = self.cx.sess().codemap();
+ let cm = self.cx.sess().source_map();
let defining_crate = self.debug_context.get_ref(DUMMY_SP).defining_crate;
Some(debuginfo::extend_scope_to_file(self.cx,
scope_metadata.unwrap(),
@@ -180,6 +180,11 @@
enum LocalRef<'ll, 'tcx> {
Place(PlaceRef<'ll, 'tcx>),
+ /// `UnsizedPlace(p)`: `p` itself is a thin pointer (indirect place).
+ /// `*p` is the fat pointer that references the actual unsized place.
+ /// Every time it is initialized, we have to reallocate the place
+ /// and update the fat pointer. That's the reason why it is indirect.
+ UnsizedPlace(PlaceRef<'ll, 'tcx>),
Operand(Option<OperandRef<'ll, 'tcx>>),
}
@@ -275,17 +280,24 @@
}
debug!("alloc: {:?} ({}) -> place", local, name);
- let place = PlaceRef::alloca(&bx, layout, &name.as_str());
- if dbg {
- let (scope, span) = fx.debug_loc(mir::SourceInfo {
- span: decl.source_info.span,
- scope: decl.visibility_scope,
- });
- declare_local(&bx, &fx.debug_context, name, layout.ty, scope.unwrap(),
- VariableAccess::DirectVariable { alloca: place.llval },
- VariableKind::LocalVariable, span);
+ if layout.is_unsized() {
+ let indirect_place =
+ PlaceRef::alloca_unsized_indirect(&bx, layout, &name.as_str());
+ // FIXME: add an appropriate debuginfo
+ LocalRef::UnsizedPlace(indirect_place)
+ } else {
+ let place = PlaceRef::alloca(&bx, layout, &name.as_str());
+ if dbg {
+ let (scope, span) = fx.debug_loc(mir::SourceInfo {
+ span: decl.source_info.span,
+ scope: decl.visibility_scope,
+ });
+ declare_local(&bx, &fx.debug_context, name, layout.ty, scope.unwrap(),
+ VariableAccess::DirectVariable { alloca: place.llval },
+ VariableKind::LocalVariable, span);
+ }
+ LocalRef::Place(place)
}
- LocalRef::Place(place)
} else {
// Temporary or return place
if local == mir::RETURN_PLACE && fx.fn_ty.ret.is_indirect() {
@@ -294,7 +306,13 @@
LocalRef::Place(PlaceRef::new_sized(llretptr, layout, layout.align))
} else if memory_locals.contains(local) {
debug!("alloc: {:?} -> place", local);
- LocalRef::Place(PlaceRef::alloca(&bx, layout, &format!("{:?}", local)))
+ if layout.is_unsized() {
+ let indirect_place =
+ PlaceRef::alloca_unsized_indirect(&bx, layout, &format!("{:?}", local));
+ LocalRef::UnsizedPlace(indirect_place)
+ } else {
+ LocalRef::Place(PlaceRef::alloca(&bx, layout, &format!("{:?}", local)))
+ }
} else {
// If this is an immediate local, we do not create an
// alloca in advance. Instead we wait until we see the
@@ -523,7 +541,7 @@
}
}
- let place = if arg.is_indirect() {
+ let place = if arg.is_sized_indirect() {
// Don't copy an indirect argument to an alloca, the caller
// already put it in a temporary alloca and gave it up.
// FIXME: lifetimes
@@ -531,6 +549,18 @@
bx.set_value_name(llarg, &name);
llarg_idx += 1;
PlaceRef::new_sized(llarg, arg.layout, arg.layout.align)
+ } else if arg.is_unsized_indirect() {
+ // As the storage for the indirect argument lives during
+ // the whole function call, we just copy the fat pointer.
+ let llarg = llvm::get_param(bx.llfn(), llarg_idx as c_uint);
+ llarg_idx += 1;
+ let llextra = llvm::get_param(bx.llfn(), llarg_idx as c_uint);
+ llarg_idx += 1;
+ let indirect_operand = OperandValue::Pair(llarg, llextra);
+
+ let tmp = PlaceRef::alloca_unsized_indirect(bx, arg.layout, &name);
+ indirect_operand.store(&bx, tmp);
+ tmp
} else {
let tmp = PlaceRef::alloca(bx, arg.layout, &name);
arg.store_fn_arg(bx, &mut llarg_idx, tmp);
@@ -574,6 +604,25 @@
};
let upvar_tys = upvar_substs.upvar_tys(def_id, tcx);
+ // Store the pointer to closure data in an alloca for debuginfo
+ // because that's what the llvm.dbg.declare intrinsic expects.
+
+ // FIXME(eddyb) this shouldn't be necessary but SROA seems to
+ // mishandle DW_OP_plus not preceded by DW_OP_deref, i.e. it
+ // doesn't actually strip the offset when splitting the closure
+ // environment into its components so it ends up out of bounds.
+ // (cuviper) It seems to be fine without the alloca on LLVM 6 and later.
+ let env_alloca = !env_ref && unsafe { llvm::LLVMRustVersionMajor() < 6 };
+ let env_ptr = if env_alloca {
+ let scratch = PlaceRef::alloca(bx,
+ bx.cx.layout_of(tcx.mk_mut_ptr(arg.layout.ty)),
+ "__debuginfo_env_ptr");
+ bx.store(place.llval, scratch.llval, scratch.align);
+ scratch.llval
+ } else {
+ place.llval
+ };
+
for (i, (decl, ty)) in mir.upvar_decls.iter().zip(upvar_tys).enumerate() {
let byte_offset_of_var_in_env = closure_layout.fields.offset(i).bytes();
@@ -585,7 +634,10 @@
};
// The environment and the capture can each be indirect.
- let mut ops = if env_ref { &ops[..] } else { &ops[1..] };
+
+ // FIXME(eddyb) see above why we sometimes have to keep
+ // a pointer in an alloca for debuginfo atm.
+ let mut ops = if env_ref || env_alloca { &ops[..] } else { &ops[1..] };
let ty = if let (true, &ty::TyRef(_, ty, _)) = (decl.by_ref, &ty.sty) {
ty
@@ -595,7 +647,7 @@
};
let variable_access = VariableAccess::IndirectVariable {
- alloca: place.llval,
+ alloca: env_ptr,
address_operations: &ops
};
declare_local(
@@ -610,7 +662,11 @@
);
}
});
- LocalRef::Place(place)
+ if arg.is_unsized_indirect() {
+ LocalRef::UnsizedPlace(place)
+ } else {
+ LocalRef::Place(place)
+ }
}).collect()
}
diff --git a/src/librustc_codegen_llvm/mir/operand.rs b/src/librustc_codegen_llvm/mir/operand.rs
index f8166ee..9537379 100644
--- a/src/librustc_codegen_llvm/mir/operand.rs
+++ b/src/librustc_codegen_llvm/mir/operand.rs
@@ -21,6 +21,8 @@
use builder::{Builder, MemFlags};
use value::Value;
use type_of::LayoutLlvmExt;
+use type_::Type;
+use glue;
use std::fmt;
@@ -35,7 +37,9 @@
pub enum OperandValue<'ll> {
/// A reference to the actual operand. The data is guaranteed
/// to be valid for the operand's lifetime.
- Ref(&'ll Value, Align),
+ /// The second value, if any, is the extra data (vtable or length)
+ /// which indicates that it refers to an unsized rvalue.
+ Ref(&'ll Value, Option<&'ll Value>, Align),
/// A single LLVM value.
Immediate(&'ll Value),
/// A pair of immediate LLVM values. Used by fat pointers too.
@@ -283,10 +287,13 @@
return;
}
match self {
- OperandValue::Ref(r, source_align) => {
+ OperandValue::Ref(r, None, source_align) => {
base::memcpy_ty(bx, dest.llval, r, dest.layout,
source_align.min(dest.align), flags)
}
+ OperandValue::Ref(_, Some(_), _) => {
+ bug!("cannot directly store unsized values");
+ }
OperandValue::Immediate(s) => {
let val = base::from_immediate(bx, s);
bx.store_with_flags(val, dest.llval, dest.align, flags);
@@ -300,6 +307,35 @@
}
}
}
+
+ pub fn store_unsized(self, bx: &Builder<'a, 'll, 'tcx>, indirect_dest: PlaceRef<'ll, 'tcx>) {
+ debug!("OperandRef::store_unsized: operand={:?}, indirect_dest={:?}", self, indirect_dest);
+ let flags = MemFlags::empty();
+
+ // `indirect_dest` must have `*mut T` type. We extract `T` out of it.
+ let unsized_ty = indirect_dest.layout.ty.builtin_deref(true)
+ .unwrap_or_else(|| bug!("indirect_dest has non-pointer type: {:?}", indirect_dest)).ty;
+
+ let (llptr, llextra) =
+ if let OperandValue::Ref(llptr, Some(llextra), _) = self {
+ (llptr, llextra)
+ } else {
+ bug!("store_unsized called with a sized value")
+ };
+
+ // FIXME: choose an appropriate alignment, or use dynamic align somehow
+ let max_align = Align::from_bits(128, 128).unwrap();
+ let min_align = Align::from_bits(8, 8).unwrap();
+
+ // Allocate an appropriate region on the stack, and copy the value into it
+ let (llsize, _) = glue::size_and_align_of_dst(&bx, unsized_ty, Some(llextra));
+ let lldst = bx.array_alloca(Type::i8(bx.cx), llsize, "unsized_tmp", max_align);
+ base::call_memcpy(&bx, lldst, llptr, llsize, min_align, flags);
+
+ // Store the allocated region and the extra to the indirect place.
+ let indirect_operand = OperandValue::Pair(lldst, llextra);
+ indirect_operand.store(&bx, indirect_dest);
+ }
}
impl FunctionCx<'a, 'll, 'tcx> {
@@ -320,7 +356,7 @@
LocalRef::Operand(None) => {
bug!("use of {:?} before def", place);
}
- LocalRef::Place(..) => {
+ LocalRef::Place(..) | LocalRef::UnsizedPlace(..) => {
// use path below
}
}
diff --git a/src/librustc_codegen_llvm/mir/place.rs b/src/librustc_codegen_llvm/mir/place.rs
index 6fa0845..89d41dc 100644
--- a/src/librustc_codegen_llvm/mir/place.rs
+++ b/src/librustc_codegen_llvm/mir/place.rs
@@ -48,6 +48,7 @@
layout: TyLayout<'tcx>,
align: Align,
) -> PlaceRef<'ll, 'tcx> {
+ assert!(!layout.is_unsized());
PlaceRef {
llval,
llextra: None,
@@ -77,10 +78,21 @@
pub fn alloca(bx: &Builder<'a, 'll, 'tcx>, layout: TyLayout<'tcx>, name: &str)
-> PlaceRef<'ll, 'tcx> {
debug!("alloca({:?}: {:?})", name, layout);
+ assert!(!layout.is_unsized(), "tried to statically allocate unsized place");
let tmp = bx.alloca(layout.llvm_type(bx.cx), name, layout.align);
Self::new_sized(tmp, layout, layout.align)
}
+ /// Returns a place for an indirect reference to an unsized place.
+ pub fn alloca_unsized_indirect(bx: &Builder<'a, 'll, 'tcx>, layout: TyLayout<'tcx>, name: &str)
+ -> PlaceRef<'ll, 'tcx> {
+ debug!("alloca_unsized_indirect({:?}: {:?})", name, layout);
+ assert!(layout.is_unsized(), "tried to allocate indirect place for sized values");
+ let ptr_ty = bx.cx.tcx.mk_mut_ptr(layout.ty);
+ let ptr_layout = bx.cx.layout_of(ptr_ty);
+ Self::alloca(bx, ptr_layout, name)
+ }
+
pub fn len(&self, cx: &CodegenCx<'ll, 'tcx>) -> &'ll Value {
if let layout::FieldPlacement::Array { count, .. } = self.layout.fields {
if self.layout.is_unsized() {
@@ -97,7 +109,7 @@
pub fn load(&self, bx: &Builder<'a, 'll, 'tcx>) -> OperandRef<'ll, 'tcx> {
debug!("PlaceRef::load: {:?}", self);
- assert_eq!(self.llextra, None);
+ assert_eq!(self.llextra.is_some(), self.layout.is_unsized());
if self.layout.is_zst() {
return OperandRef::new_zst(bx.cx, self.layout);
@@ -119,7 +131,9 @@
}
};
- let val = if self.layout.is_llvm_immediate() {
+ let val = if let Some(llextra) = self.llextra {
+ OperandValue::Ref(self.llval, Some(llextra), self.align)
+ } else if self.layout.is_llvm_immediate() {
let mut const_llval = None;
unsafe {
if let Some(global) = llvm::LLVMIsAGlobalVariable(self.llval) {
@@ -149,7 +163,7 @@
};
OperandValue::Pair(load(0, a), load(1, b))
} else {
- OperandValue::Ref(self.llval, self.align)
+ OperandValue::Ref(self.llval, None, self.align)
};
OperandRef { val, layout: self.layout }
@@ -424,6 +438,9 @@
LocalRef::Place(place) => {
return place;
}
+ LocalRef::UnsizedPlace(place) => {
+ return place.load(bx).deref(&cx);
+ }
LocalRef::Operand(..) => {
bug!("using operand local {:?} as place", place);
}
diff --git a/src/librustc_codegen_llvm/mir/rvalue.rs b/src/librustc_codegen_llvm/mir/rvalue.rs
index dda33ae..84427d8 100644
--- a/src/librustc_codegen_llvm/mir/rvalue.rs
+++ b/src/librustc_codegen_llvm/mir/rvalue.rs
@@ -83,10 +83,13 @@
base::coerce_unsized_into(&bx, scratch, dest);
scratch.storage_dead(&bx);
}
- OperandValue::Ref(llref, align) => {
+ OperandValue::Ref(llref, None, align) => {
let source = PlaceRef::new_sized(llref, operand.layout, align);
base::coerce_unsized_into(&bx, source, dest);
}
+ OperandValue::Ref(_, Some(_), _) => {
+ bug!("unsized coercion on an unsized rvalue")
+ }
}
bx
}
@@ -175,6 +178,26 @@
}
}
+ pub fn codegen_rvalue_unsized(&mut self,
+ bx: Builder<'a, 'll, 'tcx>,
+ indirect_dest: PlaceRef<'ll, 'tcx>,
+ rvalue: &mir::Rvalue<'tcx>)
+ -> Builder<'a, 'll, 'tcx>
+ {
+ debug!("codegen_rvalue_unsized(indirect_dest.llval={:?}, rvalue={:?})",
+ indirect_dest.llval, rvalue);
+
+ match *rvalue {
+ mir::Rvalue::Use(ref operand) => {
+ let cg_operand = self.codegen_operand(&bx, operand);
+ cg_operand.val.store_unsized(&bx, indirect_dest);
+ bx
+ }
+
+ _ => bug!("unsized assignment other than Rvalue::Use"),
+ }
+ }
+
pub fn codegen_rvalue_operand(&mut self,
bx: Builder<'a, 'll, 'tcx>,
rvalue: &mir::Rvalue<'tcx>)
@@ -304,7 +327,9 @@
// then `i1 1` (i.e. E::B) is effectively `i8 -1`.
signed = !scalar.is_bool() && s;
- if scalar.valid_range.end() > scalar.valid_range.start() {
+ let er = scalar.valid_range_exclusive(bx.cx);
+ if er.end != er.start &&
+ scalar.valid_range.end() > scalar.valid_range.start() {
// We want `table[e as usize]` to not
// have bound checks, and this is the most
// convenient place to put the `assume`.
diff --git a/src/librustc_codegen_llvm/mir/statement.rs b/src/librustc_codegen_llvm/mir/statement.rs
index 06340a3..dd62a12 100644
--- a/src/librustc_codegen_llvm/mir/statement.rs
+++ b/src/librustc_codegen_llvm/mir/statement.rs
@@ -31,6 +31,9 @@
LocalRef::Place(cg_dest) => {
self.codegen_rvalue(bx, cg_dest, rvalue)
}
+ LocalRef::UnsizedPlace(cg_indirect_dest) => {
+ self.codegen_rvalue_unsized(bx, cg_indirect_dest, rvalue)
+ }
LocalRef::Operand(None) => {
let (bx, operand) = self.codegen_rvalue_operand(bx, rvalue);
self.locals[index] = LocalRef::Operand(Some(operand));
@@ -61,12 +64,16 @@
mir::StatementKind::StorageLive(local) => {
if let LocalRef::Place(cg_place) = self.locals[local] {
cg_place.storage_live(&bx);
+ } else if let LocalRef::UnsizedPlace(cg_indirect_place) = self.locals[local] {
+ cg_indirect_place.storage_live(&bx);
}
bx
}
mir::StatementKind::StorageDead(local) => {
if let LocalRef::Place(cg_place) = self.locals[local] {
cg_place.storage_dead(&bx);
+ } else if let LocalRef::UnsizedPlace(cg_indirect_place) = self.locals[local] {
+ cg_indirect_place.storage_dead(&bx);
}
bx
}
diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs
index a528008..7f25911 100644
--- a/src/librustc_codegen_llvm/mono_item.rs
+++ b/src/librustc_codegen_llvm/mono_item.rs
@@ -143,7 +143,6 @@
}
cx.instances.borrow_mut().insert(instance, g);
- cx.statics.borrow_mut().insert(g, def_id);
}
fn predefine_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
@@ -183,7 +182,7 @@
if instance.def.is_inline(cx.tcx) {
attributes::inline(lldecl, attributes::InlineAttr::Hint);
}
- attributes::from_fn_attrs(cx, lldecl, instance.def.def_id());
+ attributes::from_fn_attrs(cx, lldecl, Some(instance.def.def_id()));
cx.instances.borrow_mut().insert(instance, lldecl);
}
diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs
index 9fa7cc4..51a233d 100644
--- a/src/librustc_codegen_llvm/type_.rs
+++ b/src/librustc_codegen_llvm/type_.rs
@@ -19,8 +19,8 @@
use syntax::ast;
use rustc::ty::layout::{self, Align, Size};
+use rustc_data_structures::small_c_str::SmallCStr;
-use std::ffi::CString;
use std::fmt;
use libc::c_uint;
@@ -201,7 +201,7 @@
}
pub fn named_struct(cx: &CodegenCx<'ll, '_>, name: &str) -> &'ll Type {
- let name = CString::new(name).unwrap();
+ let name = SmallCStr::new(name);
unsafe {
llvm::LLVMStructCreateNamed(cx.llcx, name.as_ptr())
}
diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs
index 5fd4f15..69d91b3 100644
--- a/src/librustc_codegen_llvm/type_of.rs
+++ b/src/librustc_codegen_llvm/type_of.rs
@@ -89,7 +89,7 @@
Type::struct_(cx, &[fill], packed)
}
Some(ref name) => {
- let mut llty = Type::named_struct(cx, name);
+ let llty = Type::named_struct(cx, name);
llty.set_struct_body(&[fill], packed);
llty
}
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs
index 3ff2388b..635819e 100644
--- a/src/librustc_codegen_utils/lib.rs
+++ b/src/librustc_codegen_utils/lib.rs
@@ -19,6 +19,7 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(custom_attribute)]
+#![cfg_attr(not(stage0), feature(nll))]
#![allow(unused_attributes)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
diff --git a/src/librustc_codegen_utils/link.rs b/src/librustc_codegen_utils/link.rs
index 73cffdf..a0d88cc 100644
--- a/src/librustc_codegen_utils/link.rs
+++ b/src/librustc_codegen_utils/link.rs
@@ -11,7 +11,7 @@
use rustc::session::config::{self, OutputFilenames, Input, OutputType};
use rustc::session::Session;
use rustc::middle::cstore::LinkMeta;
-use rustc::hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use std::path::{Path, PathBuf};
use syntax::{ast, attr};
use syntax_pos::Span;
diff --git a/src/librustc_cratesio_shim/src/lib.rs b/src/librustc_cratesio_shim/src/lib.rs
index 85a5b33..39087c5 100644
--- a/src/librustc_cratesio_shim/src/lib.rs
+++ b/src/librustc_cratesio_shim/src/lib.rs
@@ -11,5 +11,7 @@
// See Cargo.toml for a comment explaining this crate.
#![allow(unused_extern_crates)]
+#![cfg_attr(not(stage0), feature(nll))]
+
extern crate bitflags;
extern crate log;
diff --git a/src/librustc_data_structures/base_n.rs b/src/librustc_data_structures/base_n.rs
index d333b63..d3b47da 100644
--- a/src/librustc_data_structures/base_n.rs
+++ b/src/librustc_data_structures/base_n.rs
@@ -17,7 +17,7 @@
pub const ALPHANUMERIC_ONLY: usize = 62;
pub const CASE_INSENSITIVE: usize = 36;
-const BASE_64: &'static [u8; MAX_BASE as usize] =
+const BASE_64: &[u8; MAX_BASE as usize] =
b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@$";
#[inline]
@@ -37,7 +37,8 @@
break;
}
}
- &mut s[0..index].reverse();
+ s[0..index].reverse();
+
output.push_str(str::from_utf8(&s[0..index]).unwrap());
}
diff --git a/src/librustc_data_structures/bitslice.rs b/src/librustc_data_structures/bitslice.rs
index b8f191c..a63033c 100644
--- a/src/librustc_data_structures/bitslice.rs
+++ b/src/librustc_data_structures/bitslice.rs
@@ -75,7 +75,7 @@
let word = bit / word_bits;
let bit_in_word = bit % word_bits;
let bit_mask = 1 << bit_in_word;
- BitLookup { word: word, bit_in_word: bit_in_word, bit_mask: bit_mask }
+ BitLookup { word, bit_in_word, bit_mask }
}
pub fn bits_to_string(words: &[Word], bits: usize) -> String {
@@ -105,7 +105,8 @@
sep = '|';
}
result.push(']');
- return result
+
+ result
}
#[inline]
diff --git a/src/librustc_data_structures/bitvec.rs b/src/librustc_data_structures/bitvec.rs
index 6e8a45d..49ab3e5 100644
--- a/src/librustc_data_structures/bitvec.rs
+++ b/src/librustc_data_structures/bitvec.rs
@@ -196,7 +196,8 @@
self.current >>= offset;
self.current >>= 1; // shift otherwise overflows for 0b1000_0000_…_0000
self.idx += offset + 1;
- return Some(C::new(self.idx - 1));
+
+ Some(C::new(self.idx - 1))
}
fn size_hint(&self) -> (usize, Option<usize>) {
@@ -299,7 +300,7 @@
let v1 = vector[write_index];
let v2 = v1 | vector[read_index];
vector[write_index] = v2;
- changed = changed | (v1 != v2);
+ changed |= v1 != v2;
}
changed
}
diff --git a/src/librustc_data_structures/const_cstr.rs b/src/librustc_data_structures/const_cstr.rs
new file mode 100644
index 0000000..4589d97
--- /dev/null
+++ b/src/librustc_data_structures/const_cstr.rs
@@ -0,0 +1,42 @@
+// 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.
+
+/// This macro creates a zero-overhead &CStr by adding a NUL terminator to
+/// the string literal passed into it at compile-time. Use it like:
+///
+/// ```
+/// let some_const_cstr = const_cstr!("abc");
+/// ```
+///
+/// The above is roughly equivalent to:
+///
+/// ```
+/// let some_const_cstr = CStr::from_bytes_with_nul(b"abc\0").unwrap()
+/// ```
+///
+/// Note that macro only checks the string literal for internal NULs if
+/// debug-assertions are enabled in order to avoid runtime overhead in release
+/// builds.
+#[macro_export]
+macro_rules! const_cstr {
+ ($s:expr) => ({
+ use std::ffi::CStr;
+
+ let str_plus_nul = concat!($s, "\0");
+
+ if cfg!(debug_assertions) {
+ CStr::from_bytes_with_nul(str_plus_nul.as_bytes()).unwrap()
+ } else {
+ unsafe {
+ CStr::from_bytes_with_nul_unchecked(str_plus_nul.as_bytes())
+ }
+ }
+ })
+}
diff --git a/src/librustc_data_structures/fingerprint.rs b/src/librustc_data_structures/fingerprint.rs
new file mode 100644
index 0000000..aa9ddda
--- /dev/null
+++ b/src/librustc_data_structures/fingerprint.rs
@@ -0,0 +1,111 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::mem;
+use stable_hasher;
+use serialize;
+use serialize::opaque::{EncodeResult, Encoder, Decoder};
+
+#[derive(Eq, PartialEq, Ord, PartialOrd, Hash, Debug, Clone, Copy)]
+pub struct Fingerprint(u64, u64);
+
+impl Fingerprint {
+
+ pub const ZERO: Fingerprint = Fingerprint(0, 0);
+
+ #[inline]
+ pub fn from_smaller_hash(hash: u64) -> Fingerprint {
+ Fingerprint(hash, hash)
+ }
+
+ #[inline]
+ pub fn to_smaller_hash(&self) -> u64 {
+ self.0
+ }
+
+ #[inline]
+ pub fn as_value(&self) -> (u64, u64) {
+ (self.0, self.1)
+ }
+
+ #[inline]
+ pub fn combine(self, other: Fingerprint) -> Fingerprint {
+ // See https://stackoverflow.com/a/27952689 on why this function is
+ // implemented this way.
+ Fingerprint(
+ self.0.wrapping_mul(3).wrapping_add(other.0),
+ self.1.wrapping_mul(3).wrapping_add(other.1)
+ )
+ }
+
+ // Combines two hashes in an order independent way. Make sure this is what
+ // you want.
+ #[inline]
+ pub fn combine_commutative(self, other: Fingerprint) -> Fingerprint {
+ let a = (self.1 as u128) << 64 | self.0 as u128;
+ let b = (other.1 as u128) << 64 | other.0 as u128;
+
+ let c = a.wrapping_add(b);
+
+ Fingerprint((c >> 64) as u64, c as u64)
+ }
+
+ pub fn to_hex(&self) -> String {
+ format!("{:x}{:x}", self.0, self.1)
+ }
+
+ pub fn encode_opaque(&self, encoder: &mut Encoder) -> EncodeResult {
+ let bytes: [u8; 16] = unsafe { mem::transmute([self.0.to_le(), self.1.to_le()]) };
+
+ encoder.emit_raw_bytes(&bytes);
+ Ok(())
+ }
+
+ pub fn decode_opaque<'a>(decoder: &mut Decoder<'a>) -> Result<Fingerprint, String> {
+ let mut bytes = [0; 16];
+
+ decoder.read_raw_bytes(&mut bytes)?;
+
+ let [l, r]: [u64; 2] = unsafe { mem::transmute(bytes) };
+
+ Ok(Fingerprint(u64::from_le(l), u64::from_le(r)))
+ }
+}
+
+impl ::std::fmt::Display for Fingerprint {
+ fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
+ write!(formatter, "{:x}-{:x}", self.0, self.1)
+ }
+}
+
+impl stable_hasher::StableHasherResult for Fingerprint {
+ fn finish(hasher: stable_hasher::StableHasher<Self>) -> Self {
+ let (_0, _1) = hasher.finalize();
+ Fingerprint(_0, _1)
+ }
+}
+
+impl_stable_hash_via_hash!(Fingerprint);
+
+impl serialize::UseSpecializedEncodable for Fingerprint { }
+
+impl serialize::UseSpecializedDecodable for Fingerprint { }
+
+impl serialize::SpecializedEncoder<Fingerprint> for serialize::opaque::Encoder {
+ fn specialized_encode(&mut self, f: &Fingerprint) -> Result<(), Self::Error> {
+ f.encode_opaque(self)
+ }
+}
+
+impl<'a> serialize::SpecializedDecoder<Fingerprint> for serialize::opaque::Decoder<'a> {
+ fn specialized_decode(&mut self) -> Result<Fingerprint, Self::Error> {
+ Fingerprint::decode_opaque(self)
+ }
+}
diff --git a/src/librustc_data_structures/flock.rs b/src/librustc_data_structures/flock.rs
index ff1ebb1..3f248da 100644
--- a/src/librustc_data_structures/flock.rs
+++ b/src/librustc_data_structures/flock.rs
@@ -254,8 +254,8 @@
type ULONG_PTR = usize;
type LPOVERLAPPED = *mut OVERLAPPED;
- const LOCKFILE_EXCLUSIVE_LOCK: DWORD = 0x00000002;
- const LOCKFILE_FAIL_IMMEDIATELY: DWORD = 0x00000001;
+ const LOCKFILE_EXCLUSIVE_LOCK: DWORD = 0x0000_0002;
+ const LOCKFILE_FAIL_IMMEDIATELY: DWORD = 0x0000_0001;
const FILE_SHARE_DELETE: DWORD = 0x4;
const FILE_SHARE_READ: DWORD = 0x1;
diff --git a/src/librustc_data_structures/graph/dominators/mod.rs b/src/librustc_data_structures/graph/dominators/mod.rs
index d134fad..e54147c 100644
--- a/src/librustc_data_structures/graph/dominators/mod.rs
+++ b/src/librustc_data_structures/graph/dominators/mod.rs
@@ -107,7 +107,8 @@
node2 = immediate_dominators[node2].unwrap();
}
}
- return node1;
+
+ node1
}
#[derive(Clone, Debug)]
diff --git a/src/librustc_data_structures/graph/implementation/mod.rs b/src/librustc_data_structures/graph/implementation/mod.rs
index cf9403d..baac756 100644
--- a/src/librustc_data_structures/graph/implementation/mod.rs
+++ b/src/librustc_data_structures/graph/implementation/mod.rs
@@ -90,7 +90,7 @@
impl NodeIndex {
/// Returns unique id (unique with respect to the graph holding associated node).
- pub fn node_id(&self) -> usize {
+ pub fn node_id(self) -> usize {
self.0
}
}
@@ -187,7 +187,7 @@
self.nodes[source.0].first_edge[OUTGOING.repr] = idx;
self.nodes[target.0].first_edge[INCOMING.repr] = idx;
- return idx;
+ idx
}
pub fn edge(&self, idx: EdgeIndex) -> &Edge<E> {
@@ -261,8 +261,8 @@
DepthFirstTraversal::with_start_node(self, start, direction)
}
- pub fn nodes_in_postorder<'a>(
- &'a self,
+ pub fn nodes_in_postorder(
+ &self,
direction: Direction,
entry_node: NodeIndex,
) -> Vec<NodeIndex> {
diff --git a/src/librustc_data_structures/graph/test.rs b/src/librustc_data_structures/graph/test.rs
index 48b6547..b72d011 100644
--- a/src/librustc_data_structures/graph/test.rs
+++ b/src/librustc_data_structures/graph/test.rs
@@ -33,12 +33,12 @@
for &(source, target) in edges {
graph.num_nodes = max(graph.num_nodes, source + 1);
graph.num_nodes = max(graph.num_nodes, target + 1);
- graph.successors.entry(source).or_insert(vec![]).push(target);
- graph.predecessors.entry(target).or_insert(vec![]).push(source);
+ graph.successors.entry(source).or_default().push(target);
+ graph.predecessors.entry(target).or_default().push(source);
}
for node in 0..graph.num_nodes {
- graph.successors.entry(node).or_insert(vec![]);
- graph.predecessors.entry(node).or_insert(vec![]);
+ graph.successors.entry(node).or_default();
+ graph.predecessors.entry(node).or_default();
}
graph
}
diff --git a/src/librustc_data_structures/indexed_set.rs b/src/librustc_data_structures/indexed_set.rs
index 2e95a45..a7672d1 100644
--- a/src/librustc_data_structures/indexed_set.rs
+++ b/src/librustc_data_structures/indexed_set.rs
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use array_vec::ArrayVec;
use std::borrow::{Borrow, BorrowMut, ToOwned};
use std::fmt;
use std::iter;
@@ -25,6 +26,8 @@
///
/// In other words, `T` is the type used to index into the bitvector
/// this type uses to represent the set of object it holds.
+///
+/// The representation is dense, using one bit per possible element.
#[derive(Eq, PartialEq)]
pub struct IdxSetBuf<T: Idx> {
_pd: PhantomData<fn(&T)>,
@@ -59,16 +62,13 @@
// pnkfelix wants to have this be `IdxSet<T>([Word]) and then pass
// around `&mut IdxSet<T>` or `&IdxSet<T>`.
-//
-// WARNING: Mapping a `&IdxSetBuf<T>` to `&IdxSet<T>` (at least today)
-// requires a transmute relying on representation guarantees that may
-// not hold in the future.
/// Represents a set (or packed family of sets), of some element type
/// E, where each E is identified by some unique index type `T`.
///
/// In other words, `T` is the type used to index into the bitslice
/// this type uses to represent the set of object it holds.
+#[repr(transparent)]
pub struct IdxSet<T: Idx> {
_pd: PhantomData<fn(&T)>,
bits: [Word],
@@ -93,6 +93,8 @@
}
}
+const BITS_PER_WORD: usize = mem::size_of::<Word>() * 8;
+
impl<T: Idx> fmt::Debug for IdxSetBuf<T> {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
w.debug_list()
@@ -111,8 +113,7 @@
impl<T: Idx> IdxSetBuf<T> {
fn new(init: Word, universe_size: usize) -> Self {
- let bits_per_word = mem::size_of::<Word>() * 8;
- let num_words = (universe_size + (bits_per_word - 1)) / bits_per_word;
+ let num_words = (universe_size + (BITS_PER_WORD - 1)) / BITS_PER_WORD;
IdxSetBuf {
_pd: Default::default(),
bits: vec![init; num_words],
@@ -134,11 +135,11 @@
impl<T: Idx> IdxSet<T> {
unsafe fn from_slice(s: &[Word]) -> &Self {
- mem::transmute(s) // (see above WARNING)
+ &*(s as *const [Word] as *const Self)
}
unsafe fn from_slice_mut(s: &mut [Word]) -> &mut Self {
- mem::transmute(s) // (see above WARNING)
+ &mut *(s as *mut [Word] as *mut Self)
}
}
@@ -163,6 +164,16 @@
}
}
+ /// Duplicates as a hybrid set.
+ pub fn to_hybrid(&self) -> HybridIdxSetBuf<T> {
+ // This universe_size may be slightly larger than the one specified
+ // upon creation, due to rounding up to a whole word. That's ok.
+ let universe_size = self.bits.len() * BITS_PER_WORD;
+
+ // Note: we currently don't bother trying to make a Sparse set.
+ HybridIdxSetBuf::Dense(self.to_owned(), universe_size)
+ }
+
/// Removes all elements
pub fn clear(&mut self) {
for b in &mut self.bits {
@@ -180,11 +191,9 @@
/// Clear all elements above `universe_size`.
fn trim_to(&mut self, universe_size: usize) {
- let word_bits = mem::size_of::<Word>() * 8;
-
// `trim_block` is the first block where some bits have
// to be cleared.
- let trim_block = universe_size / word_bits;
+ let trim_block = universe_size / BITS_PER_WORD;
// all the blocks above it have to be completely cleared.
if trim_block < self.bits.len() {
@@ -192,9 +201,9 @@
*b = 0;
}
- // at that block, the `universe_size % word_bits` lsbs
+ // at that block, the `universe_size % BITS_PER_WORD` lsbs
// should remain.
- let remaining_bits = universe_size % word_bits;
+ let remaining_bits = universe_size % BITS_PER_WORD;
let mask = (1<<remaining_bits)-1;
self.bits[trim_block] &= mask;
}
@@ -245,12 +254,46 @@
bitwise(self.words_mut(), other.words(), &Union)
}
+ /// Like `union()`, but takes a `SparseIdxSetBuf` argument.
+ fn union_sparse(&mut self, other: &SparseIdxSetBuf<T>) -> bool {
+ let mut changed = false;
+ for elem in other.iter() {
+ changed |= self.add(&elem);
+ }
+ changed
+ }
+
+ /// Like `union()`, but takes a `HybridIdxSetBuf` argument.
+ pub fn union_hybrid(&mut self, other: &HybridIdxSetBuf<T>) -> bool {
+ match other {
+ HybridIdxSetBuf::Sparse(sparse, _) => self.union_sparse(sparse),
+ HybridIdxSetBuf::Dense(dense, _) => self.union(dense),
+ }
+ }
+
/// Set `self = self - other` and return true if `self` changed.
/// (i.e., if any bits were removed).
pub fn subtract(&mut self, other: &IdxSet<T>) -> bool {
bitwise(self.words_mut(), other.words(), &Subtract)
}
+ /// Like `subtract()`, but takes a `SparseIdxSetBuf` argument.
+ fn subtract_sparse(&mut self, other: &SparseIdxSetBuf<T>) -> bool {
+ let mut changed = false;
+ for elem in other.iter() {
+ changed |= self.remove(&elem);
+ }
+ changed
+ }
+
+ /// Like `subtract()`, but takes a `HybridIdxSetBuf` argument.
+ pub fn subtract_hybrid(&mut self, other: &HybridIdxSetBuf<T>) -> bool {
+ match other {
+ HybridIdxSetBuf::Sparse(sparse, _) => self.subtract_sparse(sparse),
+ HybridIdxSetBuf::Dense(dense, _) => self.subtract(dense),
+ }
+ }
+
/// Set `self = self & other` and return true if `self` changed.
/// (i.e., if any bits were removed).
pub fn intersect(&mut self, other: &IdxSet<T>) -> bool {
@@ -276,11 +319,10 @@
type Item = T;
fn next(&mut self) -> Option<T> {
- let word_bits = mem::size_of::<Word>() * 8;
loop {
if let Some((ref mut word, offset)) = self.cur {
let bit_pos = word.trailing_zeros() as usize;
- if bit_pos != word_bits {
+ if bit_pos != BITS_PER_WORD {
let bit = 1 << bit_pos;
*word ^= bit;
return Some(T::new(bit_pos + offset))
@@ -288,7 +330,189 @@
}
let (i, word) = self.iter.next()?;
- self.cur = Some((*word, word_bits * i));
+ self.cur = Some((*word, BITS_PER_WORD * i));
+ }
+ }
+}
+
+const SPARSE_MAX: usize = 8;
+
+/// A sparse index set with a maximum of SPARSE_MAX elements. Used by
+/// HybridIdxSetBuf; do not use directly.
+///
+/// The elements are stored as an unsorted vector with no duplicates.
+#[derive(Clone, Debug)]
+pub struct SparseIdxSetBuf<T: Idx>(ArrayVec<[T; SPARSE_MAX]>);
+
+impl<T: Idx> SparseIdxSetBuf<T> {
+ fn new() -> Self {
+ SparseIdxSetBuf(ArrayVec::new())
+ }
+
+ fn len(&self) -> usize {
+ self.0.len()
+ }
+
+ fn contains(&self, elem: &T) -> bool {
+ self.0.contains(elem)
+ }
+
+ fn add(&mut self, elem: &T) -> bool {
+ // Ensure there are no duplicates.
+ if self.0.contains(elem) {
+ false
+ } else {
+ self.0.push(*elem);
+ true
+ }
+ }
+
+ fn remove(&mut self, elem: &T) -> bool {
+ if let Some(i) = self.0.iter().position(|e| e == elem) {
+ // Swap the found element to the end, then pop it.
+ let len = self.0.len();
+ self.0.swap(i, len - 1);
+ self.0.pop();
+ true
+ } else {
+ false
+ }
+ }
+
+ fn to_dense(&self, universe_size: usize) -> IdxSetBuf<T> {
+ let mut dense = IdxSetBuf::new_empty(universe_size);
+ for elem in self.0.iter() {
+ dense.add(elem);
+ }
+ dense
+ }
+
+ fn iter(&self) -> SparseIter<T> {
+ SparseIter {
+ iter: self.0.iter(),
+ }
+ }
+}
+
+pub struct SparseIter<'a, T: Idx> {
+ iter: slice::Iter<'a, T>,
+}
+
+impl<'a, T: Idx> Iterator for SparseIter<'a, T> {
+ type Item = T;
+
+ fn next(&mut self) -> Option<T> {
+ self.iter.next().map(|e| *e)
+ }
+}
+
+/// Like IdxSetBuf, but with a hybrid representation: sparse when there are few
+/// elements in the set, but dense when there are many. It's especially
+/// efficient for sets that typically have a small number of elements, but a
+/// large `universe_size`, and are cleared frequently.
+#[derive(Clone, Debug)]
+pub enum HybridIdxSetBuf<T: Idx> {
+ Sparse(SparseIdxSetBuf<T>, usize),
+ Dense(IdxSetBuf<T>, usize),
+}
+
+impl<T: Idx> HybridIdxSetBuf<T> {
+ pub fn new_empty(universe_size: usize) -> Self {
+ HybridIdxSetBuf::Sparse(SparseIdxSetBuf::new(), universe_size)
+ }
+
+ fn universe_size(&mut self) -> usize {
+ match *self {
+ HybridIdxSetBuf::Sparse(_, size) => size,
+ HybridIdxSetBuf::Dense(_, size) => size,
+ }
+ }
+
+ pub fn clear(&mut self) {
+ let universe_size = self.universe_size();
+ *self = HybridIdxSetBuf::new_empty(universe_size);
+ }
+
+ /// Returns true iff set `self` contains `elem`.
+ pub fn contains(&self, elem: &T) -> bool {
+ match self {
+ HybridIdxSetBuf::Sparse(sparse, _) => sparse.contains(elem),
+ HybridIdxSetBuf::Dense(dense, _) => dense.contains(elem),
+ }
+ }
+
+ /// Adds `elem` to the set `self`.
+ pub fn add(&mut self, elem: &T) -> bool {
+ match self {
+ HybridIdxSetBuf::Sparse(sparse, _) if sparse.len() < SPARSE_MAX => {
+ // The set is sparse and has space for `elem`.
+ sparse.add(elem)
+ }
+ HybridIdxSetBuf::Sparse(sparse, _) if sparse.contains(elem) => {
+ // The set is sparse and does not have space for `elem`, but
+ // that doesn't matter because `elem` is already present.
+ false
+ }
+ HybridIdxSetBuf::Sparse(_, _) => {
+ // The set is sparse and full. Convert to a dense set.
+ //
+ // FIXME: This code is awful, but I can't work out how else to
+ // appease the borrow checker.
+ let dummy = HybridIdxSetBuf::Sparse(SparseIdxSetBuf::new(), 0);
+ match mem::replace(self, dummy) {
+ HybridIdxSetBuf::Sparse(sparse, universe_size) => {
+ let mut dense = sparse.to_dense(universe_size);
+ let changed = dense.add(elem);
+ assert!(changed);
+ mem::replace(self, HybridIdxSetBuf::Dense(dense, universe_size));
+ changed
+ }
+ _ => panic!("impossible"),
+ }
+ }
+
+ HybridIdxSetBuf::Dense(dense, _) => dense.add(elem),
+ }
+ }
+
+ /// Removes `elem` from the set `self`.
+ pub fn remove(&mut self, elem: &T) -> bool {
+ // Note: we currently don't bother going from Dense back to Sparse.
+ match self {
+ HybridIdxSetBuf::Sparse(sparse, _) => sparse.remove(elem),
+ HybridIdxSetBuf::Dense(dense, _) => dense.remove(elem),
+ }
+ }
+
+ /// Converts to a dense set, consuming itself in the process.
+ pub fn to_dense(self) -> IdxSetBuf<T> {
+ match self {
+ HybridIdxSetBuf::Sparse(sparse, universe_size) => sparse.to_dense(universe_size),
+ HybridIdxSetBuf::Dense(dense, _) => dense,
+ }
+ }
+
+ /// Iteration order is unspecified.
+ pub fn iter(&self) -> HybridIter<T> {
+ match self {
+ HybridIdxSetBuf::Sparse(sparse, _) => HybridIter::Sparse(sparse.iter()),
+ HybridIdxSetBuf::Dense(dense, _) => HybridIter::Dense(dense.iter()),
+ }
+ }
+}
+
+pub enum HybridIter<'a, T: Idx> {
+ Sparse(SparseIter<'a, T>),
+ Dense(Iter<'a, T>),
+}
+
+impl<'a, T: Idx> Iterator for HybridIter<'a, T> {
+ type Item = T;
+
+ fn next(&mut self) -> Option<T> {
+ match self {
+ HybridIter::Sparse(sparse) => sparse.next(),
+ HybridIter::Dense(dense) => dense.next(),
}
}
}
@@ -326,7 +550,7 @@
#[test]
fn test_new_filled() {
for i in 0..128 {
- let mut idx_buf = IdxSetBuf::new_filled(i);
+ let idx_buf = IdxSetBuf::new_filled(i);
let elems: Vec<usize> = idx_buf.iter().collect();
let expected: Vec<usize> = (0..i).collect();
assert_eq!(elems, expected);
diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs
index dd90cf7..5699512 100644
--- a/src/librustc_data_structures/lib.rs
+++ b/src/librustc_data_structures/lib.rs
@@ -26,6 +26,7 @@
#![feature(specialization)]
#![feature(optin_builtin_traits)]
#![feature(macro_vis_matcher)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(allow_internal_unstable)]
#![feature(vec_resize_with)]
@@ -46,6 +47,7 @@
extern crate rustc_rayon as rayon;
extern crate rustc_rayon_core as rayon_core;
extern crate rustc_hash;
+extern crate serialize;
// See librustc_cratesio_shim/Cargo.toml for a comment explaining this.
#[allow(unused_extern_crates)]
@@ -53,11 +55,13 @@
pub use rustc_serialize::hex::ToHex;
+pub mod svh;
pub mod accumulate_vec;
pub mod array_vec;
pub mod base_n;
pub mod bitslice;
pub mod bitvec;
+pub mod const_cstr;
pub mod flock;
pub mod fx;
pub mod graph;
@@ -67,17 +71,20 @@
pub mod owning_ref;
pub mod ptr_key;
pub mod sip128;
+pub mod small_c_str;
pub mod small_vec;
pub mod snapshot_map;
pub use ena::snapshot_vec;
pub mod sorted_map;
-pub mod stable_hasher;
+#[macro_use] pub mod stable_hasher;
pub mod sync;
pub mod tiny_list;
+pub mod thin_vec;
pub mod transitive_relation;
pub mod tuple_slice;
pub use ena::unify;
pub mod work_queue;
+pub mod fingerprint;
pub struct OnDrop<F: Fn()>(pub F);
diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs
index 0d6cf26..7ef8885 100644
--- a/src/librustc_data_structures/obligation_forest/mod.rs
+++ b/src/librustc_data_structures/obligation_forest/mod.rs
@@ -573,7 +573,7 @@
}
let mut kill_list = vec![];
- for (predicate, index) in self.waiting_cache.iter_mut() {
+ for (predicate, index) in &mut self.waiting_cache {
let new_index = node_rewrites[index.get()];
if new_index >= nodes_len {
kill_list.push(predicate.clone());
diff --git a/src/librustc_data_structures/small_c_str.rs b/src/librustc_data_structures/small_c_str.rs
new file mode 100644
index 0000000..b0ad83e4
--- /dev/null
+++ b/src/librustc_data_structures/small_c_str.rs
@@ -0,0 +1,131 @@
+// 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.
+
+use std::ffi;
+use std::ops::Deref;
+
+const SIZE: usize = 38;
+
+/// Like SmallVec but for C strings.
+#[derive(Clone)]
+pub enum SmallCStr {
+ OnStack {
+ data: [u8; SIZE],
+ len_with_nul: u8,
+ },
+ OnHeap {
+ data: ffi::CString,
+ }
+}
+
+impl SmallCStr {
+ #[inline]
+ pub fn new(s: &str) -> SmallCStr {
+ if s.len() < SIZE {
+ let mut data = [0; SIZE];
+ data[.. s.len()].copy_from_slice(s.as_bytes());
+ let len_with_nul = s.len() + 1;
+
+ // Make sure once that this is a valid CStr
+ if let Err(e) = ffi::CStr::from_bytes_with_nul(&data[.. len_with_nul]) {
+ panic!("The string \"{}\" cannot be converted into a CStr: {}", s, e);
+ }
+
+ SmallCStr::OnStack {
+ data,
+ len_with_nul: len_with_nul as u8,
+ }
+ } else {
+ SmallCStr::OnHeap {
+ data: ffi::CString::new(s).unwrap()
+ }
+ }
+ }
+
+ #[inline]
+ pub fn as_c_str(&self) -> &ffi::CStr {
+ match *self {
+ SmallCStr::OnStack { ref data, len_with_nul } => {
+ unsafe {
+ let slice = &data[.. len_with_nul as usize];
+ ffi::CStr::from_bytes_with_nul_unchecked(slice)
+ }
+ }
+ SmallCStr::OnHeap { ref data } => {
+ data.as_c_str()
+ }
+ }
+ }
+
+ #[inline]
+ pub fn len_with_nul(&self) -> usize {
+ match *self {
+ SmallCStr::OnStack { len_with_nul, .. } => {
+ len_with_nul as usize
+ }
+ SmallCStr::OnHeap { ref data } => {
+ data.as_bytes_with_nul().len()
+ }
+ }
+ }
+}
+
+impl Deref for SmallCStr {
+ type Target = ffi::CStr;
+
+ fn deref(&self) -> &ffi::CStr {
+ self.as_c_str()
+ }
+}
+
+
+#[test]
+fn short() {
+ const TEXT: &str = "abcd";
+ let reference = ffi::CString::new(TEXT.to_string()).unwrap();
+
+ let scs = SmallCStr::new(TEXT);
+
+ assert_eq!(scs.len_with_nul(), TEXT.len() + 1);
+ assert_eq!(scs.as_c_str(), reference.as_c_str());
+ assert!(if let SmallCStr::OnStack { .. } = scs { true } else { false });
+}
+
+#[test]
+fn empty() {
+ const TEXT: &str = "";
+ let reference = ffi::CString::new(TEXT.to_string()).unwrap();
+
+ let scs = SmallCStr::new(TEXT);
+
+ assert_eq!(scs.len_with_nul(), TEXT.len() + 1);
+ assert_eq!(scs.as_c_str(), reference.as_c_str());
+ assert!(if let SmallCStr::OnStack { .. } = scs { true } else { false });
+}
+
+#[test]
+fn long() {
+ const TEXT: &str = "01234567890123456789012345678901234567890123456789\
+ 01234567890123456789012345678901234567890123456789\
+ 01234567890123456789012345678901234567890123456789";
+ let reference = ffi::CString::new(TEXT.to_string()).unwrap();
+
+ let scs = SmallCStr::new(TEXT);
+
+ assert_eq!(scs.len_with_nul(), TEXT.len() + 1);
+ assert_eq!(scs.as_c_str(), reference.as_c_str());
+ assert!(if let SmallCStr::OnHeap { .. } = scs { true } else { false });
+}
+
+#[test]
+#[should_panic]
+fn internal_nul() {
+ let _ = SmallCStr::new("abcd\0def");
+}
diff --git a/src/librustc_data_structures/small_vec.rs b/src/librustc_data_structures/small_vec.rs
index 76b01be..6f101b2 100644
--- a/src/librustc_data_structures/small_vec.rs
+++ b/src/librustc_data_structures/small_vec.rs
@@ -29,6 +29,8 @@
pub struct SmallVec<A: Array>(AccumulateVec<A>);
+pub type OneVector<T> = SmallVec<[T; 1]>;
+
impl<A> Clone for SmallVec<A>
where A: Array,
A::Element: Clone {
@@ -210,7 +212,12 @@
A::Element: Decodable {
fn decode<D: Decoder>(d: &mut D) -> Result<SmallVec<A>, D::Error> {
d.read_seq(|d, len| {
- (0..len).map(|i| d.read_seq_elt(i, |d| Decodable::decode(d))).collect()
+ let mut vec = SmallVec::with_capacity(len);
+ // FIXME(#48994) - could just be collected into a Result<SmallVec, D::Error>
+ for i in 0..len {
+ vec.push(d.read_seq_elt(i, |d| Decodable::decode(d))?);
+ }
+ Ok(vec)
})
}
}
@@ -222,6 +229,69 @@
use super::*;
+ #[test]
+ fn test_len() {
+ let v: OneVector<isize> = OneVector::new();
+ assert_eq!(0, v.len());
+
+ assert_eq!(1, OneVector::one(1).len());
+ assert_eq!(5, OneVector::many(vec![1, 2, 3, 4, 5]).len());
+ }
+
+ #[test]
+ fn test_push_get() {
+ let mut v = OneVector::new();
+ v.push(1);
+ assert_eq!(1, v.len());
+ assert_eq!(1, v[0]);
+ v.push(2);
+ assert_eq!(2, v.len());
+ assert_eq!(2, v[1]);
+ v.push(3);
+ assert_eq!(3, v.len());
+ assert_eq!(3, v[2]);
+ }
+
+ #[test]
+ fn test_from_iter() {
+ let v: OneVector<isize> = (vec![1, 2, 3]).into_iter().collect();
+ assert_eq!(3, v.len());
+ assert_eq!(1, v[0]);
+ assert_eq!(2, v[1]);
+ assert_eq!(3, v[2]);
+ }
+
+ #[test]
+ fn test_move_iter() {
+ let v = OneVector::new();
+ let v: Vec<isize> = v.into_iter().collect();
+ assert_eq!(v, Vec::new());
+
+ let v = OneVector::one(1);
+ assert_eq!(v.into_iter().collect::<Vec<_>>(), [1]);
+
+ let v = OneVector::many(vec![1, 2, 3]);
+ assert_eq!(v.into_iter().collect::<Vec<_>>(), [1, 2, 3]);
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_expect_one_zero() {
+ let _: isize = OneVector::new().expect_one("");
+ }
+
+ #[test]
+ #[should_panic]
+ fn test_expect_one_many() {
+ OneVector::many(vec![1, 2]).expect_one("");
+ }
+
+ #[test]
+ fn test_expect_one_one() {
+ assert_eq!(1, OneVector::one(1).expect_one(""));
+ assert_eq!(1, OneVector::many(vec![1]).expect_one(""));
+ }
+
#[bench]
fn fill_small_vec_1_10_with_cap(b: &mut Bencher) {
b.iter(|| {
diff --git a/src/librustc_data_structures/snapshot_map/mod.rs b/src/librustc_data_structures/snapshot_map/mod.rs
index 6ee8c35..5030bf9 100644
--- a/src/librustc_data_structures/snapshot_map/mod.rs
+++ b/src/librustc_data_structures/snapshot_map/mod.rs
@@ -92,7 +92,7 @@
pub fn snapshot(&mut self) -> Snapshot {
self.undo_log.push(UndoLog::OpenSnapshot);
let len = self.undo_log.len() - 1;
- Snapshot { len: len }
+ Snapshot { len }
}
fn assert_open_snapshot(&self, snapshot: &Snapshot) {
@@ -103,8 +103,8 @@
});
}
- pub fn commit(&mut self, snapshot: Snapshot) {
- self.assert_open_snapshot(&snapshot);
+ pub fn commit(&mut self, snapshot: &Snapshot) {
+ self.assert_open_snapshot(snapshot);
if snapshot.len == 0 {
// The root snapshot.
self.undo_log.truncate(0);
@@ -135,8 +135,8 @@
}
}
- pub fn rollback_to(&mut self, snapshot: Snapshot) {
- self.assert_open_snapshot(&snapshot);
+ pub fn rollback_to(&mut self, snapshot: &Snapshot) {
+ self.assert_open_snapshot(snapshot);
while self.undo_log.len() > snapshot.len + 1 {
let entry = self.undo_log.pop().unwrap();
self.reverse(entry);
diff --git a/src/librustc_data_structures/snapshot_map/test.rs b/src/librustc_data_structures/snapshot_map/test.rs
index 4114082..b163e0f 100644
--- a/src/librustc_data_structures/snapshot_map/test.rs
+++ b/src/librustc_data_structures/snapshot_map/test.rs
@@ -20,7 +20,7 @@
map.insert(44, "fourty-four");
assert_eq!(map[&44], "fourty-four");
assert_eq!(map.get(&33), None);
- map.rollback_to(snapshot);
+ map.rollback_to(&snapshot);
assert_eq!(map[&22], "twenty-two");
assert_eq!(map.get(&33), None);
assert_eq!(map.get(&44), None);
@@ -33,7 +33,7 @@
map.insert(22, "twenty-two");
let snapshot1 = map.snapshot();
let _snapshot2 = map.snapshot();
- map.rollback_to(snapshot1);
+ map.rollback_to(&snapshot1);
}
#[test]
@@ -43,8 +43,8 @@
let snapshot1 = map.snapshot();
let snapshot2 = map.snapshot();
map.insert(22, "thirty-three");
- map.commit(snapshot2);
+ map.commit(&snapshot2);
assert_eq!(map[&22], "thirty-three");
- map.rollback_to(snapshot1);
+ map.rollback_to(&snapshot1);
assert_eq!(map[&22], "twenty-two");
}
diff --git a/src/librustc_data_structures/stable_hasher.rs b/src/librustc_data_structures/stable_hasher.rs
index a8f689e..9f1c7da 100644
--- a/src/librustc_data_structures/stable_hasher.rs
+++ b/src/librustc_data_structures/stable_hasher.rs
@@ -183,13 +183,16 @@
// Implement HashStable by just calling `Hash::hash()`. This works fine for
// self-contained values that don't depend on the hashing context `CTX`.
+#[macro_export]
macro_rules! impl_stable_hash_via_hash {
($t:ty) => (
- impl<CTX> HashStable<CTX> for $t {
+ impl<CTX> $crate::stable_hasher::HashStable<CTX> for $t {
#[inline]
- fn hash_stable<W: StableHasherResult>(&self,
- _: &mut CTX,
- hasher: &mut StableHasher<W>) {
+ fn hash_stable<W: $crate::stable_hasher::StableHasherResult>(
+ &self,
+ _: &mut CTX,
+ hasher: &mut $crate::stable_hasher::StableHasher<W>
+ ) {
::std::hash::Hash::hash(self, hasher);
}
}
diff --git a/src/librustc_data_structures/svh.rs b/src/librustc_data_structures/svh.rs
new file mode 100644
index 0000000..94f1325
--- /dev/null
+++ b/src/librustc_data_structures/svh.rs
@@ -0,0 +1,84 @@
+// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Calculation and management of a Strict Version Hash for crates
+//!
+//! The SVH is used for incremental compilation to track when HIR
+//! nodes have changed between compilations, and also to detect
+//! mismatches where we have two versions of the same crate that were
+//! compiled from distinct sources.
+
+use std::fmt;
+use std::hash::{Hash, Hasher};
+use serialize::{Encodable, Decodable, Encoder, Decoder};
+
+use stable_hasher;
+
+#[derive(Copy, Clone, PartialEq, Eq, Debug)]
+pub struct Svh {
+ hash: u64,
+}
+
+impl Svh {
+ /// Create a new `Svh` given the hash. If you actually want to
+ /// compute the SVH from some HIR, you want the `calculate_svh`
+ /// function found in `librustc_incremental`.
+ pub fn new(hash: u64) -> Svh {
+ Svh { hash: hash }
+ }
+
+ pub fn as_u64(&self) -> u64 {
+ self.hash
+ }
+
+ pub fn to_string(&self) -> String {
+ format!("{:016x}", self.hash)
+ }
+}
+
+impl Hash for Svh {
+ fn hash<H>(&self, state: &mut H) where H: Hasher {
+ self.hash.to_le().hash(state);
+ }
+}
+
+impl fmt::Display for Svh {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.pad(&self.to_string())
+ }
+}
+
+impl Encodable for Svh {
+ fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
+ s.emit_u64(self.as_u64().to_le())
+ }
+}
+
+impl Decodable for Svh {
+ fn decode<D: Decoder>(d: &mut D) -> Result<Svh, D::Error> {
+ d.read_u64()
+ .map(u64::from_le)
+ .map(Svh::new)
+ }
+}
+
+impl<T> stable_hasher::HashStable<T> for Svh {
+ #[inline]
+ fn hash_stable<W: stable_hasher::StableHasherResult>(
+ &self,
+ ctx: &mut T,
+ hasher: &mut stable_hasher::StableHasher<W>
+ ) {
+ let Svh {
+ hash
+ } = *self;
+ hash.hash_stable(ctx, hasher);
+ }
+}
diff --git a/src/libsyntax/util/thin_vec.rs b/src/librustc_data_structures/thin_vec.rs
similarity index 100%
rename from src/libsyntax/util/thin_vec.rs
rename to src/librustc_data_structures/thin_vec.rs
diff --git a/src/librustc_data_structures/tiny_list.rs b/src/librustc_data_structures/tiny_list.rs
index c12fc22..e1bfdf3 100644
--- a/src/librustc_data_structures/tiny_list.rs
+++ b/src/librustc_data_structures/tiny_list.rs
@@ -107,7 +107,8 @@
};
self.next = new_next;
- return true
+
+ true
}
fn len(&self) -> usize {
diff --git a/src/librustc_data_structures/transitive_relation.rs b/src/librustc_data_structures/transitive_relation.rs
index a8124fb..2acc29a 100644
--- a/src/librustc_data_structures/transitive_relation.rs
+++ b/src/librustc_data_structures/transitive_relation.rs
@@ -77,7 +77,7 @@
..
} = self;
- map.entry(a.clone())
+ *map.entry(a.clone())
.or_insert_with(|| {
elements.push(a);
@@ -86,7 +86,6 @@
Index(elements.len() - 1)
})
- .clone()
}
/// Applies the (partial) function to each edge and returns a new
@@ -98,14 +97,7 @@
{
let mut result = TransitiveRelation::new();
for edge in &self.edges {
- let r = f(&self.elements[edge.source.0]).and_then(|source| {
- f(&self.elements[edge.target.0]).and_then(|target| {
- Some(result.add(source, target))
- })
- });
- if r.is_none() {
- return None;
- }
+ result.add(f(&self.elements[edge.source.0])?, f(&self.elements[edge.target.0])?);
}
Some(result)
}
@@ -372,7 +364,7 @@
let mut changed = true;
while changed {
changed = false;
- for edge in self.edges.iter() {
+ for edge in &self.edges {
// add an edge from S -> T
changed |= matrix.add(edge.source.0, edge.target.0);
diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs
index 805a5ec..1c2c0ad 100644
--- a/src/librustc_driver/driver.rs
+++ b/src/librustc_driver/driver.rs
@@ -11,7 +11,7 @@
use rustc::dep_graph::DepGraph;
use rustc::hir::{self, map as hir_map};
use rustc::hir::lowering::lower_crate;
-use rustc::ich::Fingerprint;
+use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::stable_hasher::StableHasher;
use rustc_mir as mir;
use rustc::session::{CompileResult, CrateDisambiguator, Session};
@@ -57,7 +57,7 @@
use syntax::fold::Folder;
use syntax::parse::{self, PResult};
use syntax::util::node_count::NodeCounter;
-use syntax_pos::FileName;
+use syntax_pos::{FileName, hygiene};
use syntax_ext;
use derive_registrar;
@@ -670,6 +670,7 @@
) -> PResult<'a, ast::Crate> {
sess.diagnostic()
.set_continue_after_error(control.continue_parse_after_error);
+ hygiene::set_default_edition(sess.edition());
if sess.profile_queries() {
profile::begin(sess);
@@ -694,7 +695,7 @@
if sess.opts.debugging_opts.input_stats {
println!(
"Lines of code: {}",
- sess.codemap().count_lines()
+ sess.source_map().count_lines()
);
println!("Pre-expansion node count: {}", count_nodes(&krate));
}
@@ -865,7 +866,7 @@
krate = time(sess, "crate injection", || {
let alt_std_name = sess.opts.alt_std_name.as_ref().map(|s| &**s);
- syntax::std_inject::maybe_inject_crates_ref(krate, alt_std_name)
+ syntax::std_inject::maybe_inject_crates_ref(krate, alt_std_name, sess.edition())
});
let mut addl_plugins = Some(addl_plugins);
@@ -1461,7 +1462,7 @@
let result = (|| -> io::Result<()> {
// Build a list of files used to compile the output and
// write Makefile-compatible dependency rules
- let files: Vec<String> = sess.codemap()
+ let files: Vec<String> = sess.source_map()
.files()
.iter()
.filter(|fmap| fmap.is_real_file())
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs
index 556ee9f..f88c619 100644
--- a/src/librustc_driver/lib.rs
+++ b/src/librustc_driver/lib.rs
@@ -20,6 +20,7 @@
#![feature(box_syntax)]
#![cfg_attr(unix, feature(libc))]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(option_replace)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
@@ -106,10 +107,10 @@
use std::thread;
use syntax::ast;
-use syntax::codemap::{CodeMap, FileLoader, RealFileLoader};
+use syntax::source_map::{SourceMap, FileLoader, RealFileLoader};
use syntax::feature_gate::{GatedCfg, UnstableFeatures};
use syntax::parse::{self, PResult};
-use syntax_pos::{hygiene, DUMMY_SP, MultiSpan, FileName};
+use syntax_pos::{DUMMY_SP, MultiSpan, FileName};
#[cfg(test)]
mod test;
@@ -477,7 +478,6 @@
};
let (sopts, cfg) = config::build_session_options_and_crate_config(&matches);
- hygiene::set_default_edition(sopts.edition);
driver::spawn_thread_pool(sopts, |sopts| {
run_compiler_with_pool(matches, sopts, cfg, callbacks, file_loader, emitter_dest)
@@ -522,9 +522,9 @@
};
let loader = file_loader.unwrap_or(box RealFileLoader);
- let codemap = Lrc::new(CodeMap::with_file_loader(loader, sopts.file_path_mapping()));
- let mut sess = session::build_session_with_codemap(
- sopts, input_file_path.clone(), descriptions, codemap, emitter_dest,
+ let source_map = Lrc::new(SourceMap::with_file_loader(loader, sopts.file_path_mapping()));
+ let mut sess = session::build_session_with_source_map(
+ sopts, input_file_path.clone(), descriptions, source_map, emitter_dest,
);
if let Some(err) = input_err {
@@ -1512,7 +1512,7 @@
true
} else if rlim.rlim_max < STACK_SIZE as libc::rlim_t {
true
- } else {
+ } else if rlim.rlim_cur < STACK_SIZE as libc::rlim_t {
std::rt::deinit_stack_guard();
rlim.rlim_cur = STACK_SIZE as libc::rlim_t;
if libc::setrlimit(libc::RLIMIT_STACK, &mut rlim) != 0 {
@@ -1524,6 +1524,8 @@
std::rt::update_stack_guard();
false
}
+ } else {
+ false
}
};
diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs
index 3e74aef..65cbee8 100644
--- a/src/librustc_driver/pretty.rs
+++ b/src/librustc_driver/pretty.rs
@@ -24,6 +24,8 @@
use rustc::session::config::{Input, OutputFilenames};
use rustc_borrowck as borrowck;
use rustc_borrowck::graphviz as borrowck_dot;
+use rustc_data_structures::small_vec::OneVector;
+use rustc_data_structures::thin_vec::ThinVec;
use rustc_metadata::cstore::CStore;
use rustc_mir::util::{write_mir_pretty, write_mir_graphviz};
@@ -33,8 +35,6 @@
use syntax::print::{pprust};
use syntax::print::pprust::PrintState;
use syntax::ptr::P;
-use syntax::util::ThinVec;
-use syntax::util::small_vector::SmallVector;
use syntax_pos::{self, FileName};
use graphviz as dot;
@@ -727,7 +727,7 @@
self.run(is_const, |s| fold::noop_fold_item_kind(i, s))
}
- fn fold_trait_item(&mut self, i: ast::TraitItem) -> SmallVector<ast::TraitItem> {
+ fn fold_trait_item(&mut self, i: ast::TraitItem) -> OneVector<ast::TraitItem> {
let is_const = match i.node {
ast::TraitItemKind::Const(..) => true,
ast::TraitItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
@@ -737,7 +737,7 @@
self.run(is_const, |s| fold::noop_fold_trait_item(i, s))
}
- fn fold_impl_item(&mut self, i: ast::ImplItem) -> SmallVector<ast::ImplItem> {
+ fn fold_impl_item(&mut self, i: ast::ImplItem) -> OneVector<ast::ImplItem> {
let is_const = match i.node {
ast::ImplItemKind::Const(..) => true,
ast::ImplItemKind::Method(ast::MethodSig { ref decl, ref header, .. }, _) =>
@@ -785,7 +785,7 @@
node: ast::ExprKind::Loop(P(empty_block), None),
id: self.sess.next_node_id(),
span: syntax_pos::DUMMY_SP,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
});
let loop_stmt = ast::Stmt {
@@ -915,8 +915,8 @@
fn get_source(input: &Input, sess: &Session) -> (Vec<u8>, FileName) {
let src_name = driver::source_name(input);
- let src = sess.codemap()
- .get_filemap(&src_name)
+ let src = sess.source_map()
+ .get_source_file(&src_name)
.unwrap()
.src
.as_ref()
@@ -954,7 +954,7 @@
s.call_with_pp_support(sess, None, move |annotation| {
debug!("pretty printing source code {:?}", s);
let sess = annotation.sess();
- pprust::print_crate(sess.codemap(),
+ pprust::print_crate(sess.source_map(),
&sess.parse_sess,
krate,
src_name,
@@ -1011,7 +1011,7 @@
s.call_with_pp_support(sess, Some(hir_map), move |annotation| {
debug!("pretty printing source code {:?}", s);
let sess = annotation.sess();
- pprust::print_crate(sess.codemap(),
+ pprust::print_crate(sess.source_map(),
&sess.parse_sess,
krate,
src_name,
@@ -1035,7 +1035,7 @@
move |annotation, krate| {
debug!("pretty printing source code {:?}", s);
let sess = annotation.sess();
- pprust_hir::print_crate(sess.codemap(),
+ pprust_hir::print_crate(sess.source_map(),
&sess.parse_sess,
krate,
src_name,
@@ -1076,7 +1076,7 @@
debug!("pretty printing source code {:?}", s);
let sess = annotation.sess();
let hir_map = annotation.hir_map().expect("-Z unpretty missing HIR map");
- let mut pp_state = pprust_hir::State::new_from_input(sess.codemap(),
+ let mut pp_state = pprust_hir::State::new_from_input(sess.source_map(),
&sess.parse_sess,
src_name,
&mut rdr,
diff --git a/src/librustc_driver/test.rs b/src/librustc_driver/test.rs
index 0365132..1754229 100644
--- a/src/librustc_driver/test.rs
+++ b/src/librustc_driver/test.rs
@@ -32,7 +32,7 @@
use syntax;
use syntax::ast;
use rustc_target::spec::abi::Abi;
-use syntax::codemap::{CodeMap, FilePathMapping, FileName};
+use syntax::source_map::{SourceMap, FilePathMapping, FileName};
use errors;
use errors::emitter::Emitter;
use errors::{Level, DiagnosticBuilder};
@@ -121,7 +121,7 @@
let sess = session::build_session_(options,
None,
diagnostic_handler,
- Lrc::new(CodeMap::new(FilePathMapping::empty())));
+ Lrc::new(SourceMap::new(FilePathMapping::empty())));
let cstore = CStore::new(::get_codegen_backend(&sess).metadata_loader());
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
let input = config::Input::Str {
@@ -162,7 +162,7 @@
&arenas,
resolutions,
hir_map,
- OnDiskCache::new_empty(sess.codemap()),
+ OnDiskCache::new_empty(sess.source_map()),
"test_crate",
tx,
&outputs,
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index 09295e2..b4034a6 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -10,9 +10,9 @@
use self::Destination::*;
-use syntax_pos::{FileMap, Span, MultiSpan};
+use syntax_pos::{SourceFile, Span, MultiSpan};
-use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, CodeMapperDyn, DiagnosticId};
+use {Level, CodeSuggestion, DiagnosticBuilder, SubDiagnostic, SourceMapperDyn, DiagnosticId};
use snippet::{Annotation, AnnotationType, Line, MultilineAnnotation, StyledString, Style};
use styled_buffer::StyledBuffer;
@@ -120,21 +120,21 @@
pub struct EmitterWriter {
dst: Destination,
- cm: Option<Lrc<CodeMapperDyn>>,
+ cm: Option<Lrc<SourceMapperDyn>>,
short_message: bool,
teach: bool,
ui_testing: bool,
}
struct FileWithAnnotatedLines {
- file: Lrc<FileMap>,
+ file: Lrc<SourceFile>,
lines: Vec<Line>,
multiline_depth: usize,
}
impl EmitterWriter {
pub fn stderr(color_config: ColorConfig,
- code_map: Option<Lrc<CodeMapperDyn>>,
+ code_map: Option<Lrc<SourceMapperDyn>>,
short_message: bool,
teach: bool)
-> EmitterWriter {
@@ -149,7 +149,7 @@
}
pub fn new(dst: Box<dyn Write + Send>,
- code_map: Option<Lrc<CodeMapperDyn>>,
+ code_map: Option<Lrc<SourceMapperDyn>>,
short_message: bool,
teach: bool)
-> EmitterWriter {
@@ -177,7 +177,7 @@
fn preprocess_annotations(&mut self, msp: &MultiSpan) -> Vec<FileWithAnnotatedLines> {
fn add_annotation_to_file(file_vec: &mut Vec<FileWithAnnotatedLines>,
- file: Lrc<FileMap>,
+ file: Lrc<SourceFile>,
line_index: usize,
ann: Annotation) {
@@ -307,7 +307,7 @@
fn render_source_line(&self,
buffer: &mut StyledBuffer,
- file: Lrc<FileMap>,
+ file: Lrc<SourceFile>,
line: &Line,
width_offset: usize,
code_offset: usize) -> Vec<(usize, Style)> {
@@ -1021,7 +1021,7 @@
// Print out the annotate source lines that correspond with the error
for annotated_file in annotated_files {
// we can't annotate anything if the source is unavailable.
- if !cm.ensure_filemap_source_present(annotated_file.file.clone()) {
+ if !cm.ensure_source_file_source_present(annotated_file.file.clone()) {
continue;
}
@@ -1295,7 +1295,7 @@
}
// if we elided some lines, add an ellipsis
- if let Some(_) = lines.next() {
+ if lines.next().is_some() {
buffer.puts(row_num, max_line_num_len - 1, "...", Style::LineNumber);
} else if !show_underline {
draw_col_separator_no_space(&mut buffer, row_num, max_line_num_len + 1);
diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs
index 8254674..3582c23 100644
--- a/src/librustc_errors/lib.rs
+++ b/src/librustc_errors/lib.rs
@@ -16,6 +16,7 @@
#![allow(unused_attributes)]
#![feature(range_contains)]
#![cfg_attr(unix, feature(libc))]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(optin_builtin_traits)]
extern crate atty;
@@ -54,7 +55,14 @@
mod styled_buffer;
mod lock;
-use syntax_pos::{BytePos, Loc, FileLinesResult, FileMap, FileName, MultiSpan, Span, NO_EXPANSION};
+use syntax_pos::{BytePos,
+ Loc,
+ FileLinesResult,
+ SourceFile,
+ FileName,
+ MultiSpan,
+ Span,
+ NO_EXPANSION};
#[derive(Copy, Clone, Debug, PartialEq, Hash, RustcEncodable, RustcDecodable)]
pub enum Applicability {
@@ -110,22 +118,22 @@
pub snippet: String,
}
-pub type CodeMapperDyn = dyn CodeMapper + sync::Send + sync::Sync;
+pub type SourceMapperDyn = dyn SourceMapper + sync::Send + sync::Sync;
-pub trait CodeMapper {
+pub trait SourceMapper {
fn lookup_char_pos(&self, pos: BytePos) -> Loc;
fn span_to_lines(&self, sp: Span) -> FileLinesResult;
fn span_to_string(&self, sp: Span) -> String;
fn span_to_filename(&self, sp: Span) -> FileName;
fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span>;
fn call_span_if_macro(&self, sp: Span) -> Span;
- fn ensure_filemap_source_present(&self, file_map: Lrc<FileMap>) -> bool;
+ fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool;
fn doctest_offset_line(&self, line: usize) -> usize;
}
impl CodeSuggestion {
/// Returns the assembled code suggestions and whether they should be shown with an underline.
- pub fn splice_lines(&self, cm: &CodeMapperDyn)
+ pub fn splice_lines(&self, cm: &SourceMapperDyn)
-> Vec<(String, Vec<SubstitutionPart>)> {
use syntax_pos::{CharPos, Loc, Pos};
@@ -320,7 +328,7 @@
pub fn with_tty_emitter(color_config: ColorConfig,
can_emit_warnings: bool,
treat_err_as_bug: bool,
- cm: Option<Lrc<CodeMapperDyn>>)
+ cm: Option<Lrc<SourceMapperDyn>>)
-> Handler {
Handler::with_tty_emitter_and_flags(
color_config,
@@ -333,7 +341,7 @@
}
pub fn with_tty_emitter_and_flags(color_config: ColorConfig,
- cm: Option<Lrc<CodeMapperDyn>>,
+ cm: Option<Lrc<SourceMapperDyn>>,
flags: HandlerFlags)
-> Handler {
let emitter = Box::new(EmitterWriter::stderr(color_config, cm, false, false));
diff --git a/src/librustc_fs_util/Cargo.toml b/src/librustc_fs_util/Cargo.toml
new file mode 100644
index 0000000..e40b442
--- /dev/null
+++ b/src/librustc_fs_util/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+authors = ["The Rust Project Developers"]
+name = "rustc_fs_util"
+version = "0.0.0"
+
+[lib]
+name = "rustc_fs_util"
+path = "lib.rs"
+crate-type = ["dylib"]
+
+[dependencies]
diff --git a/src/librustc_fs_util/lib.rs b/src/librustc_fs_util/lib.rs
new file mode 100644
index 0000000..ffe420b
--- /dev/null
+++ b/src/librustc_fs_util/lib.rs
@@ -0,0 +1,128 @@
+// 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.
+
+use std::path::{Path, PathBuf};
+use std::ffi::CString;
+use std::fs;
+use std::io;
+
+// Unfortunately, on windows, it looks like msvcrt.dll is silently translating
+// verbatim paths under the hood to non-verbatim paths! This manifests itself as
+// gcc looking like it cannot accept paths of the form `\\?\C:\...`, but the
+// real bug seems to lie in msvcrt.dll.
+//
+// Verbatim paths are generally pretty rare, but the implementation of
+// `fs::canonicalize` currently generates paths of this form, meaning that we're
+// going to be passing quite a few of these down to gcc, so we need to deal with
+// this case.
+//
+// For now we just strip the "verbatim prefix" of `\\?\` from the path. This
+// will probably lose information in some cases, but there's not a whole lot
+// more we can do with a buggy msvcrt...
+//
+// For some more information, see this comment:
+// https://github.com/rust-lang/rust/issues/25505#issuecomment-102876737
+#[cfg(windows)]
+pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
+ use std::path;
+ use std::ffi::OsString;
+ let mut components = p.components();
+ let prefix = match components.next() {
+ Some(path::Component::Prefix(p)) => p,
+ _ => return p.to_path_buf(),
+ };
+ match prefix.kind() {
+ path::Prefix::VerbatimDisk(disk) => {
+ let mut base = OsString::from(format!("{}:", disk as char));
+ base.push(components.as_path());
+ PathBuf::from(base)
+ }
+ path::Prefix::VerbatimUNC(server, share) => {
+ let mut base = OsString::from(r"\\");
+ base.push(server);
+ base.push(r"\");
+ base.push(share);
+ base.push(components.as_path());
+ PathBuf::from(base)
+ }
+ _ => p.to_path_buf(),
+ }
+}
+
+#[cfg(not(windows))]
+pub fn fix_windows_verbatim_for_gcc(p: &Path) -> PathBuf {
+ p.to_path_buf()
+}
+
+pub enum LinkOrCopy {
+ Link,
+ Copy,
+}
+
+/// Copy `p` into `q`, preferring to use hard-linking if possible. If
+/// `q` already exists, it is removed first.
+/// The result indicates which of the two operations has been performed.
+pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<LinkOrCopy> {
+ let p = p.as_ref();
+ let q = q.as_ref();
+ if q.exists() {
+ fs::remove_file(&q)?;
+ }
+
+ match fs::hard_link(p, q) {
+ Ok(()) => Ok(LinkOrCopy::Link),
+ Err(_) => {
+ match fs::copy(p, q) {
+ Ok(_) => Ok(LinkOrCopy::Copy),
+ Err(e) => Err(e),
+ }
+ }
+ }
+}
+
+#[derive(Debug)]
+pub enum RenameOrCopyRemove {
+ Rename,
+ CopyRemove,
+}
+
+/// Rename `p` into `q`, preferring to use `rename` if possible.
+/// If `rename` fails (rename may fail for reasons such as crossing
+/// filesystem), fallback to copy & remove
+pub fn rename_or_copy_remove<P: AsRef<Path>, Q: AsRef<Path>>(p: P,
+ q: Q)
+ -> io::Result<RenameOrCopyRemove> {
+ let p = p.as_ref();
+ let q = q.as_ref();
+ match fs::rename(p, q) {
+ Ok(()) => Ok(RenameOrCopyRemove::Rename),
+ Err(_) => {
+ match fs::copy(p, q) {
+ Ok(_) => {
+ fs::remove_file(p)?;
+ Ok(RenameOrCopyRemove::CopyRemove)
+ }
+ Err(e) => Err(e),
+ }
+ }
+ }
+}
+
+#[cfg(unix)]
+pub fn path2cstr(p: &Path) -> CString {
+ use std::os::unix::prelude::*;
+ use std::ffi::OsStr;
+ let p: &OsStr = p.as_ref();
+ CString::new(p.as_bytes()).unwrap()
+}
+#[cfg(windows)]
+pub fn path2cstr(p: &Path) -> CString {
+ CString::new(p.to_str().unwrap()).unwrap()
+}
diff --git a/src/librustc_incremental/Cargo.toml b/src/librustc_incremental/Cargo.toml
index dd05679..c3f6062 100644
--- a/src/librustc_incremental/Cargo.toml
+++ b/src/librustc_incremental/Cargo.toml
@@ -17,3 +17,4 @@
serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
+rustc_fs_util = { path = "../librustc_fs_util" }
diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs
index df8e0f0..9b8e2c4 100644
--- a/src/librustc_incremental/assert_module_sources.rs
+++ b/src/librustc_incremental/assert_module_sources.rs
@@ -27,11 +27,11 @@
//! the HIR doesn't change as a result of the annotations, which might
//! perturb the reuse results.
+use rustc::hir::def_id::LOCAL_CRATE;
use rustc::dep_graph::{DepNode, DepConstructor};
-use rustc::mir::mono::CodegenUnit;
+use rustc::mir::mono::CodegenUnitNameBuilder;
use rustc::ty::TyCtxt;
use syntax::ast;
-use syntax_pos::symbol::Symbol;
use rustc::ich::{ATTR_PARTITION_REUSED, ATTR_PARTITION_CODEGENED};
const MODULE: &'static str = "module";
@@ -72,12 +72,37 @@
return;
}
- let mname = self.field(attr, MODULE);
- let mangled_cgu_name = CodegenUnit::mangle_name(&mname.as_str());
- let mangled_cgu_name = Symbol::intern(&mangled_cgu_name).as_interned_str();
+ let user_path = self.field(attr, MODULE).as_str().to_string();
+ let crate_name = self.tcx.crate_name(LOCAL_CRATE).as_str().to_string();
+
+ if !user_path.starts_with(&crate_name) {
+ let msg = format!("Found malformed codegen unit name `{}`. \
+ Codegen units names must always start with the name of the \
+ crate (`{}` in this case).", user_path, crate_name);
+ self.tcx.sess.span_fatal(attr.span, &msg);
+ }
+
+ // Split of the "special suffix" if there is one.
+ let (user_path, cgu_special_suffix) = if let Some(index) = user_path.rfind(".") {
+ (&user_path[..index], Some(&user_path[index + 1 ..]))
+ } else {
+ (&user_path[..], None)
+ };
+
+ let mut cgu_path_components = user_path.split("-").collect::<Vec<_>>();
+
+ // Remove the crate name
+ assert_eq!(cgu_path_components.remove(0), crate_name);
+
+ let cgu_name_builder = &mut CodegenUnitNameBuilder::new(self.tcx);
+ let cgu_name = cgu_name_builder.build_cgu_name(LOCAL_CRATE,
+ cgu_path_components,
+ cgu_special_suffix);
+
+ debug!("mapping '{}' to cgu name '{}'", self.field(attr, MODULE), cgu_name);
let dep_node = DepNode::new(self.tcx,
- DepConstructor::CompileCodegenUnit(mangled_cgu_name));
+ DepConstructor::CompileCodegenUnit(cgu_name));
if let Some(loaded_from_cache) = self.tcx.dep_graph.was_loaded_from_cache(&dep_node) {
match (disposition, loaded_from_cache) {
@@ -85,13 +110,13 @@
self.tcx.sess.span_err(
attr.span,
&format!("expected module named `{}` to be Reused but is Codegened",
- mname));
+ user_path));
}
(Disposition::Codegened, true) => {
self.tcx.sess.span_err(
attr.span,
&format!("expected module named `{}` to be Codegened but is Reused",
- mname));
+ user_path));
}
(Disposition::Reused, true) |
(Disposition::Codegened, false) => {
@@ -99,7 +124,19 @@
}
}
} else {
- self.tcx.sess.span_err(attr.span, &format!("no module named `{}`", mname));
+ let available_cgus = self.tcx
+ .collect_and_partition_mono_items(LOCAL_CRATE)
+ .1
+ .iter()
+ .map(|cgu| format!("{}", cgu.name()))
+ .collect::<Vec<String>>()
+ .join(", ");
+
+ self.tcx.sess.span_err(attr.span,
+ &format!("no module named `{}` (mangled: {}).\nAvailable modules: {}",
+ user_path,
+ cgu_name,
+ available_cgus));
}
}
diff --git a/src/librustc_incremental/lib.rs b/src/librustc_incremental/lib.rs
index 73886e5..ad8714f 100644
--- a/src/librustc_incremental/lib.rs
+++ b/src/librustc_incremental/lib.rs
@@ -14,6 +14,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(specialization)]
#![recursion_limit="256"]
@@ -23,6 +24,7 @@
extern crate rustc_data_structures;
extern crate serialize as rustc_serialize;
extern crate rand;
+extern crate rustc_fs_util;
#[macro_use] extern crate log;
extern crate syntax;
diff --git a/src/librustc_incremental/persist/fs.rs b/src/librustc_incremental/persist/fs.rs
index 795825f..28d53dc 100644
--- a/src/librustc_incremental/persist/fs.rs
+++ b/src/librustc_incremental/persist/fs.rs
@@ -114,11 +114,11 @@
//! unsupported file system and emit a warning in that case. This is not yet
//! implemented.
-use rustc::hir::svh::Svh;
use rustc::session::{Session, CrateDisambiguator};
-use rustc::util::fs as fs_util;
+use rustc_fs_util::{link_or_copy, LinkOrCopy};
use rustc_data_structures::{flock, base_n};
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
+use rustc_data_structures::svh::Svh;
use std::fs as std_fs;
use std::io;
@@ -429,11 +429,11 @@
let source_path = entry.path();
debug!("copying into session dir: {}", source_path.display());
- match fs_util::link_or_copy(source_path, target_file_path) {
- Ok(fs_util::LinkOrCopy::Link) => {
+ match link_or_copy(source_path, target_file_path) {
+ Ok(LinkOrCopy::Link) => {
files_linked += 1
}
- Ok(fs_util::LinkOrCopy::Copy) => {
+ Ok(LinkOrCopy::Copy) => {
files_copied += 1
}
Err(_) => return Err(())
diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs
index 9ee3b21..fbc3bf0 100644
--- a/src/librustc_incremental/persist/load.rs
+++ b/src/librustc_incremental/persist/load.rs
@@ -207,11 +207,11 @@
pub fn load_query_result_cache<'sess>(sess: &'sess Session) -> OnDiskCache<'sess> {
if sess.opts.incremental.is_none() ||
!sess.opts.debugging_opts.incremental_queries {
- return OnDiskCache::new_empty(sess.codemap());
+ return OnDiskCache::new_empty(sess.source_map());
}
match load_data(sess.opts.debugging_opts.incremental_info, &query_cache_path(sess)) {
LoadResult::Ok{ data: (bytes, start_pos) } => OnDiskCache::new(sess, bytes, start_pos),
- _ => OnDiskCache::new_empty(sess.codemap())
+ _ => OnDiskCache::new_empty(sess.source_map())
}
}
diff --git a/src/librustc_incremental/persist/work_product.rs b/src/librustc_incremental/persist/work_product.rs
index c0ccbd6..cfe59b1 100644
--- a/src/librustc_incremental/persist/work_product.rs
+++ b/src/librustc_incremental/persist/work_product.rs
@@ -13,7 +13,7 @@
use persist::fs::*;
use rustc::dep_graph::{WorkProduct, WorkProductId, WorkProductFileKind};
use rustc::session::Session;
-use rustc::util::fs::link_or_copy;
+use rustc_fs_util::link_or_copy;
use std::path::PathBuf;
use std::fs as std_fs;
diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs
index 3a449b6..0936f28 100644
--- a/src/librustc_lint/builtin.rs
+++ b/src/librustc_lint/builtin.rs
@@ -45,7 +45,7 @@
use syntax::tokenstream::{TokenTree, TokenStream};
use syntax::ast;
use syntax::attr;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::edition::Edition;
use syntax::feature_gate::{AttributeGate, AttributeType, Stability, deprecated_attributes};
use syntax_pos::{BytePos, Span, SyntaxContext};
@@ -82,7 +82,7 @@
if let ast::LitKind::Bool(true) = lit.node {
if lit.span.ctxt() == SyntaxContext::empty() {
let msg = "denote infinite loops with `loop { ... }`";
- let condition_span = cx.tcx.sess.codemap().def_span(e.span);
+ let condition_span = cx.tcx.sess.source_map().def_span(e.span);
let mut err = cx.struct_span_lint(WHILE_TRUE, condition_span, msg);
err.span_suggestion_short_with_applicability(
condition_span,
@@ -195,7 +195,8 @@
let mut err = cx.struct_span_lint(NON_SHORTHAND_FIELD_PATTERNS,
fieldpat.span,
&format!("the `{}:` in this pattern is redundant", ident));
- let subspan = cx.tcx.sess.codemap().span_through_char(fieldpat.span, ':');
+ let subspan = cx.tcx.sess.source_map().span_through_char(fieldpat.span,
+ ':');
err.span_suggestion_short_with_applicability(
subspan,
"remove this",
@@ -367,7 +368,7 @@
let has_doc = attrs.iter().any(|a| has_doc(a));
if !has_doc {
cx.span_lint(MISSING_DOCS,
- cx.tcx.sess.codemap().def_span(sp),
+ cx.tcx.sess.source_map().def_span(sp),
&format!("missing documentation for {}", desc));
}
}
@@ -651,7 +652,7 @@
if ident.name == keywords::Invalid.name() {
let ty_snip = cx
.sess
- .codemap()
+ .source_map()
.span_to_snippet(arg.ty.span);
let (ty_snip, appl) = if let Ok(snip) = ty_snip {
@@ -958,7 +959,7 @@
// no break */ }`) shouldn't be linted unless it actually
// recurs.
if !reached_exit_without_self_call && !self_call_spans.is_empty() {
- let sp = cx.tcx.sess.codemap().def_span(sp);
+ let sp = cx.tcx.sess.source_map().def_span(sp);
let mut db = cx.struct_span_lint(UNCONDITIONAL_RECURSION,
sp,
"function cannot return without recurring");
@@ -1278,7 +1279,7 @@
let mut err = cx.struct_span_lint(NO_MANGLE_CONST_ITEMS, it.span, msg);
// account for "pub const" (#45562)
- let start = cx.tcx.sess.codemap().span_to_snippet(it.span)
+ let start = cx.tcx.sess.source_map().span_to_snippet(it.span)
.map(|snippet| snippet.find("const").unwrap_or(0))
.unwrap_or(0) as u32;
// `const` is 5 chars
@@ -1440,7 +1441,7 @@
if span.ctxt().outer().expn_info().is_some() {
applicability = Applicability::MaybeIncorrect;
}
- let def_span = cx.tcx.sess.codemap().def_span(span);
+ let def_span = cx.tcx.sess.source_map().def_span(span);
let mut err = cx.struct_span_lint(UNREACHABLE_PUB, def_span,
&format!("unreachable `pub` {}", what));
let replacement = if cx.tcx.features().crate_visibility_modifier {
diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs
index 75d1623..801604d 100644
--- a/src/librustc_lint/lib.rs
+++ b/src/librustc_lint/lib.rs
@@ -27,6 +27,7 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(macro_vis_matcher)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(macro_at_most_once_rep)]
diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs
index f1636c4..46b3325 100644
--- a/src/librustc_lint/types.rs
+++ b/src/librustc_lint/types.rs
@@ -25,7 +25,7 @@
use syntax::errors::Applicability;
use rustc_target::spec::abi::Abi;
use syntax_pos::Span;
-use syntax::codemap;
+use syntax::source_map;
use rustc::hir;
@@ -208,7 +208,7 @@
}
fn rev_binop(binop: hir::BinOp) -> hir::BinOp {
- codemap::respan(binop.span,
+ source_map::respan(binop.span,
match binop.node {
hir::BinOpKind::Lt => hir::BinOpKind::Gt,
hir::BinOpKind::Le => hir::BinOpKind::Ge,
@@ -300,7 +300,7 @@
}
fn get_bin_hex_repr(cx: &LateContext, lit: &ast::Lit) -> Option<String> {
- let src = cx.sess().codemap().span_to_snippet(lit.span).ok()?;
+ let src = cx.sess().source_map().span_to_snippet(lit.span).ok()?;
let firstch = src.chars().next()?;
if firstch == '0' {
diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs
index ffa97bd..3876604 100644
--- a/src/librustc_llvm/lib.rs
+++ b/src/librustc_llvm/lib.rs
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(static_nobundle)]
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
diff --git a/src/librustc_lsan/lib.rs b/src/librustc_lsan/lib.rs
index 0c78fd7..b3ba86a 100644
--- a/src/librustc_lsan/lib.rs
+++ b/src/librustc_lsan/lib.rs
@@ -10,6 +10,7 @@
#![sanitizer_runtime]
#![feature(alloc_system)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs
index 62c06aa..c242f8d 100644
--- a/src/librustc_metadata/creader.rs
+++ b/src/librustc_metadata/creader.rs
@@ -16,7 +16,7 @@
use rustc_data_structures::sync::{Lrc, RwLock, Lock};
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX};
-use rustc::hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use rustc::middle::allocator::AllocatorKind;
use rustc::middle::cstore::DepKind;
use rustc::mir::interpret::AllocDecodingState;
@@ -245,7 +245,7 @@
cnum_map,
cnum,
dependencies: Lock::new(dependencies),
- codemap_import_info: RwLock::new(vec![]),
+ source_map_import_info: RwLock::new(vec![]),
alloc_decoding_state: AllocDecodingState::new(interpret_alloc_index),
dep_kind: Lock::new(dep_kind),
source: cstore::CrateSource {
@@ -1139,32 +1139,4 @@
cnum
}
-
- pub fn process_use_extern(
- &mut self,
- name: Symbol,
- span: Span,
- id: ast::NodeId,
- definitions: &Definitions,
- ) -> CrateNum {
- let cnum = self.resolve_crate(
- &None, name, name, None, None, span, PathKind::Crate, DepKind::Explicit
- ).0;
-
- let def_id = definitions.opt_local_def_id(id).unwrap();
- let path_len = definitions.def_path(def_id.index).data.len();
-
- self.update_extern_crate(
- cnum,
- ExternCrate {
- src: ExternCrateSource::Use,
- span,
- path_len,
- direct: true,
- },
- &mut FxHashSet(),
- );
-
- cnum
- }
}
diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs
index 2d3e308..aad632f 100644
--- a/src/librustc_metadata/cstore.rs
+++ b/src/librustc_metadata/cstore.rs
@@ -41,15 +41,15 @@
pub struct MetadataBlob(pub MetadataRef);
-/// Holds information about a syntax_pos::FileMap imported from another crate.
-/// See `imported_filemaps()` for more information.
-pub struct ImportedFileMap {
- /// This FileMap's byte-offset within the codemap of its original crate
+/// Holds information about a syntax_pos::SourceFile imported from another crate.
+/// See `imported_source_files()` for more information.
+pub struct ImportedSourceFile {
+ /// This SourceFile's byte-offset within the source_map of its original crate
pub original_start_pos: syntax_pos::BytePos,
- /// The end of this FileMap within the codemap of its original crate
+ /// The end of this SourceFile within the source_map of its original crate
pub original_end_pos: syntax_pos::BytePos,
- /// The imported FileMap's representation within the local codemap
- pub translated_filemap: Lrc<syntax_pos::FileMap>,
+ /// The imported SourceFile's representation within the local source_map
+ pub translated_source_file: Lrc<syntax_pos::SourceFile>,
}
pub struct CrateMetadata {
@@ -64,7 +64,7 @@
pub cnum_map: CrateNumMap,
pub cnum: CrateNum,
pub dependencies: Lock<Vec<CrateNum>>,
- pub codemap_import_info: RwLock<Vec<ImportedFileMap>>,
+ pub source_map_import_info: RwLock<Vec<ImportedSourceFile>>,
/// Used for decoding interpret::AllocIds in a cached & thread-safe manner.
pub alloc_decoding_state: AllocDecodingState,
diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs
index 060dddd..c51bebd 100644
--- a/src/librustc_metadata/cstore_impl.rs
+++ b/src/librustc_metadata/cstore_impl.rs
@@ -30,6 +30,7 @@
use rustc::hir::map::blocks::FnLikeNode;
use rustc::hir::map::definitions::DefPathTable;
use rustc::util::nodemap::DefIdMap;
+use rustc_data_structures::svh::Svh;
use std::any::Any;
use rustc_data_structures::sync::Lrc;
@@ -37,9 +38,9 @@
use syntax::ast;
use syntax::attr;
-use syntax::codemap;
+use syntax::source_map;
use syntax::edition::Edition;
-use syntax::parse::filemap_to_stream;
+use syntax::parse::source_file_to_stream;
use syntax::symbol::Symbol;
use syntax_pos::{Span, NO_EXPANSION, FileName};
use rustc_data_structures::indexed_set::IdxSetBuf;
@@ -462,9 +463,9 @@
let (name, def) = data.get_macro(id.index);
let source_name = FileName::Macros(name.to_string());
- let filemap = sess.parse_sess.codemap().new_filemap(source_name, def.body);
- let local_span = Span::new(filemap.start_pos, filemap.end_pos, NO_EXPANSION);
- let body = filemap_to_stream(&sess.parse_sess, filemap, None);
+ let source_file = sess.parse_sess.source_map().new_source_file(source_name, def.body);
+ let local_span = Span::new(source_file.start_pos, source_file.end_pos, NO_EXPANSION);
+ let body = source_file_to_stream(&sess.parse_sess, source_file, None);
// Mark the attrs as used
let attrs = data.get_item_attrs(id.index, sess);
@@ -486,7 +487,7 @@
tokens: body.into(),
legacy: def.legacy,
}),
- vis: codemap::respan(local_span.shrink_to_lo(), ast::VisibilityKind::Inherited),
+ vis: source_map::respan(local_span.shrink_to_lo(), ast::VisibilityKind::Inherited),
tokens: None,
})
}
@@ -515,7 +516,7 @@
self.get_crate_data(cnum).root.disambiguator
}
- fn crate_hash_untracked(&self, cnum: CrateNum) -> hir::svh::Svh
+ fn crate_hash_untracked(&self, cnum: CrateNum) -> Svh
{
self.get_crate_data(cnum).root.hash
}
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs
index 5121b68..f4dd8861 100644
--- a/src/librustc_metadata/decoder.rs
+++ b/src/librustc_metadata/decoder.rs
@@ -22,7 +22,7 @@
use rustc::hir::def::{self, Def, CtorKind};
use rustc::hir::def_id::{CrateNum, DefId, DefIndex,
CRATE_DEF_INDEX, LOCAL_CRATE, LocalDefId};
-use rustc::ich::Fingerprint;
+use rustc_data_structures::fingerprint::Fingerprint;
use rustc::middle::lang_items;
use rustc::mir::{self, interpret};
use rustc::mir::interpret::AllocDecodingSession;
@@ -39,7 +39,7 @@
use rustc_serialize::{Decodable, Decoder, SpecializedDecoder, opaque};
use syntax::attr;
use syntax::ast::{self, Ident};
-use syntax::codemap;
+use syntax::source_map;
use syntax::symbol::InternedString;
use syntax::ext::base::MacroKind;
use syntax_pos::{self, Span, BytePos, Pos, DUMMY_SP, NO_EXPANSION};
@@ -50,8 +50,8 @@
sess: Option<&'a Session>,
tcx: Option<TyCtxt<'a, 'tcx, 'tcx>>,
- // Cache the last used filemap for translating spans as an optimization.
- last_filemap_index: usize,
+ // Cache the last used source_file for translating spans as an optimization.
+ last_source_file_index: usize,
lazy_state: LazyState,
@@ -73,7 +73,7 @@
cdata: self.cdata(),
sess: self.sess().or(tcx.map(|tcx| tcx.sess)),
tcx,
- last_filemap_index: 0,
+ last_source_file_index: 0,
lazy_state: LazyState::NoNode,
alloc_decoding_session: self.cdata().map(|cdata| {
cdata.alloc_decoding_state.new_decoding_session()
@@ -314,43 +314,45 @@
bug!("Cannot decode Span without Session.")
};
- let imported_filemaps = self.cdata().imported_filemaps(&sess.codemap());
- let filemap = {
+ let imported_source_files = self.cdata().imported_source_files(&sess.source_map());
+ let source_file = {
// Optimize for the case that most spans within a translated item
- // originate from the same filemap.
- let last_filemap = &imported_filemaps[self.last_filemap_index];
+ // originate from the same source_file.
+ let last_source_file = &imported_source_files[self.last_source_file_index];
- if lo >= last_filemap.original_start_pos &&
- lo <= last_filemap.original_end_pos {
- last_filemap
+ if lo >= last_source_file.original_start_pos &&
+ lo <= last_source_file.original_end_pos {
+ last_source_file
} else {
let mut a = 0;
- let mut b = imported_filemaps.len();
+ let mut b = imported_source_files.len();
while b - a > 1 {
let m = (a + b) / 2;
- if imported_filemaps[m].original_start_pos > lo {
+ if imported_source_files[m].original_start_pos > lo {
b = m;
} else {
a = m;
}
}
- self.last_filemap_index = a;
- &imported_filemaps[a]
+ self.last_source_file_index = a;
+ &imported_source_files[a]
}
};
// Make sure our binary search above is correct.
- debug_assert!(lo >= filemap.original_start_pos &&
- lo <= filemap.original_end_pos);
+ debug_assert!(lo >= source_file.original_start_pos &&
+ lo <= source_file.original_end_pos);
// Make sure we correctly filtered out invalid spans during encoding
- debug_assert!(hi >= filemap.original_start_pos &&
- hi <= filemap.original_end_pos);
+ debug_assert!(hi >= source_file.original_start_pos &&
+ hi <= source_file.original_end_pos);
- let lo = (lo + filemap.translated_filemap.start_pos) - filemap.original_start_pos;
- let hi = (hi + filemap.translated_filemap.start_pos) - filemap.original_start_pos;
+ let lo = (lo + source_file.translated_source_file.start_pos)
+ - source_file.original_start_pos;
+ let hi = (hi + source_file.translated_source_file.start_pos)
+ - source_file.original_start_pos;
Ok(Span::new(lo, hi, NO_EXPANSION))
}
@@ -1094,52 +1096,52 @@
self.def_path_table.def_path_hash(index)
}
- /// Imports the codemap from an external crate into the codemap of the crate
+ /// Imports the source_map from an external crate into the source_map of the crate
/// currently being compiled (the "local crate").
///
/// The import algorithm works analogous to how AST items are inlined from an
/// external crate's metadata:
- /// For every FileMap in the external codemap an 'inline' copy is created in the
- /// local codemap. The correspondence relation between external and local
- /// FileMaps is recorded in the `ImportedFileMap` objects returned from this
+ /// For every SourceFile in the external source_map an 'inline' copy is created in the
+ /// local source_map. The correspondence relation between external and local
+ /// SourceFiles is recorded in the `ImportedSourceFile` objects returned from this
/// function. When an item from an external crate is later inlined into this
/// crate, this correspondence information is used to translate the span
/// information of the inlined item so that it refers the correct positions in
- /// the local codemap (see `<decoder::DecodeContext as SpecializedDecoder<Span>>`).
+ /// the local source_map (see `<decoder::DecodeContext as SpecializedDecoder<Span>>`).
///
- /// The import algorithm in the function below will reuse FileMaps already
- /// existing in the local codemap. For example, even if the FileMap of some
+ /// The import algorithm in the function below will reuse SourceFiles already
+ /// existing in the local source_map. For example, even if the SourceFile of some
/// source file of libstd gets imported many times, there will only ever be
- /// one FileMap object for the corresponding file in the local codemap.
+ /// one SourceFile object for the corresponding file in the local source_map.
///
- /// Note that imported FileMaps do not actually contain the source code of the
+ /// Note that imported SourceFiles do not actually contain the source code of the
/// file they represent, just information about length, line breaks, and
/// multibyte characters. This information is enough to generate valid debuginfo
/// for items inlined from other crates.
- pub fn imported_filemaps(&'a self,
- local_codemap: &codemap::CodeMap)
- -> ReadGuard<'a, Vec<cstore::ImportedFileMap>> {
+ pub fn imported_source_files(&'a self,
+ local_source_map: &source_map::SourceMap)
+ -> ReadGuard<'a, Vec<cstore::ImportedSourceFile>> {
{
- let filemaps = self.codemap_import_info.borrow();
- if !filemaps.is_empty() {
- return filemaps;
+ let source_files = self.source_map_import_info.borrow();
+ if !source_files.is_empty() {
+ return source_files;
}
}
- // Lock the codemap_import_info to ensure this only happens once
- let mut codemap_import_info = self.codemap_import_info.borrow_mut();
+ // Lock the source_map_import_info to ensure this only happens once
+ let mut source_map_import_info = self.source_map_import_info.borrow_mut();
- if !codemap_import_info.is_empty() {
- drop(codemap_import_info);
- return self.codemap_import_info.borrow();
+ if !source_map_import_info.is_empty() {
+ drop(source_map_import_info);
+ return self.source_map_import_info.borrow();
}
- let external_codemap = self.root.codemap.decode(self);
+ let external_source_map = self.root.source_map.decode(self);
- let imported_filemaps = external_codemap.map(|filemap_to_import| {
- // We can't reuse an existing FileMap, so allocate a new one
+ let imported_source_files = external_source_map.map(|source_file_to_import| {
+ // We can't reuse an existing SourceFile, so allocate a new one
// containing the information we need.
- let syntax_pos::FileMap { name,
+ let syntax_pos::SourceFile { name,
name_was_remapped,
src_hash,
start_pos,
@@ -1148,15 +1150,15 @@
mut multibyte_chars,
mut non_narrow_chars,
name_hash,
- .. } = filemap_to_import;
+ .. } = source_file_to_import;
let source_length = (end_pos - start_pos).to_usize();
// Translate line-start positions and multibyte character
// position into frame of reference local to file.
- // `CodeMap::new_imported_filemap()` will then translate those
+ // `SourceMap::new_imported_source_file()` will then translate those
// coordinates to their new global frame of reference when the
- // offset of the FileMap is known.
+ // offset of the SourceFile is known.
for pos in &mut lines {
*pos = *pos - start_pos;
}
@@ -1167,7 +1169,7 @@
*swc = *swc - start_pos;
}
- let local_version = local_codemap.new_imported_filemap(name,
+ let local_version = local_source_map.new_imported_source_file(name,
name_was_remapped,
self.cnum.as_u32(),
src_hash,
@@ -1176,23 +1178,23 @@
lines,
multibyte_chars,
non_narrow_chars);
- debug!("CrateMetaData::imported_filemaps alloc \
- filemap {:?} original (start_pos {:?} end_pos {:?}) \
+ debug!("CrateMetaData::imported_source_files alloc \
+ source_file {:?} original (start_pos {:?} end_pos {:?}) \
translated (start_pos {:?} end_pos {:?})",
local_version.name, start_pos, end_pos,
local_version.start_pos, local_version.end_pos);
- cstore::ImportedFileMap {
+ cstore::ImportedSourceFile {
original_start_pos: start_pos,
original_end_pos: end_pos,
- translated_filemap: local_version,
+ translated_source_file: local_version,
}
}).collect();
- *codemap_import_info = imported_filemaps;
- drop(codemap_import_info);
+ *source_map_import_info = imported_source_files;
+ drop(source_map_import_info);
// This shouldn't borrow twice, but there is no way to downgrade RefMut to Ref.
- self.codemap_import_info.borrow()
+ self.source_map_import_info.borrow()
}
}
diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs
index 96d6c5b..4b5c9d6 100644
--- a/src/librustc_metadata/encoder.rs
+++ b/src/librustc_metadata/encoder.rs
@@ -18,7 +18,7 @@
use rustc::hir::def::CtorKind;
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefIndex, DefId, LocalDefId, LOCAL_CRATE};
use rustc::hir::map::definitions::DefPathTable;
-use rustc::ich::Fingerprint;
+use rustc_data_structures::fingerprint::Fingerprint;
use rustc::middle::dependency_format::Linkage;
use rustc::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel,
metadata_symbol_name};
@@ -40,9 +40,9 @@
use std::u32;
use syntax::ast::{self, CRATE_NODE_ID};
use syntax::attr;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::symbol::keywords;
-use syntax_pos::{self, hygiene, FileName, FileMap, Span};
+use syntax_pos::{self, hygiene, FileName, SourceFile, Span};
use rustc::hir::{self, PatKind};
use rustc::hir::itemlikevisit::ItemLikeVisitor;
@@ -62,7 +62,7 @@
interpret_allocs_inverse: Vec<interpret::AllocId>,
// This is used to speed up Span encoding.
- filemap_cache: Lrc<FileMap>,
+ source_file_cache: Lrc<SourceFile>,
}
macro_rules! encoder_methods {
@@ -157,13 +157,13 @@
// The Span infrastructure should make sure that this invariant holds:
debug_assert!(span.lo <= span.hi);
- if !self.filemap_cache.contains(span.lo) {
- let codemap = self.tcx.sess.codemap();
- let filemap_index = codemap.lookup_filemap_idx(span.lo);
- self.filemap_cache = codemap.files()[filemap_index].clone();
+ if !self.source_file_cache.contains(span.lo) {
+ let source_map = self.tcx.sess.source_map();
+ let source_file_index = source_map.lookup_source_file_idx(span.lo);
+ self.source_file_cache = source_map.files()[source_file_index].clone();
}
- if !self.filemap_cache.contains(span.hi) {
+ if !self.source_file_cache.contains(span.hi) {
// Unfortunately, macro expansion still sometimes generates Spans
// that malformed in this way.
return TAG_INVALID_SPAN.encode(self)
@@ -337,36 +337,36 @@
self.lazy(definitions.def_path_table())
}
- fn encode_codemap(&mut self) -> LazySeq<syntax_pos::FileMap> {
- let codemap = self.tcx.sess.codemap();
- let all_filemaps = codemap.files();
+ fn encode_source_map(&mut self) -> LazySeq<syntax_pos::SourceFile> {
+ let source_map = self.tcx.sess.source_map();
+ let all_source_files = source_map.files();
let (working_dir, working_dir_was_remapped) = self.tcx.sess.working_dir.clone();
- let adapted = all_filemaps.iter()
- .filter(|filemap| {
- // No need to re-export imported filemaps, as any downstream
+ let adapted = all_source_files.iter()
+ .filter(|source_file| {
+ // No need to re-export imported source_files, as any downstream
// crate will import them from their original source.
- !filemap.is_imported()
+ !source_file.is_imported()
})
- .map(|filemap| {
- // When exporting FileMaps, we expand all paths to absolute
+ .map(|source_file| {
+ // When exporting SourceFiles, we expand all paths to absolute
// paths because any relative paths are potentially relative to
// a wrong directory.
// However, if a path has been modified via
// `--remap-path-prefix` we assume the user has already set
// things up the way they want and don't touch the path values
// anymore.
- match filemap.name {
+ match source_file.name {
FileName::Real(ref name) => {
- if filemap.name_was_remapped ||
+ if source_file.name_was_remapped ||
(name.is_relative() && working_dir_was_remapped) {
- // This path of this FileMap has been modified by
+ // This path of this SourceFile has been modified by
// path-remapping, so we use it verbatim (and avoid cloning
// the whole map in the process).
- filemap.clone()
+ source_file.clone()
} else {
- let mut adapted = (**filemap).clone();
+ let mut adapted = (**source_file).clone();
adapted.name = Path::new(&working_dir).join(name).into();
adapted.name_hash = {
let mut hasher: StableHasher<u128> = StableHasher::new();
@@ -377,7 +377,7 @@
}
},
// expanded code, not from a file
- _ => filemap.clone(),
+ _ => source_file.clone(),
}
})
.collect::<Vec<_>>();
@@ -418,10 +418,10 @@
IsolatedEncoder::encode_foreign_modules,
());
- // Encode codemap
+ // Encode source_map
i = self.position();
- let codemap = self.encode_codemap();
- let codemap_bytes = self.position() - i;
+ let source_map = self.encode_source_map();
+ let source_map_bytes = self.position() - i;
// Encode DefPathTable
i = self.position();
@@ -523,7 +523,7 @@
lang_items_missing,
native_libraries,
foreign_modules,
- codemap,
+ source_map,
def_path_table,
impls,
exported_symbols,
@@ -546,7 +546,7 @@
println!(" lib feature bytes: {}", lib_feature_bytes);
println!(" lang item bytes: {}", lang_item_bytes);
println!(" native bytes: {}", native_lib_bytes);
- println!(" codemap bytes: {}", codemap_bytes);
+ println!(" source_map bytes: {}", source_map_bytes);
println!(" impl bytes: {}", impl_bytes);
println!(" exp. symbols bytes: {}", exported_symbols_bytes);
println!(" def-path table bytes: {}", def_path_table_bytes);
@@ -1788,7 +1788,7 @@
if let Some(trait_ref) = self.tcx.impl_trait_ref(impl_id) {
self.impls
.entry(trait_ref.def_id)
- .or_insert(vec![])
+ .or_default()
.push(impl_id.index);
}
}
@@ -1842,7 +1842,7 @@
lazy_state: LazyState::NoNode,
type_shorthands: Default::default(),
predicate_shorthands: Default::default(),
- filemap_cache: tcx.sess.codemap().files()[0].clone(),
+ source_file_cache: tcx.sess.source_map().files()[0].clone(),
interpret_allocs: Default::default(),
interpret_allocs_inverse: Default::default(),
};
diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs
index 98946ad6..a3591b2 100644
--- a/src/librustc_metadata/lib.rs
+++ b/src/librustc_metadata/lib.rs
@@ -15,6 +15,7 @@
#![feature(box_patterns)]
#![feature(libc)]
#![feature(macro_at_most_once_rep)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(proc_macro_internals)]
#![feature(proc_macro_quote)]
#![feature(quote)]
diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs
index f68bcdd..f78a194 100644
--- a/src/librustc_metadata/locator.rs
+++ b/src/librustc_metadata/locator.rs
@@ -226,7 +226,7 @@
use creader::Library;
use schema::{METADATA_HEADER, rustc_version};
-use rustc::hir::svh::Svh;
+use rustc_data_structures::svh::Svh;
use rustc::middle::cstore::MetadataLoader;
use rustc::session::{config, Session};
use rustc::session::filesearch::{FileSearch, FileMatches, FileDoesntMatch};
@@ -451,7 +451,10 @@
let rlib_prefix = format!("lib{}{}", self.crate_name, extra_prefix);
let staticlib_prefix = format!("{}{}{}", staticpair.0, self.crate_name, extra_prefix);
- let mut candidates = FxHashMap();
+ let mut candidates: FxHashMap<
+ _,
+ (FxHashMap<_, _>, FxHashMap<_, _>, FxHashMap<_, _>),
+ > = FxHashMap();
let mut staticlibs = vec![];
// First, find all possible candidate rlibs and dylibs purely based on
@@ -493,8 +496,7 @@
info!("lib candidate: {}", path.display());
let hash_str = hash.to_string();
- let slot = candidates.entry(hash_str)
- .or_insert_with(|| (FxHashMap(), FxHashMap(), FxHashMap()));
+ let slot = candidates.entry(hash_str).or_default();
let (ref mut rlibs, ref mut rmetas, ref mut dylibs) = *slot;
fs::canonicalize(path)
.map(|p| {
diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs
index 078295c..70eda89 100644
--- a/src/librustc_metadata/native_libs.rs
+++ b/src/librustc_metadata/native_libs.rs
@@ -16,7 +16,7 @@
use rustc::util::nodemap::FxHashSet;
use rustc_target::spec::abi::Abi;
use syntax::attr;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use syntax::feature_gate::{self, GateIssue};
use syntax::symbol::Symbol;
diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs
index 894c7cb..8e454dd 100644
--- a/src/librustc_metadata/schema.rs
+++ b/src/librustc_metadata/schema.rs
@@ -20,6 +20,7 @@
use rustc::session::CrateDisambiguator;
use rustc::ty::{self, Ty, ReprOptions};
use rustc_target::spec::{PanicStrategy, TargetTriple};
+use rustc_data_structures::svh::Svh;
use rustc_serialize as serialize;
use syntax::{ast, attr};
@@ -187,7 +188,7 @@
pub name: Symbol,
pub triple: TargetTriple,
pub extra_filename: String,
- pub hash: hir::svh::Svh,
+ pub hash: Svh,
pub disambiguator: CrateDisambiguator,
pub panic_strategy: PanicStrategy,
pub edition: Edition,
@@ -203,7 +204,7 @@
pub lang_items_missing: LazySeq<lang_items::LangItem>,
pub native_libraries: LazySeq<NativeLibrary>,
pub foreign_modules: LazySeq<ForeignModule>,
- pub codemap: LazySeq<syntax_pos::FileMap>,
+ pub source_map: LazySeq<syntax_pos::SourceFile>,
pub def_path_table: Lazy<hir::map::definitions::DefPathTable>,
pub impls: LazySeq<TraitImpls>,
pub exported_symbols: EncodedExportedSymbols,
@@ -223,7 +224,7 @@
#[derive(RustcEncodable, RustcDecodable)]
pub struct CrateDep {
pub name: ast::Name,
- pub hash: hir::svh::Svh,
+ pub hash: Svh,
pub kind: DepKind,
pub extra_filename: String,
}
diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs
index fe33dc0..454f89e 100644
--- a/src/librustc_mir/borrow_check/borrow_set.rs
+++ b/src/librustc_mir/borrow_check/borrow_set.rs
@@ -159,7 +159,7 @@
location: mir::Location,
) {
if let mir::Rvalue::Ref(region, kind, ref borrowed_place) = *rvalue {
- if borrowed_place.is_unsafe_place(self.tcx, self.mir) {
+ if borrowed_place.ignore_borrow(self.tcx, self.mir) {
return;
}
@@ -248,7 +248,7 @@
self.activation_map
.entry(location)
- .or_insert(Vec::new())
+ .or_default()
.push(borrow_index);
TwoPhaseActivation::ActivatedAt(location)
}
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs
index aabed66..2ae0637 100644
--- a/src/librustc_mir/borrow_check/error_reporting.rs
+++ b/src/librustc_mir/borrow_check/error_reporting.rs
@@ -138,7 +138,7 @@
let tables = self.tcx.typeck_tables_of(id);
let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
let hir_id = self.tcx.hir.node_to_hir_id(node_id);
- if let Some(_) = tables.closure_kind_origins().get(hir_id) {
+ if tables.closure_kind_origins().get(hir_id).is_some() {
false
} else {
true
@@ -412,6 +412,12 @@
.insert((root_place.clone(), borrow_span));
let mut err = match &self.describe_place(&borrow.borrowed_place) {
+ Some(_) if self.is_place_thread_local(root_place) => {
+ self.report_thread_local_value_does_not_live_long_enough(
+ drop_span,
+ borrow_span,
+ )
+ }
Some(name) => self.report_local_value_does_not_live_long_enough(
context,
name,
@@ -455,9 +461,9 @@
context, name, scope_tree, borrow, drop_span, borrow_span
);
- let tcx = self.tcx;
- let mut err =
- tcx.path_does_not_live_long_enough(borrow_span, &format!("`{}`", name), Origin::Mir);
+ let mut err = self.tcx.path_does_not_live_long_enough(
+ borrow_span, &format!("`{}`", name), Origin::Mir);
+
err.span_label(borrow_span, "borrowed value does not live long enough");
err.span_label(
drop_span,
@@ -468,6 +474,27 @@
err
}
+ fn report_thread_local_value_does_not_live_long_enough(
+ &mut self,
+ drop_span: Span,
+ borrow_span: Span,
+ ) -> DiagnosticBuilder<'cx> {
+ debug!(
+ "report_thread_local_value_does_not_live_long_enough(\
+ {:?}, {:?}\
+ )",
+ drop_span, borrow_span
+ );
+
+ let mut err = self.tcx.thread_local_value_does_not_live_long_enough(
+ borrow_span, Origin::Mir);
+
+ err.span_label(borrow_span,
+ "thread-local variables cannot be borrowed beyond the end of the function");
+ err.span_label(drop_span, "end of enclosing function is here");
+ err
+ }
+
fn report_temporary_value_does_not_live_long_enough(
&mut self,
context: Context,
@@ -735,7 +762,7 @@
&including_downcast,
)?;
buf.push_str("[");
- if let Err(_) = self.append_local_to_string(index, buf) {
+ if self.append_local_to_string(index, buf).is_err() {
buf.push_str("..");
}
buf.push_str("]");
@@ -856,6 +883,21 @@
},
}
}
+
+ /// Check if a place is a thread-local static.
+ pub fn is_place_thread_local(&self, place: &Place<'tcx>) -> bool {
+ if let Place::Static(statik) = place {
+ let attrs = self.tcx.get_attrs(statik.def_id);
+ let is_thread_local = attrs.iter().any(|attr| attr.check_name("thread_local"));
+
+ debug!("is_place_thread_local: attrs={:?} is_thread_local={:?}",
+ attrs, is_thread_local);
+ is_thread_local
+ } else {
+ debug!("is_place_thread_local: no");
+ false
+ }
+ }
}
// The span(s) associated to a use of a place.
diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index 320d3a4..82d3d31 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -151,7 +151,7 @@
let location_table = &LocationTable::new(mir);
let mut errors_buffer = Vec::new();
- let (move_data, move_errors): (MoveData<'tcx>, Option<Vec<MoveError<'tcx>>>) =
+ let (move_data, move_errors): (MoveData<'tcx>, Option<Vec<(Place<'tcx>, MoveError<'tcx>)>>) =
match MoveData::gather_moves(mir, tcx) {
Ok(move_data) => (move_data, None),
Err((move_data, move_errors)) => (move_data, Some(move_errors)),
@@ -316,7 +316,7 @@
}
let span = local_decl.source_info.span;
- let mut_span = tcx.sess.codemap().span_until_non_whitespace(span);
+ let mut_span = tcx.sess.source_map().span_until_non_whitespace(span);
let mut err = tcx.struct_span_lint_node(
UNUSED_MUT,
@@ -798,12 +798,6 @@
No,
}
-struct AccessErrorsReported {
- mutability_error: bool,
- #[allow(dead_code)]
- conflict_error: bool,
-}
-
#[derive(Copy, Clone)]
enum InitializationRequiringAction {
Update,
@@ -1072,7 +1066,7 @@
kind: (ShallowOrDeep, ReadOrWrite),
is_local_mutation_allowed: LocalMutationIsAllowed,
flow_state: &Flows<'cx, 'gcx, 'tcx>,
- ) -> AccessErrorsReported {
+ ) {
let (sd, rw) = kind;
if let Activation(_, borrow_index) = rw {
@@ -1082,10 +1076,7 @@
place: {:?} borrow_index: {:?}",
place_span.0, borrow_index
);
- return AccessErrorsReported {
- mutability_error: false,
- conflict_error: true,
- };
+ return;
}
}
@@ -1097,10 +1088,7 @@
"access_place: suppressing error place_span=`{:?}` kind=`{:?}`",
place_span, kind
);
- return AccessErrorsReported {
- mutability_error: false,
- conflict_error: true,
- };
+ return;
}
let mutability_error =
@@ -1122,11 +1110,6 @@
self.access_place_error_reported
.insert((place_span.0.clone(), place_span.1));
}
-
- AccessErrorsReported {
- mutability_error,
- conflict_error,
- }
}
fn check_access_for_conflict(
@@ -1275,23 +1258,30 @@
}
}
- let errors_reported = self.access_place(
+ // Special case: you can assign a immutable local variable
+ // (e.g., `x = ...`) so long as it has never been initialized
+ // before (at this point in the flow).
+ if let &Place::Local(local) = place_span.0 {
+ if let Mutability::Not = self.mir.local_decls[local].mutability {
+ // check for reassignments to immutable local variables
+ self.check_if_reassignment_to_immutable_state(
+ context,
+ local,
+ place_span,
+ flow_state,
+ );
+ return;
+ }
+ }
+
+ // Otherwise, use the normal access permission rules.
+ self.access_place(
context,
place_span,
(kind, Write(WriteKind::Mutate)),
- // We want immutable upvars to cause an "assignment to immutable var"
- // error, not an "reassignment of immutable var" error, because the
- // latter can't find a good previous assignment span.
- //
- // There's probably a better way to do this.
- LocalMutationIsAllowed::ExceptUpvars,
+ LocalMutationIsAllowed::No,
flow_state,
);
-
- if !errors_reported.mutability_error {
- // check for reassignments to immutable local variables
- self.check_if_reassignment_to_immutable_state(context, place_span, flow_state);
- }
}
fn consume_rvalue(
@@ -1487,15 +1477,10 @@
// FIXME: allow thread-locals to borrow other thread locals?
let (might_be_alive, will_be_dropped) = match root_place {
Place::Promoted(_) => (true, false),
- Place::Static(statik) => {
+ Place::Static(_) => {
// Thread-locals might be dropped after the function exits, but
// "true" statics will never be.
- let is_thread_local = self
- .tcx
- .get_attrs(statik.def_id)
- .iter()
- .any(|attr| attr.check_name("thread_local"));
-
+ let is_thread_local = self.is_place_thread_local(&root_place);
(true, is_thread_local)
}
Place::Local(_) => {
@@ -1524,7 +1509,7 @@
debug!("check_for_invalidation_at_exit({:?}): INVALID", place);
// FIXME: should be talking about the region lifetime instead
// of just a span here.
- let span = self.tcx.sess.codemap().end_point(span);
+ let span = self.tcx.sess.source_map().end_point(span);
self.report_borrowed_value_does_not_live_long_enough(
context,
borrow,
@@ -1595,27 +1580,20 @@
fn check_if_reassignment_to_immutable_state(
&mut self,
context: Context,
- (place, span): (&Place<'tcx>, Span),
+ local: Local,
+ place_span: (&Place<'tcx>, Span),
flow_state: &Flows<'cx, 'gcx, 'tcx>,
) {
- debug!("check_if_reassignment_to_immutable_state({:?})", place);
- // determine if this path has a non-mut owner (and thus needs checking).
- let err_place = match self.is_mutable(place, LocalMutationIsAllowed::No) {
- Ok(..) => return,
- Err(place) => place,
- };
- debug!(
- "check_if_reassignment_to_immutable_state({:?}) - is an imm local",
- place
- );
+ debug!("check_if_reassignment_to_immutable_state({:?})", local);
- for i in flow_state.ever_inits.iter_incoming() {
- let init = self.move_data.inits[i];
- let init_place = &self.move_data.move_paths[init.path].place;
- if places_conflict::places_conflict(self.tcx, self.mir, &init_place, place, Deep) {
- self.report_illegal_reassignment(context, (place, span), init.span, err_place);
- break;
- }
+ // Check if any of the initializiations of `local` have happened yet:
+ let mpi = self.move_data.rev_lookup.find_local(local);
+ let init_indices = &self.move_data.init_path_map[mpi];
+ let first_init_index = init_indices.iter().find(|ii| flow_state.ever_inits.contains(ii));
+ if let Some(&init_index) = first_init_index {
+ // And, if so, report an error.
+ let init = &self.move_data.inits[init_index];
+ self.report_illegal_reassignment(context, place_span, init.span, place_span.0);
}
}
diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs
index 4d988fe..5ef6475 100644
--- a/src/librustc_mir/borrow_check/move_errors.rs
+++ b/src/librustc_mir/borrow_check/move_errors.rs
@@ -8,14 +8,15 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use rustc::hir;
+use core::unicode::property::Pattern_White_Space;
use rustc::mir::*;
use rustc::ty;
-use rustc_data_structures::indexed_vec::Idx;
use rustc_errors::DiagnosticBuilder;
+use rustc_data_structures::indexed_vec::Idx;
use syntax_pos::Span;
use borrow_check::MirBorrowckCtxt;
+use borrow_check::prefixes::PrefixSet;
use dataflow::move_paths::{IllegalMoveOrigin, IllegalMoveOriginKind};
use dataflow::move_paths::{LookupResult, MoveError, MovePathIndex};
use util::borrowck_errors::{BorrowckErrors, Origin};
@@ -35,17 +36,19 @@
// let (&x, &y) = (&String::new(), &String::new());
#[derive(Debug)]
enum GroupedMoveError<'tcx> {
- // Match place can't be moved from
+ // Place expression can't be moved from,
// e.g. match x[0] { s => (), } where x: &[String]
- MovesFromMatchPlace {
+ MovesFromPlace {
+ original_path: Place<'tcx>,
span: Span,
move_from: Place<'tcx>,
kind: IllegalMoveOriginKind<'tcx>,
binds_to: Vec<Local>,
},
- // Part of a pattern can't be moved from,
+ // Part of a value expression can't be moved from,
// e.g. match &String::new() { &x => (), }
- MovesFromPattern {
+ MovesFromValue {
+ original_path: Place<'tcx>,
span: Span,
move_from: MovePathIndex,
kind: IllegalMoveOriginKind<'tcx>,
@@ -53,23 +56,27 @@
},
// Everything that isn't from pattern matching.
OtherIllegalMove {
+ original_path: Place<'tcx>,
span: Span,
kind: IllegalMoveOriginKind<'tcx>,
},
}
impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> {
- pub(crate) fn report_move_errors(&mut self, move_errors: Vec<MoveError<'tcx>>) {
+ pub(crate) fn report_move_errors(&mut self, move_errors: Vec<(Place<'tcx>, MoveError<'tcx>)>) {
let grouped_errors = self.group_move_errors(move_errors);
for error in grouped_errors {
self.report(error);
}
}
- fn group_move_errors(&self, errors: Vec<MoveError<'tcx>>) -> Vec<GroupedMoveError<'tcx>> {
+ fn group_move_errors(
+ &self,
+ errors: Vec<(Place<'tcx>, MoveError<'tcx>)>
+ ) -> Vec<GroupedMoveError<'tcx>> {
let mut grouped_errors = Vec::new();
- for error in errors {
- self.append_to_grouped_errors(&mut grouped_errors, error);
+ for (original_path, error) in errors {
+ self.append_to_grouped_errors(&mut grouped_errors, original_path, error);
}
grouped_errors
}
@@ -77,6 +84,7 @@
fn append_to_grouped_errors(
&self,
grouped_errors: &mut Vec<GroupedMoveError<'tcx>>,
+ original_path: Place<'tcx>,
error: MoveError<'tcx>,
) {
match error {
@@ -111,11 +119,13 @@
opt_match_place: Some((ref opt_match_place, match_span)),
binding_mode: _,
opt_ty_info: _,
+ pat_span: _,
}))) = local_decl.is_user_variable
{
self.append_binding_error(
grouped_errors,
kind,
+ original_path,
move_from,
*local,
opt_match_place,
@@ -127,6 +137,7 @@
}
grouped_errors.push(GroupedMoveError::OtherIllegalMove {
span: stmt_source_info.span,
+ original_path,
kind,
});
}
@@ -137,6 +148,7 @@
&self,
grouped_errors: &mut Vec<GroupedMoveError<'tcx>>,
kind: IllegalMoveOriginKind<'tcx>,
+ original_path: Place<'tcx>,
move_from: &Place<'tcx>,
bind_to: Local,
match_place: &Option<Place<'tcx>>,
@@ -144,7 +156,7 @@
statement_span: Span,
) {
debug!(
- "append_to_grouped_errors(match_place={:?}, match_span={:?})",
+ "append_binding_error(match_place={:?}, match_span={:?})",
match_place, match_span
);
@@ -155,7 +167,7 @@
// Error with the match place
LookupResult::Parent(_) => {
for ge in &mut *grouped_errors {
- if let GroupedMoveError::MovesFromMatchPlace { span, binds_to, .. } = ge {
+ if let GroupedMoveError::MovesFromPlace { span, binds_to, .. } = ge {
if match_span == *span {
debug!("appending local({:?}) to list", bind_to);
if !binds_to.is_empty() {
@@ -173,9 +185,10 @@
} else {
(vec![bind_to], match_span)
};
- grouped_errors.push(GroupedMoveError::MovesFromMatchPlace {
+ grouped_errors.push(GroupedMoveError::MovesFromPlace {
span,
move_from: match_place.clone(),
+ original_path,
kind,
binds_to,
});
@@ -188,7 +201,7 @@
_ => unreachable!("Probably not unreachable..."),
};
for ge in &mut *grouped_errors {
- if let GroupedMoveError::MovesFromPattern {
+ if let GroupedMoveError::MovesFromValue {
span,
move_from: other_mpi,
binds_to,
@@ -203,9 +216,10 @@
}
}
debug!("found a new move error location");
- grouped_errors.push(GroupedMoveError::MovesFromPattern {
+ grouped_errors.push(GroupedMoveError::MovesFromValue {
span: match_span,
move_from: mpi,
+ original_path,
kind,
binds_to: vec![bind_to],
});
@@ -215,12 +229,23 @@
fn report(&mut self, error: GroupedMoveError<'tcx>) {
let (mut err, err_span) = {
- let (span, kind): (Span, &IllegalMoveOriginKind) = match error {
- GroupedMoveError::MovesFromMatchPlace { span, ref kind, .. }
- | GroupedMoveError::MovesFromPattern { span, ref kind, .. }
- | GroupedMoveError::OtherIllegalMove { span, ref kind } => (span, kind),
- };
+ let (span, original_path, kind): (Span, &Place<'tcx>, &IllegalMoveOriginKind) =
+ match error {
+ GroupedMoveError::MovesFromPlace {
+ span,
+ ref original_path,
+ ref kind,
+ ..
+ } |
+ GroupedMoveError::MovesFromValue { span, ref original_path, ref kind, .. } |
+ GroupedMoveError::OtherIllegalMove { span, ref original_path, ref kind } => {
+ (span, original_path, kind)
+ },
+ };
let origin = Origin::Mir;
+ debug!("report: original_path={:?} span={:?}, kind={:?} \
+ original_path.is_upvar_field_projection={:?}", original_path, span, kind,
+ original_path.is_upvar_field_projection(self.mir, &self.tcx));
(
match kind {
IllegalMoveOriginKind::Static => {
@@ -231,22 +256,17 @@
// borrow to provide feedback about why this
// was a move rather than a copy.
let ty = place.ty(self.mir, self.tcx).to_ty(self.tcx);
+ let is_upvar_field_projection =
+ self.prefixes(&original_path, PrefixSet::All)
+ .any(|p| p.is_upvar_field_projection(self.mir, &self.tcx)
+ .is_some());
match ty.sty {
ty::TyArray(..) | ty::TySlice(..) => self
.tcx
.cannot_move_out_of_interior_noncopy(span, ty, None, origin),
ty::TyClosure(def_id, closure_substs)
- if !self.mir.upvar_decls.is_empty()
- && {
- match place {
- Place::Projection(ref proj) => {
- proj.base == Place::Local(Local::new(1))
- }
- Place::Promoted(_) |
- Place::Local(_) | Place::Static(_) => unreachable!(),
- }
- } =>
- {
+ if !self.mir.upvar_decls.is_empty() && is_upvar_field_projection
+ => {
let closure_kind_ty =
closure_substs.closure_kind_ty(def_id, self.tcx);
let closure_kind = closure_kind_ty.to_opt_closure_kind();
@@ -262,7 +282,28 @@
}
None => bug!("closure kind not inferred by borrowck"),
};
- self.tcx.cannot_move_out_of(span, place_description, origin)
+ debug!("report: closure_kind_ty={:?} closure_kind={:?} \
+ place_description={:?}", closure_kind_ty, closure_kind,
+ place_description);
+
+ let mut diag = self.tcx.cannot_move_out_of(
+ span, place_description, origin);
+
+ for prefix in self.prefixes(&original_path, PrefixSet::All) {
+ if let Some(field) = prefix.is_upvar_field_projection(
+ self.mir, &self.tcx) {
+ let upvar_decl = &self.mir.upvar_decls[field.index()];
+ let upvar_hir_id =
+ upvar_decl.var_hir_id.assert_crate_local();
+ let upvar_node_id =
+ self.tcx.hir.hir_to_node_id(upvar_hir_id);
+ let upvar_span = self.tcx.hir.span(upvar_node_id);
+ diag.span_label(upvar_span, "captured outer variable");
+ break;
+ }
+ }
+
+ diag
}
_ => self
.tcx
@@ -291,111 +332,140 @@
err: &mut DiagnosticBuilder<'a>,
span: Span,
) {
+ let snippet = self.tcx.sess.source_map().span_to_snippet(span).unwrap();
match error {
- GroupedMoveError::MovesFromMatchPlace {
+ GroupedMoveError::MovesFromPlace {
mut binds_to,
move_from,
..
} => {
- // Ok to suggest a borrow, since the target can't be moved from
- // anyway.
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
- match move_from {
- Place::Projection(ref proj)
- if self.suitable_to_remove_deref(proj, &snippet) =>
- {
- err.span_suggestion(
- span,
- "consider removing this dereference operator",
- (&snippet[1..]).to_owned(),
- );
- }
- _ => {
- err.span_suggestion(
- span,
- "consider using a reference instead",
- format!("&{}", snippet),
- );
- }
- }
-
- binds_to.sort();
- binds_to.dedup();
- for local in binds_to {
- let bind_to = &self.mir.local_decls[local];
- let binding_span = bind_to.source_info.span;
- err.span_label(
- binding_span,
- format!(
- "move occurs because {} has type `{}`, \
- which does not implement the `Copy` trait",
- bind_to.name.unwrap(),
- bind_to.ty
- ),
- );
- }
+ let try_remove_deref = match move_from {
+ Place::Projection(box PlaceProjection {
+ elem: ProjectionElem::Deref,
+ ..
+ }) => true,
+ _ => false,
+ };
+ if try_remove_deref && snippet.starts_with('*') {
+ // The snippet doesn't start with `*` in (e.g.) index
+ // expressions `a[b]`, which roughly desugar to
+ // `*Index::index(&a, b)` or
+ // `*IndexMut::index_mut(&mut a, b)`.
+ err.span_suggestion(
+ span,
+ "consider removing the `*`",
+ snippet[1..].to_owned(),
+ );
+ } else {
+ err.span_suggestion(
+ span,
+ "consider borrowing here",
+ format!("&{}", snippet),
+ );
}
- }
- GroupedMoveError::MovesFromPattern { mut binds_to, .. } => {
- // Suggest ref, since there might be a move in
- // another match arm
+
binds_to.sort();
binds_to.dedup();
- let mut multipart_suggestion = Vec::with_capacity(binds_to.len());
- for (j, local) in binds_to.into_iter().enumerate() {
- let bind_to = &self.mir.local_decls[local];
- let binding_span = bind_to.source_info.span;
-
- // Suggest ref mut when the user has already written mut.
- let ref_kind = match bind_to.mutability {
- Mutability::Not => "ref",
- Mutability::Mut => "ref mut",
- };
- if j == 0 {
- err.span_label(binding_span, format!("data moved here"));
- } else {
- err.span_label(binding_span, format!("... and here"));
- }
- match bind_to.name {
- Some(name) => {
- multipart_suggestion.push((binding_span,
- format!("{} {}", ref_kind, name)));
- }
- None => {
- err.span_label(
- span,
- format!("Local {:?} is not suitable for ref", bind_to),
- );
- }
- }
- }
- err.multipart_suggestion("to prevent move, use ref or ref mut",
- multipart_suggestion);
+ self.add_move_error_details(err, &binds_to);
}
- // Nothing to suggest.
+ GroupedMoveError::MovesFromValue { mut binds_to, .. } => {
+ binds_to.sort();
+ binds_to.dedup();
+ self.add_move_error_suggestions(err, &binds_to);
+ self.add_move_error_details(err, &binds_to);
+ }
+ // No binding. Nothing to suggest.
GroupedMoveError::OtherIllegalMove { .. } => (),
}
}
- fn suitable_to_remove_deref(&self, proj: &PlaceProjection<'tcx>, snippet: &str) -> bool {
- let is_shared_ref = |ty: ty::Ty| match ty.sty {
- ty::TypeVariants::TyRef(.., hir::Mutability::MutImmutable) => true,
- _ => false,
- };
-
- proj.elem == ProjectionElem::Deref && snippet.starts_with('*') && match proj.base {
- Place::Local(local) => {
- let local_decl = &self.mir.local_decls[local];
- // If this is a temporary, then this could be from an
- // overloaded * operator.
- local_decl.is_user_variable.is_some() && is_shared_ref(local_decl.ty)
+ fn add_move_error_suggestions(
+ &self,
+ err: &mut DiagnosticBuilder<'a>,
+ binds_to: &[Local],
+ ) {
+ let mut suggestions: Vec<(Span, &str, String)> = Vec::new();
+ for local in binds_to {
+ let bind_to = &self.mir.local_decls[*local];
+ if let Some(
+ ClearCrossCrate::Set(BindingForm::Var(VarBindingForm {
+ pat_span,
+ ..
+ }))
+ ) = bind_to.is_user_variable {
+ let pat_snippet = self
+ .tcx.sess.source_map()
+ .span_to_snippet(pat_span)
+ .unwrap();
+ if pat_snippet.starts_with('&') {
+ let pat_snippet = pat_snippet[1..].trim_left();
+ let suggestion;
+ let to_remove;
+ if pat_snippet.starts_with("mut")
+ && pat_snippet["mut".len()..].starts_with(Pattern_White_Space)
+ {
+ suggestion = pat_snippet["mut".len()..].trim_left();
+ to_remove = "&mut";
+ } else {
+ suggestion = pat_snippet;
+ to_remove = "&";
+ }
+ suggestions.push((
+ pat_span,
+ to_remove,
+ suggestion.to_owned(),
+ ));
+ }
}
- Place::Promoted(_) => true,
- Place::Static(ref st) => is_shared_ref(st.ty),
- Place::Projection(ref proj) => match proj.elem {
- ProjectionElem::Field(_, ty) => is_shared_ref(ty),
- _ => false,
- },
+ }
+ suggestions.sort_unstable_by_key(|&(span, _, _)| span);
+ suggestions.dedup_by_key(|&mut (span, _, _)| span);
+ for (span, to_remove, suggestion) in suggestions {
+ err.span_suggestion(
+ span,
+ &format!("consider removing the `{}`", to_remove),
+ suggestion
+ );
+ }
+ }
+
+ fn add_move_error_details(
+ &self,
+ err: &mut DiagnosticBuilder<'a>,
+ binds_to: &[Local],
+ ) {
+ let mut noncopy_var_spans = Vec::new();
+ for (j, local) in binds_to.into_iter().enumerate() {
+ let bind_to = &self.mir.local_decls[*local];
+ let binding_span = bind_to.source_info.span;
+
+ if j == 0 {
+ err.span_label(binding_span, format!("data moved here"));
+ } else {
+ err.span_label(binding_span, format!("...and here"));
+ }
+
+ if binds_to.len() == 1 {
+ err.span_note(
+ binding_span,
+ &format!(
+ "move occurs because `{}` has type `{}`, \
+ which does not implement the `Copy` trait",
+ bind_to.name.unwrap(),
+ bind_to.ty
+ ),
+ );
+ } else {
+ noncopy_var_spans.push(binding_span);
+ }
+ }
+
+ if binds_to.len() > 1 {
+ err.span_note(
+ noncopy_var_spans,
+ "move occurs because these variables have types that \
+ don't implement the `Copy` trait",
+ );
}
}
}
diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs
index e886232..05d6f49 100644
--- a/src/librustc_mir/borrow_check/mutability_errors.rs
+++ b/src/librustc_mir/borrow_check/mutability_errors.rs
@@ -36,10 +36,18 @@
error_access: AccessKind,
location: Location,
) {
+ debug!(
+ "report_mutability_error(\
+ access_place={:?}, span={:?}, the_place_err={:?}, error_access={:?}, location={:?},\
+ )",
+ access_place, span, the_place_err, error_access, location,
+ );
+
let mut err;
let item_msg;
let reason;
let access_place_desc = self.describe_place(access_place);
+ debug!("report_mutability_error: access_place_desc={:?}", access_place_desc);
match the_place_err {
Place::Local(local) => {
@@ -63,7 +71,7 @@
));
item_msg = format!("`{}`", access_place_desc.unwrap());
- if self.is_upvar(access_place) {
+ if access_place.is_upvar_field_projection(self.mir, &self.tcx).is_some() {
reason = ", as it is not declared as mutable".to_string();
} else {
let name = self.mir.upvar_decls[upvar_index.index()].debug_name;
@@ -82,7 +90,8 @@
the_place_err.ty(self.mir, self.tcx).to_ty(self.tcx)
));
- reason = if self.is_upvar(access_place) {
+ reason = if access_place.is_upvar_field_projection(self.mir,
+ &self.tcx).is_some() {
", as it is a captured variable in a `Fn` closure".to_string()
} else {
", as `Fn` closures cannot mutate their captured variables".to_string()
@@ -155,6 +164,8 @@
}) => bug!("Unexpected immutable place."),
}
+ debug!("report_mutability_error: item_msg={:?}, reason={:?}", item_msg, reason);
+
// `act` and `acted_on` are strings that let us abstract over
// the verbs used in some diagnostic messages.
let act;
@@ -199,6 +210,8 @@
}
};
+ debug!("report_mutability_error: act={:?}, acted_on={:?}", act, acted_on);
+
match the_place_err {
// We want to suggest users use `let mut` for local (user
// variable) mutations...
@@ -255,7 +268,7 @@
// a local variable, then just suggest the user remove it.
Place::Local(_)
if {
- if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
+ if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
snippet.starts_with("&mut ")
} else {
false
@@ -316,7 +329,11 @@
ClearCrossCrate::Set(mir::BindingForm::Var(mir::VarBindingForm {
binding_mode: ty::BindingMode::BindByReference(_),
..
- })) => suggest_ref_mut(self.tcx, local_decl.source_info.span),
+ })) => {
+ let pattern_span = local_decl.source_info.span;
+ suggest_ref_mut(self.tcx, pattern_span)
+ .map(|replacement| (pattern_span, replacement))
+ }
//
ClearCrossCrate::Set(mir::BindingForm::RefForGuard) => unreachable!(),
@@ -382,31 +399,6 @@
err.buffer(&mut self.errors_buffer);
}
-
- // Does this place refer to what the user sees as an upvar
- fn is_upvar(&self, place: &Place<'tcx>) -> bool {
- match *place {
- Place::Projection(box Projection {
- ref base,
- elem: ProjectionElem::Field(_, _),
- }) => {
- let base_ty = base.ty(self.mir, self.tcx).to_ty(self.tcx);
- is_closure_or_generator(base_ty)
- }
- Place::Projection(box Projection {
- base:
- Place::Projection(box Projection {
- ref base,
- elem: ProjectionElem::Field(upvar_index, _),
- }),
- elem: ProjectionElem::Deref,
- }) => {
- let base_ty = base.ty(self.mir, self.tcx).to_ty(self.tcx);
- is_closure_or_generator(base_ty) && self.mir.upvar_decls[upvar_index.index()].by_ref
- }
- _ => false,
- }
- }
}
fn suggest_ampmut_self<'cx, 'gcx, 'tcx>(
@@ -414,7 +406,7 @@
local_decl: &mir::LocalDecl<'tcx>,
) -> (Span, String) {
let sp = local_decl.source_info.span;
- (sp, match tcx.sess.codemap().span_to_snippet(sp) {
+ (sp, match tcx.sess.source_map().span_to_snippet(sp) {
Ok(snippet) => {
let lt_pos = snippet.find('\'');
if let Some(lt_pos) = lt_pos {
@@ -452,7 +444,7 @@
let locations = mir.find_assignments(local);
if locations.len() > 0 {
let assignment_rhs_span = mir.source_info(locations[0]).span;
- if let Ok(src) = tcx.sess.codemap().span_to_snippet(assignment_rhs_span) {
+ if let Ok(src) = tcx.sess.source_map().span_to_snippet(assignment_rhs_span) {
if let (true, Some(ws_pos)) = (
src.starts_with("&'"),
src.find(|c: char| -> bool { c.is_whitespace() }),
@@ -477,7 +469,7 @@
None => local_decl.source_info.span,
};
- if let Ok(src) = tcx.sess.codemap().span_to_snippet(highlight_span) {
+ if let Ok(src) = tcx.sess.source_map().span_to_snippet(highlight_span) {
if let (true, Some(ws_pos)) = (
src.starts_with("&'"),
src.find(|c: char| -> bool { c.is_whitespace() }),
diff --git a/src/librustc_mir/borrow_check/nll/constraints/graph.rs b/src/librustc_mir/borrow_check/nll/constraints/graph.rs
index 5f05ae8..1a1094b 100644
--- a/src/librustc_mir/borrow_check/nll/constraints/graph.rs
+++ b/src/librustc_mir/borrow_check/nll/constraints/graph.rs
@@ -8,27 +8,80 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use borrow_check::nll::constraints::{ConstraintIndex, ConstraintSet};
+use borrow_check::nll::constraints::{ConstraintIndex, ConstraintSet, OutlivesConstraint};
use rustc::ty::RegionVid;
use rustc_data_structures::graph;
use rustc_data_structures::indexed_vec::IndexVec;
-crate struct ConstraintGraph {
+/// The construct graph organizes the constraints by their end-points.
+/// It can be used to view a `R1: R2` constraint as either an edge `R1
+/// -> R2` or `R2 -> R1` depending on the direction type `D`.
+crate struct ConstraintGraph<D: ConstraintGraphDirecton> {
+ _direction: D,
first_constraints: IndexVec<RegionVid, Option<ConstraintIndex>>,
next_constraints: IndexVec<ConstraintIndex, Option<ConstraintIndex>>,
}
-impl ConstraintGraph {
+crate type NormalConstraintGraph = ConstraintGraph<Normal>;
+
+crate type ReverseConstraintGraph = ConstraintGraph<Reverse>;
+
+/// Marker trait that controls whether a `R1: R2` constraint
+/// represents an edge `R1 -> R2` or `R2 -> R1`.
+crate trait ConstraintGraphDirecton: Copy + 'static {
+ fn start_region(c: &OutlivesConstraint) -> RegionVid;
+ fn end_region(c: &OutlivesConstraint) -> RegionVid;
+}
+
+/// In normal mode, a `R1: R2` constraint results in an edge `R1 ->
+/// R2`. This is what we use when constructing the SCCs for
+/// inference. This is because we compute the value of R1 by union'ing
+/// all the things that it relies on.
+#[derive(Copy, Clone, Debug)]
+crate struct Normal;
+
+impl ConstraintGraphDirecton for Normal {
+ fn start_region(c: &OutlivesConstraint) -> RegionVid {
+ c.sup
+ }
+
+ fn end_region(c: &OutlivesConstraint) -> RegionVid {
+ c.sub
+ }
+}
+
+/// In reverse mode, a `R1: R2` constraint results in an edge `R2 ->
+/// R1`. We use this for optimizing liveness computation, because then
+/// we wish to iterate from a region (e.g., R2) to all the regions
+/// that will outlive it (e.g., R1).
+#[derive(Copy, Clone, Debug)]
+crate struct Reverse;
+
+impl ConstraintGraphDirecton for Reverse {
+ fn start_region(c: &OutlivesConstraint) -> RegionVid {
+ c.sub
+ }
+
+ fn end_region(c: &OutlivesConstraint) -> RegionVid {
+ c.sup
+ }
+}
+
+impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
/// Create a "dependency graph" where each region constraint `R1:
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
/// construct SCCs for region inference but also for error
/// reporting.
- crate fn new(set: &ConstraintSet, num_region_vars: usize) -> Self {
+ crate fn new(
+ direction: D,
+ set: &ConstraintSet,
+ num_region_vars: usize,
+ ) -> Self {
let mut first_constraints = IndexVec::from_elem_n(None, num_region_vars);
let mut next_constraints = IndexVec::from_elem(None, &set.constraints);
for (idx, constraint) in set.constraints.iter_enumerated().rev() {
- let head = &mut first_constraints[constraint.sup];
+ let head = &mut first_constraints[D::start_region(constraint)];
let next = &mut next_constraints[idx];
debug_assert!(next.is_none());
*next = *head;
@@ -36,13 +89,21 @@
}
Self {
+ _direction: direction,
first_constraints,
next_constraints,
}
}
+ /// Given the constraint set from which this graph was built
+ /// creates a region graph so that you can iterate over *regions*
+ /// and not constraints.
+ crate fn region_graph<'rg>(&'rg self, set: &'rg ConstraintSet) -> RegionGraph<'rg, D> {
+ RegionGraph::new(set, self)
+ }
+
/// Given a region `R`, iterate over all constraints `R: R1`.
- crate fn outgoing_edges(&self, region_sup: RegionVid) -> Edges<'_> {
+ crate fn outgoing_edges(&self, region_sup: RegionVid) -> Edges<'_, D> {
let first = self.first_constraints[region_sup];
Edges {
graph: self,
@@ -51,12 +112,12 @@
}
}
-crate struct Edges<'s> {
- graph: &'s ConstraintGraph,
+crate struct Edges<'s, D: ConstraintGraphDirecton> {
+ graph: &'s ConstraintGraph<D>,
pointer: Option<ConstraintIndex>,
}
-impl<'s> Iterator for Edges<'s> {
+impl<'s, D: ConstraintGraphDirecton> Iterator for Edges<'s, D> {
type Item = ConstraintIndex;
fn next(&mut self) -> Option<Self::Item> {
@@ -69,17 +130,20 @@
}
}
-crate struct RegionGraph<'s> {
+/// This struct brings together a constraint set and a (normal, not
+/// reverse) constraint graph. It implements the graph traits and is
+/// usd for doing the SCC computation.
+crate struct RegionGraph<'s, D: ConstraintGraphDirecton> {
set: &'s ConstraintSet,
- constraint_graph: &'s ConstraintGraph,
+ constraint_graph: &'s ConstraintGraph<D>,
}
-impl<'s> RegionGraph<'s> {
+impl<'s, D: ConstraintGraphDirecton> RegionGraph<'s, D> {
/// Create a "dependency graph" where each region constraint `R1:
/// R2` is treated as an edge `R1 -> R2`. We use this graph to
/// construct SCCs for region inference but also for error
/// reporting.
- crate fn new(set: &'s ConstraintSet, constraint_graph: &'s ConstraintGraph) -> Self {
+ crate fn new(set: &'s ConstraintSet, constraint_graph: &'s ConstraintGraph<D>) -> Self {
Self {
set,
constraint_graph,
@@ -88,7 +152,7 @@
/// Given a region `R`, iterate over all regions `R1` such that
/// there exists a constraint `R: R1`.
- crate fn sub_regions(&self, region_sup: RegionVid) -> Successors<'_> {
+ crate fn outgoing_regions(&self, region_sup: RegionVid) -> Successors<'_, D> {
Successors {
set: self.set,
edges: self.constraint_graph.outgoing_edges(region_sup),
@@ -96,39 +160,39 @@
}
}
-crate struct Successors<'s> {
+crate struct Successors<'s, D: ConstraintGraphDirecton> {
set: &'s ConstraintSet,
- edges: Edges<'s>,
+ edges: Edges<'s, D>,
}
-impl<'s> Iterator for Successors<'s> {
+impl<'s, D: ConstraintGraphDirecton> Iterator for Successors<'s, D> {
type Item = RegionVid;
fn next(&mut self) -> Option<Self::Item> {
- self.edges.next().map(|c| self.set[c].sub)
+ self.edges.next().map(|c| D::end_region(&self.set[c]))
}
}
-impl<'s> graph::DirectedGraph for RegionGraph<'s> {
+impl<'s, D: ConstraintGraphDirecton> graph::DirectedGraph for RegionGraph<'s, D> {
type Node = RegionVid;
}
-impl<'s> graph::WithNumNodes for RegionGraph<'s> {
+impl<'s, D: ConstraintGraphDirecton> graph::WithNumNodes for RegionGraph<'s, D> {
fn num_nodes(&self) -> usize {
self.constraint_graph.first_constraints.len()
}
}
-impl<'s> graph::WithSuccessors for RegionGraph<'s> {
+impl<'s, D: ConstraintGraphDirecton> graph::WithSuccessors for RegionGraph<'s, D> {
fn successors<'graph>(
&'graph self,
node: Self::Node,
) -> <Self as graph::GraphSuccessors<'graph>>::Iter {
- self.sub_regions(node)
+ self.outgoing_regions(node)
}
}
-impl<'s, 'graph> graph::GraphSuccessors<'graph> for RegionGraph<'s> {
+impl<'s, 'graph, D: ConstraintGraphDirecton> graph::GraphSuccessors<'graph> for RegionGraph<'s, D> {
type Item = RegionVid;
- type Iter = Successors<'graph>;
+ type Iter = Successors<'graph, D>;
}
diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/nll/constraints/mod.rs
index 5972412..4cb9226 100644
--- a/src/librustc_mir/borrow_check/nll/constraints/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/constraints/mod.rs
@@ -36,12 +36,20 @@
self.constraints.push(constraint);
}
- /// Constructs a graph from the constraint set; the graph makes it
- /// easy to find the constraints affecting a particular region
- /// (you should not mutate the set once this graph is
- /// constructed).
- crate fn graph(&self, num_region_vars: usize) -> graph::ConstraintGraph {
- graph::ConstraintGraph::new(self, num_region_vars)
+ /// Constructs a "normal" graph from the constraint set; the graph makes it
+ /// easy to find the constraints affecting a particular region.
+ ///
+ /// NB: This graph contains a "frozen" view of the current
+ /// constraints. any new constraints added to the `ConstraintSet`
+ /// after the graph is built will not be present in the graph.
+ crate fn graph(&self, num_region_vars: usize) -> graph::NormalConstraintGraph {
+ graph::ConstraintGraph::new(graph::Normal, self, num_region_vars)
+ }
+
+ /// Like `graph`, but constraints a reverse graph where `R1: R2`
+ /// represents an edge `R2 -> R1`.
+ crate fn reverse_graph(&self, num_region_vars: usize) -> graph::ReverseConstraintGraph {
+ graph::ConstraintGraph::new(graph::Reverse, self, num_region_vars)
}
/// Compute cycles (SCCs) in the graph of regions. In particular,
@@ -49,9 +57,9 @@
/// them into an SCC, and find the relationships between SCCs.
crate fn compute_sccs(
&self,
- constraint_graph: &graph::ConstraintGraph,
+ constraint_graph: &graph::NormalConstraintGraph,
) -> Sccs<RegionVid, ConstraintSccIndex> {
- let region_graph = &graph::RegionGraph::new(self, constraint_graph);
+ let region_graph = &constraint_graph.region_graph(self);
Sccs::new(region_graph)
}
}
diff --git a/src/librustc_mir/borrow_check/nll/liveness_map.rs b/src/librustc_mir/borrow_check/nll/liveness_map.rs
deleted file mode 100644
index cbd9c9a..0000000
--- a/src/librustc_mir/borrow_check/nll/liveness_map.rs
+++ /dev/null
@@ -1,77 +0,0 @@
-// 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.
-
-//! For the NLL computation, we need to compute liveness, but only for those
-//! local variables whose types contain regions. The others are not of interest
-//! to us. This file defines a new index type (LocalWithRegion) that indexes into
-//! a list of "variables whose type contain regions". It also defines a map from
-//! Local to LocalWithRegion and vice versa -- this map can be given to the
-//! liveness code so that it only operates over variables with regions in their
-//! types, instead of all variables.
-
-use rustc::ty::TypeFoldable;
-use rustc_data_structures::indexed_vec::IndexVec;
-use rustc::mir::{Mir, Local};
-use util::liveness::LiveVariableMap;
-
-use rustc_data_structures::indexed_vec::Idx;
-
-/// Map between Local and LocalWithRegion indices: this map is supplied to the
-/// liveness code so that it will only analyze those variables whose types
-/// contain regions.
-crate struct NllLivenessMap {
- /// For each local variable, contains either None (if the type has no regions)
- /// or Some(i) with a suitable index.
- pub from_local: IndexVec<Local, Option<LocalWithRegion>>,
- /// For each LocalWithRegion, maps back to the original Local index.
- pub to_local: IndexVec<LocalWithRegion, Local>,
-
-}
-
-impl LiveVariableMap for NllLivenessMap {
-
- fn from_local(&self, local: Local) -> Option<Self::LiveVar> {
- self.from_local[local]
- }
-
- type LiveVar = LocalWithRegion;
-
- fn from_live_var(&self, local: Self::LiveVar) -> Local {
- self.to_local[local]
- }
-
- fn num_variables(&self) -> usize {
- self.to_local.len()
- }
-}
-
-impl NllLivenessMap {
- /// Iterates over the variables in Mir and assigns each Local whose type contains
- /// regions a LocalWithRegion index. Returns a map for converting back and forth.
- pub fn compute(mir: &Mir) -> Self {
- let mut to_local = IndexVec::default();
- let from_local: IndexVec<Local,Option<_>> = mir
- .local_decls
- .iter_enumerated()
- .map(|(local, local_decl)| {
- if local_decl.ty.has_free_regions() {
- Some(to_local.push(local))
- }
- else {
- None
- }
- }).collect();
-
- Self { from_local, to_local }
- }
-}
-
-/// Index given to each local variable whose type contains a region.
-newtype_index!(LocalWithRegion);
diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs
index 973568a..f54d80d 100644
--- a/src/librustc_mir/borrow_check/nll/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/mod.rs
@@ -11,9 +11,9 @@
use borrow_check::borrow_set::BorrowSet;
use borrow_check::location::{LocationIndex, LocationTable};
use borrow_check::nll::facts::AllFactsExt;
-use borrow_check::nll::type_check::MirTypeckRegionConstraints;
+use borrow_check::nll::type_check::{MirTypeckResults, MirTypeckRegionConstraints};
+use borrow_check::nll::type_check::liveness::liveness_map::{NllLivenessMap, LocalWithRegion};
use borrow_check::nll::region_infer::values::RegionValueElements;
-use borrow_check::nll::liveness_map::{NllLivenessMap, LocalWithRegion};
use dataflow::indexes::BorrowIndex;
use dataflow::move_paths::MoveData;
use dataflow::FlowAtLocation;
@@ -47,7 +47,6 @@
mod renumber;
crate mod type_check;
mod universal_regions;
-crate mod liveness_map;
mod constraints;
@@ -109,9 +108,12 @@
let elements = &Rc::new(RegionValueElements::new(mir));
// Run the MIR type-checker.
- let liveness_map = NllLivenessMap::compute(&mir);
- let liveness = LivenessResults::compute(mir, &liveness_map);
- let (constraint_sets, universal_region_relations) = type_check::type_check(
+ let MirTypeckResults {
+ constraints,
+ universal_region_relations,
+ liveness,
+ liveness_map,
+ } = type_check::type_check(
infcx,
param_env,
mir,
@@ -119,7 +121,6 @@
&universal_regions,
location_table,
borrow_set,
- &liveness,
&mut all_facts,
flow_inits,
move_data,
@@ -141,7 +142,7 @@
mut liveness_constraints,
outlives_constraints,
type_tests,
- } = constraint_sets;
+ } = constraints;
constraint_generation::generate_constraints(
infcx,
@@ -205,6 +206,7 @@
dump_mir_results(
infcx,
&liveness,
+ &liveness_map,
MirSource::item(def_id),
&mir,
®ioncx,
@@ -221,6 +223,7 @@
fn dump_mir_results<'a, 'gcx, 'tcx>(
infcx: &InferCtxt<'a, 'gcx, 'tcx>,
liveness: &LivenessResults<LocalWithRegion>,
+ liveness_map: &NllLivenessMap,
source: MirSource,
mir: &Mir<'tcx>,
regioncx: &RegionInferenceContext,
@@ -230,8 +233,6 @@
return;
}
- let map = &NllLivenessMap::compute(mir);
-
let regular_liveness_per_location: FxHashMap<_, _> = mir
.basic_blocks()
.indices()
@@ -239,7 +240,7 @@
let mut results = vec![];
liveness
.regular
- .simulate_block(&mir, bb, map, |location, local_set| {
+ .simulate_block(&mir, bb, liveness_map, |location, local_set| {
results.push((location, local_set.clone()));
});
results
@@ -253,7 +254,7 @@
let mut results = vec![];
liveness
.drop
- .simulate_block(&mir, bb, map, |location, local_set| {
+ .simulate_block(&mir, bb, liveness_map, |location, local_set| {
results.push((location, local_set.clone()));
});
results
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
index c267038..ca208a4 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/mod.rs
@@ -14,7 +14,7 @@
use rustc::infer::error_reporting::nice_region_error::NiceRegionError;
use rustc::infer::InferCtxt;
use rustc::mir::{self, Location, Mir, Place, Rvalue, StatementKind, TerminatorKind};
-use rustc::ty::RegionVid;
+use rustc::ty::{TyCtxt, RegionVid};
use rustc_data_structures::indexed_vec::IndexVec;
use rustc_errors::Diagnostic;
use std::collections::VecDeque;
@@ -42,7 +42,7 @@
// Must end with a space. Allows for empty names to be provided.
match self {
ConstraintCategory::Assignment => write!(f, "assignment "),
- ConstraintCategory::Return => write!(f, "return "),
+ ConstraintCategory::Return => write!(f, "returning this value "),
ConstraintCategory::Cast => write!(f, "cast "),
ConstraintCategory::CallArgument => write!(f, "argument "),
_ => write!(f, ""),
@@ -67,6 +67,7 @@
fn best_blame_constraint(
&self,
mir: &Mir<'tcx>,
+ tcx: TyCtxt<'_, '_, 'tcx>,
from_region: RegionVid,
target_test: impl Fn(RegionVid) -> bool,
) -> (ConstraintCategory, Span, RegionVid) {
@@ -92,7 +93,7 @@
// Classify each of the constraints along the path.
let mut categorized_path: Vec<(ConstraintCategory, Span)> = path
.iter()
- .map(|&index| self.classify_constraint(index, mir))
+ .map(|&index| self.classify_constraint(index, mir, tcx))
.collect();
debug!(
"best_blame_constraint: categorized_path={:#?}",
@@ -123,13 +124,15 @@
let constraint = &self.constraints[path[i]];
let constraint_sup_scc = self.constraint_sccs.scc(constraint.sup);
- if constraint_sup_scc == target_scc {
- return false;
- }
match categorized_path[i].0 {
ConstraintCategory::Boring => false,
- _ => true,
+ ConstraintCategory::Other => {
+ // other isn't interesting when the two lifetimes
+ // are unified.
+ constraint_sup_scc != self.constraint_sccs.scc(constraint.sub)
+ }
+ _ => constraint_sup_scc != target_scc,
}
});
if let Some(i) = best_choice {
@@ -231,6 +234,7 @@
&self,
index: ConstraintIndex,
mir: &Mir<'tcx>,
+ tcx: TyCtxt<'_, '_, 'tcx>,
) -> (ConstraintCategory, Span) {
let constraint = self.constraints[index];
debug!("classify_constraint: constraint={:?}", constraint);
@@ -254,7 +258,34 @@
debug!("classify_constraint: terminator.kind={:?}", terminator.kind);
match terminator.kind {
TerminatorKind::DropAndReplace { .. } => ConstraintCategory::Assignment,
- TerminatorKind::Call { .. } => ConstraintCategory::CallArgument,
+ // Classify calls differently depending on whether or not
+ // the sub region appears in the destination type (so the
+ // sup region is in the return type). If the return type
+ // contains the sub-region, then this is either an
+ // assignment or a return, depending on whether we are
+ // writing to the RETURN_PLACE or not.
+ //
+ // The idea here is that the region is being propagated
+ // from an input into the output place, so it's a kind of
+ // assignment. Otherwise, if the sub-region only appears in
+ // the argument types, then use the CallArgument
+ // classification.
+ TerminatorKind::Call { destination: Some((ref place, _)), .. } => {
+ if tcx.any_free_region_meets(
+ &place.ty(mir, tcx).to_ty(tcx),
+ |region| self.to_region_vid(region) == constraint.sub,
+ ) {
+ match place {
+ Place::Local(mir::RETURN_PLACE) => ConstraintCategory::Return,
+ _ => ConstraintCategory::Assignment,
+ }
+ } else {
+ ConstraintCategory::CallArgument
+ }
+ }
+ TerminatorKind::Call { destination: None, .. } => {
+ ConstraintCategory::CallArgument
+ }
_ => ConstraintCategory::Other,
}
} else {
@@ -304,7 +335,12 @@
) {
debug!("report_error(fr={:?}, outlived_fr={:?})", fr, outlived_fr);
- let (category, span, _) = self.best_blame_constraint(mir, fr, |r| r == outlived_fr);
+ let (category, span, _) = self.best_blame_constraint(
+ mir,
+ infcx.tcx,
+ fr,
+ |r| r == outlived_fr
+ );
// Check if we can use one of the "nice region errors".
if let (Some(f), Some(o)) = (self.to_error_region(fr), self.to_error_region(outlived_fr)) {
@@ -417,7 +453,7 @@
diag.span_label(span, format!(
"{} was supposed to return data with lifetime `{}` but it is returning \
data with lifetime `{}`",
- mir_def_name, fr_name, outlived_fr_name,
+ mir_def_name, outlived_fr_name, fr_name
));
},
_ => {
@@ -446,10 +482,11 @@
crate fn find_outlives_blame_span(
&self,
mir: &Mir<'tcx>,
+ tcx: TyCtxt<'_, '_, 'tcx>,
fr1: RegionVid,
fr2: RegionVid,
) -> Span {
- let (_, span, _) = self.best_blame_constraint(mir, fr1, |r| r == fr2);
+ let (_, span, _) = self.best_blame_constraint(mir, tcx, fr1, |r| r == fr2);
span
}
}
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
index 8c2a5f1..532c36f 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs
@@ -95,8 +95,12 @@
debug!("give_region_a_name: error_region = {:?}", error_region);
match error_region {
ty::ReEarlyBound(ebr) => {
- self.highlight_named_span(tcx, error_region, &ebr.name, diag);
- Some(ebr.name)
+ if ebr.has_name() {
+ self.highlight_named_span(tcx, error_region, &ebr.name, diag);
+ Some(ebr.name)
+ } else {
+ None
+ }
},
ty::ReStatic => Some(keywords::StaticLifetime.name().as_interned_str()),
@@ -185,7 +189,7 @@
name: &InternedString,
diag: &mut DiagnosticBuilder<'_>,
) {
- let cm = tcx.sess.codemap();
+ let cm = tcx.sess.source_map();
let scope = error_region.free_region_binding_scope(tcx);
let node = tcx.hir.as_local_node_id(scope).unwrap_or(DUMMY_NODE_ID);
@@ -238,17 +242,14 @@
return Some(region_name);
}
- let (_argument_name, argument_span) = self.get_argument_name_and_span_for_region(
- mir, argument_index);
-
- let region_name = self.synthesize_region_name(counter);
-
- diag.span_label(
- argument_span,
- format!("lifetime `{}` appears in this argument", region_name,),
- );
-
- Some(region_name)
+ self.give_name_if_we_cannot_match_hir_ty(
+ infcx,
+ mir,
+ fr,
+ arg_ty,
+ counter,
+ diag,
+ )
}
fn give_name_if_we_can_match_hir_ty_from_argument(
@@ -366,14 +367,7 @@
search_stack.push((argument_ty, argument_hir_ty));
- let mut closest_match: &hir::Ty = argument_hir_ty;
-
while let Some((ty, hir_ty)) = search_stack.pop() {
- // While we search, also track the closet match.
- if tcx.any_free_region_meets(&ty, |r| r.to_region_vid() == needle_fr) {
- closest_match = hir_ty;
- }
-
match (&ty.sty, &hir_ty.node) {
// Check if the `argument_ty` is `&'X ..` where `'X`
// is the region we are looking for -- if so, and we have a `&T`
@@ -389,8 +383,8 @@
let region_name = self.synthesize_region_name(counter);
// Just grab the first character, the `&`.
- let codemap = tcx.sess.codemap();
- let ampersand_span = codemap.start_point(hir_ty.span);
+ let source_map = tcx.sess.source_map();
+ let ampersand_span = source_map.start_point(hir_ty.span);
diag.span_label(
ampersand_span,
@@ -448,13 +442,7 @@
}
}
- let region_name = self.synthesize_region_name(counter);
- diag.span_label(
- closest_match.span,
- format!("lifetime `{}` appears in this type", region_name),
- );
-
- return Some(region_name);
+ return None;
}
/// We've found an enum/struct/union type with the substitutions
@@ -599,13 +587,13 @@
infcx.extract_type_name(&return_ty)
});
- let mir_node_id = tcx.hir.as_local_node_id(mir_def_id).expect("non-local mir");
+ let mir_node_id = tcx.hir.as_local_node_id(mir_def_id).expect("non-local mir");
let (return_span, mir_description) = if let hir::ExprKind::Closure(_, _, _, span, gen_move)
= tcx.hir.expect_expr(mir_node_id).node
{
(
- tcx.sess.codemap().end_point(span),
+ tcx.sess.source_map().end_point(span),
if gen_move.is_some() { " of generator" } else { " of closure" }
)
} else {
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs
index f1c3a74..57ff0f4 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs
@@ -13,7 +13,7 @@
use rustc::mir::{Local, Mir};
use rustc::ty::{RegionVid, TyCtxt};
use rustc_data_structures::indexed_vec::Idx;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use syntax_pos::symbol::Symbol;
impl<'tcx> RegionInferenceContext<'tcx> {
diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
index 0798a45..ebcc044 100644
--- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs
@@ -9,7 +9,7 @@
// except according to those terms.
use super::universal_regions::UniversalRegions;
-use borrow_check::nll::constraints::graph::ConstraintGraph;
+use borrow_check::nll::constraints::graph::NormalConstraintGraph;
use borrow_check::nll::constraints::{
ConstraintIndex, ConstraintSccIndex, ConstraintSet, OutlivesConstraint,
};
@@ -61,7 +61,7 @@
/// The constraint-set, but in graph form, making it easy to traverse
/// the constraints adjacent to a particular region. Used to construct
/// the SCC (see `constraint_sccs`) and for error reporting.
- constraint_graph: Rc<ConstraintGraph>,
+ constraint_graph: Rc<NormalConstraintGraph>,
/// The SCC computed from `constraints` and the constraint graph. Used to compute the values
/// of each region.
@@ -1040,7 +1040,7 @@
longer_fr, shorter_fr,
);
- let blame_span = self.find_outlives_blame_span(mir, longer_fr, shorter_fr);
+ let blame_span = self.find_outlives_blame_span(mir, infcx.tcx, longer_fr, shorter_fr);
if let Some(propagated_outlives_requirements) = propagated_outlives_requirements {
// Shrink `fr` until we find a non-local region (if we do).
@@ -1128,7 +1128,7 @@
};
// Find the code to blame for the fact that `longer_fr` outlives `error_fr`.
- let span = self.find_outlives_blame_span(mir, longer_fr, error_region);
+ let span = self.find_outlives_blame_span(mir, infcx.tcx, longer_fr, error_region);
// Obviously, this error message is far from satisfactory.
// At present, though, it only appears in unit tests --
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs
deleted file mode 100644
index 2b9307d..0000000
--- a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs
+++ /dev/null
@@ -1,246 +0,0 @@
-// 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.
-
-use borrow_check::nll::{NllLivenessMap, LocalWithRegion};
-use borrow_check::nll::type_check::AtLocation;
-use dataflow::move_paths::{HasMoveData, MoveData};
-use dataflow::MaybeInitializedPlaces;
-use dataflow::{FlowAtLocation, FlowsAtLocation};
-use rustc::infer::canonical::QueryRegionConstraint;
-use rustc::mir::{BasicBlock, Location, Mir};
-use rustc::traits::query::dropck_outlives::DropckOutlivesResult;
-use rustc::traits::query::type_op::outlives::DropckOutlives;
-use rustc::traits::query::type_op::TypeOp;
-use rustc::ty::{Ty, TypeFoldable};
-use rustc_data_structures::fx::FxHashMap;
-use std::rc::Rc;
-use util::liveness::{LivenessResults, LiveVariableMap };
-
-use super::TypeChecker;
-
-/// Combines liveness analysis with initialization analysis to
-/// determine which variables are live at which points, both due to
-/// ordinary uses and drops. Returns a set of (ty, location) pairs
-/// that indicate which types must be live at which point in the CFG.
-/// This vector is consumed by `constraint_generation`.
-///
-/// NB. This computation requires normalization; therefore, it must be
-/// performed before
-pub(super) fn generate<'gcx, 'tcx>(
- cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
- mir: &Mir<'tcx>,
- liveness: &LivenessResults<LocalWithRegion>,
- flow_inits: &mut FlowAtLocation<MaybeInitializedPlaces<'_, 'gcx, 'tcx>>,
- move_data: &MoveData<'tcx>,
-) {
- let mut generator = TypeLivenessGenerator {
- cx,
- mir,
- liveness,
- flow_inits,
- move_data,
- drop_data: FxHashMap(),
- map: &NllLivenessMap::compute(mir),
- };
-
- for bb in mir.basic_blocks().indices() {
- generator.add_liveness_constraints(bb);
- }
-}
-
-struct TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx>
-where
- 'typeck: 'gen,
- 'flow: 'gen,
- 'tcx: 'typeck + 'flow,
- 'gcx: 'tcx,
-{
- cx: &'gen mut TypeChecker<'typeck, 'gcx, 'tcx>,
- mir: &'gen Mir<'tcx>,
- liveness: &'gen LivenessResults<LocalWithRegion>,
- flow_inits: &'gen mut FlowAtLocation<MaybeInitializedPlaces<'flow, 'gcx, 'tcx>>,
- move_data: &'gen MoveData<'tcx>,
- drop_data: FxHashMap<Ty<'tcx>, DropData<'tcx>>,
- map: &'gen NllLivenessMap,
-}
-
-struct DropData<'tcx> {
- dropck_result: DropckOutlivesResult<'tcx>,
- region_constraint_data: Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>,
-}
-
-impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx> {
- /// Liveness constraints:
- ///
- /// > If a variable V is live at point P, then all regions R in the type of V
- /// > must include the point P.
- fn add_liveness_constraints(&mut self, bb: BasicBlock) {
- debug!("add_liveness_constraints(bb={:?})", bb);
-
- self.liveness
- .regular
- .simulate_block(self.mir, bb, self.map, |location, live_locals| {
- for live_local in live_locals.iter() {
- let local = self.map.from_live_var(live_local);
- let live_local_ty = self.mir.local_decls[local].ty;
- Self::push_type_live_constraint(&mut self.cx, live_local_ty, location);
- }
- });
-
- let mut all_live_locals: Vec<(Location, Vec<LocalWithRegion>)> = vec![];
- self.liveness
- .drop
- .simulate_block(self.mir, bb, self.map, |location, live_locals| {
- all_live_locals.push((location, live_locals.iter().collect()));
- });
- debug!(
- "add_liveness_constraints: all_live_locals={:#?}",
- all_live_locals
- );
-
- let terminator_index = self.mir.basic_blocks()[bb].statements.len();
- self.flow_inits.reset_to_entry_of(bb);
- while let Some((location, live_locals)) = all_live_locals.pop() {
- for live_local in live_locals {
- debug!(
- "add_liveness_constraints: location={:?} live_local={:?}",
- location, live_local
- );
-
- if log_enabled!(::log::Level::Debug) {
- self.flow_inits.each_state_bit(|mpi_init| {
- debug!(
- "add_liveness_constraints: location={:?} initialized={:?}",
- location,
- &self.flow_inits.operator().move_data().move_paths[mpi_init]
- );
- });
- }
-
- let local = self.map.from_live_var(live_local);
- let mpi = self.move_data.rev_lookup.find_local(local);
- if let Some(initialized_child) = self.flow_inits.has_any_child_of(mpi) {
- debug!(
- "add_liveness_constraints: mpi={:?} has initialized child {:?}",
- self.move_data.move_paths[mpi],
- self.move_data.move_paths[initialized_child]
- );
-
- let local = self.map.from_live_var(live_local);
- let live_local_ty = self.mir.local_decls[local].ty;
- self.add_drop_live_constraint(live_local, live_local_ty, location);
- }
- }
-
- if location.statement_index == terminator_index {
- debug!(
- "add_liveness_constraints: reconstruct_terminator_effect from {:#?}",
- location
- );
- self.flow_inits.reconstruct_terminator_effect(location);
- } else {
- debug!(
- "add_liveness_constraints: reconstruct_statement_effect from {:#?}",
- location
- );
- self.flow_inits.reconstruct_statement_effect(location);
- }
- self.flow_inits.apply_local_effect(location);
- }
- }
-
- /// Some variable with type `live_ty` is "regular live" at
- /// `location` -- i.e., it may be used later. This means that all
- /// regions appearing in the type `live_ty` must be live at
- /// `location`.
- fn push_type_live_constraint<T>(
- cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
- value: T,
- location: Location,
- ) where
- T: TypeFoldable<'tcx>,
- {
- debug!(
- "push_type_live_constraint(live_ty={:?}, location={:?})",
- value, location
- );
-
- cx.tcx().for_each_free_region(&value, |live_region| {
- if let Some(ref mut borrowck_context) = cx.borrowck_context {
- let region_vid = borrowck_context.universal_regions.to_region_vid(live_region);
- borrowck_context.constraints.liveness_constraints.add_element(region_vid, location);
-
- if let Some(all_facts) = borrowck_context.all_facts {
- let start_index = borrowck_context.location_table.start_index(location);
- all_facts.region_live_at.push((region_vid, start_index));
-
- let mid_index = borrowck_context.location_table.mid_index(location);
- all_facts.region_live_at.push((region_vid, mid_index));
- }
- }
- });
- }
-
- /// Some variable with type `live_ty` is "drop live" at `location`
- /// -- i.e., it may be dropped later. This means that *some* of
- /// the regions in its type must be live at `location`. The
- /// precise set will depend on the dropck constraints, and in
- /// particular this takes `#[may_dangle]` into account.
- fn add_drop_live_constraint(
- &mut self,
- dropped_local: LocalWithRegion,
- dropped_ty: Ty<'tcx>,
- location: Location,
- ) {
- debug!(
- "add_drop_live_constraint(dropped_local={:?}, dropped_ty={:?}, location={:?})",
- dropped_local, dropped_ty, location
- );
-
- let drop_data = self.drop_data.entry(dropped_ty).or_insert_with({
- let cx = &mut self.cx;
- move || Self::compute_drop_data(cx, dropped_ty)
- });
-
- if let Some(data) = &drop_data.region_constraint_data {
- self.cx.push_region_constraints(location.boring(), data);
- }
-
- drop_data.dropck_result.report_overflows(
- self.cx.infcx.tcx,
- self.mir.source_info(location).span,
- dropped_ty,
- );
-
- // All things in the `outlives` array may be touched by
- // the destructor and must be live at this point.
- for &kind in &drop_data.dropck_result.kinds {
- Self::push_type_live_constraint(&mut self.cx, kind, location);
- }
- }
-
- fn compute_drop_data(
- cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
- dropped_ty: Ty<'tcx>,
- ) -> DropData<'tcx> {
- debug!("compute_drop_data(dropped_ty={:?})", dropped_ty,);
-
- let param_env = cx.param_env;
- let (dropck_result, region_constraint_data) = param_env
- .and(DropckOutlives::new(dropped_ty))
- .fully_perform(cx.infcx)
- .unwrap();
-
- DropData {
- dropck_result,
- region_constraint_data,
- }
- }
-}
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs
new file mode 100644
index 0000000..89e8c76
--- /dev/null
+++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/liveness_map.rs
@@ -0,0 +1,97 @@
+// 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.
+
+//! For the NLL computation, we need to compute liveness, but only for those
+//! local variables whose types contain regions. The others are not of interest
+//! to us. This file defines a new index type (LocalWithRegion) that indexes into
+//! a list of "variables whose type contain regions". It also defines a map from
+//! Local to LocalWithRegion and vice versa -- this map can be given to the
+//! liveness code so that it only operates over variables with regions in their
+//! types, instead of all variables.
+
+use borrow_check::nll::ToRegionVid;
+use rustc::mir::{Local, Mir};
+use rustc::ty::{RegionVid, TyCtxt};
+use rustc_data_structures::fx::FxHashSet;
+use rustc_data_structures::indexed_vec::{Idx, IndexVec};
+use util::liveness::LiveVariableMap;
+
+/// Map between Local and LocalWithRegion indices: the purpose of this
+/// map is to define the subset of local variables for which we need
+/// to do a liveness computation. We only need to compute whether a
+/// variable `X` is live if that variable contains some region `R` in
+/// its type where `R` is not known to outlive a free region (i.e.,
+/// where `R` may be valid for just a subset of the fn body).
+crate struct NllLivenessMap {
+ /// For each local variable, contains `Some(i)` if liveness is
+ /// needed for this variable.
+ pub from_local: IndexVec<Local, Option<LocalWithRegion>>,
+
+ /// For each `LocalWithRegion`, maps back to the original `Local` index.
+ pub to_local: IndexVec<LocalWithRegion, Local>,
+}
+
+impl LiveVariableMap for NllLivenessMap {
+ fn from_local(&self, local: Local) -> Option<Self::LiveVar> {
+ self.from_local[local]
+ }
+
+ type LiveVar = LocalWithRegion;
+
+ fn from_live_var(&self, local: Self::LiveVar) -> Local {
+ self.to_local[local]
+ }
+
+ fn num_variables(&self) -> usize {
+ self.to_local.len()
+ }
+}
+
+impl NllLivenessMap {
+ crate fn compute(
+ tcx: TyCtxt<'_, '_, 'tcx>,
+ free_regions: &FxHashSet<RegionVid>,
+ mir: &Mir<'tcx>,
+ ) -> Self {
+ let mut to_local = IndexVec::default();
+ let from_local: IndexVec<Local, Option<_>> = mir.local_decls
+ .iter_enumerated()
+ .map(|(local, local_decl)| {
+ if tcx.all_free_regions_meet(&local_decl.ty, |r| {
+ free_regions.contains(&r.to_region_vid())
+ }) {
+ // If all the regions in the type are free regions
+ // (or there are no regions), then we don't need
+ // to track liveness for this variable.
+ None
+ } else {
+ Some(to_local.push(local))
+ }
+ })
+ .collect();
+
+ debug!("{} total variables", mir.local_decls.len());
+ debug!("{} variables need liveness", to_local.len());
+ debug!("{} regions outlive free regions", free_regions.len());
+
+ Self {
+ from_local,
+ to_local,
+ }
+ }
+
+ /// True if there are no local variables that need liveness computation.
+ crate fn is_empty(&self) -> bool {
+ self.to_local.is_empty()
+ }
+}
+
+/// Index given to each local variable whose type contains a region.
+newtype_index!(LocalWithRegion);
diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs
new file mode 100644
index 0000000..a9b69cf
--- /dev/null
+++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs
@@ -0,0 +1,309 @@
+// 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.
+
+use borrow_check::nll::constraints::ConstraintSet;
+use borrow_check::nll::type_check::AtLocation;
+use borrow_check::nll::{LocalWithRegion, NllLivenessMap};
+use borrow_check::nll::universal_regions::UniversalRegions;
+use dataflow::move_paths::{HasMoveData, MoveData};
+use dataflow::MaybeInitializedPlaces;
+use dataflow::{FlowAtLocation, FlowsAtLocation};
+use rustc::infer::canonical::QueryRegionConstraint;
+use rustc::mir::{BasicBlock, Location, Mir};
+use rustc::traits::query::dropck_outlives::DropckOutlivesResult;
+use rustc::traits::query::type_op::outlives::DropckOutlives;
+use rustc::traits::query::type_op::TypeOp;
+use rustc::ty::{RegionVid, Ty, TypeFoldable};
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use std::rc::Rc;
+use util::liveness::{LiveVariableMap, LivenessResults};
+
+use super::TypeChecker;
+
+crate mod liveness_map;
+
+/// Combines liveness analysis with initialization analysis to
+/// determine which variables are live at which points, both due to
+/// ordinary uses and drops. Returns a set of (ty, location) pairs
+/// that indicate which types must be live at which point in the CFG.
+/// This vector is consumed by `constraint_generation`.
+///
+/// NB. This computation requires normalization; therefore, it must be
+/// performed before
+pub(super) fn generate<'gcx, 'tcx>(
+ cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
+ mir: &Mir<'tcx>,
+ flow_inits: &mut FlowAtLocation<MaybeInitializedPlaces<'_, 'gcx, 'tcx>>,
+ move_data: &MoveData<'tcx>,
+) -> (LivenessResults<LocalWithRegion>, NllLivenessMap) {
+ let free_regions = {
+ let borrowck_context = cx.borrowck_context.as_ref().unwrap();
+ regions_that_outlive_free_regions(
+ cx.infcx.num_region_vars(),
+ &borrowck_context.universal_regions,
+ &borrowck_context.constraints.outlives_constraints,
+ )
+ };
+ let liveness_map = NllLivenessMap::compute(cx.tcx(), &free_regions, mir);
+ let liveness = LivenessResults::compute(mir, &liveness_map);
+
+ // For everything else, it is only live where it is actually used.
+ if !liveness_map.is_empty() {
+ let mut generator = TypeLivenessGenerator {
+ cx,
+ mir,
+ liveness: &liveness,
+ flow_inits,
+ move_data,
+ drop_data: FxHashMap(),
+ map: &liveness_map,
+ };
+
+ for bb in mir.basic_blocks().indices() {
+ generator.add_liveness_constraints(bb);
+ }
+ }
+
+ (liveness, liveness_map)
+}
+
+/// Compute all regions that are (currently) known to outlive free
+/// regions. For these regions, we do not need to compute
+/// liveness, since the outlives constraints will ensure that they
+/// are live over the whole fn body anyhow.
+fn regions_that_outlive_free_regions(
+ num_region_vars: usize,
+ universal_regions: &UniversalRegions<'tcx>,
+ constraint_set: &ConstraintSet,
+) -> FxHashSet<RegionVid> {
+ // Build a graph of the outlives constraints thus far. This is
+ // a reverse graph, so for each constraint `R1: R2` we have an
+ // edge `R2 -> R1`. Therefore, if we find all regions
+ // reachable from each free region, we will have all the
+ // regions that are forced to outlive some free region.
+ let rev_constraint_graph = constraint_set.reverse_graph(num_region_vars);
+ let rev_region_graph = rev_constraint_graph.region_graph(constraint_set);
+
+ // Stack for the depth-first search. Start out with all the free regions.
+ let mut stack: Vec<_> = universal_regions.universal_regions().collect();
+
+ // Set of all free regions, plus anything that outlives them. Initially
+ // just contains the free regions.
+ let mut outlives_free_region: FxHashSet<_> = stack.iter().cloned().collect();
+
+ // Do the DFS -- for each thing in the stack, find all things
+ // that outlive it and add them to the set. If they are not,
+ // push them onto the stack for later.
+ while let Some(sub_region) = stack.pop() {
+ stack.extend(
+ rev_region_graph
+ .outgoing_regions(sub_region)
+ .filter(|&r| outlives_free_region.insert(r)),
+ );
+ }
+
+ // Return the final set of things we visited.
+ outlives_free_region
+}
+
+struct TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx>
+where
+ 'typeck: 'gen,
+ 'flow: 'gen,
+ 'tcx: 'typeck + 'flow,
+ 'gcx: 'tcx,
+{
+ cx: &'gen mut TypeChecker<'typeck, 'gcx, 'tcx>,
+ mir: &'gen Mir<'tcx>,
+ liveness: &'gen LivenessResults<LocalWithRegion>,
+ flow_inits: &'gen mut FlowAtLocation<MaybeInitializedPlaces<'flow, 'gcx, 'tcx>>,
+ move_data: &'gen MoveData<'tcx>,
+ drop_data: FxHashMap<Ty<'tcx>, DropData<'tcx>>,
+ map: &'gen NllLivenessMap,
+}
+
+struct DropData<'tcx> {
+ dropck_result: DropckOutlivesResult<'tcx>,
+ region_constraint_data: Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>,
+}
+
+impl<'gen, 'typeck, 'flow, 'gcx, 'tcx> TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx> {
+ /// Liveness constraints:
+ ///
+ /// > If a variable V is live at point P, then all regions R in the type of V
+ /// > must include the point P.
+ fn add_liveness_constraints(&mut self, bb: BasicBlock) {
+ debug!("add_liveness_constraints(bb={:?})", bb);
+
+ self.liveness
+ .regular
+ .simulate_block(self.mir, bb, self.map, |location, live_locals| {
+ for live_local in live_locals.iter() {
+ let local = self.map.from_live_var(live_local);
+ let live_local_ty = self.mir.local_decls[local].ty;
+ Self::push_type_live_constraint(&mut self.cx, live_local_ty, location);
+ }
+ });
+
+ let mut all_live_locals: Vec<(Location, Vec<LocalWithRegion>)> = vec![];
+ self.liveness
+ .drop
+ .simulate_block(self.mir, bb, self.map, |location, live_locals| {
+ all_live_locals.push((location, live_locals.iter().collect()));
+ });
+ debug!(
+ "add_liveness_constraints: all_live_locals={:#?}",
+ all_live_locals
+ );
+
+ let terminator_index = self.mir.basic_blocks()[bb].statements.len();
+ self.flow_inits.reset_to_entry_of(bb);
+ while let Some((location, live_locals)) = all_live_locals.pop() {
+ for live_local in live_locals {
+ debug!(
+ "add_liveness_constraints: location={:?} live_local={:?}",
+ location, live_local
+ );
+
+ if log_enabled!(::log::Level::Debug) {
+ self.flow_inits.each_state_bit(|mpi_init| {
+ debug!(
+ "add_liveness_constraints: location={:?} initialized={:?}",
+ location,
+ &self.flow_inits.operator().move_data().move_paths[mpi_init]
+ );
+ });
+ }
+
+ let local = self.map.from_live_var(live_local);
+ let mpi = self.move_data.rev_lookup.find_local(local);
+ if let Some(initialized_child) = self.flow_inits.has_any_child_of(mpi) {
+ debug!(
+ "add_liveness_constraints: mpi={:?} has initialized child {:?}",
+ self.move_data.move_paths[mpi],
+ self.move_data.move_paths[initialized_child]
+ );
+
+ let local = self.map.from_live_var(live_local);
+ let live_local_ty = self.mir.local_decls[local].ty;
+ self.add_drop_live_constraint(live_local, live_local_ty, location);
+ }
+ }
+
+ if location.statement_index == terminator_index {
+ debug!(
+ "add_liveness_constraints: reconstruct_terminator_effect from {:#?}",
+ location
+ );
+ self.flow_inits.reconstruct_terminator_effect(location);
+ } else {
+ debug!(
+ "add_liveness_constraints: reconstruct_statement_effect from {:#?}",
+ location
+ );
+ self.flow_inits.reconstruct_statement_effect(location);
+ }
+ self.flow_inits.apply_local_effect(location);
+ }
+ }
+
+ /// Some variable with type `live_ty` is "regular live" at
+ /// `location` -- i.e., it may be used later. This means that all
+ /// regions appearing in the type `live_ty` must be live at
+ /// `location`.
+ fn push_type_live_constraint<T>(
+ cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
+ value: T,
+ location: Location,
+ ) where
+ T: TypeFoldable<'tcx>,
+ {
+ debug!(
+ "push_type_live_constraint(live_ty={:?}, location={:?})",
+ value, location
+ );
+
+ cx.tcx().for_each_free_region(&value, |live_region| {
+ if let Some(ref mut borrowck_context) = cx.borrowck_context {
+ let region_vid = borrowck_context
+ .universal_regions
+ .to_region_vid(live_region);
+ borrowck_context
+ .constraints
+ .liveness_constraints
+ .add_element(region_vid, location);
+
+ if let Some(all_facts) = borrowck_context.all_facts {
+ let start_index = borrowck_context.location_table.start_index(location);
+ all_facts.region_live_at.push((region_vid, start_index));
+
+ let mid_index = borrowck_context.location_table.mid_index(location);
+ all_facts.region_live_at.push((region_vid, mid_index));
+ }
+ }
+ });
+ }
+
+ /// Some variable with type `live_ty` is "drop live" at `location`
+ /// -- i.e., it may be dropped later. This means that *some* of
+ /// the regions in its type must be live at `location`. The
+ /// precise set will depend on the dropck constraints, and in
+ /// particular this takes `#[may_dangle]` into account.
+ fn add_drop_live_constraint(
+ &mut self,
+ dropped_local: LocalWithRegion,
+ dropped_ty: Ty<'tcx>,
+ location: Location,
+ ) {
+ debug!(
+ "add_drop_live_constraint(dropped_local={:?}, dropped_ty={:?}, location={:?})",
+ dropped_local, dropped_ty, location
+ );
+
+ let drop_data = self.drop_data.entry(dropped_ty).or_insert_with({
+ let cx = &mut self.cx;
+ move || Self::compute_drop_data(cx, dropped_ty)
+ });
+
+ if let Some(data) = &drop_data.region_constraint_data {
+ self.cx.push_region_constraints(location.boring(), data);
+ }
+
+ drop_data.dropck_result.report_overflows(
+ self.cx.infcx.tcx,
+ self.mir.source_info(location).span,
+ dropped_ty,
+ );
+
+ // All things in the `outlives` array may be touched by
+ // the destructor and must be live at this point.
+ for &kind in &drop_data.dropck_result.kinds {
+ Self::push_type_live_constraint(&mut self.cx, kind, location);
+ }
+ }
+
+ fn compute_drop_data(
+ cx: &mut TypeChecker<'_, 'gcx, 'tcx>,
+ dropped_ty: Ty<'tcx>,
+ ) -> DropData<'tcx> {
+ debug!("compute_drop_data(dropped_ty={:?})", dropped_ty,);
+
+ let param_env = cx.param_env;
+ let (dropck_result, region_constraint_data) = param_env
+ .and(DropckOutlives::new(dropped_ty))
+ .fully_perform(cx.infcx)
+ .unwrap();
+
+ DropData {
+ dropck_result,
+ region_constraint_data,
+ }
+ }
+}
diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
index a18e236..ab83cfe 100644
--- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs
@@ -18,6 +18,7 @@
use borrow_check::nll::region_infer::values::{RegionValueElements, LivenessValues};
use borrow_check::nll::region_infer::{ClosureRegionRequirementsExt, TypeTest};
use borrow_check::nll::type_check::free_region_relations::{CreateResult, UniversalRegionRelations};
+use borrow_check::nll::type_check::liveness::liveness_map::NllLivenessMap;
use borrow_check::nll::universal_regions::UniversalRegions;
use borrow_check::nll::LocalWithRegion;
use borrow_check::nll::ToRegionVid;
@@ -74,7 +75,7 @@
mod constraint_conversion;
pub mod free_region_relations;
mod input_output;
-mod liveness;
+crate mod liveness;
mod relate_tys;
/// Type checks the given `mir` in the context of the inference
@@ -115,16 +116,12 @@
universal_regions: &Rc<UniversalRegions<'tcx>>,
location_table: &LocationTable,
borrow_set: &BorrowSet<'tcx>,
- liveness: &LivenessResults<LocalWithRegion>,
all_facts: &mut Option<AllFacts>,
flow_inits: &mut FlowAtLocation<MaybeInitializedPlaces<'_, 'gcx, 'tcx>>,
move_data: &MoveData<'tcx>,
elements: &Rc<RegionValueElements>,
errors_buffer: &mut Vec<Diagnostic>,
-) -> (
- MirTypeckRegionConstraints<'tcx>,
- Rc<UniversalRegionRelations<'tcx>>,
-) {
+) -> MirTypeckResults<'tcx> {
let implicit_region_bound = infcx.tcx.mk_region(ty::ReVar(universal_regions.fr_fn_body));
let mut constraints = MirTypeckRegionConstraints {
liveness_constraints: LivenessValues::new(elements),
@@ -147,7 +144,7 @@
all_facts,
);
- {
+ let (liveness, liveness_map) = {
let mut borrowck_context = BorrowCheckContext {
universal_regions,
location_table,
@@ -166,7 +163,6 @@
Some(&mut borrowck_context),
Some(errors_buffer),
|cx| {
- liveness::generate(cx, mir, liveness, flow_inits, move_data);
cx.equate_inputs_and_outputs(
mir,
mir_def_id,
@@ -174,14 +170,20 @@
&universal_region_relations,
&normalized_inputs_and_output,
);
+ liveness::generate(cx, mir, flow_inits, move_data)
},
- );
- }
+ )
+ };
- (constraints, universal_region_relations)
+ MirTypeckResults {
+ constraints,
+ universal_region_relations,
+ liveness,
+ liveness_map,
+ }
}
-fn type_check_internal<'a, 'gcx, 'tcx, F>(
+fn type_check_internal<'a, 'gcx, 'tcx, R>(
infcx: &'a InferCtxt<'a, 'gcx, 'tcx>,
mir_def_id: DefId,
param_env: ty::ParamEnv<'gcx>,
@@ -190,10 +192,8 @@
implicit_region_bound: Option<ty::Region<'tcx>>,
borrowck_context: Option<&'a mut BorrowCheckContext<'a, 'tcx>>,
errors_buffer: Option<&mut Vec<Diagnostic>>,
- mut extra: F,
-) where
- F: FnMut(&mut TypeChecker<'a, 'gcx, 'tcx>),
-{
+ mut extra: impl FnMut(&mut TypeChecker<'a, 'gcx, 'tcx>) -> R,
+) -> R where {
let mut checker = TypeChecker::new(
infcx,
mir,
@@ -214,7 +214,7 @@
checker.typeck_mir(mir, errors_buffer);
}
- extra(&mut checker);
+ extra(&mut checker)
}
fn mirbug(tcx: TyCtxt, span: Span, msg: &str) {
@@ -655,6 +655,13 @@
constraints: &'a mut MirTypeckRegionConstraints<'tcx>,
}
+crate struct MirTypeckResults<'tcx> {
+ crate constraints: MirTypeckRegionConstraints<'tcx>,
+ crate universal_region_relations: Rc<UniversalRegionRelations<'tcx>>,
+ crate liveness: LivenessResults<LocalWithRegion>,
+ crate liveness_map: NllLivenessMap,
+}
+
/// A collection of region constraints that must be satisfied for the
/// program to be considered well-typed.
crate struct MirTypeckRegionConstraints<'tcx> {
@@ -870,8 +877,9 @@
// they are not caused by the user, but rather artifacts
// of lowering. Assignments to other sorts of places *are* interesting
// though.
- let is_temp = if let Place::Local(l) = place {
- !mir.local_decls[*l].is_user_variable.is_some()
+ let is_temp = if let Place::Local(l) = *place {
+ l != RETURN_PLACE &&
+ !mir.local_decls[l].is_user_variable.is_some()
} else {
false
};
@@ -895,11 +903,13 @@
);
}
self.check_rvalue(mir, rv, location);
- let trait_ref = ty::TraitRef {
- def_id: tcx.lang_items().sized_trait().unwrap(),
- substs: tcx.mk_substs_trait(place_ty, &[]),
- };
- self.prove_trait_ref(trait_ref, location.interesting());
+ if !self.tcx().features().unsized_locals {
+ let trait_ref = ty::TraitRef {
+ def_id: tcx.lang_items().sized_trait().unwrap(),
+ substs: tcx.mk_substs_trait(place_ty, &[]),
+ };
+ self.prove_trait_ref(trait_ref, location.interesting());
+ }
}
StatementKind::SetDiscriminant {
ref place,
@@ -954,6 +964,7 @@
mir: &Mir<'tcx>,
term: &Terminator<'tcx>,
term_location: Location,
+ errors_buffer: &mut Option<&mut Vec<Diagnostic>>,
) {
debug!("check_terminator: {:?}", term);
let tcx = self.tcx();
@@ -1033,7 +1044,7 @@
&sig,
);
let sig = self.normalize(sig, term_location);
- self.check_call_dest(mir, term, &sig, destination, term_location);
+ self.check_call_dest(mir, term, &sig, destination, term_location, errors_buffer);
self.prove_predicates(
sig.inputs().iter().map(|ty| ty::Predicate::WellFormed(ty)),
@@ -1107,12 +1118,25 @@
sig: &ty::FnSig<'tcx>,
destination: &Option<(Place<'tcx>, BasicBlock)>,
term_location: Location,
+ errors_buffer: &mut Option<&mut Vec<Diagnostic>>,
) {
let tcx = self.tcx();
match *destination {
Some((ref dest, _target_block)) => {
let dest_ty = dest.ty(mir, tcx).to_ty(tcx);
- let locations = term_location.interesting();
+ let is_temp = if let Place::Local(l) = *dest {
+ l != RETURN_PLACE &&
+ !mir.local_decls[l].is_user_variable.is_some()
+ } else {
+ false
+ };
+
+ let locations = if is_temp {
+ term_location.boring()
+ } else {
+ term_location.interesting()
+ };
+
if let Err(terr) = self.sub_types(sig.output(), dest_ty, locations) {
span_mirbug!(
self,
@@ -1123,6 +1147,13 @@
terr
);
}
+
+ // When `#![feature(unsized_locals)]` is not enabled,
+ // this check is done at `check_local`.
+ if self.tcx().features().unsized_locals {
+ let span = term.source_info.span;
+ self.ensure_place_sized(dest_ty, span, errors_buffer);
+ }
}
None => {
// FIXME(canndrew): This is_never should probably be an is_uninhabited
@@ -1289,14 +1320,26 @@
LocalKind::Var | LocalKind::Temp => {}
}
- let span = local_decl.source_info.span;
- let ty = local_decl.ty;
+ // When `#![feature(unsized_locals)]` is enabled, only function calls
+ // are checked in `check_call_dest`.
+ if !self.tcx().features().unsized_locals {
+ let span = local_decl.source_info.span;
+ let ty = local_decl.ty;
+ self.ensure_place_sized(ty, span, errors_buffer);
+ }
+ }
+
+ fn ensure_place_sized(&mut self,
+ ty: Ty<'tcx>,
+ span: Span,
+ errors_buffer: &mut Option<&mut Vec<Diagnostic>>) {
+ let tcx = self.tcx();
// Erase the regions from `ty` to get a global type. The
// `Sized` bound in no way depends on precise regions, so this
// shouldn't affect `is_sized`.
- let gcx = self.tcx().global_tcx();
- let erased_ty = gcx.lift(&self.tcx().erase_regions(&ty)).unwrap();
+ let gcx = tcx.global_tcx();
+ let erased_ty = gcx.lift(&tcx.erase_regions(&ty)).unwrap();
if !erased_ty.is_sized(gcx.at(span), self.param_env) {
// in current MIR construction, all non-control-flow rvalue
// expressions evaluate through `as_temp` or `into` a return
@@ -1818,7 +1861,7 @@
location.statement_index += 1;
}
- self.check_terminator(mir, block_data.terminator(), location);
+ self.check_terminator(mir, block_data.terminator(), location, &mut errors_buffer);
self.check_iscleanup(mir, block_data);
}
}
diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs
index b0517c5..be00910 100644
--- a/src/librustc_mir/borrow_check/place_ext.rs
+++ b/src/librustc_mir/borrow_check/place_ext.rs
@@ -15,8 +15,11 @@
/// Extension methods for the `Place` type.
crate trait PlaceExt<'tcx> {
- /// True if this is a deref of a raw pointer.
- fn is_unsafe_place(&self, tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> bool;
+ /// Returns true if we can safely ignore borrows of this place.
+ /// This is true whenever there is no action that the user can do
+ /// to the place `self` that would invalidate the borrow. This is true
+ /// for borrows of raw pointer dereferents as well as shared references.
+ fn ignore_borrow(&self, tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> bool;
/// If this is a place like `x.f.g`, returns the local
/// `x`. Returns `None` if this is based in a static.
@@ -24,7 +27,7 @@
}
impl<'tcx> PlaceExt<'tcx> for Place<'tcx> {
- fn is_unsafe_place(&self, tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> bool {
+ fn ignore_borrow(&self, tcx: TyCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>) -> bool {
match self {
Place::Promoted(_) |
Place::Local(_) => false,
@@ -36,12 +39,23 @@
| ProjectionElem::Downcast(..)
| ProjectionElem::Subslice { .. }
| ProjectionElem::ConstantIndex { .. }
- | ProjectionElem::Index(_) => proj.base.is_unsafe_place(tcx, mir),
+ | ProjectionElem::Index(_) => proj.base.ignore_borrow(tcx, mir),
+
ProjectionElem::Deref => {
let ty = proj.base.ty(mir, tcx).to_ty(tcx);
match ty.sty {
- ty::TyRawPtr(..) => true,
- _ => proj.base.is_unsafe_place(tcx, mir),
+ // For both derefs of raw pointers and `&T`
+ // references, the original path is `Copy` and
+ // therefore not significant. In particular,
+ // there is nothing the user can do to the
+ // original path that would invalidate the
+ // newly created reference -- and if there
+ // were, then the user could have copied the
+ // original path into a new variable and
+ // borrowed *that* one, leaving the original
+ // path unborrowed.
+ ty::TyRawPtr(..) | ty::TyRef(_, _, hir::MutImmutable) => true,
+ _ => proj.base.ignore_borrow(tcx, mir),
}
}
},
diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs
index 6b6ec74..b317bb7 100644
--- a/src/librustc_mir/build/matches/mod.rs
+++ b/src/librustc_mir/build/matches/mod.rs
@@ -321,9 +321,10 @@
block.unit()
}
- /// Declares the bindings of the given pattern and returns the visibility scope
- /// for the bindings in this patterns, if such a scope had to be created.
- /// NOTE: Declaring the bindings should always be done in their drop scope.
+ /// Declares the bindings of the given patterns and returns the visibility
+ /// scope for the bindings in these patterns, if such a scope had to be
+ /// created. NOTE: Declaring the bindings should always be done in their
+ /// drop scope.
pub fn declare_bindings(&mut self,
mut visibility_scope: Option<SourceScope>,
scope_span: Span,
@@ -356,7 +357,8 @@
let visibility_scope = visibility_scope.unwrap();
this.declare_binding(source_info, visibility_scope, mutability, name, mode,
num_patterns, var, ty, has_guard,
- opt_match_place.map(|(x, y)| (x.cloned(), y)));
+ opt_match_place.map(|(x, y)| (x.cloned(), y)),
+ patterns[0].span);
});
visibility_scope
}
@@ -1181,7 +1183,8 @@
var_id: NodeId,
var_ty: Ty<'tcx>,
has_guard: ArmHasGuard,
- opt_match_place: Option<(Option<Place<'tcx>>, Span)>)
+ opt_match_place: Option<(Option<Place<'tcx>>, Span)>,
+ pat_span: Span)
{
debug!("declare_binding(var_id={:?}, name={:?}, mode={:?}, var_ty={:?}, \
visibility_scope={:?}, source_info={:?})",
@@ -1207,6 +1210,7 @@
// Instead, just abandon providing diagnostic info.
opt_ty_info: None,
opt_match_place,
+ pat_span,
}))),
};
let for_arm_body = self.local_decls.push(local.clone());
diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs
index 054bd69..c0c4318 100644
--- a/src/librustc_mir/build/mod.rs
+++ b/src/librustc_mir/build/mod.rs
@@ -763,6 +763,7 @@
binding_mode,
opt_ty_info,
opt_match_place: Some((Some(place.clone()), span)),
+ pat_span: span,
})))
};
self.var_indices.insert(var, LocalsForNode::One(local));
diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs
index 2dc5138..8e99a45 100644
--- a/src/librustc_mir/build/scope.rs
+++ b/src/librustc_mir/build/scope.rs
@@ -732,7 +732,7 @@
let region_scope_span = region_scope.span(self.hir.tcx(),
&self.hir.region_scope_tree);
// Attribute scope exit drops to scope's closing brace.
- let scope_end = self.hir.tcx().sess.codemap().end_point(region_scope_span);
+ let scope_end = self.hir.tcx().sess.source_map().end_point(region_scope_span);
scope.drops.push(DropData {
span: scope_end,
diff --git a/src/librustc_mir/dataflow/at_location.rs b/src/librustc_mir/dataflow/at_location.rs
index 05453bd..d2a8a9d 100644
--- a/src/librustc_mir/dataflow/at_location.rs
+++ b/src/librustc_mir/dataflow/at_location.rs
@@ -12,7 +12,7 @@
//! locations.
use rustc::mir::{BasicBlock, Location};
-use rustc_data_structures::indexed_set::{IdxSetBuf, Iter};
+use rustc_data_structures::indexed_set::{HybridIdxSetBuf, IdxSetBuf, Iter};
use rustc_data_structures::indexed_vec::Idx;
use dataflow::{BitDenotation, BlockSets, DataflowResults};
@@ -68,8 +68,8 @@
{
base_results: DataflowResults<BD>,
curr_state: IdxSetBuf<BD::Idx>,
- stmt_gen: IdxSetBuf<BD::Idx>,
- stmt_kill: IdxSetBuf<BD::Idx>,
+ stmt_gen: HybridIdxSetBuf<BD::Idx>,
+ stmt_kill: HybridIdxSetBuf<BD::Idx>,
}
impl<BD> FlowAtLocation<BD>
@@ -97,8 +97,8 @@
pub fn new(results: DataflowResults<BD>) -> Self {
let bits_per_block = results.sets().bits_per_block();
let curr_state = IdxSetBuf::new_empty(bits_per_block);
- let stmt_gen = IdxSetBuf::new_empty(bits_per_block);
- let stmt_kill = IdxSetBuf::new_empty(bits_per_block);
+ let stmt_gen = HybridIdxSetBuf::new_empty(bits_per_block);
+ let stmt_kill = HybridIdxSetBuf::new_empty(bits_per_block);
FlowAtLocation {
base_results: results,
curr_state: curr_state,
@@ -129,8 +129,8 @@
F: FnOnce(Iter<BD::Idx>),
{
let mut curr_state = self.curr_state.clone();
- curr_state.union(&self.stmt_gen);
- curr_state.subtract(&self.stmt_kill);
+ curr_state.union_hybrid(&self.stmt_gen);
+ curr_state.subtract_hybrid(&self.stmt_kill);
f(curr_state.iter());
}
}
@@ -193,8 +193,8 @@
}
fn apply_local_effect(&mut self, _loc: Location) {
- self.curr_state.union(&self.stmt_gen);
- self.curr_state.subtract(&self.stmt_kill);
+ self.curr_state.union_hybrid(&self.stmt_gen);
+ self.curr_state.subtract_hybrid(&self.stmt_kill);
}
}
diff --git a/src/librustc_mir/dataflow/graphviz.rs b/src/librustc_mir/dataflow/graphviz.rs
index 7475b4d..97d5499 100644
--- a/src/librustc_mir/dataflow/graphviz.rs
+++ b/src/librustc_mir/dataflow/graphviz.rs
@@ -168,13 +168,13 @@
let i = n.index();
macro_rules! dump_set_for {
- ($set:ident) => {
+ ($set:ident, $interpret:ident) => {
write!(w, "<td>")?;
let flow = self.mbcx.flow_state();
- let entry_interp = flow.interpret_set(&flow.operator,
- flow.sets.$set(i),
- &self.render_idx);
+ let entry_interp = flow.$interpret(&flow.operator,
+ flow.sets.$set(i),
+ &self.render_idx);
for e in &entry_interp {
write!(w, "{:?}<br/>", e)?;
}
@@ -184,7 +184,7 @@
write!(w, "<tr>")?;
// Entry
- dump_set_for!(on_entry_set_for);
+ dump_set_for!(on_entry_set_for, interpret_set);
// MIR statements
write!(w, "<td>")?;
@@ -198,10 +198,10 @@
write!(w, "</td>")?;
// Gen
- dump_set_for!(gen_set_for);
+ dump_set_for!(gen_set_for, interpret_hybrid_set);
// Kill
- dump_set_for!(kill_set_for);
+ dump_set_for!(kill_set_for, interpret_hybrid_set);
write!(w, "</tr>")?;
@@ -217,19 +217,14 @@
-> io::Result<()> {
let i = n.index();
- macro_rules! dump_set_for {
- ($set:ident) => {
- let flow = self.mbcx.flow_state();
- let bits_per_block = flow.sets.bits_per_block();
- let set = flow.sets.$set(i);
- write!(w, "<td>{:?}</td>",
- dot::escape_html(&bits_to_string(set.words(), bits_per_block)))?;
- }
- }
+ let flow = self.mbcx.flow_state();
+ let bits_per_block = flow.sets.bits_per_block();
write!(w, "<tr>")?;
+
// Entry
- dump_set_for!(on_entry_set_for);
+ let set = flow.sets.on_entry_set_for(i);
+ write!(w, "<td>{:?}</td>", dot::escape_html(&bits_to_string(set.words(), bits_per_block)))?;
// Terminator
write!(w, "<td>")?;
@@ -242,10 +237,12 @@
write!(w, "</td>")?;
// Gen
- dump_set_for!(gen_set_for);
+ let set = flow.sets.gen_set_for(i);
+ write!(w, "<td>{:?}</td>", dot::escape_html(&format!("{:?}", set)))?;
// Kill
- dump_set_for!(kill_set_for);
+ let set = flow.sets.kill_set_for(i);
+ write!(w, "<td>{:?}</td>", dot::escape_html(&format!("{:?}", set)))?;
write!(w, "</tr>")?;
diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs
index ea59e42..8f3595b 100644
--- a/src/librustc_mir/dataflow/impls/borrows.rs
+++ b/src/librustc_mir/dataflow/impls/borrows.rs
@@ -80,7 +80,7 @@
debug!("borrow {:?} gets killed at {:?}", borrow_index, location);
borrows_out_of_scope_at_location
.entry(location)
- .or_insert(vec![])
+ .or_default()
.push(borrow_index);
continue;
}
@@ -233,7 +233,7 @@
// propagate_call_return method.
if let mir::Rvalue::Ref(region, _, ref place) = *rhs {
- if place.is_unsafe_place(self.tcx, self.mir) { return; }
+ if place.ignore_borrow(self.tcx, self.mir) { return; }
let index = self.borrow_set.location_map.get(&location).unwrap_or_else(|| {
panic!("could not find BorrowIndex for location {:?}", location);
});
diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs
index 4227f0bc..56c4dac 100644
--- a/src/librustc_mir/dataflow/mod.rs
+++ b/src/librustc_mir/dataflow/mod.rs
@@ -10,9 +10,9 @@
use syntax::ast::{self, MetaItem};
-use rustc_data_structures::indexed_set::{IdxSet, IdxSetBuf};
-use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::bitslice::{bitwise, BitwiseOperator, Word};
+use rustc_data_structures::indexed_set::{HybridIdxSetBuf, IdxSet, IdxSetBuf};
+use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::work_queue::WorkQueue;
use rustc::ty::{self, TyCtxt};
@@ -188,7 +188,6 @@
builder: self,
};
propcx.walk_cfg(&mut temp);
-
}
fn build_sets(&mut self) {
@@ -243,8 +242,8 @@
let sets = self.builder.flow_state.sets.for_block(bb.index());
debug_assert!(in_out.words().len() == sets.on_entry.words().len());
in_out.overwrite(sets.on_entry);
- in_out.union(sets.gen_set);
- in_out.subtract(sets.kill_set);
+ in_out.union_hybrid(sets.gen_set);
+ in_out.subtract_hybrid(sets.kill_set);
}
self.builder.propagate_bits_into_graph_successors_of(
in_out, (bb, bb_data), &mut dirty_queue);
@@ -289,15 +288,11 @@
}
/// Maps each block to a set of bits
-#[derive(Debug)]
+#[derive(Clone, Debug)]
pub(crate) struct Bits<E:Idx> {
bits: IdxSetBuf<E>,
}
-impl<E:Idx> Clone for Bits<E> {
- fn clone(&self) -> Self { Bits { bits: self.bits.clone() } }
-}
-
impl<E:Idx> Bits<E> {
fn new(bits: IdxSetBuf<E>) -> Self {
Bits { bits: bits }
@@ -372,13 +367,15 @@
result: &DataflowResults<T>,
mir: &Mir<'tcx>)
-> IdxSetBuf<T::Idx> {
- let mut entry = result.sets().on_entry_set_for(loc.block.index()).to_owned();
+ let mut on_entry = result.sets().on_entry_set_for(loc.block.index()).to_owned();
+ let mut kill_set = on_entry.to_hybrid();
+ let mut gen_set = kill_set.clone();
{
let mut sets = BlockSets {
- on_entry: &mut entry.clone(),
- kill_set: &mut entry.clone(),
- gen_set: &mut entry,
+ on_entry: &mut on_entry,
+ kill_set: &mut kill_set,
+ gen_set: &mut gen_set,
};
for stmt in 0..loc.statement_index {
@@ -396,7 +393,7 @@
}
}
- entry
+ gen_set.to_dense()
}
pub struct DataflowAnalysis<'a, 'tcx: 'a, O> where O: BitDenotation
@@ -443,12 +440,22 @@
impl<O: BitDenotation> DataflowState<O> {
pub(crate) fn interpret_set<'c, P>(&self,
o: &'c O,
- words: &IdxSet<O::Idx>,
+ set: &IdxSet<O::Idx>,
render_idx: &P)
-> Vec<DebugFormatted>
where P: Fn(&O, O::Idx) -> DebugFormatted
{
- words.iter().map(|i| render_idx(o, i)).collect()
+ set.iter().map(|i| render_idx(o, i)).collect()
+ }
+
+ pub(crate) fn interpret_hybrid_set<'c, P>(&self,
+ o: &'c O,
+ set: &HybridIdxSetBuf<O::Idx>,
+ render_idx: &P)
+ -> Vec<DebugFormatted>
+ where P: Fn(&O, O::Idx) -> DebugFormatted
+ {
+ set.iter().map(|i| render_idx(o, i)).collect()
}
}
@@ -461,18 +468,18 @@
/// equal to bits_per_block / (mem::size_of::<Word> * 8), rounded up.
words_per_block: usize,
+ /// For each block, bits valid on entry to the block.
+ on_entry_sets: Bits<E>,
+
/// For each block, bits generated by executing the statements in
/// the block. (For comparison, the Terminator for each block is
/// handled in a flow-specific manner during propagation.)
- gen_sets: Bits<E>,
+ gen_sets: Vec<HybridIdxSetBuf<E>>,
/// For each block, bits killed by executing the statements in the
/// block. (For comparison, the Terminator for each block is
/// handled in a flow-specific manner during propagation.)
- kill_sets: Bits<E>,
-
- /// For each block, bits valid on entry to the block.
- on_entry_sets: Bits<E>,
+ kill_sets: Vec<HybridIdxSetBuf<E>>,
}
/// Triple of sets associated with a given block.
@@ -494,11 +501,13 @@
/// Dataflow state immediately before control flow enters the given block.
pub(crate) on_entry: &'a mut IdxSet<E>,
- /// Bits that are set to 1 by the time we exit the given block.
- pub(crate) gen_set: &'a mut IdxSet<E>,
+ /// Bits that are set to 1 by the time we exit the given block. Hybrid
+ /// because it usually contains only 0 or 1 elements.
+ pub(crate) gen_set: &'a mut HybridIdxSetBuf<E>,
- /// Bits that are set to 0 by the time we exit the given block.
- pub(crate) kill_set: &'a mut IdxSet<E>,
+ /// Bits that are set to 0 by the time we exit the given block. Hybrid
+ /// because it usually contains only 0 or 1 elements.
+ pub(crate) kill_set: &'a mut HybridIdxSetBuf<E>,
}
impl<'a, E:Idx> BlockSets<'a, E> {
@@ -542,8 +551,8 @@
}
fn apply_local_effect(&mut self) {
- self.on_entry.union(&self.gen_set);
- self.on_entry.subtract(&self.kill_set);
+ self.on_entry.union_hybrid(&self.gen_set);
+ self.on_entry.subtract_hybrid(&self.kill_set);
}
}
@@ -554,24 +563,21 @@
let range = E::new(offset)..E::new(offset + self.words_per_block);
BlockSets {
on_entry: self.on_entry_sets.bits.range_mut(&range),
- gen_set: self.gen_sets.bits.range_mut(&range),
- kill_set: self.kill_sets.bits.range_mut(&range),
+ gen_set: &mut self.gen_sets[block_idx],
+ kill_set: &mut self.kill_sets[block_idx],
}
}
- fn lookup_set_for<'a>(&self, sets: &'a Bits<E>, block_idx: usize) -> &'a IdxSet<E> {
+ pub fn on_entry_set_for(&self, block_idx: usize) -> &IdxSet<E> {
let offset = self.words_per_block * block_idx;
let range = E::new(offset)..E::new(offset + self.words_per_block);
- sets.bits.range(&range)
+ self.on_entry_sets.bits.range(&range)
}
- pub fn gen_set_for(&self, block_idx: usize) -> &IdxSet<E> {
- self.lookup_set_for(&self.gen_sets, block_idx)
+ pub fn gen_set_for(&self, block_idx: usize) -> &HybridIdxSetBuf<E> {
+ &self.gen_sets[block_idx]
}
- pub fn kill_set_for(&self, block_idx: usize) -> &IdxSet<E> {
- self.lookup_set_for(&self.kill_sets, block_idx)
- }
- pub fn on_entry_set_for(&self, block_idx: usize) -> &IdxSet<E> {
- self.lookup_set_for(&self.on_entry_sets, block_idx)
+ pub fn kill_set_for(&self, block_idx: usize) -> &HybridIdxSetBuf<E> {
+ &self.kill_sets[block_idx]
}
}
@@ -731,12 +737,12 @@
let num_blocks = mir.basic_blocks().len();
let num_overall = num_blocks * bits_per_block_rounded_up;
- let zeroes = Bits::new(IdxSetBuf::new_empty(num_overall));
let on_entry = Bits::new(if D::bottom_value() {
IdxSetBuf::new_filled(num_overall)
} else {
IdxSetBuf::new_empty(num_overall)
});
+ let empties = vec![HybridIdxSetBuf::new_empty(bits_per_block); num_blocks];
DataflowAnalysis {
mir,
@@ -745,9 +751,9 @@
sets: AllSets {
bits_per_block,
words_per_block,
- gen_sets: zeroes.clone(),
- kill_sets: zeroes,
on_entry_sets: on_entry,
+ gen_sets: empties.clone(),
+ kill_sets: empties,
},
operator: denotation,
}
diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs
index 44e46e9..60030f2 100644
--- a/src/librustc_mir/dataflow/move_paths/builder.rs
+++ b/src/librustc_mir/dataflow/move_paths/builder.rs
@@ -27,7 +27,7 @@
mir: &'a Mir<'tcx>,
tcx: TyCtxt<'a, 'gcx, 'tcx>,
data: MoveData<'tcx>,
- errors: Vec<MoveError<'tcx>>,
+ errors: Vec<(Place<'tcx>, MoveError<'tcx>)>,
}
impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
@@ -186,7 +186,9 @@
}
impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> {
- fn finalize(self) -> Result<MoveData<'tcx>, (MoveData<'tcx>, Vec<MoveError<'tcx>>)> {
+ fn finalize(
+ self
+ ) -> Result<MoveData<'tcx>, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> {
debug!("{}", {
debug!("moves for {:?}:", self.mir.span);
for (j, mo) in self.data.moves.iter_enumerated() {
@@ -207,9 +209,10 @@
}
}
-pub(super) fn gather_moves<'a, 'gcx, 'tcx>(mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>)
- -> Result<MoveData<'tcx>,
- (MoveData<'tcx>, Vec<MoveError<'tcx>>)> {
+pub(super) fn gather_moves<'a, 'gcx, 'tcx>(
+ mir: &Mir<'tcx>,
+ tcx: TyCtxt<'a, 'gcx, 'tcx>
+) -> Result<MoveData<'tcx>, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> {
let mut builder = MoveDataBuilder::new(mir, tcx);
builder.gather_args();
@@ -407,7 +410,7 @@
let path = match self.move_path_for(place) {
Ok(path) | Err(MoveError::UnionMove { path }) => path,
Err(error @ MoveError::IllegalMove { .. }) => {
- self.builder.errors.push(error);
+ self.builder.errors.push((place.clone(), error));
return;
}
};
diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs
index 64bfd36..7b4cbdf 100644
--- a/src/librustc_mir/dataflow/move_paths/mod.rs
+++ b/src/librustc_mir/dataflow/move_paths/mod.rs
@@ -313,7 +313,7 @@
impl<'a, 'gcx, 'tcx> MoveData<'tcx> {
pub fn gather_moves(mir: &Mir<'tcx>, tcx: TyCtxt<'a, 'gcx, 'tcx>)
- -> Result<Self, (Self, Vec<MoveError<'tcx>>)> {
+ -> Result<Self, (Self, Vec<(Place<'tcx>, MoveError<'tcx>)>)> {
builder::gather_moves(mir, tcx)
}
}
diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs
index 79b7d04..ae4713a 100644
--- a/src/librustc_mir/diagnostics.rs
+++ b/src/librustc_mir/diagnostics.rs
@@ -2164,6 +2164,29 @@
```
"##,
+E0712: r##"
+This error occurs because a borrow of a thread-local variable was made inside a
+function which outlived the lifetime of the function.
+
+Example of erroneous code:
+
+```compile_fail,E0712
+#![feature(nll)]
+#![feature(thread_local)]
+
+#[thread_local]
+static FOO: u8 = 3;
+
+fn main() {
+ let a = &FOO; // error: thread-local variable borrowed past end of function
+
+ std::thread::spawn(move || {
+ println!("{}", a);
+ });
+}
+```
+"##,
+
}
register_diagnostics! {
diff --git a/src/librustc_mir/interpret/const_eval.rs b/src/librustc_mir/interpret/const_eval.rs
index 9d66a0b..dd298d9 100644
--- a/src/librustc_mir/interpret/const_eval.rs
+++ b/src/librustc_mir/interpret/const_eval.rs
@@ -10,8 +10,8 @@
use rustc_data_structures::indexed_vec::IndexVec;
use syntax::ast::Mutability;
-use syntax::codemap::Span;
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::Span;
+use syntax::source_map::DUMMY_SP;
use rustc::mir::interpret::{
EvalResult, EvalError, EvalErrorKind, GlobalId,
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 52305be..3329a47 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -18,7 +18,7 @@
ScalarMaybeUndef,
};
-use syntax::codemap::{self, Span};
+use syntax::source_map::{self, Span};
use syntax::ast::Mutability;
use super::{Place, PlaceExtra, Memory,
@@ -91,7 +91,7 @@
pub instance: ty::Instance<'tcx>,
/// The span of the call site.
- pub span: codemap::Span,
+ pub span: source_map::Span,
////////////////////////////////////////////////////////////////////////////////
// Return place and locals
@@ -545,7 +545,7 @@
pub fn push_stack_frame(
&mut self,
instance: ty::Instance<'tcx>,
- span: codemap::Span,
+ span: source_map::Span,
mir: &'mir mir::Mir<'tcx>,
return_place: Place,
return_to_block: StackPopCleanup,
diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs
index e2086c5..112d875 100644
--- a/src/librustc_mir/interpret/machine.rs
+++ b/src/librustc_mir/interpret/machine.rs
@@ -10,7 +10,7 @@
use rustc::mir;
use rustc::ty::{self, Ty};
use rustc::ty::layout::Size;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use syntax::ast::Mutability;
/// Methods of this trait signifies a point where CTFE evaluation would fail
diff --git a/src/librustc_mir/interpret/terminator/drop.rs b/src/librustc_mir/interpret/terminator/drop.rs
index fe80718..f86c0e8 100644
--- a/src/librustc_mir/interpret/terminator/drop.rs
+++ b/src/librustc_mir/interpret/terminator/drop.rs
@@ -1,6 +1,6 @@
use rustc::mir::BasicBlock;
use rustc::ty::{self, Ty};
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use rustc::mir::interpret::{EvalResult, Value};
use interpret::{Machine, ValTy, EvalContext, Place, PlaceExtra};
diff --git a/src/librustc_mir/interpret/terminator/mod.rs b/src/librustc_mir/interpret/terminator/mod.rs
index 682e384..3a77255 100644
--- a/src/librustc_mir/interpret/terminator/mod.rs
+++ b/src/librustc_mir/interpret/terminator/mod.rs
@@ -1,7 +1,7 @@
use rustc::mir;
use rustc::ty::{self, Ty};
use rustc::ty::layout::{LayoutOf, Size};
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use rustc_target::spec::abi::Abi;
use rustc::mir::interpret::{EvalResult, Scalar, Value};
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index 05c8430..bda80ff 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -14,6 +14,7 @@
*/
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(infer_outlives_requirements)]
#![feature(in_band_lifetimes)]
#![feature(slice_patterns)]
@@ -34,6 +35,7 @@
#![feature(try_trait)]
#![feature(unicode_internals)]
#![feature(step_trait)]
+#![feature(slice_concat_ext)]
#![recursion_limit="256"]
diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs
index 95968c0..f73c9d4 100644
--- a/src/librustc_mir/monomorphize/item.rs
+++ b/src/librustc_mir/monomorphize/item.rs
@@ -26,7 +26,7 @@
use std::iter;
use rustc::mir::mono::Linkage;
use syntax_pos::symbol::Symbol;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
pub use rustc::mir::mono::MonoItem;
/// Describes how a monomorphization will be instantiated in object files.
diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs
index 4e32ca4..7d7be69 100644
--- a/src/librustc_mir/monomorphize/partitioning.rs
+++ b/src/librustc_mir/monomorphize/partitioning.rs
@@ -105,9 +105,9 @@
use monomorphize::collector::InliningMap;
use rustc::dep_graph::WorkProductId;
use rustc::hir::CodegenFnAttrFlags;
-use rustc::hir::def_id::DefId;
+use rustc::hir::def_id::{DefId, LOCAL_CRATE, CRATE_DEF_INDEX};
use rustc::hir::map::DefPathData;
-use rustc::mir::mono::{Linkage, Visibility};
+use rustc::mir::mono::{Linkage, Visibility, CodegenUnitNameBuilder};
use rustc::middle::exported_symbols::SymbolExportLevel;
use rustc::ty::{self, TyCtxt, InstanceDef};
use rustc::ty::item_path::characteristic_def_id_of_type;
@@ -115,7 +115,7 @@
use std::collections::hash_map::Entry;
use std::cmp;
use syntax::ast::NodeId;
-use syntax::symbol::{Symbol, InternedString};
+use syntax::symbol::InternedString;
use rustc::mir::mono::MonoItem;
use monomorphize::item::{MonoItemExt, InstantiationMode};
@@ -203,17 +203,10 @@
}
// Anything we can't find a proper codegen unit for goes into this.
-fn fallback_cgu_name(tcx: TyCtxt) -> InternedString {
- const FALLBACK_CODEGEN_UNIT: &'static str = "__rustc_fallback_codegen_unit";
-
- if tcx.sess.opts.debugging_opts.human_readable_cgu_names {
- Symbol::intern(FALLBACK_CODEGEN_UNIT).as_interned_str()
- } else {
- Symbol::intern(&CodegenUnit::mangle_name(FALLBACK_CODEGEN_UNIT)).as_interned_str()
- }
+fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder) -> InternedString {
+ name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu"))
}
-
pub fn partition<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
mono_items: I,
strategy: PartitioningStrategy,
@@ -224,8 +217,7 @@
// In the first step, we place all regular monomorphizations into their
// respective 'home' codegen unit. Regular monomorphizations are all
// functions and statics defined in the local crate.
- let mut initial_partitioning = place_root_mono_items(tcx,
- mono_items);
+ let mut initial_partitioning = place_root_mono_items(tcx, mono_items);
initial_partitioning.codegen_units.iter_mut().for_each(|cgu| cgu.estimate_size(&tcx));
@@ -234,7 +226,7 @@
// If the partitioning should produce a fixed count of codegen units, merge
// until that count is reached.
if let PartitioningStrategy::FixedUnitCount(count) = strategy {
- merge_codegen_units(&mut initial_partitioning, count, &tcx.crate_name.as_str());
+ merge_codegen_units(tcx, &mut initial_partitioning, count);
debug_dump(tcx, "POST MERGING:", initial_partitioning.codegen_units.iter());
}
@@ -308,6 +300,9 @@
let export_generics = tcx.sess.opts.share_generics() &&
tcx.local_crate_exports_generics();
+ let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
+ let cgu_name_cache = &mut FxHashMap();
+
for mono_item in mono_items {
match mono_item.instantiation_mode(tcx) {
InstantiationMode::GloballyShared { .. } => {}
@@ -319,8 +314,12 @@
mono_item.is_generic_fn();
let codegen_unit_name = match characteristic_def_id {
- Some(def_id) => compute_codegen_unit_name(tcx, def_id, is_volatile),
- None => fallback_cgu_name(tcx),
+ Some(def_id) => compute_codegen_unit_name(tcx,
+ cgu_name_builder,
+ def_id,
+ is_volatile,
+ cgu_name_cache),
+ None => fallback_cgu_name(cgu_name_builder),
};
let codegen_unit = codegen_units.entry(codegen_unit_name.clone())
@@ -344,7 +343,7 @@
// always ensure we have at least one CGU; otherwise, if we have a
// crate with just types (for example), we could wind up with no CGU
if codegen_units.is_empty() {
- let codegen_unit_name = fallback_cgu_name(tcx);
+ let codegen_unit_name = fallback_cgu_name(cgu_name_builder);
codegen_units.insert(codegen_unit_name.clone(),
CodegenUnit::new(codegen_unit_name.clone()));
}
@@ -552,9 +551,9 @@
}
}
-fn merge_codegen_units<'tcx>(initial_partitioning: &mut PreInliningPartitioning<'tcx>,
- target_cgu_count: usize,
- crate_name: &str) {
+fn merge_codegen_units<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>,
+ initial_partitioning: &mut PreInliningPartitioning<'tcx>,
+ target_cgu_count: usize) {
assert!(target_cgu_count >= 1);
let codegen_units = &mut initial_partitioning.codegen_units;
@@ -582,14 +581,15 @@
}
}
+ let cgu_name_builder = &mut CodegenUnitNameBuilder::new(tcx);
for (index, cgu) in codegen_units.iter_mut().enumerate() {
- cgu.set_name(numbered_codegen_unit_name(crate_name, index));
+ cgu.set_name(numbered_codegen_unit_name(cgu_name_builder, index));
}
}
fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning<'tcx>,
- inlining_map: &InliningMap<'tcx>)
- -> PostInliningPartitioning<'tcx> {
+ inlining_map: &InliningMap<'tcx>)
+ -> PostInliningPartitioning<'tcx> {
let mut new_partitioning = Vec::new();
let mut mono_item_placements = FxHashMap();
@@ -696,7 +696,7 @@
inlining_map.iter_accesses(|accessor, accessees| {
for accessee in accessees {
accessor_map.entry(*accessee)
- .or_insert(Vec::new())
+ .or_default()
.push(accessor);
}
});
@@ -783,46 +783,72 @@
}
}
-fn compute_codegen_unit_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- def_id: DefId,
- volatile: bool)
- -> InternedString {
- // Unfortunately we cannot just use the `ty::item_path` infrastructure here
- // because we need paths to modules and the DefIds of those are not
- // available anymore for external items.
- let mut cgu_name = String::with_capacity(64);
+type CguNameCache = FxHashMap<(DefId, bool), InternedString>;
- let def_path = tcx.def_path(def_id);
- cgu_name.push_str(&tcx.crate_name(def_path.krate).as_str());
+fn compute_codegen_unit_name(tcx: TyCtxt,
+ name_builder: &mut CodegenUnitNameBuilder,
+ def_id: DefId,
+ volatile: bool,
+ cache: &mut CguNameCache)
+ -> InternedString {
+ // Find the innermost module that is not nested within a function
+ let mut current_def_id = def_id;
+ let mut cgu_def_id = None;
+ // Walk backwards from the item we want to find the module for:
+ loop {
+ let def_key = tcx.def_key(current_def_id);
- for part in tcx.def_path(def_id)
- .data
- .iter()
- .take_while(|part| {
- match part.data {
- DefPathData::Module(..) => true,
- _ => false,
- }
- }) {
- cgu_name.push_str("-");
- cgu_name.push_str(&part.data.as_interned_str().as_str());
+ match def_key.disambiguated_data.data {
+ DefPathData::Module(..) => {
+ if cgu_def_id.is_none() {
+ cgu_def_id = Some(current_def_id);
+ }
+ }
+ DefPathData::CrateRoot { .. } => {
+ if cgu_def_id.is_none() {
+ // If we have not found a module yet, take the crate root.
+ cgu_def_id = Some(DefId {
+ krate: def_id.krate,
+ index: CRATE_DEF_INDEX,
+ });
+ }
+ break
+ }
+ _ => {
+ // If we encounter something that is not a module, throw away
+ // any module that we've found so far because we now know that
+ // it is nested within something else.
+ cgu_def_id = None;
+ }
+ }
+
+ current_def_id.index = def_key.parent.unwrap();
}
- if volatile {
- cgu_name.push_str(".volatile");
- }
+ let cgu_def_id = cgu_def_id.unwrap();
- let cgu_name = if tcx.sess.opts.debugging_opts.human_readable_cgu_names {
- cgu_name
- } else {
- CodegenUnit::mangle_name(&cgu_name)
- };
+ cache.entry((cgu_def_id, volatile)).or_insert_with(|| {
+ let def_path = tcx.def_path(cgu_def_id);
- Symbol::intern(&cgu_name[..]).as_interned_str()
+ let components = def_path
+ .data
+ .iter()
+ .map(|part| part.data.as_interned_str());
+
+ let volatile_suffix = if volatile {
+ Some("volatile")
+ } else {
+ None
+ };
+
+ name_builder.build_cgu_name(def_path.krate, components, volatile_suffix)
+ }).clone()
}
-fn numbered_codegen_unit_name(crate_name: &str, index: usize) -> InternedString {
- Symbol::intern(&format!("{}{}", crate_name, index)).as_interned_str()
+fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder,
+ index: usize)
+ -> InternedString {
+ name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index))
}
fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs
index aba3996..80e484d 100644
--- a/src/librustc_mir/transform/check_unsafety.rs
+++ b/src/librustc_mir/transform/check_unsafety.rs
@@ -424,12 +424,12 @@
}
fn report_unused_unsafe(tcx: TyCtxt, used_unsafe: &FxHashSet<ast::NodeId>, id: ast::NodeId) {
- let span = tcx.sess.codemap().def_span(tcx.hir.span(id));
+ let span = tcx.sess.source_map().def_span(tcx.hir.span(id));
let msg = "unnecessary `unsafe` block";
let mut db = tcx.struct_span_lint_node(UNUSED_UNSAFE, id, span, msg);
db.span_label(span, msg);
if let Some((kind, id)) = is_enclosed(tcx, used_unsafe, id) {
- db.span_label(tcx.sess.codemap().def_span(tcx.hir.span(id)),
+ db.span_label(tcx.sess.source_map().def_span(tcx.hir.span(id)),
format!("because it's nested under this `unsafe` {}", kind));
}
db.emit();
diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs
index 5912eee..47c45ad 100644
--- a/src/librustc_mir/transform/const_prop.rs
+++ b/src/librustc_mir/transform/const_prop.rs
@@ -24,7 +24,7 @@
use interpret::CompileTimeEvaluator;
use interpret::{eval_promoted, mk_borrowck_eval_cx, ValTy};
use transform::{MirPass, MirSource};
-use syntax::codemap::{Span, DUMMY_SP};
+use syntax::source_map::{Span, DUMMY_SP};
use rustc::ty::subst::Substs;
use rustc_data_structures::indexed_vec::IndexVec;
use rustc::ty::ParamEnv;
diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs
index da149f4..776d788 100644
--- a/src/librustc_mir/transform/rustc_peek.rs
+++ b/src/librustc_mir/transform/rustc_peek.rs
@@ -138,9 +138,9 @@
}
};
- let mut entry = results.0.sets.on_entry_set_for(bb.index()).to_owned();
- let mut gen = results.0.sets.gen_set_for(bb.index()).to_owned();
- let mut kill = results.0.sets.kill_set_for(bb.index()).to_owned();
+ let mut on_entry = results.0.sets.on_entry_set_for(bb.index()).to_owned();
+ let mut gen_set = results.0.sets.gen_set_for(bb.index()).clone();
+ let mut kill_set = results.0.sets.kill_set_for(bb.index()).clone();
// Emulate effect of all statements in the block up to (but not
// including) the borrow within `peek_arg_place`. Do *not* include
@@ -148,9 +148,9 @@
// of the argument at time immediate preceding Call to
// `rustc_peek`).
- let mut sets = dataflow::BlockSets { on_entry: &mut entry,
- gen_set: &mut gen,
- kill_set: &mut kill };
+ let mut sets = dataflow::BlockSets { on_entry: &mut on_entry,
+ gen_set: &mut gen_set,
+ kill_set: &mut kill_set };
for (j, stmt) in statements.iter().enumerate() {
debug!("rustc_peek: ({:?},{}) {:?}", bb, j, stmt);
@@ -203,14 +203,14 @@
debug!("rustc_peek: computing effect on place: {:?} ({:?}) in stmt: {:?}",
place, lhs_mpi, stmt);
// reset GEN and KILL sets before emulating their effect.
- for e in sets.gen_set.words_mut() { *e = 0; }
- for e in sets.kill_set.words_mut() { *e = 0; }
+ sets.gen_set.clear();
+ sets.kill_set.clear();
results.0.operator.before_statement_effect(
&mut sets, Location { block: bb, statement_index: j });
results.0.operator.statement_effect(
&mut sets, Location { block: bb, statement_index: j });
- sets.on_entry.union(sets.gen_set);
- sets.on_entry.subtract(sets.kill_set);
+ sets.on_entry.union_hybrid(sets.gen_set);
+ sets.on_entry.subtract_hybrid(sets.kill_set);
}
results.0.operator.before_terminator_effect(
diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs
index 0a53361..7be6241 100644
--- a/src/librustc_mir/util/borrowck_errors.rs
+++ b/src/librustc_mir/util/borrowck_errors.rs
@@ -675,6 +675,22 @@
self.cancel_if_wrong_origin(err, o)
}
+
+ fn thread_local_value_does_not_live_long_enough(
+ self,
+ span: Span,
+ o: Origin,
+ ) -> DiagnosticBuilder<'cx> {
+ let err = struct_span_err!(
+ self,
+ span,
+ E0712,
+ "thread-local variable borrowed past end of function{OGN}",
+ OGN = o
+ );
+
+ self.cancel_if_wrong_origin(err, o)
+ }
}
impl<'cx, 'gcx, 'tcx> BorrowckErrors<'cx> for TyCtxt<'cx, 'gcx, 'tcx> {
diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs
index 78e9dd2..1e62408 100644
--- a/src/librustc_mir/util/mod.rs
+++ b/src/librustc_mir/util/mod.rs
@@ -31,14 +31,14 @@
/// If possible, suggest replacing `ref` with `ref mut`.
pub fn suggest_ref_mut<'cx, 'gcx, 'tcx>(
tcx: ty::TyCtxt<'cx, 'gcx, 'tcx>,
- pattern_span: Span,
-) -> Option<(Span, String)> {
- let hi_src = tcx.sess.codemap().span_to_snippet(pattern_span).unwrap();
+ binding_span: Span,
+) -> Option<(String)> {
+ let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap();
if hi_src.starts_with("ref")
&& hi_src["ref".len()..].starts_with(Pattern_White_Space)
{
let replacement = format!("ref mut{}", &hi_src["ref".len()..]);
- Some((pattern_span, replacement))
+ Some(replacement)
} else {
None
}
diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs
index 4bb74c6..df97599 100644
--- a/src/librustc_mir/util/pretty.rs
+++ b/src/librustc_mir/util/pretty.rs
@@ -441,7 +441,7 @@
format!(
"scope {} at {}",
scope.index(),
- tcx.sess.codemap().span_to_string(span)
+ tcx.sess.source_map().span_to_string(span)
)
}
@@ -528,7 +528,7 @@
if let Some(parent) = scope_data.parent_scope {
scope_tree
.entry(parent)
- .or_insert(vec![])
+ .or_default()
.push(SourceScope::new(index));
} else {
// Only the argument scope has no parent, because it's the root.
diff --git a/src/librustc_msan/lib.rs b/src/librustc_msan/lib.rs
index 0c78fd7..b3ba86a 100644
--- a/src/librustc_msan/lib.rs
+++ b/src/librustc_msan/lib.rs
@@ -10,6 +10,7 @@
#![sanitizer_runtime]
#![feature(alloc_system)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
diff --git a/src/librustc_passes/ast_validation.rs b/src/librustc_passes/ast_validation.rs
index 0ea90e7..99ea62e 100644
--- a/src/librustc_passes/ast_validation.rs
+++ b/src/librustc_passes/ast_validation.rs
@@ -20,7 +20,7 @@
use rustc::session::Session;
use syntax::ast::*;
use syntax::attr;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::symbol::keywords;
use syntax::visit::{self, Visitor};
use syntax_pos::Span;
diff --git a/src/librustc_passes/diagnostics.rs b/src/librustc_passes/diagnostics.rs
index f1ec337..f1d0a4f 100644
--- a/src/librustc_passes/diagnostics.rs
+++ b/src/librustc_passes/diagnostics.rs
@@ -261,6 +261,27 @@
```
"##,
+E0642: r##"
+Trait methods currently cannot take patterns as arguments.
+
+Example of erroneous code:
+
+```compile_fail,E0642
+trait Foo {
+ fn foo((x, y): (i32, i32)); // error: patterns aren't allowed
+ // in trait methods
+}
+```
+
+You can instead use a single name for the argument:
+
+```
+trait Foo {
+ fn foo(x_and_y: (i32, i32)); // ok!
+}
+```
+"##,
+
E0695: r##"
A `break` statement without a label appeared inside a labeled block.
@@ -306,7 +327,6 @@
E0561, // patterns aren't allowed in function pointer types
E0567, // auto traits can not have generic parameters
E0568, // auto traits can not have super traits
- E0642, // patterns aren't allowed in methods without bodies
E0666, // nested `impl Trait` is illegal
E0667, // `impl Trait` in projections
E0696, // `continue` pointing to a labeled block
diff --git a/src/librustc_passes/lib.rs b/src/librustc_passes/lib.rs
index 41f1e78..d62cb00 100644
--- a/src/librustc_passes/lib.rs
+++ b/src/librustc_passes/lib.rs
@@ -18,6 +18,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_diagnostic_macros)]
#[macro_use]
diff --git a/src/librustc_platform_intrinsics/lib.rs b/src/librustc_platform_intrinsics/lib.rs
index b57debd..d41f4cd 100644
--- a/src/librustc_platform_intrinsics/lib.rs
+++ b/src/librustc_platform_intrinsics/lib.rs
@@ -10,6 +10,8 @@
#![allow(bad_style)]
+#![cfg_attr(not(stage0), feature(nll))]
+
pub struct Intrinsic {
pub inputs: &'static [&'static Type],
pub output: &'static Type,
diff --git a/src/librustc_plugin/lib.rs b/src/librustc_plugin/lib.rs
index 348aa6a..67f53a6 100644
--- a/src/librustc_plugin/lib.rs
+++ b/src/librustc_plugin/lib.rs
@@ -64,6 +64,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_diagnostic_macros)]
#[macro_use] extern crate syntax;
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index b6dd0e8..fcb1b65 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -12,6 +12,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_diagnostic_macros)]
#![recursion_limit="256"]
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index 0be1bf3..19dc35f 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -17,7 +17,7 @@
use resolve_imports::ImportDirective;
use resolve_imports::ImportDirectiveSubclass::{self, GlobImport, SingleImport};
use {Module, ModuleData, ModuleKind, NameBinding, NameBindingKind, ToNameBinding};
-use {PerNS, Resolver, ResolverArenas};
+use {ModuleOrUniformRoot, PerNS, Resolver, ResolverArenas};
use Namespace::{self, TypeNS, ValueNS, MacroNS};
use {resolve_error, resolve_struct_error, ResolutionError};
@@ -113,16 +113,24 @@
}
}
- fn build_reduced_graph_for_use_tree(&mut self,
- root_use_tree: &ast::UseTree,
- root_id: NodeId,
- use_tree: &ast::UseTree,
- id: NodeId,
- vis: ty::Visibility,
- prefix: &ast::Path,
- nested: bool,
- item: &Item,
- expansion: Mark) {
+ fn build_reduced_graph_for_use_tree(
+ &mut self,
+ root_use_tree: &ast::UseTree,
+ root_id: NodeId,
+ use_tree: &ast::UseTree,
+ id: NodeId,
+ vis: ty::Visibility,
+ prefix: &ast::Path,
+ mut uniform_paths_canary_emitted: bool,
+ nested: bool,
+ item: &Item,
+ expansion: Mark,
+ ) {
+ debug!("build_reduced_graph_for_use_tree(prefix={:?}, \
+ uniform_paths_canary_emitted={}, \
+ use_tree={:?}, nested={})",
+ prefix, uniform_paths_canary_emitted, use_tree, nested);
+
let is_prelude = attr::contains_name(&item.attrs, "prelude_import");
let path = &use_tree.prefix;
@@ -131,6 +139,103 @@
.map(|seg| seg.ident)
.collect();
+ debug!("build_reduced_graph_for_use_tree: module_path={:?}", module_path);
+
+ // `#[feature(uniform_paths)]` allows an unqualified import path,
+ // e.g. `use x::...;` to resolve not just globally (`use ::x::...;`)
+ // but also relatively (`use self::x::...;`). To catch ambiguities
+ // that might arise from both of these being available and resolution
+ // silently picking one of them, an artificial `use self::x as _;`
+ // import is injected as a "canary", and an error is emitted if it
+ // successfully resolves while an `x` external crate exists.
+ //
+ // For each block scope around the `use` item, one special canary
+ // import of the form `use x as _;` is also injected, having its
+ // parent set to that scope; `resolve_imports` will only resolve
+ // it within its appropriate scope; if any of them successfully
+ // resolve, an ambiguity error is emitted, since the original
+ // import can't see the item in the block scope (`self::x` only
+ // looks in the enclosing module), but a non-`use` path could.
+ //
+ // Additionally, the canary might be able to catch limitations of the
+ // current implementation, where `::x` may be chosen due to `self::x`
+ // not existing, but `self::x` could appear later, from macro expansion.
+ //
+ // NB. The canary currently only errors if the `x::...` path *could*
+ // resolve as a relative path through the extern crate, i.e. `x` is
+ // in `extern_prelude`, *even though* `::x` might still forcefully
+ // load a non-`extern_prelude` crate.
+ // While always producing an ambiguity errors if `self::x` exists and
+ // a crate *could* be loaded, would be more conservative, imports for
+ // local modules named `test` (or less commonly, `syntax` or `log`),
+ // would need to be qualified (e.g. `self::test`), which is considered
+ // ergonomically unacceptable.
+ let emit_uniform_paths_canary =
+ !uniform_paths_canary_emitted &&
+ module_path.get(0).map_or(false, |ident| {
+ !ident.is_path_segment_keyword()
+ });
+ if emit_uniform_paths_canary {
+ // Relative paths should only get here if the feature-gate is on.
+ assert!(self.session.rust_2018() &&
+ self.session.features_untracked().uniform_paths);
+
+ let source = module_path[0];
+ // Helper closure to emit a canary with the given base path.
+ let emit = |this: &mut Self, base: Option<Ident>| {
+ let subclass = SingleImport {
+ target: Ident {
+ name: keywords::Underscore.name().gensymed(),
+ span: source.span,
+ },
+ source,
+ result: PerNS {
+ type_ns: Cell::new(Err(Undetermined)),
+ value_ns: Cell::new(Err(Undetermined)),
+ macro_ns: Cell::new(Err(Undetermined)),
+ },
+ type_ns_only: false,
+ };
+ this.add_import_directive(
+ base.into_iter().collect(),
+ subclass.clone(),
+ source.span,
+ id,
+ root_use_tree.span,
+ root_id,
+ ty::Visibility::Invisible,
+ expansion,
+ true, // is_uniform_paths_canary
+ );
+ };
+
+ // A single simple `self::x` canary.
+ emit(self, Some(Ident {
+ name: keywords::SelfValue.name(),
+ span: source.span,
+ }));
+
+ // One special unprefixed canary per block scope around
+ // the import, to detect items unreachable by `self::x`.
+ let orig_current_module = self.current_module;
+ let mut span = source.span.modern();
+ loop {
+ match self.current_module.kind {
+ ModuleKind::Block(..) => emit(self, None),
+ ModuleKind::Def(..) => break,
+ }
+ match self.hygienic_lexical_parent(self.current_module, &mut span) {
+ Some(module) => {
+ self.current_module = module;
+ }
+ None => break,
+ }
+ }
+ self.current_module = orig_current_module;
+
+ uniform_paths_canary_emitted = true;
+ }
+
match use_tree.kind {
ast::UseTreeKind::Simple(rename, ..) => {
let mut ident = use_tree.ident();
@@ -142,8 +247,10 @@
if source.name == keywords::SelfValue.name() {
type_ns_only = true;
- let last_segment = *module_path.last().unwrap();
- if last_segment.name == keywords::CrateRoot.name() {
+ let empty_prefix = module_path.last().map_or(true, |ident| {
+ ident.name == keywords::CrateRoot.name()
+ });
+ if empty_prefix {
resolve_error(
self,
use_tree.span,
@@ -154,10 +261,9 @@
}
// Replace `use foo::self;` with `use foo;`
- let _ = module_path.pop();
- source = last_segment;
+ source = module_path.pop().unwrap();
if rename.is_none() {
- ident = last_segment;
+ ident = source;
}
}
} else {
@@ -169,13 +275,23 @@
}
// Disallow `use $crate;`
- if source.name == keywords::DollarCrate.name() && path.segments.len() == 1 {
+ if source.name == keywords::DollarCrate.name() && module_path.is_empty() {
let crate_root = self.resolve_crate_root(source);
let crate_name = match crate_root.kind {
ModuleKind::Def(_, name) => name,
ModuleKind::Block(..) => unreachable!(),
};
- source.name = crate_name;
+ // HACK(eddyb) unclear how good this is, but keeping `$crate`
+ // in `source` breaks `src/test/compile-fail/import-crate-var.rs`,
+ // while the current crate doesn't have a valid `crate_name`.
+ if crate_name != keywords::Invalid.name() {
+ // `crate_name` should not be interpreted as relative.
+ module_path.push(Ident {
+ name: keywords::CrateRoot.name(),
+ span: source.span,
+ });
+ source.name = crate_name;
+ }
if rename.is_none() {
ident.name = crate_name;
}
@@ -187,6 +303,12 @@
}
}
+ if ident.name == keywords::Crate.name() {
+ self.session.span_err(ident.span,
+ "crate root imports need to be explicitly named: \
+ `use crate as name;`");
+ }
+
let subclass = SingleImport {
target: ident,
source,
@@ -206,6 +328,7 @@
root_id,
vis,
expansion,
+ false, // is_uniform_paths_canary
);
}
ast::UseTreeKind::Glob => {
@@ -222,6 +345,7 @@
root_id,
vis,
expansion,
+ false, // is_uniform_paths_canary
);
}
ast::UseTreeKind::Nested(ref items) => {
@@ -256,7 +380,16 @@
for &(ref tree, id) in items {
self.build_reduced_graph_for_use_tree(
- root_use_tree, root_id, tree, id, vis, &prefix, true, item, expansion
+ root_use_tree,
+ root_id,
+ tree,
+ id,
+ vis,
+ &prefix,
+ uniform_paths_canary_emitted,
+ true,
+ item,
+ expansion,
);
}
}
@@ -272,14 +405,32 @@
match item.node {
ItemKind::Use(ref use_tree) => {
+ let uniform_paths =
+ self.session.rust_2018() &&
+ self.session.features_untracked().uniform_paths;
// Imports are resolved as global by default, add starting root segment.
+ let root = if !uniform_paths {
+ use_tree.prefix.make_root()
+ } else {
+ // Except when `#![feature(uniform_paths)]` is on.
+ None
+ };
let prefix = ast::Path {
- segments: use_tree.prefix.make_root().into_iter().collect(),
+ segments: root.into_iter().collect(),
span: use_tree.span,
};
self.build_reduced_graph_for_use_tree(
- use_tree, item.id, use_tree, item.id, vis, &prefix, false, item, expansion,
+ use_tree,
+ item.id,
+ use_tree,
+ item.id,
+ vis,
+ &prefix,
+ false, // uniform_paths_canary_emitted
+ false,
+ item,
+ expansion,
);
}
@@ -299,7 +450,7 @@
root_id: item.id,
id: item.id,
parent,
- imported_module: Cell::new(Some(module)),
+ imported_module: Cell::new(Some(ModuleOrUniformRoot::Module(module))),
subclass: ImportDirectiveSubclass::ExternCrate(orig_name),
root_span: item.span,
span: item.span,
@@ -307,6 +458,7 @@
vis: Cell::new(vis),
expansion,
used: Cell::new(used),
+ is_uniform_paths_canary: false,
});
self.potentially_unused_imports.push(directive);
let imported_binding = self.import(binding, directive);
@@ -681,19 +833,12 @@
-> bool {
let allow_shadowing = expansion == Mark::root();
let legacy_imports = self.legacy_macro_imports(&item.attrs);
- let mut used = legacy_imports != LegacyMacroImports::default();
+ let used = legacy_imports != LegacyMacroImports::default();
// `#[macro_use]` is only allowed at the crate root.
if self.current_module.parent.is_some() && used {
span_err!(self.session, item.span, E0468,
"an `extern crate` loading macros must be at the crate root");
- } else if !self.use_extern_macros && !used &&
- self.cstore.dep_kind_untracked(module.def_id().unwrap().krate)
- .macros_only() {
- let msg = "proc macro crates and `#[no_link]` crates have no effect without \
- `#[macro_use]`";
- self.session.span_warn(item.span, msg);
- used = true; // Avoid the normal unused extern crate warning
}
let (graph_root, arenas) = (self.graph_root, self.arenas);
@@ -701,7 +846,7 @@
root_id: item.id,
id: item.id,
parent: graph_root,
- imported_module: Cell::new(Some(module)),
+ imported_module: Cell::new(Some(ModuleOrUniformRoot::Module(module))),
subclass: ImportDirectiveSubclass::MacroUse,
root_span: span,
span,
@@ -709,6 +854,7 @@
vis: Cell::new(ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX))),
expansion,
used: Cell::new(false),
+ is_uniform_paths_canary: false,
});
if let Some(span) = legacy_imports.import_all {
@@ -721,7 +867,13 @@
} else {
for (name, span) in legacy_imports.imports {
let ident = Ident::with_empty_ctxt(name);
- let result = self.resolve_ident_in_module(module, ident, MacroNS, false, span);
+ let result = self.resolve_ident_in_module(
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ MacroNS,
+ false,
+ span,
+ );
if let Ok(binding) = result {
let directive = macro_use_directive(span);
self.potentially_unused_imports.push(directive);
@@ -789,7 +941,6 @@
fn visit_invoc(&mut self, id: ast::NodeId) -> &'b InvocationData<'b> {
let mark = id.placeholder_to_mark();
self.resolver.current_module.unresolved_invocations.borrow_mut().insert(mark);
- self.resolver.unresolved_invocations_macro_export.insert(mark);
let invocation = self.resolver.invocations[&mark];
invocation.module.set(self.resolver.current_module);
invocation.legacy_scope.set(self.legacy_scope);
diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs
index e1b059d..de94815 100644
--- a/src/librustc_resolve/check_unused.rs
+++ b/src/librustc_resolve/check_unused.rs
@@ -65,7 +65,7 @@
// Check later.
return;
}
- self.unused_imports.entry(item_id).or_insert_with(NodeMap).insert(id, span);
+ self.unused_imports.entry(item_id).or_default().insert(id, span);
} else {
// This trait import is definitely used, in a way other than
// method resolution.
@@ -112,7 +112,7 @@
if items.len() == 0 {
self.unused_imports
.entry(self.base_id)
- .or_insert_with(NodeMap)
+ .or_default()
.insert(id, span);
}
} else {
@@ -131,7 +131,7 @@
directive.vis.get() == ty::Visibility::Public ||
directive.span.is_dummy() => {
if let ImportDirectiveSubclass::MacroUse = directive.subclass {
- if resolver.use_extern_macros && !directive.span.is_dummy() {
+ if !directive.span.is_dummy() {
resolver.session.buffer_lint(
lint::builtin::MACRO_USE_EXTERN_CRATE,
directive.id,
@@ -175,7 +175,7 @@
let ms = MultiSpan::from_spans(spans.clone());
let mut span_snippets = spans.iter()
.filter_map(|s| {
- match visitor.session.codemap().span_to_snippet(*s) {
+ match visitor.session.source_map().span_to_snippet(*s) {
Ok(s) => Some(format!("`{}`", s)),
_ => None,
}
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs
index 6593e23..c1dc304 100644
--- a/src/librustc_resolve/diagnostics.rs
+++ b/src/librustc_resolve/diagnostics.rs
@@ -770,17 +770,18 @@
"##,
E0411: r##"
-The `Self` keyword was used outside an impl or a trait.
+The `Self` keyword was used outside an impl, trait, or type definition.
Erroneous code example:
```compile_fail,E0411
-<Self>::foo; // error: use of `Self` outside of an impl or trait
+<Self>::foo; // error: use of `Self` outside of an impl, trait, or type
+ // definition
```
The `Self` keyword represents the current type, which explains why it can only
-be used inside an impl or a trait. It gives access to the associated items of a
-type:
+be used inside an impl, trait, or type definition. It gives access to the
+associated items of a type:
```
trait Foo {
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index d969677..282589c 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -9,10 +9,11 @@
// except according to those terms.
#![doc(html_logo_url = "https://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
- html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
- html_root_url = "https://doc.rust-lang.org/nightly/")]
+ html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
+ html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(crate_visibility_modifier)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]
@@ -48,7 +49,7 @@
use rustc_metadata::creader::CrateLoader;
use rustc_metadata::cstore::CStore;
-use syntax::codemap::CodeMap;
+use syntax::source_map::SourceMap;
use syntax::ext::hygiene::{Mark, Transparency, SyntaxContext};
use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
use syntax::ext::base::SyntaxExtension;
@@ -79,7 +80,7 @@
use rustc_data_structures::sync::Lrc;
use resolve_imports::{ImportDirective, ImportDirectiveSubclass, NameResolution, ImportResolver};
-use macros::{InvocationData, LegacyBinding, LegacyScope, MacroBinding};
+use macros::{InvocationData, LegacyBinding, MacroBinding};
// NB: This module needs to be declared first so diagnostics are
// registered before they are used.
@@ -194,7 +195,7 @@
"can't use type parameters from outer function");
err.span_label(span, "use of type variable from outer function");
- let cm = resolver.session.codemap();
+ let cm = resolver.session.source_map();
match outer_def {
Def::SelfTy(_, maybe_impl_defid) => {
if let Some(impl_span) = maybe_impl_defid.map_or(None,
@@ -413,8 +414,8 @@
///
/// Attention: The method used is very fragile since it essentially duplicates the work of the
/// parser. If you need to use this function or something similar, please consider updating the
-/// codemap functions and this function to something more robust.
-fn reduce_impl_span_to_impl_keyword(cm: &CodeMap, impl_span: Span) -> Span {
+/// source_map functions and this function to something more robust.
+fn reduce_impl_span_to_impl_keyword(cm: &SourceMap, impl_span: Span) -> Span {
let impl_span = cm.span_until_char(impl_span, '<');
let impl_span = cm.span_until_whitespace(impl_span);
impl_span
@@ -952,9 +953,20 @@
}
}
+#[derive(Copy, Clone, Debug)]
+pub enum ModuleOrUniformRoot<'a> {
+ /// Regular module.
+ Module(Module<'a>),
+
+ /// The `{{root}}` (`CrateRoot` aka "global") / `extern` initial segment
+ /// in which external crates resolve, and also `crate` (only in `{{root}}`,
+ /// but *not* `extern`), in the Rust 2018 edition.
+ UniformRoot(Name),
+}
+
#[derive(Clone, Debug)]
enum PathResult<'a> {
- Module(Module<'a>),
+ Module(ModuleOrUniformRoot<'a>),
NonModule(PathResolution),
Indeterminate,
Failed(Span, String, bool /* is the error from the last segment? */),
@@ -1384,24 +1396,21 @@
use_injections: Vec<UseError<'a>>,
/// `use` injections for proc macros wrongly imported with #[macro_use]
proc_mac_errors: Vec<macros::ProcMacError>,
+ /// crate-local macro expanded `macro_export` referred to by a module-relative path
+ macro_expanded_macro_export_errors: BTreeSet<(Span, Span)>,
- gated_errors: FxHashSet<Span>,
disallowed_shadowing: Vec<&'a LegacyBinding<'a>>,
arenas: &'a ResolverArenas<'a>,
dummy_binding: &'a NameBinding<'a>,
- /// true if `#![feature(use_extern_macros)]`
- use_extern_macros: bool,
crate_loader: &'a mut CrateLoader<'b>,
macro_names: FxHashSet<Ident>,
macro_prelude: FxHashMap<Name, &'a NameBinding<'a>>,
pub all_macros: FxHashMap<Name, Def>,
- lexical_macro_resolutions: Vec<(Ident, &'a Cell<LegacyScope<'a>>)>,
macro_map: FxHashMap<DefId, Lrc<SyntaxExtension>>,
macro_defs: FxHashMap<Mark, DefId>,
local_macro_def_scopes: FxHashMap<NodeId, Module<'a>>,
- macro_exports: Vec<Export>, // FIXME: Remove when `use_extern_macros` is stabilized
pub whitelisted_legacy_custom_derives: Vec<Name>,
pub found_unresolved_macro: bool,
@@ -1431,9 +1440,6 @@
/// Only supposed to be used by rustdoc, otherwise should be false.
pub ignore_extern_prelude_feature: bool,
-
- /// Macro invocations in the whole crate that can expand into a `#[macro_export] macro_rules`.
- unresolved_invocations_macro_export: FxHashSet<Mark>,
}
/// Nothing really interesting here, it just provides memory for the rest of the crate.
@@ -1583,11 +1589,13 @@
let hir::Path { ref segments, span, ref mut def } = *path;
let path: Vec<_> = segments.iter().map(|seg| seg.ident).collect();
// FIXME (Manishearth): Intra doc links won't get warned of epoch changes
- match self.resolve_path(&path, Some(namespace), true, span, CrateLint::No) {
- PathResult::Module(module) => *def = module.def().unwrap(),
+ match self.resolve_path(None, &path, Some(namespace), true, span, CrateLint::No) {
+ PathResult::Module(ModuleOrUniformRoot::Module(module)) =>
+ *def = module.def().unwrap(),
PathResult::NonModule(path_res) if path_res.unresolved_segments() == 0 =>
*def = path_res.base_def(),
PathResult::NonModule(..) => match self.resolve_path(
+ None,
&path,
None,
true,
@@ -1599,6 +1607,7 @@
}
_ => {}
},
+ PathResult::Module(ModuleOrUniformRoot::UniformRoot(_)) |
PathResult::Indeterminate => unreachable!(),
PathResult::Failed(span, msg, _) => {
error_callback(self, span, ResolutionError::FailedToResolve(&msg));
@@ -1643,8 +1652,6 @@
invocations.insert(Mark::root(),
arenas.alloc_invocation_data(InvocationData::root(graph_root)));
- let features = session.features_untracked();
-
let mut macro_defs = FxHashMap();
macro_defs.insert(Mark::root(), root_def_id);
@@ -1703,8 +1710,8 @@
ambiguity_errors: Vec::new(),
use_injections: Vec::new(),
proc_mac_errors: Vec::new(),
- gated_errors: FxHashSet(),
disallowed_shadowing: Vec::new(),
+ macro_expanded_macro_export_errors: BTreeSet::new(),
arenas,
dummy_binding: arenas.alloc_name_binding(NameBinding {
@@ -1714,15 +1721,11 @@
vis: ty::Visibility::Public,
}),
- use_extern_macros: features.use_extern_macros(),
-
crate_loader,
macro_names: FxHashSet(),
macro_prelude: FxHashMap(),
all_macros: FxHashMap(),
- lexical_macro_resolutions: Vec::new(),
macro_map: FxHashMap(),
- macro_exports: Vec::new(),
invocations,
macro_defs,
local_macro_def_scopes: FxHashMap(),
@@ -1736,7 +1739,6 @@
current_type_ascription: Vec::new(),
injected_crate: None,
ignore_extern_prelude_feature: false,
- unresolved_invocations_macro_export: FxHashSet(),
}
}
@@ -1756,9 +1758,7 @@
fn per_ns<F: FnMut(&mut Self, Namespace)>(&mut self, mut f: F) {
f(self, TypeNS);
f(self, ValueNS);
- if self.use_extern_macros {
- f(self, MacroNS);
- }
+ f(self, MacroNS);
}
fn macro_def(&self, mut ctxt: SyntaxContext) -> DefId {
@@ -1819,7 +1819,7 @@
fn add_to_glob_map(&mut self, id: NodeId, ident: Ident) {
if self.make_glob_map {
- self.glob_map.entry(id).or_insert_with(FxHashSet).insert(ident.name);
+ self.glob_map.entry(id).or_default().insert(ident.name);
}
}
@@ -1881,7 +1881,12 @@
};
let item = self.resolve_ident_in_module_unadjusted(
- module, ident, ns, false, record_used, path_span,
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ record_used,
+ path_span,
);
if let Ok(binding) = item {
// The ident resolves to an item.
@@ -1906,7 +1911,12 @@
let orig_current_module = self.current_module;
self.current_module = module; // Lexical resolutions can never be a privacy error.
let result = self.resolve_ident_in_module_unadjusted(
- module, ident, ns, false, record_used, path_span,
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ record_used,
+ path_span,
);
self.current_module = orig_current_module;
@@ -1954,8 +1964,14 @@
return Some(LexicalScopeBinding::Item(binding));
}
if let Some(prelude) = self.prelude {
- if let Ok(binding) = self.resolve_ident_in_module_unadjusted(prelude, ident, ns,
- false, false, path_span) {
+ if let Ok(binding) = self.resolve_ident_in_module_unadjusted(
+ ModuleOrUniformRoot::Module(prelude),
+ ident,
+ ns,
+ false,
+ false,
+ path_span,
+ ) {
return Some(LexicalScopeBinding::Item(binding));
}
}
@@ -2013,7 +2029,7 @@
}
fn resolve_ident_in_module(&mut self,
- module: Module<'a>,
+ module: ModuleOrUniformRoot<'a>,
mut ident: Ident,
ns: Namespace,
record_used: bool,
@@ -2021,8 +2037,10 @@
-> Result<&'a NameBinding<'a>, Determinacy> {
ident.span = ident.span.modern();
let orig_current_module = self.current_module;
- if let Some(def) = ident.span.adjust(module.expansion) {
- self.current_module = self.macro_def_scope(def);
+ if let ModuleOrUniformRoot::Module(module) = module {
+ if let Some(def) = ident.span.adjust(module.expansion) {
+ self.current_module = self.macro_def_scope(def);
+ }
}
let result = self.resolve_ident_in_module_unadjusted(
module, ident, ns, false, record_used, span,
@@ -2154,20 +2172,29 @@
fn resolve_item(&mut self, item: &Item) {
let name = item.ident.name;
-
debug!("(resolving item) resolving {}", name);
- self.check_proc_macro_attrs(&item.attrs);
-
match item.node {
- ItemKind::Enum(_, ref generics) |
ItemKind::Ty(_, ref generics) |
- ItemKind::Existential(_, ref generics) |
- ItemKind::Struct(_, ref generics) |
- ItemKind::Union(_, ref generics) |
- ItemKind::Fn(_, _, ref generics, _) => {
+ ItemKind::Fn(_, _, ref generics, _) |
+ ItemKind::Existential(_, ref generics) => {
self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind),
- |this| visit::walk_item(this, item));
+ |this| visit::walk_item(this, item));
+ }
+
+ ItemKind::Enum(_, ref generics) |
+ ItemKind::Struct(_, ref generics) |
+ ItemKind::Union(_, ref generics) => {
+ self.with_type_parameter_rib(HasTypeParameters(generics, ItemRibKind), |this| {
+ let item_def_id = this.definitions.local_def_id(item.id);
+ if this.session.features_untracked().self_in_typedefs {
+ this.with_self_rib(Def::SelfTy(None, Some(item_def_id)), |this| {
+ visit::walk_item(this, item);
+ });
+ } else {
+ visit::walk_item(this, item);
+ }
+ });
}
ItemKind::Impl(.., ref generics, ref opt_trait_ref, ref self_type, ref impl_items) =>
@@ -2186,8 +2213,6 @@
walk_list!(this, visit_param_bound, bounds);
for trait_item in trait_items {
- this.check_proc_macro_attrs(&trait_item.attrs);
-
let type_parameters = HasTypeParameters(&trait_item.generics,
TraitOrImplItemRibKind);
this.with_type_parameter_rib(type_parameters, |this| {
@@ -2410,13 +2435,16 @@
if def != Def::Err {
new_id = Some(def.def_id());
let span = trait_ref.path.span;
- if let PathResult::Module(module) = self.resolve_path(
- &path,
- None,
- false,
- span,
- CrateLint::SimplePath(trait_ref.ref_id),
- ) {
+ if let PathResult::Module(ModuleOrUniformRoot::Module(module)) =
+ self.resolve_path(
+ None,
+ &path,
+ None,
+ false,
+ span,
+ CrateLint::SimplePath(trait_ref.ref_id),
+ )
+ {
new_val = Some((module, trait_ref.clone()));
}
}
@@ -2454,16 +2482,16 @@
let item_def_id = this.definitions.local_def_id(item_id);
this.with_self_rib(Def::SelfTy(trait_id, Some(item_def_id)), |this| {
if let Some(trait_ref) = opt_trait_reference.as_ref() {
- // Resolve type arguments in trait path
+ // Resolve type arguments in the trait path.
visit::walk_trait_ref(this, trait_ref);
}
// Resolve the self type.
this.visit_ty(self_type);
// Resolve the type parameters.
this.visit_generics(generics);
+ // Resolve the items within the impl.
this.with_current_self_type(self_type, |this| {
for impl_item in impl_items {
- this.check_proc_macro_attrs(&impl_item.attrs);
this.resolve_visibility(&impl_item.vis);
// We also need a new scope for the impl item type parameters.
@@ -2476,8 +2504,8 @@
// If this is a trait impl, ensure the const
// exists in trait
this.check_trait_item(impl_item.ident,
- ValueNS,
- impl_item.span,
+ ValueNS,
+ impl_item.span,
|n, s| ConstNotMemberOfTrait(n, s));
this.with_constant_rib(|this|
visit::walk_impl_item(this, impl_item)
@@ -2487,8 +2515,8 @@
// If this is a trait impl, ensure the method
// exists in trait
this.check_trait_item(impl_item.ident,
- ValueNS,
- impl_item.span,
+ ValueNS,
+ impl_item.span,
|n, s| MethodNotMemberOfTrait(n, s));
visit::walk_impl_item(this, impl_item);
@@ -2497,8 +2525,8 @@
// If this is a trait impl, ensure the type
// exists in trait
this.check_trait_item(impl_item.ident,
- TypeNS,
- impl_item.span,
+ TypeNS,
+ impl_item.span,
|n, s| TypeNotMemberOfTrait(n, s));
this.visit_ty(ty);
@@ -2507,8 +2535,8 @@
// If this is a trait impl, ensure the type
// exists in trait
this.check_trait_item(impl_item.ident,
- TypeNS,
- impl_item.span,
+ TypeNS,
+ impl_item.span,
|n, s| TypeNotMemberOfTrait(n, s));
for bound in bounds {
@@ -2533,7 +2561,13 @@
// If there is a TraitRef in scope for an impl, then the method must be in the
// trait.
if let Some((module, _)) = self.current_trait_ref {
- if self.resolve_ident_in_module(module, ident, ns, false, span).is_err() {
+ if self.resolve_ident_in_module(
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ span,
+ ).is_err() {
let path = &self.current_trait_ref.as_ref().unwrap().1.path;
resolve_error(self, span, err(ident.name, &path_names_to_string(path)));
}
@@ -2698,7 +2732,7 @@
self.label_ribs.pop();
}
self.ribs[ValueNS].pop();
- if let Some(_) = anonymous_module {
+ if anonymous_module.is_some() {
self.ribs[TypeNS].pop();
}
debug!("(resolving block) leaving block");
@@ -2908,9 +2942,10 @@
(String::new(), "the crate root".to_string())
} else {
let mod_path = &path[..path.len() - 1];
- let mod_prefix = match this.resolve_path(mod_path, Some(TypeNS),
+ let mod_prefix = match this.resolve_path(None, mod_path, Some(TypeNS),
false, span, CrateLint::No) {
- PathResult::Module(module) => module.def(),
+ PathResult::Module(ModuleOrUniformRoot::Module(module)) =>
+ module.def(),
_ => None,
}.map_or(String::new(), |def| format!("{} ", def.kind_name()));
(mod_prefix, format!("`{}`", names_to_string(mod_path)))
@@ -2926,7 +2961,12 @@
if is_self_type(path, ns) {
__diagnostic_used!(E0411);
err.code(DiagnosticId::Error("E0411".into()));
- err.span_label(span, "`Self` is only available in traits and impls");
+ let available_in = if this.session.features_untracked().self_in_typedefs {
+ "impls, traits, and type definitions"
+ } else {
+ "traits and impls"
+ };
+ err.span_label(span, format!("`Self` is only available in {}", available_in));
return (err, Vec::new());
}
if is_self_value(path, ns) {
@@ -3045,7 +3085,7 @@
// parser issue where a struct literal is being used on an expression
// where a brace being opened means a block is being started. Look
// ahead for the next text to see if `span` is followed by a `{`.
- let cm = this.session.codemap();
+ let cm = this.session.source_map();
let mut sp = span;
loop {
sp = cm.next_point(sp);
@@ -3172,7 +3212,7 @@
err: &mut DiagnosticBuilder,
base_span: Span) {
debug!("type_ascription_suggetion {:?}", base_span);
- let cm = self.session.codemap();
+ let cm = self.session.source_map();
debug!("self.current_type_ascription {:?}", self.current_type_ascription);
if let Some(sp) = self.current_type_ascription.last() {
let mut sp = *sp;
@@ -3319,6 +3359,7 @@
}
let result = match self.resolve_path(
+ None,
&path,
Some(ns),
true,
@@ -3326,7 +3367,7 @@
crate_lint,
) {
PathResult::NonModule(path_res) => path_res,
- PathResult::Module(module) if !module.is_normal() => {
+ PathResult::Module(ModuleOrUniformRoot::Module(module)) if !module.is_normal() => {
PathResolution::new(module.def().unwrap())
}
// In `a(::assoc_item)*` `a` cannot be a module. If `a` does resolve to a module we
@@ -3341,18 +3382,21 @@
//
// Such behavior is required for backward compatibility.
// The same fallback is used when `a` resolves to nothing.
- PathResult::Module(..) | PathResult::Failed(..)
+ PathResult::Module(ModuleOrUniformRoot::Module(_)) |
+ PathResult::Failed(..)
if (ns == TypeNS || path.len() > 1) &&
self.primitive_type_table.primitive_types
.contains_key(&path[0].name) => {
let prim = self.primitive_type_table.primitive_types[&path[0].name];
PathResolution::with_unresolved_segments(Def::PrimTy(prim), path.len() - 1)
}
- PathResult::Module(module) => PathResolution::new(module.def().unwrap()),
+ PathResult::Module(ModuleOrUniformRoot::Module(module)) =>
+ PathResolution::new(module.def().unwrap()),
PathResult::Failed(span, msg, false) => {
resolve_error(self, span, ResolutionError::FailedToResolve(&msg));
err_path_resolution()
}
+ PathResult::Module(ModuleOrUniformRoot::UniformRoot(_)) |
PathResult::Failed(..) => return None,
PathResult::Indeterminate => bug!("indetermined path result in resolve_qpath"),
};
@@ -3362,6 +3406,7 @@
path[0].name != keywords::DollarCrate.name() {
let unqualified_result = {
match self.resolve_path(
+ None,
&[*path.last().unwrap()],
Some(ns),
false,
@@ -3369,7 +3414,8 @@
CrateLint::No,
) {
PathResult::NonModule(path_res) => path_res.base_def(),
- PathResult::Module(module) => module.def().unwrap(),
+ PathResult::Module(ModuleOrUniformRoot::Module(module)) =>
+ module.def().unwrap(),
_ => return Some(result),
}
};
@@ -3384,13 +3430,14 @@
fn resolve_path(
&mut self,
+ base_module: Option<ModuleOrUniformRoot<'a>>,
path: &[Ident],
opt_ns: Option<Namespace>, // `None` indicates a module path
record_used: bool,
path_span: Span,
crate_lint: CrateLint,
) -> PathResult<'a> {
- let mut module = None;
+ let mut module = base_module;
let mut allow_super = true;
let mut second_binding = None;
@@ -3410,65 +3457,57 @@
let ns = if is_last { opt_ns.unwrap_or(TypeNS) } else { TypeNS };
let name = ident.name;
- if i == 0 && ns == TypeNS && name == keywords::SelfValue.name() {
- let mut ctxt = ident.span.ctxt().modern();
- module = Some(self.resolve_self(&mut ctxt, self.current_module));
- continue
- } else if allow_super && ns == TypeNS && name == keywords::Super.name() {
- let mut ctxt = ident.span.ctxt().modern();
- let self_module = match i {
- 0 => self.resolve_self(&mut ctxt, self.current_module),
- _ => module.unwrap(),
- };
- if let Some(parent) = self_module.parent {
- module = Some(self.resolve_self(&mut ctxt, parent));
- continue
- } else {
+ allow_super &= ns == TypeNS &&
+ (name == keywords::SelfValue.name() ||
+ name == keywords::Super.name());
+
+ if ns == TypeNS {
+ if allow_super && name == keywords::Super.name() {
+ let mut ctxt = ident.span.ctxt().modern();
+ let self_module = match i {
+ 0 => Some(self.resolve_self(&mut ctxt, self.current_module)),
+ _ => match module {
+ Some(ModuleOrUniformRoot::Module(module)) => Some(module),
+ _ => None,
+ },
+ };
+ if let Some(self_module) = self_module {
+ if let Some(parent) = self_module.parent {
+ module = Some(ModuleOrUniformRoot::Module(
+ self.resolve_self(&mut ctxt, parent)));
+ continue;
+ }
+ }
let msg = "There are too many initial `super`s.".to_string();
return PathResult::Failed(ident.span, msg, false);
}
- } else if i == 0 && ns == TypeNS && name == keywords::Extern.name() {
- continue;
- }
- allow_super = false;
-
- if ns == TypeNS {
- if (i == 0 && name == keywords::CrateRoot.name()) ||
- (i == 0 && name == keywords::Crate.name()) ||
- (i == 0 && name == keywords::DollarCrate.name()) ||
- (i == 1 && name == keywords::Crate.name() &&
- path[0].name == keywords::CrateRoot.name()) {
- // `::a::b`, `crate::a::b`, `::crate::a::b` or `$crate::a::b`
- module = Some(self.resolve_crate_root(ident));
- continue
- } else if i == 1 && !ident.is_path_segment_keyword() {
- let prev_name = path[0].name;
- if prev_name == keywords::Extern.name() ||
- prev_name == keywords::CrateRoot.name() &&
+ if i == 0 {
+ if name == keywords::SelfValue.name() {
+ let mut ctxt = ident.span.ctxt().modern();
+ module = Some(ModuleOrUniformRoot::Module(
+ self.resolve_self(&mut ctxt, self.current_module)));
+ continue;
+ }
+ if name == keywords::Extern.name() ||
+ name == keywords::CrateRoot.name() &&
self.session.features_untracked().extern_absolute_paths &&
self.session.rust_2018() {
- // `::extern_crate::a::b`
- let crate_id = self.crate_loader.process_path_extern(name, ident.span);
- let crate_root =
- self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
- self.populate_module_if_necessary(crate_root);
- module = Some(crate_root);
- continue
+ module = Some(ModuleOrUniformRoot::UniformRoot(name));
+ continue;
+ }
+ if name == keywords::CrateRoot.name() ||
+ name == keywords::Crate.name() ||
+ name == keywords::DollarCrate.name() {
+ // `::a::b`, `crate::a::b` or `$crate::a::b`
+ module = Some(ModuleOrUniformRoot::Module(
+ self.resolve_crate_root(ident)));
+ continue;
}
}
}
// Report special messages for path segment keywords in wrong positions.
- if name == keywords::CrateRoot.name() && i != 0 ||
- name == keywords::DollarCrate.name() && i != 0 ||
- name == keywords::SelfValue.name() && i != 0 ||
- name == keywords::SelfType.name() && i != 0 ||
- name == keywords::Super.name() && i != 0 ||
- name == keywords::Extern.name() && i != 0 ||
- // we allow crate::foo and ::crate::foo but nothing else
- name == keywords::Crate.name() && i > 1 &&
- path[0].name != keywords::CrateRoot.name() ||
- name == keywords::Crate.name() && path.len() == 1 {
+ if ident.is_path_segment_keyword() && i != 0 {
let name_str = if name == keywords::CrateRoot.name() {
"crate root".to_string()
} else {
@@ -3513,7 +3552,7 @@
let def = binding.def();
let maybe_assoc = opt_ns != Some(MacroNS) && PathSource::Type.is_expected(def);
if let Some(next_module) = binding.module() {
- module = Some(next_module);
+ module = Some(ModuleOrUniformRoot::Module(next_module));
} else if def == Def::ToolMod && i + 1 != path.len() {
let def = Def::NonMacroAttr(NonMacroAttrKind::Tool);
return PathResult::NonModule(PathResolution::new(def));
@@ -3537,14 +3576,18 @@
}
Err(Undetermined) => return PathResult::Indeterminate,
Err(Determined) => {
- if let Some(module) = module {
+ if let Some(ModuleOrUniformRoot::Module(module)) = module {
if opt_ns.is_some() && !module.is_normal() {
return PathResult::NonModule(PathResolution::with_unresolved_segments(
module.def().unwrap(), path.len() - i
));
}
}
- let msg = if module.and_then(ModuleData::def) == self.graph_root.def() {
+ let module_def = match module {
+ Some(ModuleOrUniformRoot::Module(module)) => module.def(),
+ _ => None,
+ };
+ let msg = if module_def == self.graph_root.def() {
let is_mod = |def| match def { Def::Mod(..) => true, _ => false };
let mut candidates =
self.lookup_import_candidates(name, TypeNS, is_mod);
@@ -3568,7 +3611,10 @@
self.lint_if_path_starts_with_module(crate_lint, path, path_span, second_binding);
- PathResult::Module(module.unwrap_or(self.graph_root))
+ PathResult::Module(module.unwrap_or_else(|| {
+ span_bug!(path_span, "resolve_path: empty(?) path {:?} has no module", path);
+ }))
+
}
fn lint_if_path_starts_with_module(
@@ -3578,6 +3624,17 @@
path_span: Span,
second_binding: Option<&NameBinding>,
) {
+ // In the 2018 edition this lint is a hard error, so nothing to do
+ if self.session.rust_2018() {
+ return
+ }
+
+ // In the 2015 edition there's no use in emitting lints unless the
+ // crate's already enabled the feature that we're going to suggest
+ if !self.session.features_untracked().crate_in_paths {
+ return
+ }
+
let (diag_id, diag_span) = match crate_lint {
CrateLint::No => return,
CrateLint::SimplePath(id) => (id, path_span),
@@ -3620,24 +3677,11 @@
}
}
- self.lint_path_starts_with_module(diag_id, diag_span);
- }
-
- fn lint_path_starts_with_module(&self, id: NodeId, span: Span) {
- // In the 2018 edition this lint is a hard error, so nothing to do
- if self.session.rust_2018() {
- return
- }
- // In the 2015 edition there's no use in emitting lints unless the
- // crate's already enabled the feature that we're going to suggest
- if !self.session.features_untracked().crate_in_paths {
- return
- }
let diag = lint::builtin::BuiltinLintDiagnostics
- ::AbsPathWithModule(span);
+ ::AbsPathWithModule(diag_span);
self.session.buffer_lint_with_diagnostic(
lint::builtin::ABSOLUTE_PATHS_NOT_STARTING_WITH_CRATE,
- id, span,
+ diag_id, diag_span,
"absolute paths must start with `self`, `super`, \
`crate`, or an external crate name in the 2018 edition",
diag);
@@ -3677,14 +3721,14 @@
let seen = self.freevars_seen
.entry(function_id)
- .or_insert_with(|| NodeMap());
+ .or_default();
if let Some(&index) = seen.get(&node_id) {
def = Def::Upvar(node_id, index, function_id);
continue;
}
let vec = self.freevars
.entry(function_id)
- .or_insert_with(|| vec![]);
+ .or_default();
let depth = vec.len();
def = Def::Upvar(node_id, depth, function_id);
@@ -3782,8 +3826,13 @@
// Look for associated items in the current trait.
if let Some((module, _)) = self.current_trait_ref {
- if let Ok(binding) =
- self.resolve_ident_in_module(module, ident, ns, false, module.span) {
+ if let Ok(binding) = self.resolve_ident_in_module(
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ module.span,
+ ) {
let def = binding.def();
if filter_fn(def) {
return Some(if self.has_self.contains(&def.def_id()) {
@@ -3855,9 +3904,11 @@
} else {
// Search in module.
let mod_path = &path[..path.len() - 1];
- if let PathResult::Module(module) = self.resolve_path(mod_path, Some(TypeNS),
+ if let PathResult::Module(module) = self.resolve_path(None, mod_path, Some(TypeNS),
false, span, CrateLint::No) {
- add_module_candidates(module, &mut names);
+ if let ModuleOrUniformRoot::Module(module) = module {
+ add_module_candidates(module, &mut names);
+ }
}
}
@@ -4096,7 +4147,13 @@
let mut found_traits = Vec::new();
// Look for the current trait.
if let Some((module, _)) = self.current_trait_ref {
- if self.resolve_ident_in_module(module, ident, ns, false, module.span).is_ok() {
+ if self.resolve_ident_in_module(
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ module.span,
+ ).is_ok() {
let def_id = module.def_id().unwrap();
found_traits.push(TraitCandidate { def_id: def_id, import_id: None });
}
@@ -4125,6 +4182,7 @@
ns: Namespace,
module: Module<'a>,
found_traits: &mut Vec<TraitCandidate>) {
+ assert!(ns == TypeNS || ns == ValueNS);
let mut traits = module.traits.borrow_mut();
if traits.is_none() {
let mut collected_traits = Vec::new();
@@ -4143,8 +4201,14 @@
if ident.span.glob_adjust(module.expansion, binding.span.ctxt().modern()).is_none() {
continue
}
- if self.resolve_ident_in_module_unadjusted(module, ident, ns, false, false, module.span)
- .is_ok() {
+ if self.resolve_ident_in_module_unadjusted(
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ false,
+ module.span,
+ ).is_ok() {
let import_id = match binding.kind {
NameBindingKind::Import { directive, .. } => {
self.maybe_unused_trait_imports.insert(directive.id);
@@ -4256,7 +4320,7 @@
while let Some((in_module, path_segments)) = worklist.pop() {
// abort if the module is already found
- if let Some(_) = result { break; }
+ if result.is_some() { break; }
self.populate_module_if_necessary(in_module);
@@ -4370,6 +4434,14 @@
self.report_proc_macro_import(krate);
let mut reported_spans = FxHashSet();
+ for &(span_use, span_def) in &self.macro_expanded_macro_export_errors {
+ let msg = "macro-expanded `macro_export` macros from the current crate \
+ cannot be referred to by absolute paths";
+ self.session.struct_span_err(span_use, msg)
+ .span_note(span_def, "the macro is defined here")
+ .emit();
+ }
+
for &AmbiguityError { span, name, b1, b2, lexical } in &self.ambiguity_errors {
if !reported_spans.insert(span) { continue }
let participle = |binding: &NameBinding| {
@@ -4414,10 +4486,6 @@
}
fn report_shadowing_errors(&mut self) {
- for (ident, scope) in replace(&mut self.lexical_macro_resolutions, Vec::new()) {
- self.resolve_legacy_scope(scope, ident, true);
- }
-
let mut reported_errors = FxHashSet();
for binding in replace(&mut self.disallowed_shadowing, Vec::new()) {
if self.resolve_legacy_scope(&binding.parent, binding.ident, false).is_some() &&
@@ -4459,7 +4527,7 @@
false => "defined",
};
- let (name, span) = (ident.name, self.session.codemap().def_span(new_binding.span));
+ let (name, span) = (ident.name, self.session.source_map().def_span(new_binding.span));
if let Some(s) = self.name_already_seen.get(&name) {
if s == &span {
@@ -4498,7 +4566,7 @@
err.span_label(span, format!("`{}` re{} here", name, new_participle));
if !old_binding.span.is_dummy() {
- err.span_label(self.session.codemap().def_span(old_binding.span),
+ err.span_label(self.session.source_map().def_span(old_binding.span),
format!("previous {} of the {} `{}` here", old_noun, old_kind, name));
}
@@ -4510,7 +4578,7 @@
old_binding
};
- let cm = self.session.codemap();
+ let cm = self.session.source_map();
let rename_msg = "You can use `as` to change the binding name of the import";
if let (Ok(snippet), false) = (cm.span_to_snippet(binding.span),
@@ -4538,36 +4606,6 @@
err.emit();
self.name_already_seen.insert(name, span);
}
-
- fn check_proc_macro_attrs(&mut self, attrs: &[ast::Attribute]) {
- if self.use_extern_macros { return; }
-
- for attr in attrs {
- if attr.path.segments.len() > 1 {
- continue
- }
- let ident = attr.path.segments[0].ident;
- let result = self.resolve_lexical_macro_path_segment(ident,
- MacroNS,
- false,
- false,
- true,
- attr.path.span);
- if let Ok(binding) = result {
- if let SyntaxExtension::AttrProcMacro(..) = *binding.binding().get_macro(self) {
- attr::mark_known(attr);
-
- let msg = "attribute procedural macros are experimental";
- let feature = "use_extern_macros";
-
- feature_err(&self.session.parse_sess, feature,
- attr.span, GateIssue::Language, msg)
- .span_label(binding.span(), "procedural macro imported here")
- .emit();
- }
- }
- }
- }
}
fn is_self_type(path: &[Ident], namespace: Namespace) -> bool {
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index d680b2d..8f2e76d 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -10,12 +10,13 @@
use {AmbiguityError, CrateLint, Resolver, ResolutionError, is_known_tool, resolve_error};
use {Module, ModuleKind, NameBinding, NameBindingKind, PathResult, ToNameBinding};
+use ModuleOrUniformRoot;
use Namespace::{self, TypeNS, MacroNS};
use build_reduced_graph::{BuildReducedGraphVisitor, IsMacroExport};
use resolve_imports::ImportResolver;
use rustc::hir::def_id::{DefId, BUILTIN_MACROS_CRATE, CRATE_DEF_INDEX, DefIndex,
DefIndexAddressSpace};
-use rustc::hir::def::{Def, Export, NonMacroAttrKind};
+use rustc::hir::def::{Def, NonMacroAttrKind};
use rustc::hir::map::{self, DefCollector};
use rustc::{ty, lint};
use rustc::middle::cstore::CrateStore;
@@ -28,6 +29,7 @@
use syntax::ext::hygiene::{self, Mark};
use syntax::ext::tt::macro_rules;
use syntax::feature_gate::{self, feature_err, emit_feature_err, is_builtin_attr_name, GateIssue};
+use syntax::feature_gate::EXPLAIN_DERIVE_UNDERSCORE;
use syntax::fold::{self, Folder};
use syntax::parse::parser::PathStyle;
use syntax::parse::token::{self, Token};
@@ -195,9 +197,7 @@
self.current_module = invocation.module.get();
self.current_module.unresolved_invocations.borrow_mut().remove(&mark);
- self.unresolved_invocations_macro_export.remove(&mark);
self.current_module.unresolved_invocations.borrow_mut().extend(derives);
- self.unresolved_invocations_macro_export.extend(derives);
for &derive in derives {
self.invocations.insert(derive, invocation);
}
@@ -338,19 +338,37 @@
match attr_kind {
NonMacroAttrKind::Tool | NonMacroAttrKind::DeriveHelper |
NonMacroAttrKind::Custom if is_attr_invoc => {
+ let features = self.session.features_untracked();
if attr_kind == NonMacroAttrKind::Tool &&
- !self.session.features_untracked().tool_attributes {
+ !features.tool_attributes {
feature_err(&self.session.parse_sess, "tool_attributes",
invoc.span(), GateIssue::Language,
"tool attributes are unstable").emit();
}
- if attr_kind == NonMacroAttrKind::Custom &&
- !self.session.features_untracked().custom_attribute {
- let msg = format!("The attribute `{}` is currently unknown to the compiler \
- and may have meaning added to it in the future", path);
- feature_err(&self.session.parse_sess, "custom_attribute", invoc.span(),
- GateIssue::Language, &msg).emit();
+ if attr_kind == NonMacroAttrKind::Custom {
+ assert!(path.segments.len() == 1);
+ let name = path.segments[0].ident.name.as_str();
+ if name.starts_with("rustc_") {
+ if !features.rustc_attrs {
+ let msg = "unless otherwise specified, attributes with the prefix \
+ `rustc_` are reserved for internal compiler diagnostics";
+ feature_err(&self.session.parse_sess, "rustc_attrs", invoc.span(),
+ GateIssue::Language, &msg).emit();
+ }
+ } else if name.starts_with("derive_") {
+ if !features.custom_derive {
+ feature_err(&self.session.parse_sess, "custom_derive", invoc.span(),
+ GateIssue::Language, EXPLAIN_DERIVE_UNDERSCORE).emit();
+ }
+ } else if !features.custom_attribute {
+ let msg = format!("The attribute `{}` is currently unknown to the \
+ compiler and may have meaning added to it in the \
+ future", path);
+ feature_err(&self.session.parse_sess, "custom_attribute", invoc.span(),
+ GateIssue::Language, &msg).emit();
+ }
}
+
return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr {
mark_used: attr_kind == NonMacroAttrKind::Tool,
})));
@@ -506,22 +524,15 @@
self.current_module = if module.is_trait() { module.parent.unwrap() } else { module };
// Possibly apply the macro helper hack
- if self.use_extern_macros && kind == MacroKind::Bang && path.len() == 1 &&
+ if kind == MacroKind::Bang && path.len() == 1 &&
path[0].span.ctxt().outer().expn_info().map_or(false, |info| info.local_inner_macros) {
let root = Ident::new(keywords::DollarCrate.name(), path[0].span);
path.insert(0, root);
}
if path.len() > 1 {
- if !self.use_extern_macros && self.gated_errors.insert(span) {
- let msg = "non-ident macro paths are experimental";
- let feature = "use_extern_macros";
- emit_feature_err(&self.session.parse_sess, feature, span, GateIssue::Language, msg);
- self.found_unresolved_macro = true;
- return Err(Determinacy::Determined);
- }
-
- let def = match self.resolve_path(&path, Some(MacroNS), false, span, CrateLint::No) {
+ let res = self.resolve_path(None, &path, Some(MacroNS), false, span, CrateLint::No);
+ let def = match res {
PathResult::NonModule(path_res) => match path_res.base_def() {
Def::Err => Err(Determinacy::Determined),
def @ _ => {
@@ -638,7 +649,12 @@
WhereToResolve::Module(module) => {
let orig_current_module = mem::replace(&mut self.current_module, module);
let binding = self.resolve_ident_in_module_unadjusted(
- module, ident, ns, true, record_used, path_span,
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ true,
+ record_used,
+ path_span,
);
self.current_module = orig_current_module;
binding.map(MacroBinding::Modern)
@@ -650,7 +666,10 @@
}
}
WhereToResolve::BuiltinAttrs => {
- if is_builtin_attr_name(ident.name) {
+ // FIXME: Only built-in attributes are not considered as candidates for
+ // non-attributes to fight off regressions on stable channel (#53205).
+ // We need to come up with some more principled approach instead.
+ if is_attr && is_builtin_attr_name(ident.name) {
let binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin),
ty::Visibility::Public, ident.span, Mark::root())
.to_name_binding(self.arenas);
@@ -695,9 +714,14 @@
let mut result = Err(Determinacy::Determined);
if use_prelude {
if let Some(prelude) = self.prelude {
- if let Ok(binding) =
- self.resolve_ident_in_module_unadjusted(prelude, ident, ns,
- false, false, path_span) {
+ if let Ok(binding) = self.resolve_ident_in_module_unadjusted(
+ ModuleOrUniformRoot::Module(prelude),
+ ident,
+ ns,
+ false,
+ false,
+ path_span,
+ ) {
result = Ok(MacroBinding::Global(binding));
}
}
@@ -811,7 +835,6 @@
record_used: bool)
-> Option<MacroBinding<'a>> {
let ident = ident.modern();
- let mut possible_time_travel = None;
let mut relative_depth: u32 = 0;
let mut binding = None;
loop {
@@ -821,9 +844,6 @@
match invocation.expansion.get() {
LegacyScope::Invocation(_) => scope.set(invocation.legacy_scope.get()),
LegacyScope::Empty => {
- if possible_time_travel.is_none() {
- possible_time_travel = Some(scope);
- }
scope = &invocation.legacy_scope;
}
_ => {
@@ -838,7 +858,7 @@
}
LegacyScope::Binding(potential_binding) => {
if potential_binding.ident == ident {
- if (!self.use_extern_macros || record_used) && relative_depth > 0 {
+ if record_used && relative_depth > 0 {
self.disallowed_shadowing.push(potential_binding);
}
binding = Some(potential_binding);
@@ -852,28 +872,18 @@
let binding = if let Some(binding) = binding {
MacroBinding::Legacy(binding)
} else if let Some(binding) = self.macro_prelude.get(&ident.name).cloned() {
- if !self.use_extern_macros {
- self.record_use(ident, MacroNS, binding, DUMMY_SP);
- }
MacroBinding::Global(binding)
} else {
return None;
};
- if !self.use_extern_macros {
- if let Some(scope) = possible_time_travel {
- // Check for disallowed shadowing later
- self.lexical_macro_resolutions.push((ident, scope));
- }
- }
-
Some(binding)
}
pub fn finalize_current_module_macro_resolutions(&mut self) {
let module = self.current_module;
for &(ref path, span) in module.macro_resolutions.borrow().iter() {
- match self.resolve_path(&path, Some(MacroNS), true, span, CrateLint::No) {
+ match self.resolve_path(None, &path, Some(MacroNS), true, span, CrateLint::No) {
PathResult::NonModule(_) => {},
PathResult::Failed(span, msg, _) => {
resolve_error(self, span, ResolutionError::FailedToResolve(&msg));
@@ -976,9 +986,6 @@
find_best_match_for_name(names, name, None)
// Then check modules.
}).or_else(|| {
- if !self.use_extern_macros {
- return None;
- }
let is_macro = |def| {
if let Def::Macro(_, def_kind) = def {
def_kind == kind
@@ -1054,19 +1061,10 @@
let def = Def::Macro(def_id, MacroKind::Bang);
self.all_macros.insert(ident.name, def);
if attr::contains_name(&item.attrs, "macro_export") {
- if self.use_extern_macros {
- let module = self.graph_root;
- let vis = ty::Visibility::Public;
- self.define(module, ident, MacroNS,
- (def, vis, item.span, expansion, IsMacroExport));
- } else {
- self.macro_exports.push(Export {
- ident: ident.modern(),
- def: def,
- vis: ty::Visibility::Public,
- span: item.span,
- });
- }
+ let module = self.graph_root;
+ let vis = ty::Visibility::Public;
+ self.define(module, ident, MacroNS,
+ (def, vis, item.span, expansion, IsMacroExport));
} else {
self.unused_macros.insert(def_id);
}
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs
index a3a9b93..58390c2 100644
--- a/src/librustc_resolve/resolve_imports.rs
+++ b/src/librustc_resolve/resolve_imports.rs
@@ -10,7 +10,7 @@
use self::ImportDirectiveSubclass::*;
-use {AmbiguityError, CrateLint, Module, PerNS};
+use {AmbiguityError, CrateLint, Module, ModuleOrUniformRoot, PerNS};
use Namespace::{self, TypeNS, MacroNS};
use {NameBinding, NameBindingKind, ToNameBinding, PathResult, PrivacyError};
use Resolver;
@@ -24,7 +24,7 @@
use rustc::hir::def_id::{CRATE_DEF_INDEX, DefId};
use rustc::hir::def::*;
use rustc::session::DiagnosticMessageId;
-use rustc::util::nodemap::{FxHashMap, FxHashSet};
+use rustc::util::nodemap::FxHashSet;
use syntax::ast::{Ident, Name, NodeId, CRATE_NODE_ID};
use syntax::ext::base::Determinacy::{self, Determined, Undetermined};
@@ -34,6 +34,8 @@
use syntax_pos::Span;
use std::cell::{Cell, RefCell};
+use std::collections::BTreeMap;
+use std::fmt::Write;
use std::{mem, ptr};
/// Contains data for specific types of import directives.
@@ -85,11 +87,19 @@
pub parent: Module<'a>,
pub module_path: Vec<Ident>,
- pub imported_module: Cell<Option<Module<'a>>>, // the resolution of `module_path`
+ /// The resolution of `module_path`.
+ pub imported_module: Cell<Option<ModuleOrUniformRoot<'a>>>,
pub subclass: ImportDirectiveSubclass<'a>,
pub vis: Cell<ty::Visibility>,
pub expansion: Mark,
pub used: Cell<bool>,
+
+ /// Whether this import is a "canary" for the `uniform_paths` feature,
+ /// i.e. `use x::...;` results in an `use self::x as _;` canary.
+ /// This flag affects diagnostics: an error is reported if and only if
+ /// the import resolves successfully and an external crate with the same
+ /// name (`x` above) also exists; any resolution failures are ignored.
+ pub is_uniform_paths_canary: bool,
}
impl<'a> ImportDirective<'a> {
@@ -133,19 +143,102 @@
/// Attempts to resolve `ident` in namespaces `ns` of `module`.
/// Invariant: if `record_used` is `Some`, expansion and import resolution must be complete.
pub fn resolve_ident_in_module_unadjusted(&mut self,
- module: Module<'a>,
+ module: ModuleOrUniformRoot<'a>,
ident: Ident,
ns: Namespace,
restricted_shadowing: bool,
record_used: bool,
path_span: Span)
-> Result<&'a NameBinding<'a>, Determinacy> {
+ let module = match module {
+ ModuleOrUniformRoot::Module(module) => module,
+ ModuleOrUniformRoot::UniformRoot(root) => {
+ // HACK(eddyb): `resolve_path` uses `keywords::Invalid` to indicate
+ // paths of length 0, and currently these are relative `use` paths.
+ let can_be_relative = !ident.is_path_segment_keyword() &&
+ root == keywords::Invalid.name();
+ if can_be_relative {
+ // Relative paths should only get here if the feature-gate is on.
+ assert!(self.session.rust_2018() &&
+ self.session.features_untracked().uniform_paths);
+
+ // Try first to resolve relatively.
+ let mut ctxt = ident.span.ctxt().modern();
+ let self_module = self.resolve_self(&mut ctxt, self.current_module);
+
+ let binding = self.resolve_ident_in_module_unadjusted(
+ ModuleOrUniformRoot::Module(self_module),
+ ident,
+ ns,
+ restricted_shadowing,
+ record_used,
+ path_span,
+ );
+
+ // FIXME(eddyb) This may give false negatives, specifically
+ // if a crate with the same name is found in `extern_prelude`,
+ // preventing the check below this one from returning `binding`
+ // in all cases.
+ //
+ // That is, if there's no crate with the same name, `binding`
+ // is always returned, which is the result of doing the exact
+ // same lookup of `ident`, in the `self` module.
+ // But when a crate does exist, it will get chosen even when
+ // macro expansion could result in a success from the lookup
+ // in the `self` module, later on.
+ //
+ // NB. This is currently alleviated by the "ambiguity canaries"
+ // (see `is_uniform_paths_canary`) that get introduced for the
+ // maybe-relative imports handled here: if the false negative
+ // case were to arise, it would *also* cause an ambiguity error.
+ if binding.is_ok() {
+ return binding;
+ }
+
+ // Fall back to resolving to an external crate.
+ if !(ns == TypeNS && self.extern_prelude.contains(&ident.name)) {
+ // ... unless the crate name is not in the `extern_prelude`.
+ return binding;
+ }
+ }
+
+ let crate_root = if
+ ns == TypeNS &&
+ root != keywords::Extern.name() &&
+ (
+ ident.name == keywords::Crate.name() ||
+ ident.name == keywords::DollarCrate.name()
+ )
+ {
+ self.resolve_crate_root(ident)
+ } else if ns == TypeNS && !ident.is_path_segment_keyword() {
+ let crate_id =
+ self.crate_loader.process_path_extern(ident.name, ident.span);
+ self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX })
+ } else {
+ return Err(Determined);
+ };
+ self.populate_module_if_necessary(crate_root);
+ let binding = (crate_root, ty::Visibility::Public,
+ ident.span, Mark::root()).to_name_binding(self.arenas);
+ return Ok(binding);
+ }
+ };
+
self.populate_module_if_necessary(module);
let resolution = self.resolution(module, ident, ns)
.try_borrow_mut()
.map_err(|_| Determined)?; // This happens when there is a cycle of imports
+ if let Some(binding) = resolution.binding {
+ if !restricted_shadowing && binding.expansion != Mark::root() {
+ if let NameBindingKind::Def(_, true) = binding.kind {
+ self.macro_expanded_macro_export_errors.insert((path_span, binding.span));
+ }
+ }
+ }
+
if record_used {
if let Some(binding) = resolution.binding {
if let Some(shadowed_glob) = resolution.shadowed_glob {
@@ -211,9 +304,15 @@
// if it cannot be shadowed by some new item/import expanded from a macro.
// This happens either if there are no unexpanded macros, or expanded names cannot
// shadow globs (that happens in macro namespace or with restricted shadowing).
- let unexpanded_macros = !module.unresolved_invocations.borrow().is_empty() ||
- (ns == MacroNS && ptr::eq(module, self.graph_root) &&
- !self.unresolved_invocations_macro_export.is_empty());
+ //
+ // Additionally, any macro in any module can plant names in the root module if it creates
+ // `macro_export` macros, so the root module effectively has unresolved invocations if any
+ // module has unresolved invocations.
+ // However, it causes resolution/expansion to stuck too often (#53144), so, to make
+ // progress, we have to ignore those potential unresolved invocations from other modules
+ // and prohibit access to macro-expanded `macro_export` macros instead (unless restricted
+ // shadowing is enabled, see `macro_expanded_macro_export_errors`).
+ let unexpanded_macros = !module.unresolved_invocations.borrow().is_empty();
if let Some(binding) = resolution.binding {
if !unexpanded_macros || ns == MacroNS || restricted_shadowing {
return check_usable(self, binding);
@@ -246,7 +345,11 @@
if !self.is_accessible(glob_import.vis.get()) {
continue
}
- let module = unwrap_or!(glob_import.imported_module.get(), return Err(Undetermined));
+ let module = match glob_import.imported_module.get() {
+ Some(ModuleOrUniformRoot::Module(module)) => module,
+ Some(ModuleOrUniformRoot::UniformRoot(_)) => continue,
+ None => return Err(Undetermined),
+ };
let (orig_current_module, mut ident) = (self.current_module, ident.modern());
match ident.span.glob_adjust(module.expansion, glob_import.span.ctxt().modern()) {
Some(Some(def)) => self.current_module = self.macro_def_scope(def),
@@ -254,7 +357,12 @@
None => continue,
};
let result = self.resolve_ident_in_module_unadjusted(
- module, ident, ns, false, false, path_span,
+ ModuleOrUniformRoot::Module(module),
+ ident,
+ ns,
+ false,
+ false,
+ path_span,
);
self.current_module = orig_current_module;
match result {
@@ -276,7 +384,8 @@
root_span: Span,
root_id: NodeId,
vis: ty::Visibility,
- expansion: Mark) {
+ expansion: Mark,
+ is_uniform_paths_canary: bool) {
let current_module = self.current_module;
let directive = self.arenas.alloc_import_directive(ImportDirective {
parent: current_module,
@@ -290,8 +399,11 @@
vis: Cell::new(vis),
expansion,
used: Cell::new(false),
+ is_uniform_paths_canary,
});
+ debug!("add_import_directive({:?})", directive);
+
self.indeterminate_imports.push(directive);
match directive.subclass {
SingleImport { target, type_ns_only, .. } => {
@@ -505,11 +617,58 @@
self.finalize_resolutions_in(module);
}
+ #[derive(Default)]
+ struct UniformPathsCanaryResult {
+ module_scope: Option<Span>,
+ block_scopes: Vec<Span>,
+ }
+ // Collect all tripped `uniform_paths` canaries separately.
+ let mut uniform_paths_canaries: BTreeMap<
+ (Span, NodeId),
+ (Name, PerNS<UniformPathsCanaryResult>),
+ > = BTreeMap::new();
+
let mut errors = false;
let mut seen_spans = FxHashSet();
for i in 0 .. self.determined_imports.len() {
let import = self.determined_imports[i];
- if let Some((span, err)) = self.finalize_import(import) {
+ let error = self.finalize_import(import);
+
+ // For a `#![feature(uniform_paths)]` `use self::x as _` canary,
+ // failure is ignored, while success may cause an ambiguity error.
+ if import.is_uniform_paths_canary {
+ if error.is_some() {
+ continue;
+ }
+
+ let (name, result) = match import.subclass {
+ SingleImport { source, ref result, .. } => (source.name, result),
+ _ => bug!(),
+ };
+
+ let has_explicit_self =
+ import.module_path.len() > 0 &&
+ import.module_path[0].name == keywords::SelfValue.name();
+
+ let (prev_name, canary_results) =
+ uniform_paths_canaries.entry((import.span, import.id))
+ .or_insert((name, PerNS::default()));
+
+ // All the canaries with the same `id` should have the same `name`.
+ assert_eq!(*prev_name, name);
+
+ self.per_ns(|_, ns| {
+ if let Some(result) = result[ns].get().ok() {
+ if has_explicit_self {
+ // There should only be one `self::x` (module-scoped) canary.
+ assert_eq!(canary_results[ns].module_scope, None);
+ canary_results[ns].module_scope = Some(result.span);
+ } else {
+ canary_results[ns].block_scopes.push(result.span);
+ }
+ }
+ });
+ } else if let Some((span, err)) = error {
errors = true;
if let SingleImport { source, ref result, .. } = import.subclass {
@@ -536,12 +695,77 @@
}
}
+ for ((span, _), (name, results)) in uniform_paths_canaries {
+ self.per_ns(|this, ns| {
+ let results = &results[ns];
+
+ let has_external_crate =
+ ns == TypeNS && this.extern_prelude.contains(&name);
+
+ // An ambiguity requires more than one possible resolution.
+ let possible_resultions =
+ (has_external_crate as usize) +
+ (results.module_scope.is_some() as usize) +
+ (!results.block_scopes.is_empty() as usize);
+ if possible_resultions <= 1 {
+ return;
+ }
+
+ errors = true;
+
+ // Special-case the error when `self::x` finds its own `use x;`.
+ if has_external_crate &&
+ results.module_scope == Some(span) &&
+ results.block_scopes.is_empty() {
+ let msg = format!("`{}` import is redundant", name);
+ this.session.struct_span_err(span, &msg)
+ .span_label(span,
+ format!("refers to external crate `::{}`", name))
+ .span_label(span,
+ format!("defines `self::{}`, shadowing itself", name))
+ .help(&format!("remove or write `::{}` explicitly instead", name))
+ .note("relative `use` paths enabled by `#![feature(uniform_paths)]`")
+ .emit();
+ return;
+ }
+
+ let msg = format!("`{}` import is ambiguous", name);
+ let mut err = this.session.struct_span_err(span, &msg);
+ let mut suggestion_choices = String::new();
+ if has_external_crate {
+ write!(suggestion_choices, "`::{}`", name);
+ err.span_label(span,
+ format!("can refer to external crate `::{}`", name));
+ }
+ if let Some(span) = results.module_scope {
+ if !suggestion_choices.is_empty() {
+ suggestion_choices.push_str(" or ");
+ }
+ write!(suggestion_choices, "`self::{}`", name);
+ err.span_label(span,
+ format!("can refer to `self::{}`", name));
+ }
+ for &span in &results.block_scopes {
+ err.span_label(span,
+ format!("shadowed by block-scoped `{}`", name));
+ }
+ err.help(&format!("write {} explicitly instead", suggestion_choices));
+ err.note("relative `use` paths enabled by `#![feature(uniform_paths)]`");
+ err.emit();
+ });
+ }
+
// Report unresolved imports only if no hard error was already reported
// to avoid generating multiple errors on the same import.
if !errors {
- if let Some(import) = self.indeterminate_imports.iter().next() {
+ for import in &self.indeterminate_imports {
+ if import.is_uniform_paths_canary {
+ continue;
+ }
+
let error = ResolutionError::UnresolvedImport(None);
resolve_error(self.resolver, import.span, error);
+ break;
}
}
}
@@ -562,8 +786,18 @@
// For better failure detection, pretend that the import will not define any names
// while resolving its module path.
directive.vis.set(ty::Visibility::Invisible);
- let result = self.resolve_path(&directive.module_path[..], None, false,
- directive.span, directive.crate_lint());
+ let result = self.resolve_path(
+ Some(if directive.is_uniform_paths_canary {
+ ModuleOrUniformRoot::Module(directive.parent)
+ } else {
+ ModuleOrUniformRoot::UniformRoot(keywords::Invalid.name())
+ }),
+ &directive.module_path[..],
+ None,
+ false,
+ directive.span,
+ directive.crate_lint(),
+ );
directive.vis.set(vis);
match result {
@@ -630,77 +864,13 @@
fn finalize_import(&mut self, directive: &'b ImportDirective<'b>) -> Option<(Span, String)> {
self.current_module = directive.parent;
let ImportDirective { ref module_path, span, .. } = *directive;
- let mut warn_if_binding_comes_from_local_crate = false;
-
- // FIXME: Last path segment is treated specially in import resolution, so extern crate
- // mode for absolute paths needs some special support for single-segment imports.
- if module_path.len() == 1 && (module_path[0].name == keywords::CrateRoot.name() ||
- module_path[0].name == keywords::Extern.name()) {
- let is_extern = module_path[0].name == keywords::Extern.name() ||
- (self.session.features_untracked().extern_absolute_paths &&
- self.session.rust_2018());
- match directive.subclass {
- GlobImport { .. } if is_extern => {
- return Some((directive.span,
- "cannot glob-import all possible crates".to_string()));
- }
- GlobImport { .. } if self.session.features_untracked().extern_absolute_paths => {
- self.lint_path_starts_with_module(
- directive.root_id,
- directive.root_span,
- );
- }
- SingleImport { source, target, .. } => {
- let crate_root = if source.name == keywords::Crate.name() &&
- module_path[0].name != keywords::Extern.name() {
- if target.name == keywords::Crate.name() {
- return Some((directive.span,
- "crate root imports need to be explicitly named: \
- `use crate as name;`".to_string()));
- } else {
- Some(self.resolve_crate_root(source))
- }
- } else if is_extern && !source.is_path_segment_keyword() {
- let crate_id =
- self.resolver.crate_loader.process_use_extern(
- source.name,
- directive.span,
- directive.id,
- &self.resolver.definitions,
- );
- let crate_root =
- self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX });
- self.populate_module_if_necessary(crate_root);
- Some(crate_root)
- } else {
- warn_if_binding_comes_from_local_crate = true;
- None
- };
-
- if let Some(crate_root) = crate_root {
- let binding = (crate_root, ty::Visibility::Public, directive.span,
- directive.expansion).to_name_binding(self.arenas);
- let binding = self.arenas.alloc_name_binding(NameBinding {
- kind: NameBindingKind::Import {
- binding,
- directive,
- used: Cell::new(false),
- },
- vis: directive.vis.get(),
- span: directive.span,
- expansion: directive.expansion,
- });
- let _ = self.try_define(directive.parent, target, TypeNS, binding);
- let import = self.import_map.entry(directive.id).or_default();
- import[TypeNS] = Some(PathResolution::new(binding.def()));
- return None;
- }
- }
- _ => {}
- }
- }
let module_result = self.resolve_path(
+ Some(if directive.is_uniform_paths_canary {
+ ModuleOrUniformRoot::Module(directive.parent)
+ } else {
+ ModuleOrUniformRoot::UniformRoot(keywords::Invalid.name())
+ }),
&module_path,
None,
true,
@@ -720,7 +890,7 @@
if !self_path.is_empty() && !is_special(self_path[0]) &&
!(self_path.len() > 1 && is_special(self_path[1])) {
self_path[0].name = keywords::SelfValue.name();
- self_result = Some(self.resolve_path(&self_path, None, false,
+ self_result = Some(self.resolve_path(None, &self_path, None, false,
span, CrateLint::No));
}
return if let Some(PathResult::Module(..)) = self_result {
@@ -734,12 +904,27 @@
let (ident, result, type_ns_only) = match directive.subclass {
SingleImport { source, ref result, type_ns_only, .. } => (source, result, type_ns_only),
- GlobImport { .. } if module.def_id() == directive.parent.def_id() => {
- // Importing a module into itself is not allowed.
- return Some((directive.span,
- "Cannot glob-import a module into itself.".to_string()));
- }
GlobImport { is_prelude, ref max_vis } => {
+ if module_path.len() <= 1 {
+ // HACK(eddyb) `lint_if_path_starts_with_module` needs at least
+ // 2 segments, so the `resolve_path` above won't trigger it.
+ let mut full_path = module_path.clone();
+ full_path.push(keywords::Invalid.ident());
+ self.lint_if_path_starts_with_module(
+ directive.crate_lint(),
+ &full_path,
+ directive.span,
+ None,
+ );
+ }
+
+ if let ModuleOrUniformRoot::Module(module) = module {
+ if module.def_id() == directive.parent.def_id() {
+ // Importing a module into itself is not allowed.
+ return Some((directive.span,
+ "Cannot glob-import a module into itself.".to_string()));
+ }
+ }
if !is_prelude &&
max_vis.get() != ty::Visibility::Invisible && // Allow empty globs.
!max_vis.get().is_at_least(directive.vis.get(), &*self) {
@@ -756,8 +941,10 @@
if let Ok(binding) = result[ns].get() {
all_ns_err = false;
if this.record_use(ident, ns, binding, directive.span) {
- this.resolution(module, ident, ns).borrow_mut().binding =
- Some(this.dummy_binding);
+ if let ModuleOrUniformRoot::Module(module) = module {
+ this.resolution(module, ident, ns).borrow_mut().binding =
+ Some(this.dummy_binding);
+ }
}
}
});
@@ -772,8 +959,13 @@
});
return if all_ns_failed {
- let resolutions = module.resolutions.borrow();
- let names = resolutions.iter().filter_map(|(&(ref i, _), resolution)| {
+ let resolutions = match module {
+ ModuleOrUniformRoot::Module(module) =>
+ Some(module.resolutions.borrow()),
+ ModuleOrUniformRoot::UniformRoot(_) => None,
+ };
+ let resolutions = resolutions.as_ref().into_iter().flat_map(|r| r.iter());
+ let names = resolutions.filter_map(|(&(ref i, _), resolution)| {
if *i == ident { return None; } // Never suggest the same name
match *resolution.borrow() {
NameResolution { binding: Some(name_binding), .. } => {
@@ -799,11 +991,24 @@
Some(name) => format!(". Did you mean to use `{}`?", name),
None => "".to_owned(),
};
- let module_str = module_to_string(module);
- 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)
+ let msg = match module {
+ ModuleOrUniformRoot::Module(module) => {
+ let module_str = module_to_string(module);
+ if let Some(module_str) = module_str {
+ format!("no `{}` in `{}`{}", ident, module_str, lev_suggestion)
+ } else {
+ format!("no `{}` in the root{}", ident, lev_suggestion)
+ }
+ }
+ ModuleOrUniformRoot::UniformRoot(_) => {
+ if !ident.is_path_segment_keyword() {
+ format!("no `{}` external crate{}", ident, lev_suggestion)
+ } else {
+ // HACK(eddyb) this shows up for `self` & `super`, which
+ // should work instead - for now keep the same error message.
+ format!("no `{}` in the root{}", ident, lev_suggestion)
+ }
+ }
};
Some((span, msg))
} else {
@@ -854,26 +1059,20 @@
}
}
- if warn_if_binding_comes_from_local_crate {
- let mut warned = false;
+ if module_path.len() <= 1 {
+ // HACK(eddyb) `lint_if_path_starts_with_module` needs at least
+ // 2 segments, so the `resolve_path` above won't trigger it.
+ let mut full_path = module_path.clone();
+ full_path.push(ident);
self.per_ns(|this, ns| {
- let binding = match result[ns].get().ok() {
- Some(b) => b,
- None => return
- };
- if let NameBindingKind::Import { directive: d, .. } = binding.kind {
- if let ImportDirectiveSubclass::ExternCrate(..) = d.subclass {
- return
- }
+ if let Ok(binding) = result[ns].get() {
+ this.lint_if_path_starts_with_module(
+ directive.crate_lint(),
+ &full_path,
+ directive.span,
+ Some(binding),
+ );
}
- if warned {
- return
- }
- warned = true;
- this.lint_path_starts_with_module(
- directive.root_id,
- directive.root_span,
- );
});
}
@@ -890,7 +1089,15 @@
}
fn resolve_glob_import(&mut self, directive: &'b ImportDirective<'b>) {
- let module = directive.imported_module.get().unwrap();
+ let module = match directive.imported_module.get().unwrap() {
+ ModuleOrUniformRoot::Module(module) => module,
+ ModuleOrUniformRoot::UniformRoot(_) => {
+ self.session.span_err(directive.span,
+ "cannot glob-import all possible crates");
+ return;
+ }
+ };
+
self.populate_module_if_necessary(module);
if let Some(Def::Trait(_)) = module.def() {
@@ -935,24 +1142,6 @@
*module.globs.borrow_mut() = Vec::new();
let mut reexports = Vec::new();
- let mut exported_macro_names = FxHashMap();
- if ptr::eq(module, self.graph_root) {
- let macro_exports = mem::replace(&mut self.macro_exports, Vec::new());
- for export in macro_exports.into_iter().rev() {
- if let Some(later_span) = exported_macro_names.insert(export.ident.modern(),
- export.span) {
- self.session.buffer_lint_with_diagnostic(
- DUPLICATE_MACRO_EXPORTS,
- CRATE_NODE_ID,
- later_span,
- &format!("a macro named `{}` has already been exported", export.ident),
- BuiltinLintDiagnostics::DuplicatedMacroExports(
- export.ident, export.span, later_span));
- } else {
- reexports.push(export);
- }
- }
- }
for (&(ident, ns), resolution) in module.resolutions.borrow().iter() {
let resolution = &mut *resolution.borrow_mut();
@@ -967,16 +1156,6 @@
if !def.def_id().is_local() {
self.cstore.export_macros_untracked(def.def_id().krate);
}
- if let Def::Macro(..) = def {
- if let Some(&span) = exported_macro_names.get(&ident.modern()) {
- let msg =
- format!("a macro named `{}` has already been exported", ident);
- self.session.struct_span_err(span, &msg)
- .span_label(span, format!("`{}` already exported", ident))
- .span_note(binding.span, "previous macro export here")
- .emit();
- }
- }
reexports.push(Export {
ident: ident.modern(),
def: def,
@@ -1012,8 +1191,10 @@
};
let mut err = self.session.struct_span_err(binding.span, &msg);
- let imported_module = directive.imported_module.get()
- .expect("module should exist");
+ let imported_module = match directive.imported_module.get() {
+ Some(ModuleOrUniformRoot::Module(module)) => module,
+ _ => bug!("module should exist"),
+ };
let resolutions = imported_module.parent.expect("parent should exist")
.resolutions.borrow();
let enum_path_segment_index = directive.module_path.len() - 1;
@@ -1024,8 +1205,8 @@
let enum_span = enum_resolution.borrow()
.binding.expect("binding should exist")
.span;
- let enum_def_span = self.session.codemap().def_span(enum_span);
- let enum_def_snippet = self.session.codemap()
+ let enum_def_span = self.session.source_map().def_span(enum_span);
+ let enum_def_snippet = self.session.source_map()
.span_to_snippet(enum_def_span).expect("snippet should exist");
// potentially need to strip extant `crate`/`pub(path)` for suggestion
let after_vis_index = enum_def_snippet.find("enum")
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 04a4bca..c6cec2e 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -41,7 +41,7 @@
ty_to_string
};
use syntax::ptr::P;
-use syntax::codemap::{Spanned, DUMMY_SP, respan};
+use syntax::source_map::{Spanned, DUMMY_SP, respan};
use syntax_pos::*;
use {escape, generated_code, lower_attributes, PathCollector, SaveContext};
@@ -1368,7 +1368,7 @@
let qualname = format!("::{}", self.tcx.node_path_str(id));
- let cm = self.tcx.sess.codemap();
+ let cm = self.tcx.sess.source_map();
let filename = cm.span_to_filename(span);
let data_id = ::id_from_node_id(id, &self.save_ctxt);
let children = m.items
diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs
index 2fe7d73..d2e52f9 100644
--- a/src/librustc_save_analysis/json_dumper.rs
+++ b/src/librustc_save_analysis/json_dumper.rs
@@ -39,7 +39,7 @@
impl<'b, W: Write> DumpOutput for WriteOutput<'b, W> {
fn dump(&mut self, result: &Analysis) {
- if let Err(_) = write!(self.output, "{}", as_json(&result)) {
+ if write!(self.output, "{}", as_json(&result)).is_err() {
error!("Error writing output");
}
}
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index 703489f..b2d7885 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -12,6 +12,7 @@
html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "https://doc.rust-lang.org/nightly/")]
#![feature(custom_attribute)]
+#![cfg_attr(not(stage0), feature(nll))]
#![allow(unused_attributes)]
#![recursion_limit="256"]
@@ -55,14 +56,14 @@
use std::path::{Path, PathBuf};
use syntax::ast::{self, Attribute, NodeId, PatKind};
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::parse::lexer::comments::strip_doc_comment_decoration;
use syntax::parse::token;
use syntax::print::pprust;
use syntax::symbol::keywords;
use syntax::visit::{self, Visitor};
use syntax::print::pprust::{arg_to_string, ty_to_string};
-use syntax::codemap::MacroAttribute;
+use syntax::source_map::MacroAttribute;
use syntax_pos::*;
use json_dumper::JsonDumper;
@@ -94,7 +95,7 @@
fn span_from_span(&self, span: Span) -> SpanData {
use rls_span::{Column, Row};
- let cm = self.tcx.sess.codemap();
+ let cm = self.tcx.sess.source_map();
let start = cm.lookup_char_pos(span.lo());
let end = cm.lookup_char_pos(span.hi());
@@ -121,11 +122,11 @@
continue;
}
};
- let lo_loc = self.span_utils.sess.codemap().lookup_char_pos(span.lo());
+ let lo_loc = self.span_utils.sess.source_map().lookup_char_pos(span.lo());
result.push(ExternalCrateData {
// FIXME: change file_name field to PathBuf in rls-data
// https://github.com/nrc/rls-data/issues/7
- file_name: SpanUtils::make_path_string(&lo_loc.file.name),
+ file_name: self.span_utils.make_path_string(&lo_loc.file.name),
num: n.as_u32(),
id: GlobalCrateId {
name: self.tcx.crate_name(n).to_string(),
@@ -267,7 +268,7 @@
ast::ItemKind::Mod(ref m) => {
let qualname = format!("::{}", self.tcx.node_path_str(item.id));
- let cm = self.tcx.sess.codemap();
+ let cm = self.tcx.sess.source_map();
let filename = cm.span_to_filename(m.inner);
let sub_span = self.span_utils
diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs
index 4d93e81..e1a3829 100644
--- a/src/librustc_save_analysis/span_utils.rs
+++ b/src/librustc_save_analysis/span_utils.rs
@@ -13,7 +13,6 @@
use generated_code;
use std::cell::Cell;
-use std::env;
use syntax::parse::lexer::{self, StringReader};
use syntax::parse::token::{self, Token};
@@ -36,11 +35,10 @@
}
}
- pub fn make_path_string(path: &FileName) -> String {
+ pub fn make_path_string(&self, path: &FileName) -> String {
match *path {
FileName::Real(ref path) if !path.is_absolute() =>
- env::current_dir()
- .unwrap()
+ self.sess.working_dir.0
.join(&path)
.display()
.to_string(),
@@ -49,7 +47,7 @@
}
pub fn snippet(&self, span: Span) -> String {
- match self.sess.codemap().span_to_snippet(span) {
+ match self.sess.source_map().span_to_snippet(span) {
Ok(s) => s,
Err(_) => String::new(),
}
@@ -153,7 +151,7 @@
}
#[cfg(debug_assertions)] {
if angle_count != 0 || bracket_count != 0 {
- let loc = self.sess.codemap().lookup_char_pos(span.lo());
+ let loc = self.sess.source_map().lookup_char_pos(span.lo());
span_bug!(
span,
"Mis-counted brackets when breaking path? Parsing '{}' \
@@ -278,9 +276,9 @@
None => return true,
};
- //If the span comes from a fake filemap, filter it.
+ //If the span comes from a fake source_file, filter it.
if !self.sess
- .codemap()
+ .source_map()
.lookup_char_pos(parent.lo())
.file
.is_real_file()
diff --git a/src/librustc_target/abi/call/mips64.rs b/src/librustc_target/abi/call/mips64.rs
index 3734e56..8e2dd99 100644
--- a/src/librustc_target/abi/call/mips64.rs
+++ b/src/librustc_target/abi/call/mips64.rs
@@ -145,7 +145,7 @@
// Extract first 8 chunks as the prefix
let rest_size = size - Size::from_bytes(8) * prefix_index as u64;
arg.cast_to(CastTarget {
- prefix: prefix,
+ prefix,
prefix_chunk: Size::from_bytes(8),
rest: Uniform { unit: Reg::i64(), total: rest_size }
});
diff --git a/src/librustc_target/abi/call/mod.rs b/src/librustc_target/abi/call/mod.rs
index f65fa34..78ed4b2 100644
--- a/src/librustc_target/abi/call/mod.rs
+++ b/src/librustc_target/abi/call/mod.rs
@@ -44,7 +44,9 @@
/// a single uniform or a pair of registers.
Cast(CastTarget),
/// Pass the argument indirectly via a hidden pointer.
- Indirect(ArgAttributes),
+ /// The second value, if any, is for the extra data (vtable or length)
+ /// which indicates that it refers to an unsized rvalue.
+ Indirect(ArgAttributes, Option<ArgAttributes>),
}
// Hack to disable non_upper_case_globals only for the bitflags! and not for the rest
@@ -90,7 +92,7 @@
}
pub fn set(&mut self, attr: ArgAttribute) -> &mut Self {
- self.regular = self.regular | attr;
+ self.regular |= attr;
self
}
@@ -229,7 +231,7 @@
pub fn align<C: HasDataLayout>(&self, cx: C) -> Align {
self.prefix.iter()
- .filter_map(|x| x.map(|kind| Reg { kind: kind, size: self.prefix_chunk }.align(cx)))
+ .filter_map(|x| x.map(|kind| Reg { kind, size: self.prefix_chunk }.align(cx)))
.fold(cx.data_layout().aggregate_align.max(self.rest.align(cx)),
|acc, align| acc.max(align))
}
@@ -368,13 +370,19 @@
// i686-pc-windows-msvc, it results in wrong stack offsets.
// attrs.pointee_align = Some(self.layout.align);
- self.mode = PassMode::Indirect(attrs);
+ let extra_attrs = if self.layout.is_unsized() {
+ Some(ArgAttributes::new())
+ } else {
+ None
+ };
+
+ self.mode = PassMode::Indirect(attrs, extra_attrs);
}
pub fn make_indirect_byval(&mut self) {
self.make_indirect();
match self.mode {
- PassMode::Indirect(ref mut attrs) => {
+ PassMode::Indirect(ref mut attrs, _) => {
attrs.set(ArgAttribute::ByVal);
}
_ => unreachable!()
@@ -409,7 +417,21 @@
pub fn is_indirect(&self) -> bool {
match self.mode {
- PassMode::Indirect(_) => true,
+ PassMode::Indirect(..) => true,
+ _ => false
+ }
+ }
+
+ pub fn is_sized_indirect(&self) -> bool {
+ match self.mode {
+ PassMode::Indirect(_, None) => true,
+ _ => false
+ }
+ }
+
+ pub fn is_unsized_indirect(&self) -> bool {
+ match self.mode {
+ PassMode::Indirect(_, Some(_)) => true,
_ => false
}
}
@@ -506,7 +528,7 @@
a => return Err(format!("unrecognized arch \"{}\" in target specification", a))
}
- if let PassMode::Indirect(ref mut attrs) = self.ret.mode {
+ if let PassMode::Indirect(ref mut attrs, _) = self.ret.mode {
attrs.set(ArgAttribute::StructRet);
}
diff --git a/src/librustc_target/abi/call/x86.rs b/src/librustc_target/abi/call/x86.rs
index 0c0040d..1dcaafc 100644
--- a/src/librustc_target/abi/call/x86.rs
+++ b/src/librustc_target/abi/call/x86.rs
@@ -99,9 +99,10 @@
for arg in &mut fty.args {
let attrs = match arg.mode {
PassMode::Ignore |
- PassMode::Indirect(_) => continue,
+ PassMode::Indirect(_, None) => continue,
PassMode::Direct(ref mut attrs) => attrs,
PassMode::Pair(..) |
+ PassMode::Indirect(_, Some(_)) |
PassMode::Cast(_) => {
unreachable!("x86 shouldn't be passing arguments by {:?}", arg.mode)
}
diff --git a/src/librustc_target/abi/call/x86_64.rs b/src/librustc_target/abi/call/x86_64.rs
index a443255..eade086 100644
--- a/src/librustc_target/abi/call/x86_64.rs
+++ b/src/librustc_target/abi/call/x86_64.rs
@@ -199,10 +199,8 @@
_ => {}
}
}
- if arg.layout.is_aggregate() {
- if int_regs < needed_int || sse_regs < needed_sse {
- cls_or_mem = Err(Memory);
- }
+ if arg.layout.is_aggregate() && (int_regs < needed_int || sse_regs < needed_sse) {
+ cls_or_mem = Err(Memory);
}
}
}
diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs
index dac4738..16b5241 100644
--- a/src/librustc_target/abi/mod.rs
+++ b/src/librustc_target/abi/mod.rs
@@ -93,17 +93,17 @@
let mut dl = TargetDataLayout::default();
let mut i128_align_src = 64;
for spec in target.data_layout.split('-') {
- match &spec.split(':').collect::<Vec<_>>()[..] {
- &["e"] => dl.endian = Endian::Little,
- &["E"] => dl.endian = Endian::Big,
- &["a", ref a..] => dl.aggregate_align = align(a, "a")?,
- &["f32", ref a..] => dl.f32_align = align(a, "f32")?,
- &["f64", ref a..] => dl.f64_align = align(a, "f64")?,
- &[p @ "p", s, ref a..] | &[p @ "p0", s, ref a..] => {
+ match spec.split(':').collect::<Vec<_>>()[..] {
+ ["e"] => dl.endian = Endian::Little,
+ ["E"] => dl.endian = Endian::Big,
+ ["a", ref a..] => dl.aggregate_align = align(a, "a")?,
+ ["f32", ref a..] => dl.f32_align = align(a, "f32")?,
+ ["f64", ref a..] => dl.f64_align = align(a, "f64")?,
+ [p @ "p", s, ref a..] | [p @ "p0", s, ref a..] => {
dl.pointer_size = size(s, p)?;
dl.pointer_align = align(a, p)?;
}
- &[s, ref a..] if s.starts_with("i") => {
+ [s, ref a..] if s.starts_with("i") => {
let bits = match s[1..].parse::<u64>() {
Ok(bits) => bits,
Err(_) => {
@@ -127,7 +127,7 @@
dl.i128_align = a;
}
}
- &[s, ref a..] if s.starts_with("v") => {
+ [s, ref a..] if s.starts_with("v") => {
let v_size = size(&s[1..], "v")?;
let a = align(a, s)?;
if let Some(v) = dl.vector_align.iter_mut().find(|v| v.0 == v_size) {
@@ -429,8 +429,8 @@
}
impl Integer {
- pub fn size(&self) -> Size {
- match *self {
+ pub fn size(self) -> Size {
+ match self {
I8 => Size::from_bytes(1),
I16 => Size::from_bytes(2),
I32 => Size::from_bytes(4),
@@ -439,10 +439,10 @@
}
}
- pub fn align<C: HasDataLayout>(&self, cx: C) -> Align {
+ pub fn align<C: HasDataLayout>(self, cx: C) -> Align {
let dl = cx.data_layout();
- match *self {
+ match self {
I8 => dl.i8_align,
I16 => dl.i16_align,
I32 => dl.i32_align,
@@ -522,15 +522,15 @@
}
impl FloatTy {
- pub fn ty_to_string(&self) -> &'static str {
- match *self {
+ pub fn ty_to_string(self) -> &'static str {
+ match self {
FloatTy::F32 => "f32",
FloatTy::F64 => "f64",
}
}
- pub fn bit_width(&self) -> usize {
- match *self {
+ pub fn bit_width(self) -> usize {
+ match self {
FloatTy::F32 => 32,
FloatTy::F64 => 64,
}
@@ -596,7 +596,16 @@
pub value: Primitive,
/// Inclusive wrap-around range of valid values, that is, if
- /// min > max, it represents min..=u128::MAX followed by 0..=max.
+ /// start > end, it represents `start..=max_value()`,
+ /// followed by `0..=end`.
+ ///
+ /// That is, for an i8 primitive, a range of `254..=2` means following
+ /// sequence:
+ ///
+ /// 254 (-2), 255 (-1), 0, 1, 2
+ ///
+ /// This is intended specifically to mirror LLVM’s `!range` metadata,
+ /// semantics.
// FIXME(eddyb) always use the shortest range, e.g. by finding
// the largest space between two consecutive valid values and
// taking everything else as the (shortest) valid range.
diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs
index af2697f..5f5cc4c 100644
--- a/src/librustc_target/lib.rs
+++ b/src/librustc_target/lib.rs
@@ -23,6 +23,7 @@
#![feature(box_syntax)]
#![feature(const_fn)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(slice_patterns)]
#[macro_use]
diff --git a/src/librustc_target/spec/aarch64_pc_windows_msvc.rs b/src/librustc_target/spec/aarch64_pc_windows_msvc.rs
new file mode 100644
index 0000000..8747f23
--- /dev/null
+++ b/src/librustc_target/spec/aarch64_pc_windows_msvc.rs
@@ -0,0 +1,35 @@
+// 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.
+
+use spec::{LinkerFlavor, Target, TargetResult, PanicStrategy, LldFlavor};
+
+pub fn target() -> TargetResult {
+ let mut base = super::windows_msvc_base::opts();
+ base.max_atomic_width = Some(64);
+ base.has_elf_tls = true;
+
+ // FIXME: this shouldn't be panic=abort, it should be panic=unwind
+ base.panic_strategy = PanicStrategy::Abort;
+ base.linker = Some("rust-lld".to_owned());
+
+ Ok(Target {
+ llvm_target: "aarch64-pc-windows-msvc".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "64".to_string(),
+ target_c_int_width: "32".to_string(),
+ data_layout: "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128".to_string(),
+ arch: "aarch64".to_string(),
+ target_os: "windows".to_string(),
+ target_env: "msvc".to_string(),
+ target_vendor: "pc".to_string(),
+ linker_flavor: LinkerFlavor::Lld(LldFlavor::Link),
+ options: base,
+ })
+}
diff --git a/src/librustc_target/spec/aarch64_unknown_netbsd.rs b/src/librustc_target/spec/aarch64_unknown_netbsd.rs
new file mode 100644
index 0000000..c300855
--- /dev/null
+++ b/src/librustc_target/spec/aarch64_unknown_netbsd.rs
@@ -0,0 +1,31 @@
+// 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.
+
+use spec::{LinkerFlavor, Target, TargetResult};
+
+pub fn target() -> TargetResult {
+ let mut base = super::netbsd_base::opts();
+ base.max_atomic_width = Some(128);
+ base.abi_blacklist = super::arm_base::abi_blacklist();
+
+ Ok(Target {
+ llvm_target: "aarch64-unknown-netbsd".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "64".to_string(),
+ target_c_int_width: "32".to_string(),
+ data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
+ arch: "aarch64".to_string(),
+ target_os: "netbsd".to_string(),
+ target_env: "".to_string(),
+ target_vendor: "unknown".to_string(),
+ linker_flavor: LinkerFlavor::Gcc,
+ options: base,
+ })
+}
diff --git a/src/librustc_target/spec/aarch64_unknown_none.rs b/src/librustc_target/spec/aarch64_unknown_none.rs
new file mode 100644
index 0000000..cfba061
--- /dev/null
+++ b/src/librustc_target/spec/aarch64_unknown_none.rs
@@ -0,0 +1,46 @@
+// 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.
+
+// Generic AArch64 target for bare-metal code
+//
+// Can be used in conjunction with the `target-feature` and
+// `target-cpu` compiler flags to opt-in more hardware-specific
+// features.
+//
+// For example, `-C target-cpu=cortex-a53`.
+
+use super::{LldFlavor, LinkerFlavor, Target, TargetOptions, PanicStrategy};
+
+pub fn target() -> Result<Target, String> {
+ let opts = TargetOptions {
+ linker: Some("rust-lld".to_owned()),
+ executables: true,
+ relocation_model: "static".to_string(),
+ disable_redzone: true,
+ linker_is_gnu: true,
+ max_atomic_width: Some(128),
+ panic_strategy: PanicStrategy::Abort,
+ abi_blacklist: super::arm_base::abi_blacklist(),
+ .. Default::default()
+ };
+ Ok(Target {
+ llvm_target: "aarch64-unknown-none".to_string(),
+ target_endian: "little".to_string(),
+ target_pointer_width: "64".to_string(),
+ target_c_int_width: "32".to_string(),
+ target_os: "none".to_string(),
+ target_env: "".to_string(),
+ target_vendor: "".to_string(),
+ data_layout: "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128".to_string(),
+ arch: "aarch64".to_string(),
+ linker_flavor: LinkerFlavor::Lld(LldFlavor::Ld),
+ options: opts,
+ })
+}
diff --git a/src/librustc_target/spec/abi.rs b/src/librustc_target/spec/abi.rs
index 317cdb4..6d8c8eb 100644
--- a/src/librustc_target/spec/abi.rs
+++ b/src/librustc_target/spec/abi.rs
@@ -51,7 +51,7 @@
}
#[allow(non_upper_case_globals)]
-const AbiDatas: &'static [AbiData] = &[
+const AbiDatas: &[AbiData] = &[
// Platform-specific ABIs
AbiData {abi: Abi::Cdecl, name: "cdecl", generic: false },
AbiData {abi: Abi::Stdcall, name: "stdcall", generic: false },
@@ -87,20 +87,20 @@
impl Abi {
#[inline]
- pub fn index(&self) -> usize {
- *self as usize
+ pub fn index(self) -> usize {
+ self as usize
}
#[inline]
- pub fn data(&self) -> &'static AbiData {
+ pub fn data(self) -> &'static AbiData {
&AbiDatas[self.index()]
}
- pub fn name(&self) -> &'static str {
+ pub fn name(self) -> &'static str {
self.data().name
}
- pub fn generic(&self) -> bool {
+ pub fn generic(self) -> bool {
self.data().generic
}
}
diff --git a/src/librustc_target/spec/apple_base.rs b/src/librustc_target/spec/apple_base.rs
index 4b66891..38b3f25 100644
--- a/src/librustc_target/spec/apple_base.rs
+++ b/src/librustc_target/spec/apple_base.rs
@@ -26,7 +26,7 @@
// TLS is flagged as enabled if it looks to be supported.
let deployment_target = env::var("MACOSX_DEPLOYMENT_TARGET").ok();
let version = deployment_target.as_ref().and_then(|s| {
- let mut i = s.splitn(2, ".");
+ let mut i = s.splitn(2, '.');
i.next().and_then(|a| i.next().map(|b| (a, b)))
}).and_then(|(a, b)| {
a.parse::<u32>().and_then(|a| b.parse::<u32>().map(|b| (a, b))).ok()
diff --git a/src/librustc_target/spec/apple_ios_base.rs b/src/librustc_target/spec/apple_ios_base.rs
index 46bb01e..296eaca 100644
--- a/src/librustc_target/spec/apple_ios_base.rs
+++ b/src/librustc_target/spec/apple_ios_base.rs
@@ -25,13 +25,13 @@
}
impl Arch {
- pub fn to_string(&self) -> &'static str {
+ pub fn to_string(self) -> &'static str {
match self {
- &Armv7 => "armv7",
- &Armv7s => "armv7s",
- &Arm64 => "arm64",
- &I386 => "i386",
- &X86_64 => "x86_64"
+ Armv7 => "armv7",
+ Armv7s => "armv7s",
+ Arm64 => "arm64",
+ I386 => "i386",
+ X86_64 => "x86_64"
}
}
}
diff --git a/src/librustc_target/spec/mod.rs b/src/librustc_target/spec/mod.rs
index a6c0fdc..4a8ae69 100644
--- a/src/librustc_target/spec/mod.rs
+++ b/src/librustc_target/spec/mod.rs
@@ -342,6 +342,7 @@
("i686-unknown-openbsd", i686_unknown_openbsd),
("x86_64-unknown-openbsd", x86_64_unknown_openbsd),
+ ("aarch64-unknown-netbsd", aarch64_unknown_netbsd),
("armv6-unknown-netbsd-eabihf", armv6_unknown_netbsd_eabihf),
("armv7-unknown-netbsd-eabihf", armv7_unknown_netbsd_eabihf),
("i686-unknown-netbsd", i686_unknown_netbsd),
@@ -377,6 +378,7 @@
("x86_64-pc-windows-gnu", x86_64_pc_windows_gnu),
("i686-pc-windows-gnu", i686_pc_windows_gnu),
+ ("aarch64-pc-windows-msvc", aarch64_pc_windows_msvc),
("x86_64-pc-windows-msvc", x86_64_pc_windows_msvc),
("i686-pc-windows-msvc", i686_pc_windows_msvc),
("i586-pc-windows-msvc", i586_pc_windows_msvc),
@@ -402,6 +404,8 @@
("x86_64-unknown-hermit", x86_64_unknown_hermit),
("riscv32imac-unknown-none-elf", riscv32imac_unknown_none_elf),
+
+ ("aarch64-unknown-none", aarch64_unknown_none),
}
/// Everything `rustc` knows about how to compile for a specific target.
@@ -774,7 +778,7 @@
/// Maximum integer size in bits that this target can perform atomic
/// operations on.
pub fn max_atomic_width(&self) -> u64 {
- self.options.max_atomic_width.unwrap_or(self.target_pointer_width.parse().unwrap())
+ self.options.max_atomic_width.unwrap_or_else(|| self.target_pointer_width.parse().unwrap())
}
pub fn is_abi_supported(&self, abi: Abi) -> bool {
@@ -791,20 +795,16 @@
// the JSON parser is not updated to match the structs.
let get_req_field = |name: &str| {
- match obj.find(name)
- .map(|s| s.as_string())
- .and_then(|os| os.map(|s| s.to_string())) {
- Some(val) => Ok(val),
- None => {
- return Err(format!("Field {} in target specification is required", name))
- }
- }
+ obj.find(name)
+ .map(|s| s.as_string())
+ .and_then(|os| os.map(|s| s.to_string()))
+ .ok_or_else(|| format!("Field {} in target specification is required", name))
};
let get_opt_field = |name: &str, default: &str| {
obj.find(name).and_then(|s| s.as_string())
.map(|s| s.to_string())
- .unwrap_or(default.to_string())
+ .unwrap_or_else(|| default.to_string())
};
let mut base = Target {
@@ -1049,7 +1049,6 @@
/// filesystem access and JSON decoding.
pub fn search(target_triple: &TargetTriple) -> Result<Target, String> {
use std::env;
- use std::ffi::OsString;
use std::fs;
use serialize::json;
@@ -1060,8 +1059,8 @@
Target::from_json(obj)
}
- match target_triple {
- &TargetTriple::TargetTriple(ref target_triple) => {
+ match *target_triple {
+ TargetTriple::TargetTriple(ref target_triple) => {
// check if triple is in list of supported targets
if let Ok(t) = load_specific(target_triple) {
return Ok(t)
@@ -1074,8 +1073,7 @@
PathBuf::from(target)
};
- let target_path = env::var_os("RUST_TARGET_PATH")
- .unwrap_or(OsString::new());
+ let target_path = env::var_os("RUST_TARGET_PATH").unwrap_or_default();
// FIXME 16351: add a sane default search path?
@@ -1087,7 +1085,7 @@
}
Err(format!("Could not find specification for target {:?}", target_triple))
}
- &TargetTriple::TargetPath(ref target_path) => {
+ TargetTriple::TargetPath(ref target_path) => {
if target_path.is_file() {
return load_file(&target_path);
}
@@ -1233,7 +1231,7 @@
if default.abi_blacklist != self.options.abi_blacklist {
d.insert("abi-blacklist".to_string(), self.options.abi_blacklist.iter()
- .map(Abi::name).map(|name| name.to_json())
+ .map(|&name| Abi::name(name).to_json())
.collect::<Vec<_>>().to_json());
}
@@ -1272,9 +1270,9 @@
///
/// If this target is a path, the file name (without extension) is returned.
pub fn triple(&self) -> &str {
- match self {
- &TargetTriple::TargetTriple(ref triple) => triple,
- &TargetTriple::TargetPath(ref path) => {
+ match *self {
+ TargetTriple::TargetTriple(ref triple) => triple,
+ TargetTriple::TargetPath(ref path) => {
path.file_stem().expect("target path must not be empty").to_str()
.expect("target path must be valid unicode")
}
@@ -1290,7 +1288,7 @@
use std::collections::hash_map::DefaultHasher;
let triple = self.triple();
- if let &TargetTriple::TargetPath(ref path) = self {
+ if let TargetTriple::TargetPath(ref path) = *self {
let mut hasher = DefaultHasher::new();
path.hash(&mut hasher);
let hash = hasher.finish();
diff --git a/src/librustc_traits/Cargo.toml b/src/librustc_traits/Cargo.toml
index 1349839..3e1a6ca 100644
--- a/src/librustc_traits/Cargo.toml
+++ b/src/librustc_traits/Cargo.toml
@@ -16,4 +16,4 @@
rustc_data_structures = { path = "../librustc_data_structures" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
-chalk-engine = { version = "0.6.0", default-features=false }
+chalk-engine = { version = "0.7.0", default-features=false }
diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs
index 5f9060b..8bffecf 100644
--- a/src/librustc_traits/dropck_outlives.rs
+++ b/src/librustc_traits/dropck_outlives.rs
@@ -18,7 +18,7 @@
use rustc::ty::{self, ParamEnvAnd, Ty, TyCtxt};
use rustc::util::nodemap::FxHashSet;
use rustc_data_structures::sync::Lrc;
-use syntax::codemap::{Span, DUMMY_SP};
+use syntax::source_map::{Span, DUMMY_SP};
crate fn provide(p: &mut Providers) {
*p = Providers {
diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs
index e8a3447..b5ee346 100644
--- a/src/librustc_traits/evaluate_obligation.rs
+++ b/src/librustc_traits/evaluate_obligation.rs
@@ -13,7 +13,7 @@
use rustc::traits::query::CanonicalPredicateGoal;
use rustc::ty::query::Providers;
use rustc::ty::{ParamEnvAnd, TyCtxt};
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::DUMMY_SP;
crate fn provide(p: &mut Providers) {
*p = Providers {
diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs
index b6560fa..7b31518 100644
--- a/src/librustc_traits/implied_outlives_bounds.rs
+++ b/src/librustc_traits/implied_outlives_bounds.rs
@@ -21,7 +21,7 @@
use rustc::ty::query::Providers;
use rustc::ty::wf;
use syntax::ast::DUMMY_NODE_ID;
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::DUMMY_SP;
use rustc::traits::FulfillmentContext;
use rustc_data_structures::sync::Lrc;
diff --git a/src/librustc_traits/lib.rs b/src/librustc_traits/lib.rs
index d17cf35..ba6b2c5 100644
--- a/src/librustc_traits/lib.rs
+++ b/src/librustc_traits/lib.rs
@@ -16,6 +16,7 @@
#![feature(extern_prelude)]
#![feature(iterator_find_map)]
#![feature(in_band_lifetimes)]
+#![cfg_attr(not(stage0), feature(nll))]
#![recursion_limit="256"]
diff --git a/src/librustc_tsan/lib.rs b/src/librustc_tsan/lib.rs
index 0c78fd7..b3ba86a 100644
--- a/src/librustc_tsan/lib.rs
+++ b/src/librustc_tsan/lib.rs
@@ -10,6 +10,7 @@
#![sanitizer_runtime]
#![feature(alloc_system)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(sanitizer_runtime)]
#![feature(staged_api)]
#![no_std]
diff --git a/src/librustc_typeck/check/_match.rs b/src/librustc_typeck/check/_match.rs
index c9b5fd5..c14a07b 100644
--- a/src/librustc_typeck/check/_match.rs
+++ b/src/librustc_typeck/check/_match.rs
@@ -22,7 +22,7 @@
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::cmp;
use syntax::ast;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::ptr::P;
use syntax_pos::Span;
@@ -350,7 +350,7 @@
if let Some(mut err) = err {
if is_arg {
if let PatKind::Binding(..) = inner.node {
- if let Ok(snippet) = tcx.sess.codemap()
+ if let Ok(snippet) = tcx.sess.source_map()
.span_to_snippet(pat.span)
{
err.help(&format!("did you mean `{}: &{}`?",
diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs
index 07e19c8..29d2fe2 100644
--- a/src/librustc_typeck/check/cast.rs
+++ b/src/librustc_typeck/check/cast.rs
@@ -221,7 +221,7 @@
format!("cannot cast `{}` as `{}`",
fcx.ty_to_string(self.expr_ty),
cast_ty));
- if let Ok(snippet) = fcx.sess().codemap().span_to_snippet(self.expr.span) {
+ if let Ok(snippet) = fcx.sess().source_map().span_to_snippet(self.expr.span) {
err.span_help(self.expr.span,
&format!("did you mean `*{}`?", snippet));
}
@@ -325,7 +325,7 @@
hir::MutImmutable => "",
};
if self.cast_ty.is_trait() {
- match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
+ match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
Ok(s) => {
err.span_suggestion(self.cast_span,
"try casting to a reference instead",
@@ -344,7 +344,7 @@
}
}
ty::TyAdt(def, ..) if def.is_box() => {
- match fcx.tcx.sess.codemap().span_to_snippet(self.cast_span) {
+ match fcx.tcx.sess.source_map().span_to_snippet(self.cast_span) {
Ok(s) => {
err.span_suggestion(self.cast_span,
"try casting to a `Box` instead",
diff --git a/src/librustc_typeck/check/closure.rs b/src/librustc_typeck/check/closure.rs
index f2745d0..242b692 100644
--- a/src/librustc_typeck/check/closure.rs
+++ b/src/librustc_typeck/check/closure.rs
@@ -24,7 +24,7 @@
use std::cmp;
use std::iter;
use rustc_target::spec::abi::Abi;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use rustc::hir;
/// What signature do we *expect* the closure to have from context?
diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs
index 546553a..9aa2ba3 100644
--- a/src/librustc_typeck/check/compare_method.rs
+++ b/src/librustc_typeck/check/compare_method.rs
@@ -40,7 +40,7 @@
debug!("compare_impl_method(impl_trait_ref={:?})",
impl_trait_ref);
- let impl_m_span = tcx.sess.codemap().def_span(impl_m_span);
+ let impl_m_span = tcx.sess.source_map().def_span(impl_m_span);
if let Err(ErrorReported) = compare_self_type(tcx,
impl_m,
@@ -319,7 +319,8 @@
trait_m.ident);
if let TypeError::Mutability = terr {
if let Some(trait_err_span) = trait_err_span {
- if let Ok(trait_err_str) = tcx.sess.codemap().span_to_snippet(trait_err_span) {
+ if let Ok(trait_err_str) = tcx.sess.source_map().
+ span_to_snippet(trait_err_span) {
diag.span_suggestion(
impl_err_span,
"consider change the type to match the mutability in trait",
@@ -386,7 +387,7 @@
// are zero. Since I don't quite know how to phrase things at
// the moment, give a kind of vague error message.
if trait_params != impl_params {
- let def_span = tcx.sess.codemap().def_span(span);
+ let def_span = tcx.sess.source_map().def_span(span);
let span = tcx.hir.get_generics_span(impl_m.def_id).unwrap_or(def_span);
let mut err = struct_span_err!(
tcx.sess,
@@ -397,7 +398,7 @@
);
err.span_label(span, "lifetimes do not match method in trait");
if let Some(sp) = tcx.hir.span_if_local(trait_m.def_id) {
- let def_sp = tcx.sess.codemap().def_span(sp);
+ let def_sp = tcx.sess.source_map().def_span(sp);
let sp = tcx.hir.get_generics_span(trait_m.def_id).unwrap_or(def_sp);
err.span_label(sp, "lifetimes in impl do not match this method in trait");
}
@@ -770,7 +771,7 @@
// as another generic argument
let new_name = tcx
.sess
- .codemap()
+ .source_map()
.span_to_snippet(trait_span)
.ok()?;
let trait_m = tcx.hir.as_local_node_id(trait_m.def_id)?;
@@ -783,7 +784,7 @@
// and the opening paren of the argument list
let new_generics_span = tcx
.sess
- .codemap()
+ .source_map()
.generate_fn_name_span(impl_span)?
.shrink_to_hi();
// in case there are generics, just replace them
@@ -794,7 +795,7 @@
// replace with the generics from the trait
let new_generics = tcx
.sess
- .codemap()
+ .source_map()
.span_to_snippet(trait_m.generics.span)
.ok()?;
@@ -865,7 +866,7 @@
let bounds = bounds.first()?.span().to(bounds.last()?.span());
let bounds = tcx
.sess
- .codemap()
+ .source_map()
.span_to_snippet(bounds)
.ok()?;
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 92b35bd..00cc36e 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -21,7 +21,7 @@
use rustc::hir::{Item, ItemKind, print};
use rustc::ty::{self, Ty, AssociatedItem};
use rustc::ty::adjustment::AllowTwoPhase;
-use errors::{DiagnosticBuilder, CodeMapper};
+use errors::{DiagnosticBuilder, SourceMapper};
use super::method::probe;
@@ -251,7 +251,7 @@
checked_ty: Ty<'tcx>,
expected: Ty<'tcx>)
-> Option<(Span, &'static str, String)> {
- let cm = self.sess().codemap();
+ let cm = self.sess().source_map();
// Use the callsite's span if this is a macro call. #41858
let sp = cm.call_span_if_macro(expr.span);
if !cm.span_to_filename(sp).is_real() {
@@ -405,7 +405,7 @@
let needs_paren = expr.precedence().order() < (PREC_POSTFIX as i8);
- if let Ok(src) = self.tcx.sess.codemap().span_to_snippet(expr.span) {
+ if let Ok(src) = self.tcx.sess.source_map().span_to_snippet(expr.span) {
let msg = format!("you can cast an `{}` to `{}`", checked_ty, expected_ty);
let cast_suggestion = format!("{}{}{} as {}",
if needs_paren { "(" } else { "" },
diff --git a/src/librustc_typeck/check/generator_interior.rs b/src/librustc_typeck/check/generator_interior.rs
index e209049..6e0c0ba 100644
--- a/src/librustc_typeck/check/generator_interior.rs
+++ b/src/librustc_typeck/check/generator_interior.rs
@@ -167,7 +167,13 @@
let scope = self.region_scope_tree.temporary_scope(expr.hir_id.local_id);
- let ty = self.fcx.tables.borrow().expr_ty_adjusted(expr);
+ // Record the unadjusted type
+ let ty = self.fcx.tables.borrow().expr_ty(expr);
self.record(ty, scope, Some(expr), expr.span);
+
+ // Also include the adjusted types, since these can result in MIR locals
+ for adjustment in self.fcx.tables.borrow().expr_adjustments(expr) {
+ self.record(adjustment.target, scope, Some(expr), expr.span);
+ }
}
}
diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs
index 8d84822..68e8514 100644
--- a/src/librustc_typeck/check/method/probe.rs
+++ b/src/librustc_typeck/check/method/probe.rs
@@ -758,8 +758,9 @@
self.span, infer::FnCall, &fty);
if let Some(self_ty) = self_ty {
- if let Err(_) = self.at(&ObligationCause::dummy(), self.param_env)
- .sup(fty.inputs()[0], self_ty)
+ if self.at(&ObligationCause::dummy(), self.param_env)
+ .sup(fty.inputs()[0], self_ty)
+ .is_err()
{
return false
}
diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs
index 0fbdecf..31ec62b 100644
--- a/src/librustc_typeck/check/method/suggest.rs
+++ b/src/librustc_typeck/check/method/suggest.rs
@@ -132,7 +132,8 @@
};
if let Some(note_span) = note_span {
// We have a span pointing to the method. Show note with snippet.
- err.span_note(self.tcx.sess.codemap().def_span(note_span), ¬e_str);
+ err.span_note(self.tcx.sess.source_map().def_span(note_span),
+ ¬e_str);
} else {
err.note(¬e_str);
}
@@ -141,7 +142,7 @@
let item = self
.associated_item(trait_did, item_name, Namespace::Value)
.unwrap();
- let item_span = self.tcx.sess.codemap()
+ let item_span = self.tcx.sess.source_map()
.def_span(self.tcx.def_span(item.def_id));
if sources.len() > 1 {
span_note!(err,
@@ -246,7 +247,7 @@
};
match expr.node {
hir::ExprKind::Lit(ref lit) => { // numeric literal
- let snippet = tcx.sess.codemap().span_to_snippet(lit.span)
+ let snippet = tcx.sess.source_map().span_to_snippet(lit.span)
.unwrap_or("<numeric literal>".to_string());
err.span_suggestion(lit.span,
@@ -261,9 +262,9 @@
if let &hir::QPath::Resolved(_, ref path) = &qpath {
if let hir::def::Def::Local(node_id) = path.def {
let span = tcx.hir.span(node_id);
- let snippet = tcx.sess.codemap().span_to_snippet(span)
+ let snippet = tcx.sess.source_map().span_to_snippet(span)
.unwrap();
- let filename = tcx.sess.codemap().span_to_filename(span);
+ let filename = tcx.sess.source_map().span_to_filename(span);
let parent_node = self.tcx.hir.get(
self.tcx.hir.get_parent_node(node_id),
@@ -320,7 +321,7 @@
if let Some(def) = actual.ty_adt_def() {
if let Some(full_sp) = tcx.hir.span_if_local(def.did) {
- let def_sp = tcx.sess.codemap().def_span(full_sp);
+ let def_sp = tcx.sess.source_map().def_span(full_sp);
err.span_label(def_sp, format!("{} `{}` not found {}",
item_kind,
item_name,
@@ -341,7 +342,7 @@
let variant = &def.non_enum_variant();
if let Some(index) = self.tcx.find_field_index(item_name, variant) {
let field = &variant.fields[index];
- let snippet = tcx.sess.codemap().span_to_snippet(expr.span);
+ let snippet = tcx.sess.source_map().span_to_snippet(expr.span);
let expr_string = match snippet {
Ok(expr_string) => expr_string,
_ => "s".into(), // Default to a generic placeholder for the
@@ -387,7 +388,7 @@
}
if let Some(expr) = rcvr_expr {
- if let Ok(expr_string) = tcx.sess.codemap().span_to_snippet(expr.span) {
+ if let Ok(expr_string) = tcx.sess.source_map().span_to_snippet(expr.span) {
report_function!(expr.span, expr_string);
} else if let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) =
expr.node
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 8c47df8..b57967a 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -122,7 +122,7 @@
use rustc_target::spec::abi::Abi;
use syntax::ast;
use syntax::attr;
-use syntax::codemap::original_sp;
+use syntax::source_map::original_sp;
use syntax::feature_gate::{GateIssue, emit_feature_err};
use syntax::ptr::P;
use syntax::symbol::{Symbol, LocalInternedString, keywords};
@@ -961,8 +961,10 @@
if let PatKind::Binding(_, _, ident, _) = p.node {
let var_ty = self.assign(p.span, p.id, None);
- self.fcx.require_type_is_sized(var_ty, p.span,
- traits::VariableType(p.id));
+ if !self.fcx.tcx.features().unsized_locals {
+ self.fcx.require_type_is_sized(var_ty, p.span,
+ traits::VariableType(p.id));
+ }
debug!("Pattern binding {} is assigned to {} with type {:?}",
ident,
@@ -1048,8 +1050,8 @@
// The check for a non-trivial pattern is a hack to avoid duplicate warnings
// for simple cases like `fn foo(x: Trait)`,
// where we would error once on the parameter as a whole, and once on the binding `x`.
- if arg.pat.simple_ident().is_none() {
- fcx.require_type_is_sized(arg_ty, decl.output.span(), traits::MiscObligation);
+ if arg.pat.simple_ident().is_none() && !fcx.tcx.features().unsized_locals {
+ fcx.require_type_is_sized(arg_ty, decl.output.span(), traits::SizedArgumentType);
}
fcx.write_ty(arg.hir_id, arg_ty);
@@ -1445,7 +1447,7 @@
impl_id: DefId,
impl_trait_ref: ty::TraitRef<'tcx>,
impl_item_refs: &[hir::ImplItemRef]) {
- let impl_span = tcx.sess.codemap().def_span(impl_span);
+ let impl_span = tcx.sess.source_map().def_span(impl_span);
// If the trait reference itself is erroneous (so the compilation is going
// to fail), skip checking the items here -- the `impl_item` table in `tcx`
@@ -2005,7 +2007,7 @@
closure_def_id: DefId,
r: DeferredCallResolution<'gcx, 'tcx>) {
let mut deferred_call_resolutions = self.deferred_call_resolutions.borrow_mut();
- deferred_call_resolutions.entry(closure_def_id).or_insert(vec![]).push(r);
+ deferred_call_resolutions.entry(closure_def_id).or_default().push(r);
}
fn remove_deferred_call_resolutions(&self,
@@ -2666,11 +2668,11 @@
if arg_count == 1 {" was"} else {"s were"}),
DiagnosticId::Error(error_code.to_owned()));
- if let Some(def_s) = def_span.map(|sp| tcx.sess.codemap().def_span(sp)) {
+ if let Some(def_s) = def_span.map(|sp| tcx.sess.source_map().def_span(sp)) {
err.span_label(def_s, "defined here");
}
if sugg_unit {
- let sugg_span = tcx.sess.codemap().end_point(expr_sp);
+ let sugg_span = tcx.sess.source_map().end_point(expr_sp);
// remove closing `)` from the span
let sugg_span = sugg_span.shrink_to_lo();
err.span_suggestion(
@@ -2935,8 +2937,8 @@
(ExpectIfCondition, &hir::ExprKind::Assign(ref lhs, ref rhs)) => {
let msg = "try comparing for equality";
if let (Ok(left), Ok(right)) = (
- self.tcx.sess.codemap().span_to_snippet(lhs.span),
- self.tcx.sess.codemap().span_to_snippet(rhs.span))
+ self.tcx.sess.source_map().span_to_snippet(lhs.span),
+ self.tcx.sess.source_map().span_to_snippet(rhs.span))
{
err.span_suggestion(expr.span, msg, format!("{} == {}", left, right));
} else {
@@ -3915,7 +3917,7 @@
}
hir::ExprKind::Continue(destination) => {
- if let Ok(_) = destination.target_id {
+ if destination.target_id.is_ok() {
tcx.types.never
} else {
// There was an error, make typecheck fail
@@ -4230,7 +4232,7 @@
if let hir::ExprKind::Lit(ref lit) = idx.node {
if let ast::LitKind::Int(i,
ast::LitIntType::Unsuffixed) = lit.node {
- let snip = tcx.sess.codemap().span_to_snippet(base.span);
+ let snip = tcx.sess.source_map().span_to_snippet(base.span);
if let Ok(snip) = snip {
err.span_suggestion(expr.span,
"to access tuple elements, use",
@@ -4627,10 +4629,16 @@
err.span_suggestion(sp, msg, suggestion);
} else if !self.check_for_cast(err, expr, found, expected) {
let methods = self.get_conversion_methods(expr.span, expected, found);
- if let Ok(expr_text) = self.sess().codemap().span_to_snippet(expr.span) {
+ if let Ok(expr_text) = self.sess().source_map().span_to_snippet(expr.span) {
let suggestions = iter::repeat(expr_text).zip(methods.iter())
- .map(|(receiver, method)| format!("{}.{}()", receiver, method.ident))
- .collect::<Vec<_>>();
+ .filter_map(|(receiver, method)| {
+ let method_call = format!(".{}()", method.ident);
+ if receiver.ends_with(&method_call) {
+ None // do not suggest code that is already there (#53348)
+ } else {
+ Some(format!("{}{}", receiver, method_call))
+ }
+ }) .collect::<Vec<_>>();
if !suggestions.is_empty() {
err.span_suggestions(expr.span, "try using a conversion method", suggestions);
}
@@ -4665,7 +4673,7 @@
hir::ExprKind::Loop(..) |
hir::ExprKind::Match(..) |
hir::ExprKind::Block(..) => {
- let sp = self.tcx.sess.codemap().next_point(cause_span);
+ let sp = self.tcx.sess.source_map().next_point(cause_span);
err.span_suggestion(sp,
"try adding a semicolon",
";".to_string());
@@ -5154,6 +5162,7 @@
} else {
None
} {
+ self.set_tainted_by_errors(); // #53251
err.span_label(span, format!("expected {}", expected_text)).emit();
}
diff --git a/src/librustc_typeck/check/op.rs b/src/librustc_typeck/check/op.rs
index cdf2b6a..de211d2 100644
--- a/src/librustc_typeck/check/op.rs
+++ b/src/librustc_typeck/check/op.rs
@@ -242,7 +242,7 @@
.borrow_mut()
.adjustments_mut()
.entry(rhs_expr.hir_id)
- .or_insert(vec![])
+ .or_default()
.push(autoref);
}
}
@@ -253,7 +253,7 @@
Err(()) => {
// error types are considered "builtin"
if !lhs_ty.references_error() {
- let codemap = self.tcx.sess.codemap();
+ let source_map = self.tcx.sess.source_map();
match is_assign {
IsAssign::Yes => {
let mut err = struct_span_err!(self.tcx.sess, expr.span, E0368,
@@ -275,7 +275,7 @@
Op::Binary(op, is_assign))
.is_ok()
} {
- if let Ok(lstring) = codemap.span_to_snippet(lhs_expr.span) {
+ if let Ok(lstring) = source_map.span_to_snippet(lhs_expr.span) {
while let TyRef(_, rty_inner, _) = rty.sty {
rty = rty_inner;
}
@@ -343,7 +343,7 @@
Op::Binary(op, is_assign))
.is_ok()
} {
- if let Ok(lstring) = codemap.span_to_snippet(lhs_expr.span) {
+ if let Ok(lstring) = source_map.span_to_snippet(lhs_expr.span) {
while let TyRef(_, rty_inner, _) = rty.sty {
rty = rty_inner;
}
@@ -420,7 +420,7 @@
err: &mut errors::DiagnosticBuilder,
is_assign: bool,
) -> bool {
- let codemap = self.tcx.sess.codemap();
+ let source_map = self.tcx.sess.source_map();
let msg = "`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 \
@@ -434,7 +434,7 @@
if !is_assign {
err.span_label(expr.span,
"`+` can't be used to concatenate two `&str` strings");
- match codemap.span_to_snippet(lhs_expr.span) {
+ match source_map.span_to_snippet(lhs_expr.span) {
Ok(lstring) => err.span_suggestion(lhs_expr.span,
msg,
format!("{}.to_owned()", lstring)),
@@ -448,8 +448,8 @@
err.span_label(expr.span,
"`+` can't be used to concatenate a `&str` with a `String`");
match (
- codemap.span_to_snippet(lhs_expr.span),
- codemap.span_to_snippet(rhs_expr.span),
+ source_map.span_to_snippet(lhs_expr.span),
+ source_map.span_to_snippet(rhs_expr.span),
is_assign,
) {
(Ok(l), Ok(r), false) => {
diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs
index 38743cc..4b60977 100644
--- a/src/librustc_typeck/check/wfcheck.rs
+++ b/src/librustc_typeck/check/wfcheck.rs
@@ -258,25 +258,35 @@
ty.needs_drop(fcx_tcx, fcx_tcx.param_env(def_id))
}
};
- let unsized_len = if
+ let all_sized =
all_sized ||
variant.fields.is_empty() ||
- needs_drop_copy()
- {
+ needs_drop_copy();
+ let unsized_len = if all_sized {
0
} else {
1
};
- for field in &variant.fields[..variant.fields.len() - unsized_len] {
+ for (idx, field) in variant.fields[..variant.fields.len() - unsized_len]
+ .iter()
+ .enumerate()
+ {
+ let last = idx == variant.fields.len() - 1;
fcx.register_bound(
field.ty,
fcx.tcx.require_lang_item(lang_items::SizedTraitLangItem),
- traits::ObligationCause::new(field.span,
- fcx.body_id,
- traits::FieldSized(match item.node.adt_kind() {
- Some(i) => i,
- None => bug!(),
- })));
+ traits::ObligationCause::new(
+ field.span,
+ fcx.body_id,
+ traits::FieldSized {
+ adt_kind: match item.node.adt_kind() {
+ Some(i) => i,
+ None => bug!(),
+ },
+ last
+ }
+ )
+ );
}
// All field types must be well-formed.
diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs
index 1a57dfd..0862433 100644
--- a/src/librustc_typeck/check_unused.rs
+++ b/src/librustc_typeck/check_unused.rs
@@ -71,7 +71,7 @@
return;
}
- let msg = if let Ok(snippet) = self.tcx.sess.codemap().span_to_snippet(span) {
+ let msg = if let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span) {
format!("unused import: `{}`", snippet)
} else {
"unused import".to_string()
diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs
index 02a18fa..f37167d 100644
--- a/src/librustc_typeck/coherence/inherent_impls.rs
+++ b/src/librustc_typeck/coherence/inherent_impls.rs
@@ -304,7 +304,7 @@
let impl_def_id = self.tcx.hir.local_def_id(item.id);
let mut rc_vec = self.impls_map.inherent_impls
.entry(def_id)
- .or_insert_with(|| Lrc::new(vec![]));
+ .or_default();
// At this point, there should not be any clones of the
// `Lrc`, so we can still safely push into it in place:
diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs
index e923490..1b04c5d 100644
--- a/src/librustc_typeck/coherence/mod.rs
+++ b/src/librustc_typeck/coherence/mod.rs
@@ -52,7 +52,7 @@
fn enforce_trait_manually_implementable(tcx: TyCtxt, impl_def_id: DefId, trait_def_id: DefId) {
let did = Some(trait_def_id);
let li = tcx.lang_items();
- let span = tcx.sess.codemap().def_span(tcx.span_of_impl(impl_def_id).unwrap());
+ let span = tcx.sess.source_map().def_span(tcx.span_of_impl(impl_def_id).unwrap());
// Disallow *all* explicit impls of `Sized` and `Unsize` for now.
if did == li.sized_trait() {
@@ -169,7 +169,7 @@
traits::supertrait_def_ids(tcx,
data.principal().unwrap().def_id());
if supertrait_def_ids.any(|d| d == trait_def_id) {
- let sp = tcx.sess.codemap().def_span(tcx.span_of_impl(impl_def_id).unwrap());
+ let sp = tcx.sess.source_map().def_span(tcx.span_of_impl(impl_def_id).unwrap());
struct_span_err!(tcx.sess,
sp,
E0371,
diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs
index 9be509b..4a37470 100644
--- a/src/librustc_typeck/coherence/orphan.rs
+++ b/src/librustc_typeck/coherence/orphan.rs
@@ -40,7 +40,7 @@
self.tcx.hir.node_to_string(item.id));
let trait_ref = self.tcx.impl_trait_ref(def_id).unwrap();
let trait_def_id = trait_ref.def_id;
- let cm = self.tcx.sess.codemap();
+ let cm = self.tcx.sess.source_map();
let sp = cm.def_span(item.span);
match traits::orphan_check(self.tcx, def_id) {
Ok(()) => {}
diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs
index 77b02d9..956d542 100644
--- a/src/librustc_typeck/collect.rs
+++ b/src/librustc_typeck/collect.rs
@@ -43,7 +43,7 @@
use syntax::ast;
use syntax::ast::MetaItemKind;
use syntax::attr::{InlineAttr, list_contains_name, mark_used};
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::symbol::{Symbol, keywords};
use syntax::feature_gate;
use syntax_pos::{Span, DUMMY_SP};
@@ -1925,6 +1925,7 @@
Some("mmx_target_feature") => rust_features.mmx_target_feature,
Some("sse4a_target_feature") => rust_features.sse4a_target_feature,
Some("tbm_target_feature") => rust_features.tbm_target_feature,
+ Some("wasm_target_feature") => rust_features.wasm_target_feature,
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index ecc167d..62f93ea 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -76,6 +76,7 @@
#![feature(crate_visibility_modifier)]
#![feature(exhaustive_patterns)]
#![feature(iterator_find_map)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(quote)]
#![feature(refcell_replace_swap)]
#![feature(rustc_diagnostic_macros)]
diff --git a/src/librustc_typeck/structured_errors.rs b/src/librustc_typeck/structured_errors.rs
index afcdc75..ffd9da8 100644
--- a/src/librustc_typeck/structured_errors.rs
+++ b/src/librustc_typeck/structured_errors.rs
@@ -72,7 +72,7 @@
self.code(),
)
};
- if let Ok(snippet) = self.sess.codemap().span_to_snippet(self.span) {
+ if let Ok(snippet) = self.sess.source_map().span_to_snippet(self.span) {
err.span_suggestion(self.span,
&format!("cast the value to `{}`", self.cast_ty),
format!("{} as {}", snippet, self.cast_ty));
diff --git a/src/librustdoc/Cargo.toml b/src/librustdoc/Cargo.toml
index f0c40d1..e163fc6 100644
--- a/src/librustdoc/Cargo.toml
+++ b/src/librustdoc/Cargo.toml
@@ -9,5 +9,5 @@
[dependencies]
pulldown-cmark = { version = "0.1.2", default-features = false }
-minifier = "0.0.14"
+minifier = "0.0.19"
tempfile = "3"
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs
index 5fd0b88..1331bd5 100644
--- a/src/librustdoc/clean/auto_trait.rs
+++ b/src/librustdoc/clean/auto_trait.rs
@@ -267,7 +267,7 @@
// all intermediate RegionVids. At the end, all constraints should
// be between Regions (aka region variables). This gives us the information
// we need to create the Generics.
- let mut finished = FxHashMap();
+ let mut finished: FxHashMap<_, Vec<_>> = FxHashMap();
let mut vid_map: FxHashMap<RegionTarget, RegionDeps> = FxHashMap();
@@ -281,25 +281,25 @@
{
let deps1 = vid_map
.entry(RegionTarget::RegionVid(r1))
- .or_insert_with(|| Default::default());
+ .or_default();
deps1.larger.insert(RegionTarget::RegionVid(r2));
}
let deps2 = vid_map
.entry(RegionTarget::RegionVid(r2))
- .or_insert_with(|| Default::default());
+ .or_default();
deps2.smaller.insert(RegionTarget::RegionVid(r1));
}
&Constraint::RegSubVar(region, vid) => {
let deps = vid_map
.entry(RegionTarget::RegionVid(vid))
- .or_insert_with(|| Default::default());
+ .or_default();
deps.smaller.insert(RegionTarget::Region(region));
}
&Constraint::VarSubReg(vid, region) => {
let deps = vid_map
.entry(RegionTarget::RegionVid(vid))
- .or_insert_with(|| Default::default());
+ .or_default();
deps.larger.insert(RegionTarget::Region(region));
}
&Constraint::RegSubReg(r1, r2) => {
@@ -308,7 +308,7 @@
if self.region_name(r1) != self.region_name(r2) {
finished
.entry(self.region_name(r2).expect("no region_name found"))
- .or_insert_with(|| Vec::new())
+ .or_default()
.push(r1);
}
}
@@ -343,7 +343,7 @@
if self.region_name(r1) != self.region_name(r2) {
finished
.entry(self.region_name(r2).expect("no region name found"))
- .or_insert_with(|| Vec::new())
+ .or_default()
.push(r1) // Larger, smaller
}
}
@@ -577,8 +577,8 @@
} = full_generics.clean(self.cx);
let mut has_sized = FxHashSet();
- let mut ty_to_bounds = FxHashMap();
- let mut lifetime_to_bounds = FxHashMap();
+ let mut ty_to_bounds: FxHashMap<_, FxHashSet<_>> = FxHashMap();
+ let mut lifetime_to_bounds: FxHashMap<_, FxHashSet<_>> = FxHashMap();
let mut ty_to_traits: FxHashMap<Type, FxHashSet<Type>> = FxHashMap();
let mut ty_to_fn: FxHashMap<Type, (Option<PolyTrait>, Option<Type>)> = FxHashMap();
@@ -647,11 +647,11 @@
ty_to_bounds
.entry(ty.clone())
- .or_insert_with(|| FxHashSet());
+ .or_default();
} else {
ty_to_bounds
.entry(ty.clone())
- .or_insert_with(|| FxHashSet())
+ .or_default()
.insert(b.clone());
}
}
@@ -659,7 +659,7 @@
WherePredicate::RegionPredicate { lifetime, bounds } => {
lifetime_to_bounds
.entry(lifetime)
- .or_insert_with(|| FxHashSet())
+ .or_default()
.extend(bounds);
}
WherePredicate::EqPredicate { lhs, rhs } => {
@@ -722,7 +722,7 @@
let bounds = ty_to_bounds
.entry(*ty.clone())
- .or_insert_with(|| FxHashSet());
+ .or_default();
bounds.insert(GenericBound::TraitBound(
PolyTrait {
@@ -752,7 +752,7 @@
// loop
ty_to_traits
.entry(*ty.clone())
- .or_insert_with(|| FxHashSet())
+ .or_default()
.insert(*trait_.clone());
}
_ => panic!("Unexpected trait {:?} for {:?}", trait_, did),
diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs
index dceb04a..d5aab1f 100644
--- a/src/librustdoc/clean/cfg.rs
+++ b/src/librustdoc/clean/cfg.rs
@@ -417,7 +417,7 @@
use syntax::symbol::Symbol;
use syntax::ast::*;
- use syntax::codemap::dummy_spanned;
+ use syntax::source_map::dummy_spanned;
use syntax_pos::DUMMY_SP;
use syntax::with_globals;
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index ad774f9..9b77ff8 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -21,7 +21,7 @@
use rustc_target::spec::abi::Abi;
use syntax::ast::{self, AttrStyle, Ident};
use syntax::attr;
-use syntax::codemap::{dummy_spanned, Spanned};
+use syntax::source_map::{dummy_spanned, Spanned};
use syntax::ptr::P;
use syntax::symbol::keywords::{self, Keyword};
use syntax::symbol::InternedString;
@@ -239,7 +239,7 @@
fn clean(&self, cx: &DocContext) -> ExternalCrate {
let root = DefId { krate: *self, index: CRATE_DEF_INDEX };
let krate_span = cx.tcx.def_span(root);
- let krate_src = cx.sess().codemap().span_to_filename(krate_span);
+ let krate_src = cx.sess().source_map().span_to_filename(krate_span);
// Collect all inner modules which are tagged as implementations of
// primitives.
@@ -596,14 +596,14 @@
// determine if we should display the inner contents or
// the outer `mod` item for the source code.
let whence = {
- let cm = cx.sess().codemap();
+ let cm = cx.sess().source_map();
let outer = cm.lookup_char_pos(self.where_outer.lo());
let inner = cm.lookup_char_pos(self.where_inner.lo());
if outer.file.start_pos == inner.file.start_pos {
// mod foo { ... }
self.where_outer
} else {
- // mod foo; (and a separate FileMap for the contents)
+ // mod foo; (and a separate SourceFile for the contents)
self.where_inner
}
};
@@ -3015,7 +3015,7 @@
return Span::empty();
}
- let cm = cx.sess().codemap();
+ let cm = cx.sess().source_map();
let filename = cm.span_to_filename(*self);
let lo = cm.lookup_char_pos(self.lo());
let hi = cm.lookup_char_pos(self.hi());
@@ -3620,7 +3620,7 @@
impl ToSource for syntax_pos::Span {
fn to_src(&self, cx: &DocContext) -> String {
debug!("converting span {:?} to snippet", self.clean(cx));
- let sn = match cx.sess().codemap().span_to_snippet(*self) {
+ let sn = match cx.sess().source_map().span_to_snippet(*self) {
Ok(x) => x.to_string(),
Err(_) => "".to_string()
};
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs
index 9ea8bc5..e938d2d 100644
--- a/src/librustdoc/clean/simplify.rs
+++ b/src/librustdoc/clean/simplify.rs
@@ -34,7 +34,7 @@
pub fn where_clauses(cx: &DocContext, clauses: Vec<WP>) -> Vec<WP> {
// First, partition the where clause into its separate components
- let mut params = BTreeMap::new();
+ let mut params: BTreeMap<_, Vec<_>> = BTreeMap::new();
let mut lifetimes = Vec::new();
let mut equalities = Vec::new();
let mut tybounds = Vec::new();
@@ -43,7 +43,7 @@
match clause {
WP::BoundPredicate { ty, bounds } => {
match ty {
- clean::Generic(s) => params.entry(s).or_insert(Vec::new())
+ clean::Generic(s) => params.entry(s).or_default()
.extend(bounds),
t => tybounds.push((t, ty_bounds(bounds))),
}
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 86e5bbe..a312913 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -27,7 +27,7 @@
use rustc_target::spec::TargetTriple;
use syntax::ast::{self, Ident};
-use syntax::codemap;
+use syntax::source_map;
use syntax::edition::Edition;
use syntax::feature_gate::UnstableFeatures;
use syntax::json::JsonEmitter;
@@ -258,9 +258,9 @@
/// Creates a new diagnostic `Handler` that can be used to emit warnings and errors.
///
-/// If the given `error_format` is `ErrorOutputType::Json` and no `CodeMap` is given, a new one
+/// If the given `error_format` is `ErrorOutputType::Json` and no `SourceMap` is given, a new one
/// will be created for the handler.
-pub fn new_handler(error_format: ErrorOutputType, codemap: Option<Lrc<codemap::CodeMap>>)
+pub fn new_handler(error_format: ErrorOutputType, source_map: Option<Lrc<source_map::SourceMap>>)
-> errors::Handler
{
// rustdoc doesn't override (or allow to override) anything from this that is relevant here, so
@@ -270,18 +270,18 @@
ErrorOutputType::HumanReadable(color_config) => Box::new(
EmitterWriter::stderr(
color_config,
- codemap.map(|cm| cm as _),
+ source_map.map(|cm| cm as _),
false,
sessopts.debugging_opts.teach,
).ui_testing(sessopts.debugging_opts.ui_testing)
),
ErrorOutputType::Json(pretty) => {
- let codemap = codemap.unwrap_or_else(
- || Lrc::new(codemap::CodeMap::new(sessopts.file_path_mapping())));
+ let source_map = source_map.unwrap_or_else(
+ || Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping())));
Box::new(
JsonEmitter::stderr(
None,
- codemap,
+ source_map,
pretty,
).ui_testing(sessopts.debugging_opts.ui_testing)
)
@@ -289,7 +289,7 @@
ErrorOutputType::Short(color_config) => Box::new(
EmitterWriter::stderr(
color_config,
- codemap.map(|cm| cm as _),
+ source_map.map(|cm| cm as _),
true,
false)
),
@@ -387,11 +387,11 @@
..Options::default()
};
driver::spawn_thread_pool(sessopts, move |sessopts| {
- let codemap = Lrc::new(codemap::CodeMap::new(sessopts.file_path_mapping()));
- let diagnostic_handler = new_handler(error_format, Some(codemap.clone()));
+ let source_map = Lrc::new(source_map::SourceMap::new(sessopts.file_path_mapping()));
+ let diagnostic_handler = new_handler(error_format, Some(source_map.clone()));
let mut sess = session::build_session_(
- sessopts, cpath, diagnostic_handler, codemap,
+ sessopts, cpath, diagnostic_handler, source_map,
);
lint::builtin::HardwiredLints.get_lints()
@@ -486,7 +486,7 @@
&name,
&output_filenames,
|tcx, analysis, _, result| {
- if let Err(_) = result {
+ if result.is_err() {
sess.fatal("Compilation failed, aborting rustdoc");
}
diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs
index d6e8f3d..dd1e1e9 100644
--- a/src/librustdoc/doctree.rs
+++ b/src/librustdoc/doctree.rs
@@ -16,7 +16,7 @@
use syntax::ast::{Name, NodeId};
use syntax::attr;
use syntax::ptr::P;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax_pos::{self, Span};
use rustc::hir;
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index 73d7a9a..5df4862 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -21,7 +21,7 @@
use std::io;
use std::io::prelude::*;
-use syntax::codemap::{CodeMap, FilePathMapping};
+use syntax::source_map::{SourceMap, FilePathMapping};
use syntax::parse::lexer::{self, TokenAndSpan};
use syntax::parse::token;
use syntax::parse;
@@ -33,7 +33,8 @@
tooltip: Option<(&str, &str)>) -> String {
debug!("highlighting: ================\n{}\n==============", src);
let sess = parse::ParseSess::new(FilePathMapping::empty());
- let fm = sess.codemap().new_filemap(FileName::Custom("stdin".to_string()), src.to_string());
+ let fm = sess.source_map().new_source_file(FileName::Custom("stdin".to_string()),
+ src.to_string());
let mut out = Vec::new();
if let Some((tooltip, class)) = tooltip {
@@ -43,8 +44,9 @@
}
write_header(class, &mut out).unwrap();
- let mut classifier = Classifier::new(lexer::StringReader::new(&sess, fm, None), sess.codemap());
- if let Err(_) = classifier.write_source(&mut out) {
+ let mut classifier = Classifier::new(lexer::StringReader::new(&sess, fm, None),
+ sess.source_map());
+ if classifier.write_source(&mut out).is_err() {
return format!("<pre>{}</pre>", src);
}
@@ -60,7 +62,7 @@
/// each span of text in sequence.
struct Classifier<'a> {
lexer: lexer::StringReader<'a>,
- codemap: &'a CodeMap,
+ source_map: &'a SourceMap,
// State of the classifier.
in_attribute: bool,
@@ -145,10 +147,10 @@
}
impl<'a> Classifier<'a> {
- fn new(lexer: lexer::StringReader<'a>, codemap: &'a CodeMap) -> Classifier<'a> {
+ fn new(lexer: lexer::StringReader<'a>, source_map: &'a SourceMap) -> Classifier<'a> {
Classifier {
lexer,
- codemap,
+ source_map,
in_attribute: false,
in_macro: false,
in_macro_nonterminal: false,
@@ -338,9 +340,9 @@
out.string(Escape(&self.snip(tas.sp)), klass)
}
- // Helper function to get a snippet from the codemap.
+ // Helper function to get a snippet from the source_map.
fn snip(&self, sp: Span) -> String {
- self.codemap.span_to_snippet(sp).unwrap()
+ self.source_map.span_to_snippet(sp).unwrap()
}
}
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index b22e239..c104b88 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -625,7 +625,7 @@
data.no_run = true;
}
x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => {
- if let Ok(_) = x[1..].parse::<u32>() {
+ if x[1..].parse::<u32>().is_ok() {
data.error_codes.push(x.to_owned());
seen_rust_tags = !seen_other_tags || seen_rust_tags;
} else {
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 470aa2c..44a9710 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -56,7 +56,7 @@
use serialize::json::{ToJson, Json, as_json};
use syntax::ast;
-use syntax::codemap::FileName;
+use syntax::source_map::FileName;
use syntax::feature_gate::UnstableFeatures;
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId};
use rustc::middle::privacy::AccessLevels;
@@ -1245,7 +1245,7 @@
// Collect all the implementors of traits.
if let clean::ImplItem(ref i) = item.inner {
if let Some(did) = i.trait_.def_id() {
- self.implementors.entry(did).or_insert(vec![]).push(Impl {
+ self.implementors.entry(did).or_default().push(Impl {
impl_item: item.clone(),
});
}
@@ -1440,7 +1440,7 @@
unreachable!()
};
for did in dids {
- self.impls.entry(did).or_insert(vec![]).push(Impl {
+ self.impls.entry(did).or_default().push(Impl {
impl_item: item.clone(),
});
}
@@ -1971,7 +1971,7 @@
fn build_sidebar_items(&self, m: &clean::Module) -> BTreeMap<String, Vec<NameDoc>> {
// BTreeMap instead of HashMap to get a sorted output
- let mut map = BTreeMap::new();
+ let mut map: BTreeMap<_, Vec<_>> = BTreeMap::new();
for item in &m.items {
if item.is_stripped() { continue }
@@ -1981,7 +1981,7 @@
Some(ref s) => s.to_string(),
};
let short = short.to_string();
- map.entry(short).or_insert(vec![])
+ map.entry(short).or_default()
.push((myname, Some(plain_summary_line(item.doc_value()))));
}
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 62ef562..b63abec 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2208,6 +2208,24 @@
};
autoCollapse(getPageId(), getCurrentValue("rustdoc-collapse") === "true");
+
+ if (window.location.hash && window.location.hash.length > 0) {
+ var hash = getPageId();
+ if (hash !== null) {
+ var elem = document.getElementById(hash);
+ if (elem && elem.offsetParent === null) {
+ if (elem.parentNode && elem.parentNode.previousSibling) {
+ var collapses = elem.parentNode
+ .previousSibling
+ .getElementsByClassName("collapse-toggle");
+ if (collapses.length > 0) {
+ // The element is not visible, we need to make it appear!
+ collapseDocs(collapses[0], "show");
+ }
+ }
+ }
+ }
+ }
}());
// Sets the focus on the search bar at the top of the page
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index faca264..2ed7f7a 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -165,8 +165,8 @@
color: #ddd;
}
-.docblock a:not(.srclink):not(.test-arrow), .docblock-short a:not(.srclink):not(.test-arrow),
-.stability a {
+.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
+.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
color: #D2991D;
}
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index 5725a41..f7cb511 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -165,8 +165,8 @@
color: #000;
}
-.docblock a:not(.srclink):not(.test-arrow), .docblock-short a:not(.srclink):not(.test-arrow),
-.stability a {
+.docblock:not(.type-decl) a:not(.srclink):not(.test-arrow),
+.docblock-short a:not(.srclink):not(.test-arrow), .stability a {
color: #3873AD;
}
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index 78ecfd1..a8ae6a9 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -17,6 +17,7 @@
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(iterator_find_map)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(set_stdio)]
#![feature(slice_sort_by_cached_key)]
#![feature(test)]
@@ -598,7 +599,7 @@
/// returns a map mapping crate names to their paths or else an
/// error message.
fn parse_externs(matches: &getopts::Matches) -> Result<Externs, String> {
- let mut externs = BTreeMap::new();
+ let mut externs: BTreeMap<_, BTreeSet<_>> = BTreeMap::new();
for arg in &matches.opt_strs("extern") {
let mut parts = arg.splitn(2, '=');
let name = parts.next().ok_or("--extern value must not be empty".to_string())?;
@@ -606,7 +607,7 @@
.ok_or("--extern value must be of the format `foo=bar`"
.to_string())?;
let name = name.to_string();
- externs.entry(name).or_insert_with(BTreeSet::new).insert(location.to_string());
+ externs.entry(name).or_default().insert(location.to_string());
}
Ok(Externs::new(externs))
}
diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs
index 05661dc..a3ae953 100644
--- a/src/librustdoc/markdown.rs
+++ b/src/librustdoc/markdown.rs
@@ -19,7 +19,7 @@
use testing;
use rustc::session::search_paths::SearchPaths;
use rustc::session::config::{Externs, CodegenOptions};
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::DUMMY_SP;
use syntax::feature_gate::UnstableFeatures;
use syntax::edition::Edition;
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index d8e382f..3b07a2c 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -33,11 +33,11 @@
use rustc_metadata::cstore::CStore;
use rustc_resolve::MakeGlobMap;
use syntax::ast;
-use syntax::codemap::CodeMap;
+use syntax::source_map::SourceMap;
use syntax::edition::Edition;
use syntax::feature_gate::UnstableFeatures;
use syntax::with_globals;
-use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName, hygiene};
+use syntax_pos::{BytePos, DUMMY_SP, Pos, Span, FileName};
use errors;
use errors::emitter::ColorConfig;
@@ -86,14 +86,14 @@
..config::Options::default()
};
driver::spawn_thread_pool(sessopts, |sessopts| {
- let codemap = Lrc::new(CodeMap::new(sessopts.file_path_mapping()));
+ let source_map = Lrc::new(SourceMap::new(sessopts.file_path_mapping()));
let handler =
errors::Handler::with_tty_emitter(ColorConfig::Auto,
true, false,
- Some(codemap.clone()));
+ Some(source_map.clone()));
let mut sess = session::build_session_(
- sessopts, Some(input_path.to_owned()), handler, codemap.clone(),
+ sessopts, Some(input_path.to_owned()), handler, source_map.clone(),
);
let codegen_backend = rustc_driver::get_codegen_backend(&sess);
let cstore = CStore::new(codegen_backend.metadata_loader());
@@ -133,7 +133,7 @@
false,
opts,
maybe_sysroot,
- Some(codemap),
+ Some(source_map),
None,
linker,
edition
@@ -205,7 +205,7 @@
// never wrap the test in `fn main() { ... }`
let (test, line_offset) = make_test(test, Some(cratename), as_test_harness, opts);
// FIXME(#44940): if doctests ever support path remapping, then this filename
- // needs to be the result of CodeMap::span_to_unmapped_path
+ // needs to be the result of SourceMap::span_to_unmapped_path
let input = config::Input::Str {
name: filename.to_owned(),
input: test.to_owned(),
@@ -262,11 +262,11 @@
let _bomb = Bomb(data.clone(), old.unwrap_or(box io::stdout()));
let (libdir, outdir, compile_result) = driver::spawn_thread_pool(sessopts, |sessopts| {
- let codemap = Lrc::new(CodeMap::new_doctest(
+ let source_map = Lrc::new(SourceMap::new_doctest(
sessopts.file_path_mapping(), filename.clone(), line as isize - line_offset as isize
));
let emitter = errors::emitter::EmitterWriter::new(box Sink(data.clone()),
- Some(codemap.clone()),
+ Some(source_map.clone()),
false,
false);
@@ -274,7 +274,7 @@
let diagnostic_handler = errors::Handler::with_emitter(true, false, box emitter);
let mut sess = session::build_session_(
- sessopts, None, diagnostic_handler, codemap,
+ sessopts, None, diagnostic_handler, source_map,
);
let codegen_backend = rustc_driver::get_codegen_backend(&sess);
let cstore = CStore::new(codegen_backend.metadata_loader());
@@ -500,7 +500,7 @@
opts: TestOptions,
maybe_sysroot: Option<PathBuf>,
position: Span,
- codemap: Option<Lrc<CodeMap>>,
+ source_map: Option<Lrc<SourceMap>>,
filename: Option<PathBuf>,
linker: Option<PathBuf>,
edition: Edition,
@@ -509,7 +509,7 @@
impl Collector {
pub fn new(cratename: String, cfgs: Vec<String>, libs: SearchPaths, cg: CodegenOptions,
externs: Externs, use_headers: bool, opts: TestOptions,
- maybe_sysroot: Option<PathBuf>, codemap: Option<Lrc<CodeMap>>,
+ maybe_sysroot: Option<PathBuf>, source_map: Option<Lrc<SourceMap>>,
filename: Option<PathBuf>, linker: Option<PathBuf>, edition: Edition) -> Collector {
Collector {
tests: Vec::new(),
@@ -523,7 +523,7 @@
opts,
maybe_sysroot,
position: DUMMY_SP,
- codemap,
+ source_map,
filename,
linker,
edition,
@@ -562,7 +562,6 @@
rustc_driver::in_named_rustc_thread(name, move || with_globals(move || {
io::set_panic(panic);
io::set_print(print);
- hygiene::set_default_edition(edition);
run_test(&test,
&cratename,
&filename,
@@ -590,9 +589,9 @@
}
pub fn get_line(&self) -> usize {
- if let Some(ref codemap) = self.codemap {
+ if let Some(ref source_map) = self.source_map {
let line = self.position.lo().to_usize();
- let line = codemap.lookup_char_pos(BytePos(line as u32)).line;
+ let line = source_map.lookup_char_pos(BytePos(line as u32)).line;
if line > 0 { line - 1 } else { line }
} else {
0
@@ -604,8 +603,8 @@
}
fn get_filename(&self) -> FileName {
- if let Some(ref codemap) = self.codemap {
- let filename = codemap.span_to_filename(self.position);
+ if let Some(ref source_map) = self.source_map {
+ let filename = source_map.span_to_filename(self.position);
if let FileName::Real(ref filename) = filename {
if let Ok(cur_dir) = env::current_dir() {
if let Ok(path) = filename.strip_prefix(&cur_dir) {
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index e2c935e..68ddf72 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -15,7 +15,7 @@
use syntax::ast;
use syntax::attr;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax_pos::{self, Span};
use rustc::hir::map as hir_map;
diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs
index 4c306d9..7f3736e 100644
--- a/src/libserialize/hex.rs
+++ b/src/libserialize/hex.rs
@@ -22,7 +22,7 @@
fn to_hex(&self) -> String;
}
-const CHARS: &'static [u8] = b"0123456789abcdef";
+const CHARS: &[u8] = b"0123456789abcdef";
impl ToHex for [u8] {
/// Turn a vector of `u8` bytes into a hexadecimal string.
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index d421324..35ef632 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -365,6 +365,9 @@
}
impl From<fmt::Error> for EncoderError {
+ /// Converts a [`fmt::Error`] into `EncoderError`
+ ///
+ /// This conversion does not allocate memory.
fn from(err: fmt::Error) -> EncoderError { EncoderError::FmtError(err) }
}
@@ -438,7 +441,7 @@
}
fn spaces(wr: &mut dyn fmt::Write, mut n: usize) -> EncodeResult {
- const BUF: &'static str = " ";
+ const BUF: &str = " ";
while n >= BUF.len() {
wr.write_str(BUF)?;
@@ -799,21 +802,21 @@
escape_str(self.writer, name)
} else {
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
- write!(self.writer, "{{\n")?;
+ writeln!(self.writer, "{{")?;
self.curr_indent += self.indent;
spaces(self.writer, self.curr_indent)?;
write!(self.writer, "\"variant\": ")?;
escape_str(self.writer, name)?;
- write!(self.writer, ",\n")?;
+ writeln!(self.writer, ",")?;
spaces(self.writer, self.curr_indent)?;
- write!(self.writer, "\"fields\": [\n")?;
+ writeln!(self.writer, "\"fields\": [")?;
self.curr_indent += self.indent;
f(self)?;
self.curr_indent -= self.indent;
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
spaces(self.writer, self.curr_indent)?;
self.curr_indent -= self.indent;
- write!(self.writer, "]\n")?;
+ writeln!(self.writer, "]")?;
spaces(self.writer, self.curr_indent)?;
write!(self.writer, "}}")?;
Ok(())
@@ -825,7 +828,7 @@
{
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
if idx != 0 {
- write!(self.writer, ",\n")?;
+ writeln!(self.writer, ",")?;
}
spaces(self.writer, self.curr_indent)?;
f(self)
@@ -864,7 +867,7 @@
self.curr_indent += self.indent;
f(self)?;
self.curr_indent -= self.indent;
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
spaces(self.writer, self.curr_indent)?;
write!(self.writer, "}}")?;
}
@@ -876,9 +879,9 @@
{
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
if idx == 0 {
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
} else {
- write!(self.writer, ",\n")?;
+ writeln!(self.writer, ",")?;
}
spaces(self.writer, self.curr_indent)?;
escape_str(self.writer, name)?;
@@ -940,7 +943,7 @@
self.curr_indent += self.indent;
f(self)?;
self.curr_indent -= self.indent;
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
spaces(self.writer, self.curr_indent)?;
write!(self.writer, "]")?;
}
@@ -952,9 +955,9 @@
{
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
if idx == 0 {
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
} else {
- write!(self.writer, ",\n")?;
+ writeln!(self.writer, ",")?;
}
spaces(self.writer, self.curr_indent)?;
f(self)
@@ -971,7 +974,7 @@
self.curr_indent += self.indent;
f(self)?;
self.curr_indent -= self.indent;
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
spaces(self.writer, self.curr_indent)?;
write!(self.writer, "}}")?;
}
@@ -983,9 +986,9 @@
{
if self.is_emitting_map_key { return Err(EncoderError::BadHashmapKey); }
if idx == 0 {
- write!(self.writer, "\n")?;
+ writeln!(self.writer)?;
} else {
- write!(self.writer, ",\n")?;
+ writeln!(self.writer, ",")?;
}
spaces(self.writer, self.curr_indent)?;
self.is_emitting_map_key = true;
@@ -1387,9 +1390,8 @@
// Used by Parser to test whether the top-most element is an index.
fn last_is_index(&self) -> bool {
- if self.is_empty() { return false; }
- return match *self.stack.last().unwrap() {
- InternalIndex(_) => true,
+ match self.stack.last() {
+ Some(InternalIndex(_)) => true,
_ => false,
}
}
@@ -1530,19 +1532,17 @@
}
F64Value(res)
- } else {
- if neg {
- let res = (res as i64).wrapping_neg();
+ } else if neg {
+ let res = (res as i64).wrapping_neg();
- // Make sure we didn't underflow.
- if res > 0 {
- Error(SyntaxError(InvalidNumber, self.line, self.col))
- } else {
- I64Value(res)
- }
+ // Make sure we didn't underflow.
+ if res > 0 {
+ Error(SyntaxError(InvalidNumber, self.line, self.col))
} else {
- U64Value(res)
+ I64Value(res)
}
+ } else {
+ U64Value(res)
}
}
diff --git a/src/libserialize/leb128.rs b/src/libserialize/leb128.rs
index ae7f25c..eee95d9 100644
--- a/src/libserialize/leb128.rs
+++ b/src/libserialize/leb128.rs
@@ -103,8 +103,8 @@
loop {
let mut byte = (value as u8) & 0x7f;
value >>= 7;
- let more = !((((value == 0) && ((byte & 0x40) == 0)) ||
- ((value == -1) && ((byte & 0x40) != 0))));
+ let more = !(((value == 0) && ((byte & 0x40) == 0)) ||
+ ((value == -1) && ((byte & 0x40) != 0)));
if more {
byte |= 0x80; // Mark this byte to show that more bytes will follow.
diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs
index a5f4b32..794fc09 100644
--- a/src/libserialize/lib.rs
+++ b/src/libserialize/lib.rs
@@ -24,6 +24,7 @@
#![feature(core_intrinsics)]
#![feature(specialization)]
#![feature(never_type)]
+#![cfg_attr(not(stage0), feature(nll))]
#![cfg_attr(test, feature(test))]
pub use self::serialize::{Decoder, Encoder, Decodable, Encodable};
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
index 26d93f9..016e7ad 100644
--- a/src/libstd/build.rs
+++ b/src/libstd/build.rs
@@ -104,7 +104,8 @@
} else {
build.file("../libbacktrace/elf.c");
- if target.contains("64") {
+ let pointer_width = env::var("CARGO_CFG_TARGET_POINTER_WIDTH").unwrap();
+ if pointer_width == "64" {
build.define("BACKTRACE_ELF_SIZE", "64");
} else {
build.define("BACKTRACE_ELF_SIZE", "32");
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index b2777f5..2b87094 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -1175,9 +1175,9 @@
/// If the contents of the `CStr` are valid UTF-8 data, this
/// function will return a [`Cow`]`::`[`Borrowed`]`(`[`&str`]`)`
/// with the the corresponding [`&str`] slice. Otherwise, it will
- /// replace any invalid UTF-8 sequences with `U+FFFD REPLACEMENT
- /// CHARACTER` and return a [`Cow`]`::`[`Owned`]`(`[`String`]`)`
- /// with the result.
+ /// replace any invalid UTF-8 sequences with
+ /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD] and return a
+ /// [`Cow`]`::`[`Owned`]`(`[`String`]`)` with the result.
///
/// > **Note**: This method is currently implemented to check for validity
/// > after a constant-time cast, but it is planned to alter its definition
@@ -1189,6 +1189,7 @@
/// [`Owned`]: ../borrow/enum.Cow.html#variant.Owned
/// [`str`]: ../primitive.str.html
/// [`String`]: ../string/struct.String.html
+ /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
///
/// # Examples
///
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 9e501a8..6bcd62d 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -520,10 +520,12 @@
/// Converts an `OsStr` to a [`Cow`]`<`[`str`]`>`.
///
- /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
+ /// Any non-Unicode sequences are replaced with
+ /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD].
///
/// [`Cow`]: ../../std/borrow/enum.Cow.html
/// [`str`]: ../../std/primitive.str.html
+ /// [U+FFFD]: ../../std/char/constant.REPLACEMENT_CHARACTER.html
///
/// # Examples
///
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs
index 02a3ce8..3e50988 100644
--- a/src/libstd/io/error.rs
+++ b/src/libstd/io/error.rs
@@ -97,6 +97,7 @@
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
+#[non_exhaustive]
pub enum ErrorKind {
/// An entity was not found, often a file.
#[stable(feature = "rust1", since = "1.0.0")]
@@ -180,15 +181,6 @@
/// read.
#[stable(feature = "read_exact", since = "1.6.0")]
UnexpectedEof,
-
- /// A marker variant that tells the compiler that users of this enum cannot
- /// match it exhaustively.
- #[unstable(feature = "io_error_internals",
- reason = "better expressed through extensible enums that this \
- enum cannot be exhaustively matched against",
- issue = "0")]
- #[doc(hidden)]
- __Nonexhaustive,
}
impl ErrorKind {
@@ -212,7 +204,6 @@
ErrorKind::Interrupted => "operation interrupted",
ErrorKind::Other => "other os error",
ErrorKind::UnexpectedEof => "unexpected end of file",
- ErrorKind::__Nonexhaustive => unreachable!()
}
}
}
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs
index 01bd3ed..4f6bda6 100644
--- a/src/libstd/keyword_docs.rs
+++ b/src/libstd/keyword_docs.rs
@@ -1,4 +1,4 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// 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.
//
@@ -26,3 +26,33 @@
///
/// [book]: https://doc.rust-lang.org/book/second-edition/ch03-03-how-functions-work.html
mod fn_keyword { }
+
+#[doc(keyword = "let")]
+//
+/// The `let` keyword.
+///
+/// The `let` keyword is used to declare a variable.
+///
+/// Example:
+///
+/// ```rust
+/// # #![allow(unused_assignments)]
+/// let x = 3; // We create a variable named `x` with the value `3`.
+/// ```
+///
+/// By default, all variables are **not** mutable. If you want a mutable variable,
+/// you'll have to use the `mut` keyword.
+///
+/// Example:
+///
+/// ```rust
+/// # #![allow(unused_assignments)]
+/// let mut x = 3; // We create a mutable variable named `x` with the value `3`.
+///
+/// x += 4; // `x` is now equal to `7`.
+/// ```
+///
+/// For more information about the `let` keyword, take a look at the [Rust Book][book].
+///
+/// [book]: https://doc.rust-lang.org/book/second-edition/ch03-01-variables-and-mutability.html
+mod let_keyword { }
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 0bc968b..b0069f8 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -273,6 +273,7 @@
#![feature(macro_vis_matcher)]
#![feature(needs_panic_runtime)]
#![feature(never_type)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(exhaustive_patterns)]
#![feature(on_unimplemented)]
#![feature(optin_builtin_traits)]
@@ -301,7 +302,7 @@
#![feature(unboxed_closures)]
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
-#![feature(use_extern_macros)]
+#![cfg_attr(stage0, feature(use_extern_macros))]
#![feature(doc_cfg)]
#![feature(doc_masked)]
#![feature(doc_spotlight)]
@@ -310,6 +311,7 @@
#![feature(doc_keyword)]
#![feature(panic_info_message)]
#![feature(panic_implementation)]
+#![feature(non_exhaustive)]
#![default_lib_allocator]
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index d601a0c..9a610cd 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -160,9 +160,9 @@
/// ```
#[stable(feature = "ip_shared", since = "1.12.0")]
pub fn is_unspecified(&self) -> bool {
- match *self {
- IpAddr::V4(ref a) => a.is_unspecified(),
- IpAddr::V6(ref a) => a.is_unspecified(),
+ match self {
+ IpAddr::V4(ip) => ip.is_unspecified(),
+ IpAddr::V6(ip) => ip.is_unspecified(),
}
}
@@ -185,9 +185,9 @@
/// ```
#[stable(feature = "ip_shared", since = "1.12.0")]
pub fn is_loopback(&self) -> bool {
- match *self {
- IpAddr::V4(ref a) => a.is_loopback(),
- IpAddr::V6(ref a) => a.is_loopback(),
+ match self {
+ IpAddr::V4(ip) => ip.is_loopback(),
+ IpAddr::V6(ip) => ip.is_loopback(),
}
}
@@ -214,9 +214,9 @@
/// }
/// ```
pub fn is_global(&self) -> bool {
- match *self {
- IpAddr::V4(ref a) => a.is_global(),
- IpAddr::V6(ref a) => a.is_global(),
+ match self {
+ IpAddr::V4(ip) => ip.is_global(),
+ IpAddr::V6(ip) => ip.is_global(),
}
}
@@ -239,9 +239,9 @@
/// ```
#[stable(feature = "ip_shared", since = "1.12.0")]
pub fn is_multicast(&self) -> bool {
- match *self {
- IpAddr::V4(ref a) => a.is_multicast(),
- IpAddr::V6(ref a) => a.is_multicast(),
+ match self {
+ IpAddr::V4(ip) => ip.is_multicast(),
+ IpAddr::V6(ip) => ip.is_multicast(),
}
}
@@ -268,9 +268,9 @@
/// }
/// ```
pub fn is_documentation(&self) -> bool {
- match *self {
- IpAddr::V4(ref a) => a.is_documentation(),
- IpAddr::V6(ref a) => a.is_documentation(),
+ match self {
+ IpAddr::V4(ip) => ip.is_documentation(),
+ IpAddr::V6(ip) => ip.is_documentation(),
}
}
@@ -293,7 +293,7 @@
/// ```
#[stable(feature = "ipaddr_checker", since = "1.16.0")]
pub fn is_ipv4(&self) -> bool {
- match *self {
+ match self {
IpAddr::V4(_) => true,
IpAddr::V6(_) => false,
}
@@ -318,7 +318,7 @@
/// ```
#[stable(feature = "ipaddr_checker", since = "1.16.0")]
pub fn is_ipv6(&self) -> bool {
- match *self {
+ match self {
IpAddr::V4(_) => false,
IpAddr::V6(_) => true,
}
@@ -483,11 +483,11 @@
/// ```
#[stable(since = "1.7.0", feature = "ip_17")]
pub fn is_private(&self) -> bool {
- match (self.octets()[0], self.octets()[1]) {
- (10, _) => true,
- (172, b) if b >= 16 && b <= 31 => true,
- (192, 168) => true,
- _ => false
+ match self.octets() {
+ [10, ..] => true,
+ [172, b, ..] if b >= 16 && b <= 31 => true,
+ [192, 168, ..] => true,
+ _ => false,
}
}
@@ -509,7 +509,10 @@
/// ```
#[stable(since = "1.7.0", feature = "ip_17")]
pub fn is_link_local(&self) -> bool {
- self.octets()[0] == 169 && self.octets()[1] == 254
+ match self.octets() {
+ [169, 254, ..] => true,
+ _ => false,
+ }
}
/// Returns [`true`] if the address appears to be globally routable.
@@ -612,11 +615,11 @@
/// ```
#[stable(since = "1.7.0", feature = "ip_17")]
pub fn is_documentation(&self) -> bool {
- match(self.octets()[0], self.octets()[1], self.octets()[2], self.octets()[3]) {
- (192, 0, 2, _) => true,
- (198, 51, 100, _) => true,
- (203, 0, 113, _) => true,
- _ => false
+ match self.octets() {
+ [192, 0, 2, _] => true,
+ [198, 51, 100, _] => true,
+ [203, 0, 113, _] => true,
+ _ => false,
}
}
@@ -666,9 +669,9 @@
#[stable(feature = "ip_addr", since = "1.7.0")]
impl fmt::Display for IpAddr {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
- match *self {
- IpAddr::V4(ref a) => a.fmt(fmt),
- IpAddr::V6(ref a) => a.fmt(fmt),
+ match self {
+ IpAddr::V4(ip) => ip.fmt(fmt),
+ IpAddr::V6(ip) => ip.fmt(fmt),
}
}
}
@@ -717,8 +720,8 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialEq<Ipv4Addr> for IpAddr {
fn eq(&self, other: &Ipv4Addr) -> bool {
- match *self {
- IpAddr::V4(ref v4) => v4 == other,
+ match self {
+ IpAddr::V4(v4) => v4 == other,
IpAddr::V6(_) => false,
}
}
@@ -727,8 +730,8 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialEq<IpAddr> for Ipv4Addr {
fn eq(&self, other: &IpAddr) -> bool {
- match *other {
- IpAddr::V4(ref v4) => self == v4,
+ match other {
+ IpAddr::V4(v4) => self == v4,
IpAddr::V6(_) => false,
}
}
@@ -755,8 +758,8 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialOrd<Ipv4Addr> for IpAddr {
fn partial_cmp(&self, other: &Ipv4Addr) -> Option<Ordering> {
- match *self {
- IpAddr::V4(ref v4) => v4.partial_cmp(other),
+ match self {
+ IpAddr::V4(v4) => v4.partial_cmp(other),
IpAddr::V6(_) => Some(Ordering::Greater),
}
}
@@ -765,8 +768,8 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialOrd<IpAddr> for Ipv4Addr {
fn partial_cmp(&self, other: &IpAddr) -> Option<Ordering> {
- match *other {
- IpAddr::V4(ref v4) => self.partial_cmp(v4),
+ match other {
+ IpAddr::V4(v4) => self.partial_cmp(v4),
IpAddr::V6(_) => Some(Ordering::Less),
}
}
@@ -1335,9 +1338,9 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialEq<IpAddr> for Ipv6Addr {
fn eq(&self, other: &IpAddr) -> bool {
- match *other {
+ match other {
IpAddr::V4(_) => false,
- IpAddr::V6(ref v6) => self == v6,
+ IpAddr::V6(v6) => self == v6,
}
}
}
@@ -1345,9 +1348,9 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialEq<Ipv6Addr> for IpAddr {
fn eq(&self, other: &Ipv6Addr) -> bool {
- match *self {
+ match self {
IpAddr::V4(_) => false,
- IpAddr::V6(ref v6) => v6 == other,
+ IpAddr::V6(v6) => v6 == other,
}
}
}
@@ -1372,9 +1375,9 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialOrd<Ipv6Addr> for IpAddr {
fn partial_cmp(&self, other: &Ipv6Addr) -> Option<Ordering> {
- match *self {
+ match self {
IpAddr::V4(_) => Some(Ordering::Less),
- IpAddr::V6(ref v6) => v6.partial_cmp(other),
+ IpAddr::V6(v6) => v6.partial_cmp(other),
}
}
}
@@ -1382,9 +1385,9 @@
#[stable(feature = "ip_cmp", since = "1.16.0")]
impl PartialOrd<IpAddr> for Ipv6Addr {
fn partial_cmp(&self, other: &IpAddr) -> Option<Ordering> {
- match *other {
+ match other {
IpAddr::V4(_) => Some(Ordering::Greater),
- IpAddr::V6(ref v6) => self.partial_cmp(v6),
+ IpAddr::V6(v6) => self.partial_cmp(v6),
}
}
}
diff --git a/src/libstd/os/raw/mod.rs b/src/libstd/os/raw/mod.rs
index d5eeb52..dc33747 100644
--- a/src/libstd/os/raw/mod.rs
+++ b/src/libstd/os/raw/mod.rs
@@ -29,6 +29,9 @@
all(target_os = "android", any(target_arch = "aarch64",
target_arch = "arm")),
all(target_os = "l4re", target_arch = "x86_64"),
+ all(target_os = "netbsd", any(target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "powerpc")),
all(target_os = "openbsd", target_arch = "aarch64"),
all(target_os = "fuchsia", target_arch = "aarch64")))]
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = u8;
@@ -41,6 +44,9 @@
all(target_os = "android", any(target_arch = "aarch64",
target_arch = "arm")),
all(target_os = "l4re", target_arch = "x86_64"),
+ all(target_os = "netbsd", any(target_arch = "aarch64",
+ target_arch = "arm",
+ target_arch = "powerpc")),
all(target_os = "openbsd", target_arch = "aarch64"),
all(target_os = "fuchsia", target_arch = "aarch64"))))]
#[stable(feature = "raw_os", since = "1.1.0")] pub type c_char = i8;
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 688a7e9..ca8be75 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -1737,9 +1737,11 @@
/// Converts a `Path` to a [`Cow<str>`].
///
- /// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
+ /// Any non-Unicode sequences are replaced with
+ /// [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD].
///
/// [`Cow<str>`]: ../borrow/enum.Cow.html
+ /// [U+FFFD]: ../char/constant.REPLACEMENT_CHARACTER.html
///
/// # Examples
///
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index 3969283..53babd4 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -381,6 +381,39 @@
///
/// let hello = output.stdout;
/// ```
+///
+/// `Command` can be reused to spawn multiple processes. The builder methods
+/// change the command without needing to immediately spawn the process.
+///
+/// ```no_run
+/// use std::process::Command;
+///
+/// let mut echo_hello = Command::new("sh");
+/// echo_hello.arg("-c")
+/// .arg("echo hello");
+/// let hello_1 = echo_hello.output().expect("failed to execute process");
+/// let hello_2 = echo_hello.output().expect("failed to execute process");
+/// ```
+///
+/// Similarly, you can call builder methods after spawning a process and then
+/// spawn a new process with the modified settings.
+///
+/// ```no_run
+/// use std::process::Command;
+///
+/// let mut list_dir = Command::new("ls");
+///
+/// // Execute `ls` in the current directory of the program.
+/// list_dir.status().expect("process failed to execute");
+///
+/// println!("");
+///
+/// // Change `ls` to execute in the root directory.
+/// list_dir.current_dir("/");
+///
+/// // And then execute `ls` again but in the root directory.
+/// list_dir.status().expect("process failed to execute");
+/// ```
#[stable(feature = "process", since = "1.0.0")]
pub struct Command {
inner: imp::Command,
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index 02a96b0..59cf741 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -1247,6 +1247,34 @@
/// [`SyncSender`]: struct.SyncSender.html
/// [`Err`]: ../../../std/result/enum.Result.html#variant.Err
///
+ /// # Known Issues
+ ///
+ /// There is currently a known issue (see [`#39364`]) that causes `recv_timeout`
+ /// to panic unexpectedly with the following example:
+ ///
+ /// ```no_run
+ /// use std::sync::mpsc::channel;
+ /// use std::thread;
+ /// use std::time::Duration;
+ ///
+ /// let (tx, rx) = channel::<String>();
+ ///
+ /// thread::spawn(move || {
+ /// let d = Duration::from_millis(10);
+ /// loop {
+ /// println!("recv");
+ /// let _r = rx.recv_timeout(d);
+ /// }
+ /// });
+ ///
+ /// thread::sleep(Duration::from_millis(100));
+ /// let _c1 = tx.clone();
+ ///
+ /// thread::sleep(Duration::from_secs(1));
+ /// ```
+ ///
+ /// [`#39364`]: https://github.com/rust-lang/rust/issues/39364
+ ///
/// # Examples
///
/// Successfully receiving value before encountering timeout:
diff --git a/src/libstd/sys/cloudabi/abi/cloudabi.rs b/src/libstd/sys/cloudabi/abi/cloudabi.rs
index 2909db5..cd9a5ad 100644
--- a/src/libstd/sys/cloudabi/abi/cloudabi.rs
+++ b/src/libstd/sys/cloudabi/abi/cloudabi.rs
@@ -121,6 +121,7 @@
/// File or memory access pattern advisory information.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum advice {
/// The application expects that it will not access the
/// specified data in the near future.
@@ -140,12 +141,12 @@
/// The application expects to access the specified data
/// in the near future.
WILLNEED = 6,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
}
/// Enumeration describing the kind of value stored in [`auxv`](struct.auxv.html).
#[repr(u32)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum auxtype {
/// Base address of the binary argument data provided to
/// [`proc_exec()`](fn.proc_exec.html).
@@ -210,12 +211,12 @@
SYSINFO_EHDR = 262,
/// Thread ID of the initial thread of the process.
TID = 261,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u32,
}
/// Identifiers for clocks.
#[repr(u32)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum clockid {
/// The system-wide monotonic clock, which is defined as a
/// clock measuring real time, whose value cannot be
@@ -232,7 +233,6 @@
REALTIME = 3,
/// The CPU-time clock associated with the current thread.
THREAD_CPUTIME_ID = 4,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u32,
}
/// A userspace condition variable.
@@ -267,6 +267,7 @@
/// exclusively or merely provided for alignment with POSIX.
#[repr(u16)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum errno {
/// No error occurred. System call completed successfully.
SUCCESS = 0,
@@ -422,7 +423,6 @@
XDEV = 75,
/// Extension: Capabilities insufficient.
NOTCAPABLE = 76,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u16,
}
bitflags! {
@@ -438,6 +438,7 @@
/// Type of a subscription to an event or its occurrence.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum eventtype {
/// The time value of clock [`subscription.union.clock.clock_id`](struct.subscription_clock.html#structfield.clock_id)
/// has reached timestamp [`subscription.union.clock.timeout`](struct.subscription_clock.html#structfield.timeout).
@@ -463,7 +464,6 @@
/// The process associated with process descriptor
/// [`subscription.union.proc_terminate.fd`](struct.subscription_proc_terminate.html#structfield.fd) has terminated.
PROC_TERMINATE = 7,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
}
/// Exit code generated by a process when exiting.
@@ -530,6 +530,7 @@
/// The type of a file descriptor or file.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum filetype {
/// The type of the file descriptor or file is unknown or
/// is different from any of the other types specified.
@@ -558,7 +559,6 @@
SOCKET_STREAM = 130,
/// The file refers to a symbolic link inode.
SYMBOLIC_LINK = 144,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
}
bitflags! {
@@ -847,12 +847,12 @@
/// memory.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum scope {
/// The object is stored in private memory.
PRIVATE = 4,
/// The object is stored in shared memory.
SHARED = 8,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
}
bitflags! {
@@ -878,6 +878,7 @@
/// Signal condition.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum signal {
/// Process abort signal.
///
@@ -983,7 +984,6 @@
///
/// Action: Terminates the process.
XFSZ = 26,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
}
bitflags! {
@@ -1049,6 +1049,7 @@
/// should be set.
#[repr(u8)]
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
+#[non_exhaustive]
pub enum whence {
/// Seek relative to current position.
CUR = 1,
@@ -1056,7 +1057,6 @@
END = 2,
/// Seek relative to start-of-file.
SET = 3,
- #[doc(hidden)] _NonExhaustive = -1 as isize as u8,
}
/// Auxiliary vector entry.
diff --git a/src/libstd/sys/cloudabi/backtrace.rs b/src/libstd/sys/cloudabi/backtrace.rs
index 1b97018..2c43b59 100644
--- a/src/libstd/sys/cloudabi/backtrace.rs
+++ b/src/libstd/sys/cloudabi/backtrace.rs
@@ -64,6 +64,10 @@
arg: *mut libc::c_void,
) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
+ if cx.idx >= cx.frames.len() {
+ return uw::_URC_NORMAL_STOP;
+ }
+
let mut ip_before_insn = 0;
let mut ip = unsafe { uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void };
if !ip.is_null() && ip_before_insn == 0 {
@@ -73,14 +77,12 @@
}
let symaddr = unsafe { uw::_Unwind_FindEnclosingFunction(ip) };
- if cx.idx < cx.frames.len() {
- cx.frames[cx.idx] = Frame {
- symbol_addr: symaddr as *mut u8,
- exact_position: ip as *mut u8,
- inline_context: 0,
- };
- cx.idx += 1;
- }
+ cx.frames[cx.idx] = Frame {
+ symbol_addr: symaddr as *mut u8,
+ exact_position: ip as *mut u8,
+ inline_context: 0,
+ };
+ cx.idx += 1;
uw::_URC_NO_REASON
}
diff --git a/src/libstd/sys/redox/backtrace/tracing.rs b/src/libstd/sys/redox/backtrace/tracing.rs
index bb70ca3..c0414b7 100644
--- a/src/libstd/sys/redox/backtrace/tracing.rs
+++ b/src/libstd/sys/redox/backtrace/tracing.rs
@@ -68,6 +68,10 @@
extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
+ if cx.idx >= cx.frames.len() {
+ return uw::_URC_NORMAL_STOP;
+ }
+
let mut ip_before_insn = 0;
let mut ip = unsafe {
uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void
@@ -94,14 +98,12 @@
unsafe { uw::_Unwind_FindEnclosingFunction(ip) }
};
- if cx.idx < cx.frames.len() {
- cx.frames[cx.idx] = Frame {
- symbol_addr: symaddr as *mut u8,
- exact_position: ip as *mut u8,
- inline_context: 0,
- };
- cx.idx += 1;
- }
+ cx.frames[cx.idx] = Frame {
+ symbol_addr: symaddr as *mut u8,
+ exact_position: ip as *mut u8,
+ inline_context: 0,
+ };
+ cx.idx += 1;
uw::_URC_NO_REASON
}
diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
index 1b92fc0..6e84156 100644
--- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
+++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
@@ -68,6 +68,10 @@
extern fn trace_fn(ctx: *mut uw::_Unwind_Context,
arg: *mut libc::c_void) -> uw::_Unwind_Reason_Code {
let cx = unsafe { &mut *(arg as *mut Context) };
+ if cx.idx >= cx.frames.len() {
+ return uw::_URC_NORMAL_STOP;
+ }
+
let mut ip_before_insn = 0;
let mut ip = unsafe {
uw::_Unwind_GetIPInfo(ctx, &mut ip_before_insn) as *mut libc::c_void
@@ -94,14 +98,12 @@
unsafe { uw::_Unwind_FindEnclosingFunction(ip) }
};
- if cx.idx < cx.frames.len() {
- cx.frames[cx.idx] = Frame {
- symbol_addr: symaddr as *mut u8,
- exact_position: ip as *mut u8,
- inline_context: 0,
- };
- cx.idx += 1;
- }
+ cx.frames[cx.idx] = Frame {
+ symbol_addr: symaddr as *mut u8,
+ exact_position: ip as *mut u8,
+ inline_context: 0,
+ };
+ cx.idx += 1;
uw::_URC_NO_REASON
}
diff --git a/src/libstd/sys/unix/os.rs b/src/libstd/sys/unix/os.rs
index 08c3e15..f8f0bbd 100644
--- a/src/libstd/sys/unix/os.rs
+++ b/src/libstd/sys/unix/os.rs
@@ -414,12 +414,8 @@
unsafe {
let _guard = ENV_LOCK.lock();
let mut environ = *environ();
- if environ == ptr::null() {
- panic!("os::env() failure getting env string from OS: {}",
- io::Error::last_os_error());
- }
let mut result = Vec::new();
- while *environ != ptr::null() {
+ while environ != ptr::null() && *environ != ptr::null() {
if let Some(key_value) = parse(CStr::from_ptr(*environ).to_bytes()) {
result.push(key_value);
}
diff --git a/src/libstd/sys/windows/backtrace/mod.rs b/src/libstd/sys/windows/backtrace/mod.rs
index 7ef4e20..f64cae8 100644
--- a/src/libstd/sys/windows/backtrace/mod.rs
+++ b/src/libstd/sys/windows/backtrace/mod.rs
@@ -229,6 +229,7 @@
self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat;
c::IMAGE_FILE_MACHINE_I386
}
+
#[cfg(target_arch = "x86_64")]
fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD {
self.AddrPC.Offset = ctx.Rip as u64;
@@ -240,6 +241,17 @@
c::IMAGE_FILE_MACHINE_AMD64
}
+ #[cfg(target_arch = "aarch64")]
+ fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD {
+ self.AddrPC.Offset = ctx.Pc as u64;
+ self.AddrPC.Mode = c::ADDRESS_MODE::AddrModeFlat;
+ self.AddrStack.Offset = ctx.Sp as u64;
+ self.AddrStack.Mode = c::ADDRESS_MODE::AddrModeFlat;
+ self.AddrFrame.Offset = ctx.Fp as u64;
+ self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat;
+ c::IMAGE_FILE_MACHINE_ARM64
+ }
+
fn get_addr(&self) -> *const u8 {
(self.AddrPC.Offset - 1) as *const u8
}
@@ -260,6 +272,7 @@
self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat;
c::IMAGE_FILE_MACHINE_I386
}
+
#[cfg(target_arch = "x86_64")]
fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD {
self.AddrPC.Offset = ctx.Rip as u64;
@@ -271,6 +284,17 @@
c::IMAGE_FILE_MACHINE_AMD64
}
+ #[cfg(target_arch = "aarch64")]
+ fn init(&mut self, ctx: &c::CONTEXT) -> c::DWORD {
+ self.AddrPC.Offset = ctx.Pc as u64;
+ self.AddrPC.Mode = c::ADDRESS_MODE::AddrModeFlat;
+ self.AddrStack.Offset = ctx.Sp as u64;
+ self.AddrStack.Mode = c::ADDRESS_MODE::AddrModeFlat;
+ self.AddrFrame.Offset = ctx.Fp as u64;
+ self.AddrFrame.Mode = c::ADDRESS_MODE::AddrModeFlat;
+ c::IMAGE_FILE_MACHINE_ARM64
+ }
+
fn get_addr(&self) -> *const u8 {
(self.AddrPC.Offset - 1) as *const u8
}
diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs
index 6f81afe..e514a56 100644
--- a/src/libstd/sys/windows/c.rs
+++ b/src/libstd/sys/windows/c.rs
@@ -280,6 +280,9 @@
#[cfg(target_arch = "x86_64")]
#[cfg(feature = "backtrace")]
pub const IMAGE_FILE_MACHINE_AMD64: DWORD = 0x8664;
+#[cfg(target_arch = "aarch64")]
+#[cfg(feature = "backtrace")]
+pub const IMAGE_FILE_MACHINE_ARM64: DWORD = 0xAA64;
pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0;
pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd;
@@ -791,9 +794,68 @@
// will not appear in the final documentation. This should be also defined for
// other architectures supported by Windows such as ARM, and for historical
// interest, maybe MIPS and PowerPC as well.
-#[cfg(all(dox, not(any(target_arch = "x86_64", target_arch = "x86"))))]
+#[cfg(all(dox, not(any(target_arch = "x86_64", target_arch = "x86", target_arch = "aarch64"))))]
pub enum CONTEXT {}
+#[cfg(target_arch = "aarch64")]
+pub const ARM64_MAX_BREAKPOINTS: usize = 8;
+
+#[cfg(target_arch = "aarch64")]
+pub const ARM64_MAX_WATCHPOINTS: usize = 2;
+
+#[cfg(target_arch = "aarch64")]
+#[repr(C)]
+pub struct ARM64_NT_NEON128 {
+ pub D: [f64; 2],
+}
+
+#[cfg(target_arch = "aarch64")]
+#[repr(C, align(16))]
+pub struct CONTEXT {
+ pub ContextFlags: DWORD,
+ pub Cpsr: DWORD,
+ pub X0: u64,
+ pub X1: u64,
+ pub X2: u64,
+ pub X3: u64,
+ pub X4: u64,
+ pub X5: u64,
+ pub X6: u64,
+ pub X7: u64,
+ pub X8: u64,
+ pub X9: u64,
+ pub X10: u64,
+ pub X11: u64,
+ pub X12: u64,
+ pub X13: u64,
+ pub X14: u64,
+ pub X15: u64,
+ pub X16: u64,
+ pub X17: u64,
+ pub X18: u64,
+ pub X19: u64,
+ pub X20: u64,
+ pub X21: u64,
+ pub X22: u64,
+ pub X23: u64,
+ pub X24: u64,
+ pub X25: u64,
+ pub X26: u64,
+ pub X27: u64,
+ pub X28: u64,
+ pub Fp: u64,
+ pub Lr: u64,
+ pub Sp: u64,
+ pub Pc: u64,
+ pub V: [ARM64_NT_NEON128; 32],
+ pub Fpcr: DWORD,
+ pub Fpsr: DWORD,
+ pub Bcr: [DWORD; ARM64_MAX_BREAKPOINTS],
+ pub Bvr: [DWORD; ARM64_MAX_BREAKPOINTS],
+ pub Wcr: [DWORD; ARM64_MAX_WATCHPOINTS],
+ pub Wvr: [DWORD; ARM64_MAX_WATCHPOINTS],
+}
+
#[repr(C)]
pub struct SOCKADDR_STORAGE_LH {
pub ss_family: ADDRESS_FAMILY,
diff --git a/src/libstd/sys/windows/ext/ffi.rs b/src/libstd/sys/windows/ext/ffi.rs
index 98d4355..bae0d02 100644
--- a/src/libstd/sys/windows/ext/ffi.rs
+++ b/src/libstd/sys/windows/ext/ffi.rs
@@ -31,7 +31,7 @@
//!
//! If Rust code *does* need to look into those strings, it can
//! convert them to valid UTF-8, possibly lossily, by substituting
-//! invalid sequences with U+FFFD REPLACEMENT CHARACTER, as is
+//! invalid sequences with [`U+FFFD REPLACEMENT CHARACTER`][U+FFFD], as is
//! conventionally done in other Rust APIs that deal with string
//! encodings.
//!
@@ -65,6 +65,7 @@
//! [`from_wide`]: trait.OsStringExt.html#tymethod.from_wide
//! [`encode_wide`]: trait.OsStrExt.html#tymethod.encode_wide
//! [`collect`]: ../../../iter/trait.Iterator.html#method.collect
+//! [U+FFFD]: ../../../char/constant.REPLACEMENT_CHARACTER.html
#![stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libstd/sys/windows/mod.rs b/src/libstd/sys/windows/mod.rs
index 0d12ecf..ccf79de 100644
--- a/src/libstd/sys/windows/mod.rs
+++ b/src/libstd/sys/windows/mod.rs
@@ -266,8 +266,12 @@
// handlers.
//
// https://msdn.microsoft.com/en-us/library/dn774154.aspx
-#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+#[allow(unreachable_code)]
pub unsafe fn abort_internal() -> ! {
- asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
- ::intrinsics::unreachable();
+ #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
+ {
+ asm!("int $$0x29" :: "{ecx}"(7) ::: volatile); // 7 is FAST_FAIL_FATAL_APP_EXIT
+ ::intrinsics::unreachable();
+ }
+ ::intrinsics::abort();
}
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index 28c1e43..ec6ac86 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -13,11 +13,10 @@
pub use self::UnsafeSource::*;
pub use self::GenericArgs::*;
pub use symbol::{Ident, Symbol as Name};
-pub use util::ThinVec;
pub use util::parser::ExprPrecedence;
use syntax_pos::{Span, DUMMY_SP};
-use codemap::{dummy_spanned, respan, Spanned};
+use source_map::{dummy_spanned, respan, Spanned};
use rustc_target::spec::abi::Abi;
use ext::hygiene::{Mark, SyntaxContext};
use print::pprust;
@@ -25,6 +24,7 @@
use rustc_data_structures::indexed_vec;
use rustc_data_structures::indexed_vec::Idx;
use symbol::{Symbol, keywords};
+use ThinVec;
use tokenstream::{ThinTokenStream, TokenStream};
use serialize::{self, Encoder, Decoder};
@@ -101,7 +101,7 @@
// or starts with something like `self`/`super`/`$crate`/etc.
pub fn make_root(&self) -> Option<PathSegment> {
if let Some(ident) = self.segments.get(0).map(|seg| seg.ident) {
- if ident.is_path_segment_keyword() && ident.name != keywords::Crate.name() {
+ if ident.is_path_segment_keyword() {
return None;
}
}
@@ -501,7 +501,11 @@
PatKind::Slice(pats, None, _) if pats.len() == 1 =>
pats[0].to_ty().map(TyKind::Slice)?,
PatKind::Tuple(pats, None) => {
- let tys = pats.iter().map(|pat| pat.to_ty()).collect::<Option<Vec<_>>>()?;
+ let mut tys = Vec::with_capacity(pats.len());
+ // FIXME(#48994) - could just be collected into an Option<Vec>
+ for pat in pats {
+ tys.push(pat.to_ty()?);
+ }
TyKind::Tup(tys)
}
_ => return None,
diff --git a/src/libsyntax/attr/mod.rs b/src/libsyntax/attr/mod.rs
index b3b173d..cd9d768 100644
--- a/src/libsyntax/attr/mod.rs
+++ b/src/libsyntax/attr/mod.rs
@@ -25,7 +25,7 @@
use ast::{AttrId, Attribute, AttrStyle, Name, Ident, Path, PathSegment};
use ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind};
use ast::{Lit, LitKind, Expr, ExprKind, Item, Local, Stmt, StmtKind, GenericParam};
-use codemap::{BytePos, Spanned, respan, dummy_spanned};
+use source_map::{BytePos, Spanned, respan, dummy_spanned};
use syntax_pos::{FileName, Span};
use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
use parse::parser::Parser;
@@ -33,8 +33,8 @@
use parse::token::{self, Token};
use ptr::P;
use symbol::Symbol;
+use ThinVec;
use tokenstream::{TokenStream, TokenTree, Delimited};
-use util::ThinVec;
use GLOBALS;
use std::iter;
@@ -607,7 +607,7 @@
}
impl Lit {
- fn tokens(&self) -> TokenStream {
+ crate fn tokens(&self) -> TokenStream {
TokenTree::Token(self.span, self.node.token()).into()
}
}
@@ -794,7 +794,7 @@
);
let start_span = parser.span;
- let (path, tokens) = panictry!(parser.parse_path_and_tokens());
+ let (path, tokens) = panictry!(parser.parse_meta_item_unrestricted());
let end_span = parser.span;
if parser.token != token::Eof {
parse_sess.span_diagnostic
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
deleted file mode 100644
index 0a9991d..0000000
--- a/src/libsyntax/codemap.rs
+++ /dev/null
@@ -1,1235 +0,0 @@
-// Copyright 2012 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.
-
-//! The CodeMap tracks all the source code used within a single crate, mapping
-//! from integer byte positions to the original source code location. Each bit
-//! of source parsed during crate parsing (typically files, in-memory strings,
-//! or various bits of macro expansion) cover a continuous range of bytes in the
-//! CodeMap and are represented by FileMaps. Byte positions are stored in
-//! `spans` and used pervasively in the compiler. They are absolute positions
-//! within the CodeMap, which upon request can be converted to line and column
-//! information, source code snippets, etc.
-
-
-pub use syntax_pos::*;
-pub use syntax_pos::hygiene::{ExpnFormat, ExpnInfo};
-pub use self::ExpnFormat::*;
-
-use rustc_data_structures::fx::FxHashMap;
-use rustc_data_structures::stable_hasher::StableHasher;
-use rustc_data_structures::sync::{Lrc, Lock, LockGuard};
-use std::cmp;
-use std::hash::Hash;
-use std::path::{Path, PathBuf};
-
-use std::env;
-use std::fs;
-use std::io::{self, Read};
-use errors::CodeMapper;
-
-/// Return the span itself if it doesn't come from a macro expansion,
-/// otherwise return the call site span up to the `enclosing_sp` by
-/// following the `expn_info` chain.
-pub fn original_sp(sp: Span, enclosing_sp: Span) -> Span {
- let call_site1 = sp.ctxt().outer().expn_info().map(|ei| ei.call_site);
- let call_site2 = enclosing_sp.ctxt().outer().expn_info().map(|ei| ei.call_site);
- match (call_site1, call_site2) {
- (None, _) => sp,
- (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => sp,
- (Some(call_site1), _) => original_sp(call_site1, enclosing_sp),
- }
-}
-
-#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
-pub struct Spanned<T> {
- pub node: T,
- pub span: Span,
-}
-
-pub fn respan<T>(sp: Span, t: T) -> Spanned<T> {
- Spanned {node: t, span: sp}
-}
-
-pub fn dummy_spanned<T>(t: T) -> Spanned<T> {
- respan(DUMMY_SP, t)
-}
-
-// _____________________________________________________________________________
-// FileMap, MultiByteChar, FileName, FileLines
-//
-
-/// An abstraction over the fs operations used by the Parser.
-pub trait FileLoader {
- /// Query the existence of a file.
- fn file_exists(&self, path: &Path) -> bool;
-
- /// Return an absolute path to a file, if possible.
- fn abs_path(&self, path: &Path) -> Option<PathBuf>;
-
- /// Read the contents of an UTF-8 file into memory.
- fn read_file(&self, path: &Path) -> io::Result<String>;
-}
-
-/// A FileLoader that uses std::fs to load real files.
-pub struct RealFileLoader;
-
-impl FileLoader for RealFileLoader {
- fn file_exists(&self, path: &Path) -> bool {
- fs::metadata(path).is_ok()
- }
-
- fn abs_path(&self, path: &Path) -> Option<PathBuf> {
- if path.is_absolute() {
- Some(path.to_path_buf())
- } else {
- env::current_dir()
- .ok()
- .map(|cwd| cwd.join(path))
- }
- }
-
- fn read_file(&self, path: &Path) -> io::Result<String> {
- let mut src = String::new();
- fs::File::open(path)?.read_to_string(&mut src)?;
- Ok(src)
- }
-}
-
-// This is a FileMap identifier that is used to correlate FileMaps between
-// subsequent compilation sessions (which is something we need to do during
-// incremental compilation).
-#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
-pub struct StableFilemapId(u128);
-
-impl StableFilemapId {
- pub fn new(filemap: &FileMap) -> StableFilemapId {
- let mut hasher = StableHasher::new();
-
- filemap.name.hash(&mut hasher);
- filemap.name_was_remapped.hash(&mut hasher);
- filemap.unmapped_path.hash(&mut hasher);
-
- StableFilemapId(hasher.finish())
- }
-}
-
-// _____________________________________________________________________________
-// CodeMap
-//
-
-pub(super) struct CodeMapFiles {
- pub(super) file_maps: Vec<Lrc<FileMap>>,
- stable_id_to_filemap: FxHashMap<StableFilemapId, Lrc<FileMap>>
-}
-
-pub struct CodeMap {
- pub(super) files: Lock<CodeMapFiles>,
- file_loader: Box<dyn FileLoader + Sync + Send>,
- // This is used to apply the file path remapping as specified via
- // --remap-path-prefix to all FileMaps allocated within this CodeMap.
- path_mapping: FilePathMapping,
- /// In case we are in a doctest, replace all file names with the PathBuf,
- /// and add the given offsets to the line info
- doctest_offset: Option<(FileName, isize)>,
-}
-
-impl CodeMap {
- pub fn new(path_mapping: FilePathMapping) -> CodeMap {
- CodeMap {
- files: Lock::new(CodeMapFiles {
- file_maps: Vec::new(),
- stable_id_to_filemap: FxHashMap(),
- }),
- file_loader: Box::new(RealFileLoader),
- path_mapping,
- doctest_offset: None,
- }
- }
-
- pub fn new_doctest(path_mapping: FilePathMapping,
- file: FileName, line: isize) -> CodeMap {
- CodeMap {
- doctest_offset: Some((file, line)),
- ..CodeMap::new(path_mapping)
- }
-
- }
-
- pub fn with_file_loader(file_loader: Box<dyn FileLoader + Sync + Send>,
- path_mapping: FilePathMapping)
- -> CodeMap {
- CodeMap {
- files: Lock::new(CodeMapFiles {
- file_maps: Vec::new(),
- stable_id_to_filemap: FxHashMap(),
- }),
- file_loader: file_loader,
- path_mapping,
- doctest_offset: None,
- }
- }
-
- pub fn path_mapping(&self) -> &FilePathMapping {
- &self.path_mapping
- }
-
- pub fn file_exists(&self, path: &Path) -> bool {
- self.file_loader.file_exists(path)
- }
-
- pub fn load_file(&self, path: &Path) -> io::Result<Lrc<FileMap>> {
- let src = self.file_loader.read_file(path)?;
- let filename = if let Some((ref name, _)) = self.doctest_offset {
- name.clone()
- } else {
- path.to_owned().into()
- };
- Ok(self.new_filemap(filename, src))
- }
-
- pub fn files(&self) -> LockGuard<Vec<Lrc<FileMap>>> {
- LockGuard::map(self.files.borrow(), |files| &mut files.file_maps)
- }
-
- pub fn filemap_by_stable_id(&self, stable_id: StableFilemapId) -> Option<Lrc<FileMap>> {
- self.files.borrow().stable_id_to_filemap.get(&stable_id).map(|fm| fm.clone())
- }
-
- fn next_start_pos(&self) -> usize {
- match self.files.borrow().file_maps.last() {
- None => 0,
- // Add one so there is some space between files. This lets us distinguish
- // positions in the codemap, even in the presence of zero-length files.
- Some(last) => last.end_pos.to_usize() + 1,
- }
- }
-
- /// Creates a new filemap.
- /// This does not ensure that only one FileMap exists per file name.
- pub fn new_filemap(&self, filename: FileName, src: String) -> Lrc<FileMap> {
- let start_pos = self.next_start_pos();
-
- // The path is used to determine the directory for loading submodules and
- // include files, so it must be before remapping.
- // Note that filename may not be a valid path, eg it may be `<anon>` etc,
- // but this is okay because the directory determined by `path.pop()` will
- // be empty, so the working directory will be used.
- let unmapped_path = filename.clone();
-
- let (filename, was_remapped) = match filename {
- FileName::Real(filename) => {
- let (filename, was_remapped) = self.path_mapping.map_prefix(filename);
- (FileName::Real(filename), was_remapped)
- },
- other => (other, false),
- };
- let filemap = Lrc::new(FileMap::new(
- filename,
- was_remapped,
- unmapped_path,
- src,
- Pos::from_usize(start_pos),
- ));
-
- let mut files = self.files.borrow_mut();
-
- files.file_maps.push(filemap.clone());
- files.stable_id_to_filemap.insert(StableFilemapId::new(&filemap), filemap.clone());
-
- filemap
- }
-
- /// Allocates a new FileMap representing a source file from an external
- /// crate. The source code of such an "imported filemap" is not available,
- /// but we still know enough to generate accurate debuginfo location
- /// information for things inlined from other crates.
- pub fn new_imported_filemap(&self,
- filename: FileName,
- name_was_remapped: bool,
- crate_of_origin: u32,
- src_hash: u128,
- name_hash: u128,
- source_len: usize,
- mut file_local_lines: Vec<BytePos>,
- mut file_local_multibyte_chars: Vec<MultiByteChar>,
- mut file_local_non_narrow_chars: Vec<NonNarrowChar>)
- -> Lrc<FileMap> {
- let start_pos = self.next_start_pos();
-
- let end_pos = Pos::from_usize(start_pos + source_len);
- let start_pos = Pos::from_usize(start_pos);
-
- for pos in &mut file_local_lines {
- *pos = *pos + start_pos;
- }
-
- for mbc in &mut file_local_multibyte_chars {
- mbc.pos = mbc.pos + start_pos;
- }
-
- for swc in &mut file_local_non_narrow_chars {
- *swc = *swc + start_pos;
- }
-
- let filemap = Lrc::new(FileMap {
- name: filename,
- name_was_remapped,
- unmapped_path: None,
- crate_of_origin,
- src: None,
- src_hash,
- external_src: Lock::new(ExternalSource::AbsentOk),
- start_pos,
- end_pos,
- lines: file_local_lines,
- multibyte_chars: file_local_multibyte_chars,
- non_narrow_chars: file_local_non_narrow_chars,
- name_hash,
- });
-
- let mut files = self.files.borrow_mut();
-
- files.file_maps.push(filemap.clone());
- files.stable_id_to_filemap.insert(StableFilemapId::new(&filemap), filemap.clone());
-
- filemap
- }
-
- pub fn mk_substr_filename(&self, sp: Span) -> String {
- let pos = self.lookup_char_pos(sp.lo());
- format!("<{}:{}:{}>",
- pos.file.name,
- pos.line,
- pos.col.to_usize() + 1)
- }
-
- // If there is a doctest_offset, apply it to the line
- pub fn doctest_offset_line(&self, mut orig: usize) -> usize {
- if let Some((_, line)) = self.doctest_offset {
- if line >= 0 {
- orig = orig + line as usize;
- } else {
- orig = orig - (-line) as usize;
- }
- }
- orig
- }
-
- /// Lookup source information about a BytePos
- pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
- let chpos = self.bytepos_to_file_charpos(pos);
- match self.lookup_line(pos) {
- Ok(FileMapAndLine { fm: f, line: a }) => {
- let line = a + 1; // Line numbers start at 1
- let linebpos = f.lines[a];
- let linechpos = self.bytepos_to_file_charpos(linebpos);
- let col = chpos - linechpos;
-
- let col_display = {
- let start_width_idx = f
- .non_narrow_chars
- .binary_search_by_key(&linebpos, |x| x.pos())
- .unwrap_or_else(|x| x);
- let end_width_idx = f
- .non_narrow_chars
- .binary_search_by_key(&pos, |x| x.pos())
- .unwrap_or_else(|x| x);
- let special_chars = end_width_idx - start_width_idx;
- let non_narrow: usize = f
- .non_narrow_chars[start_width_idx..end_width_idx]
- .into_iter()
- .map(|x| x.width())
- .sum();
- col.0 - special_chars + non_narrow
- };
- debug!("byte pos {:?} is on the line at byte pos {:?}",
- pos, linebpos);
- debug!("char pos {:?} is on the line at char pos {:?}",
- chpos, linechpos);
- debug!("byte is on line: {}", line);
- assert!(chpos >= linechpos);
- Loc {
- file: f,
- line,
- col,
- col_display,
- }
- }
- Err(f) => {
- let col_display = {
- let end_width_idx = f
- .non_narrow_chars
- .binary_search_by_key(&pos, |x| x.pos())
- .unwrap_or_else(|x| x);
- let non_narrow: usize = f
- .non_narrow_chars[0..end_width_idx]
- .into_iter()
- .map(|x| x.width())
- .sum();
- chpos.0 - end_width_idx + non_narrow
- };
- Loc {
- file: f,
- line: 0,
- col: chpos,
- col_display,
- }
- }
- }
- }
-
- // If the relevant filemap is empty, we don't return a line number.
- pub fn lookup_line(&self, pos: BytePos) -> Result<FileMapAndLine, Lrc<FileMap>> {
- let idx = self.lookup_filemap_idx(pos);
-
- let f = (*self.files.borrow().file_maps)[idx].clone();
-
- match f.lookup_line(pos) {
- Some(line) => Ok(FileMapAndLine { fm: f, line: line }),
- None => Err(f)
- }
- }
-
- pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt {
- let loc = self.lookup_char_pos(pos);
- LocWithOpt {
- filename: loc.file.name.clone(),
- line: loc.line,
- col: loc.col,
- file: Some(loc.file)
- }
- }
-
- /// Returns `Some(span)`, a union of the lhs and rhs span. The lhs must precede the rhs. If
- /// there are gaps between lhs and rhs, the resulting union will cross these gaps.
- /// For this to work, the spans have to be:
- ///
- /// * the ctxt of both spans much match
- /// * the lhs span needs to end on the same line the rhs span begins
- /// * the lhs span must start at or before the rhs span
- pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
- // make sure we're at the same expansion id
- if sp_lhs.ctxt() != sp_rhs.ctxt() {
- return None;
- }
-
- let lhs_end = match self.lookup_line(sp_lhs.hi()) {
- Ok(x) => x,
- Err(_) => return None
- };
- let rhs_begin = match self.lookup_line(sp_rhs.lo()) {
- Ok(x) => x,
- Err(_) => return None
- };
-
- // if we must cross lines to merge, don't merge
- if lhs_end.line != rhs_begin.line {
- return None;
- }
-
- // ensure these follow the expected order and we don't overlap
- if (sp_lhs.lo() <= sp_rhs.lo()) && (sp_lhs.hi() <= sp_rhs.lo()) {
- Some(sp_lhs.to(sp_rhs))
- } else {
- None
- }
- }
-
- pub fn span_to_string(&self, sp: Span) -> String {
- if self.files.borrow().file_maps.is_empty() && sp.is_dummy() {
- return "no-location".to_string();
- }
-
- let lo = self.lookup_char_pos_adj(sp.lo());
- let hi = self.lookup_char_pos_adj(sp.hi());
- format!("{}:{}:{}: {}:{}",
- lo.filename,
- lo.line,
- lo.col.to_usize() + 1,
- hi.line,
- hi.col.to_usize() + 1)
- }
-
- pub fn span_to_filename(&self, sp: Span) -> FileName {
- self.lookup_char_pos(sp.lo()).file.name.clone()
- }
-
- pub fn span_to_unmapped_path(&self, sp: Span) -> FileName {
- self.lookup_char_pos(sp.lo()).file.unmapped_path.clone()
- .expect("CodeMap::span_to_unmapped_path called for imported FileMap?")
- }
-
- pub fn is_multiline(&self, sp: Span) -> bool {
- let lo = self.lookup_char_pos(sp.lo());
- let hi = self.lookup_char_pos(sp.hi());
- lo.line != hi.line
- }
-
- pub fn span_to_lines(&self, sp: Span) -> FileLinesResult {
- debug!("span_to_lines(sp={:?})", sp);
-
- if sp.lo() > sp.hi() {
- return Err(SpanLinesError::IllFormedSpan(sp));
- }
-
- let lo = self.lookup_char_pos(sp.lo());
- debug!("span_to_lines: lo={:?}", lo);
- let hi = self.lookup_char_pos(sp.hi());
- debug!("span_to_lines: hi={:?}", hi);
-
- if lo.file.start_pos != hi.file.start_pos {
- return Err(SpanLinesError::DistinctSources(DistinctSources {
- begin: (lo.file.name.clone(), lo.file.start_pos),
- end: (hi.file.name.clone(), hi.file.start_pos),
- }));
- }
- assert!(hi.line >= lo.line);
-
- let mut lines = Vec::with_capacity(hi.line - lo.line + 1);
-
- // The span starts partway through the first line,
- // but after that it starts from offset 0.
- let mut start_col = lo.col;
-
- // For every line but the last, it extends from `start_col`
- // and to the end of the line. Be careful because the line
- // numbers in Loc are 1-based, so we subtract 1 to get 0-based
- // lines.
- for line_index in lo.line-1 .. hi.line-1 {
- let line_len = lo.file.get_line(line_index)
- .map(|s| s.chars().count())
- .unwrap_or(0);
- lines.push(LineInfo { line_index,
- start_col,
- end_col: CharPos::from_usize(line_len) });
- start_col = CharPos::from_usize(0);
- }
-
- // For the last line, it extends from `start_col` to `hi.col`:
- lines.push(LineInfo { line_index: hi.line - 1,
- start_col,
- end_col: hi.col });
-
- Ok(FileLines {file: lo.file, lines: lines})
- }
-
- /// Extract the source surrounding the given `Span` using the `extract_source` function. The
- /// extract function takes three arguments: a string slice containing the source, an index in
- /// the slice for the beginning of the span and an index in the slice for the end of the span.
- fn span_to_source<F>(&self, sp: Span, extract_source: F) -> Result<String, SpanSnippetError>
- where F: Fn(&str, usize, usize) -> String
- {
- if sp.lo() > sp.hi() {
- return Err(SpanSnippetError::IllFormedSpan(sp));
- }
-
- let local_begin = self.lookup_byte_offset(sp.lo());
- let local_end = self.lookup_byte_offset(sp.hi());
-
- if local_begin.fm.start_pos != local_end.fm.start_pos {
- return Err(SpanSnippetError::DistinctSources(DistinctSources {
- begin: (local_begin.fm.name.clone(),
- local_begin.fm.start_pos),
- end: (local_end.fm.name.clone(),
- local_end.fm.start_pos)
- }));
- } else {
- self.ensure_filemap_source_present(local_begin.fm.clone());
-
- let start_index = local_begin.pos.to_usize();
- let end_index = local_end.pos.to_usize();
- let source_len = (local_begin.fm.end_pos -
- local_begin.fm.start_pos).to_usize();
-
- if start_index > end_index || end_index > source_len {
- return Err(SpanSnippetError::MalformedForCodemap(
- MalformedCodemapPositions {
- name: local_begin.fm.name.clone(),
- source_len,
- begin_pos: local_begin.pos,
- end_pos: local_end.pos,
- }));
- }
-
- if let Some(ref src) = local_begin.fm.src {
- return Ok(extract_source(src, start_index, end_index));
- } else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
- return Ok(extract_source(src, start_index, end_index));
- } else {
- return Err(SpanSnippetError::SourceNotAvailable {
- filename: local_begin.fm.name.clone()
- });
- }
- }
- }
-
- /// Return the source snippet as `String` corresponding to the given `Span`
- pub fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError> {
- self.span_to_source(sp, |src, start_index, end_index| src[start_index..end_index]
- .to_string())
- }
-
- /// Return the source snippet as `String` before the given `Span`
- pub fn span_to_prev_source(&self, sp: Span) -> Result<String, SpanSnippetError> {
- self.span_to_source(sp, |src, start_index, _| src[..start_index].to_string())
- }
-
- /// Extend the given `Span` to just after the previous occurrence of `c`. Return the same span
- /// if no character could be found or if an error occurred while retrieving the code snippet.
- pub fn span_extend_to_prev_char(&self, sp: Span, c: char) -> Span {
- if let Ok(prev_source) = self.span_to_prev_source(sp) {
- let prev_source = prev_source.rsplit(c).nth(0).unwrap_or("").trim_left();
- if !prev_source.is_empty() && !prev_source.contains('\n') {
- return sp.with_lo(BytePos(sp.lo().0 - prev_source.len() as u32));
- }
- }
-
- sp
- }
-
- /// Extend the given `Span` to just after the previous occurrence of `pat` when surrounded by
- /// whitespace. Return the same span if no character could be found or if an error occurred
- /// while retrieving the code snippet.
- pub fn span_extend_to_prev_str(&self, sp: Span, pat: &str, accept_newlines: bool) -> Span {
- // assure that the pattern is delimited, to avoid the following
- // fn my_fn()
- // ^^^^ returned span without the check
- // ---------- correct span
- for ws in &[" ", "\t", "\n"] {
- let pat = pat.to_owned() + ws;
- if let Ok(prev_source) = self.span_to_prev_source(sp) {
- let prev_source = prev_source.rsplit(&pat).nth(0).unwrap_or("").trim_left();
- if !prev_source.is_empty() && (!prev_source.contains('\n') || accept_newlines) {
- return sp.with_lo(BytePos(sp.lo().0 - prev_source.len() as u32));
- }
- }
- }
-
- sp
- }
-
- /// Given a `Span`, try to get a shorter span ending before the first occurrence of `c` `char`
- pub fn span_until_char(&self, sp: Span, c: char) -> Span {
- match self.span_to_snippet(sp) {
- Ok(snippet) => {
- let snippet = snippet.split(c).nth(0).unwrap_or("").trim_right();
- if !snippet.is_empty() && !snippet.contains('\n') {
- sp.with_hi(BytePos(sp.lo().0 + snippet.len() as u32))
- } else {
- sp
- }
- }
- _ => sp,
- }
- }
-
- /// Given a `Span`, try to get a shorter span ending just after the first occurrence of `char`
- /// `c`.
- pub fn span_through_char(&self, sp: Span, c: char) -> Span {
- if let Ok(snippet) = self.span_to_snippet(sp) {
- if let Some(offset) = snippet.find(c) {
- return sp.with_hi(BytePos(sp.lo().0 + (offset + c.len_utf8()) as u32));
- }
- }
- sp
- }
-
- /// Given a `Span`, get a new `Span` covering the first token and all its trailing whitespace or
- /// the original `Span`.
- ///
- /// If `sp` points to `"let mut x"`, then a span pointing at `"let "` will be returned.
- pub fn span_until_non_whitespace(&self, sp: Span) -> Span {
- let mut whitespace_found = false;
-
- self.span_take_while(sp, |c| {
- if !whitespace_found && c.is_whitespace() {
- whitespace_found = true;
- }
-
- if whitespace_found && !c.is_whitespace() {
- false
- } else {
- true
- }
- })
- }
-
- /// Given a `Span`, get a new `Span` covering the first token without its trailing whitespace or
- /// the original `Span` in case of error.
- ///
- /// If `sp` points to `"let mut x"`, then a span pointing at `"let"` will be returned.
- pub fn span_until_whitespace(&self, sp: Span) -> Span {
- self.span_take_while(sp, |c| !c.is_whitespace())
- }
-
- /// Given a `Span`, get a shorter one until `predicate` yields false.
- pub fn span_take_while<P>(&self, sp: Span, predicate: P) -> Span
- where P: for <'r> FnMut(&'r char) -> bool
- {
- if let Ok(snippet) = self.span_to_snippet(sp) {
- let offset = snippet.chars()
- .take_while(predicate)
- .map(|c| c.len_utf8())
- .sum::<usize>();
-
- sp.with_hi(BytePos(sp.lo().0 + (offset as u32)))
- } else {
- sp
- }
- }
-
- pub fn def_span(&self, sp: Span) -> Span {
- self.span_until_char(sp, '{')
- }
-
- /// Returns a new span representing just the start-point of this span
- pub fn start_point(&self, sp: Span) -> Span {
- let pos = sp.lo().0;
- let width = self.find_width_of_character_at_span(sp, false);
- let corrected_start_position = pos.checked_add(width).unwrap_or(pos);
- let end_point = BytePos(cmp::max(corrected_start_position, sp.lo().0));
- sp.with_hi(end_point)
- }
-
- /// Returns a new span representing just the end-point of this span
- pub fn end_point(&self, sp: Span) -> Span {
- let pos = sp.hi().0;
-
- let width = self.find_width_of_character_at_span(sp, false);
- let corrected_end_position = pos.checked_sub(width).unwrap_or(pos);
-
- let end_point = BytePos(cmp::max(corrected_end_position, sp.lo().0));
- sp.with_lo(end_point)
- }
-
- /// Returns a new span representing the next character after the end-point of this span
- pub fn next_point(&self, sp: Span) -> Span {
- let start_of_next_point = sp.hi().0;
-
- let width = self.find_width_of_character_at_span(sp, true);
- // If the width is 1, then the next span should point to the same `lo` and `hi`. However,
- // in the case of a multibyte character, where the width != 1, the next span should
- // span multiple bytes to include the whole character.
- let end_of_next_point = start_of_next_point.checked_add(
- width - 1).unwrap_or(start_of_next_point);
-
- let end_of_next_point = BytePos(cmp::max(sp.lo().0 + 1, end_of_next_point));
- Span::new(BytePos(start_of_next_point), end_of_next_point, sp.ctxt())
- }
-
- /// Finds the width of a character, either before or after the provided span.
- fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
- // Disregard malformed spans and assume a one-byte wide character.
- if sp.lo() >= sp.hi() {
- debug!("find_width_of_character_at_span: early return malformed span");
- return 1;
- }
-
- let local_begin = self.lookup_byte_offset(sp.lo());
- let local_end = self.lookup_byte_offset(sp.hi());
- debug!("find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`",
- local_begin, local_end);
-
- let start_index = local_begin.pos.to_usize();
- let end_index = local_end.pos.to_usize();
- debug!("find_width_of_character_at_span: start_index=`{:?}`, end_index=`{:?}`",
- start_index, end_index);
-
- // Disregard indexes that are at the start or end of their spans, they can't fit bigger
- // characters.
- if (!forwards && end_index == usize::min_value()) ||
- (forwards && start_index == usize::max_value()) {
- debug!("find_width_of_character_at_span: start or end of span, cannot be multibyte");
- return 1;
- }
-
- let source_len = (local_begin.fm.end_pos - local_begin.fm.start_pos).to_usize();
- debug!("find_width_of_character_at_span: source_len=`{:?}`", source_len);
- // Ensure indexes are also not malformed.
- if start_index > end_index || end_index > source_len {
- debug!("find_width_of_character_at_span: source indexes are malformed");
- return 1;
- }
-
- let src = local_begin.fm.external_src.borrow();
-
- // We need to extend the snippet to the end of the src rather than to end_index so when
- // searching forwards for boundaries we've got somewhere to search.
- let snippet = if let Some(ref src) = local_begin.fm.src {
- let len = src.len();
- (&src[start_index..len])
- } else if let Some(src) = src.get_source() {
- let len = src.len();
- (&src[start_index..len])
- } else {
- return 1;
- };
- debug!("find_width_of_character_at_span: snippet=`{:?}`", snippet);
-
- let mut target = if forwards { end_index + 1 } else { end_index - 1 };
- debug!("find_width_of_character_at_span: initial target=`{:?}`", target);
-
- while !snippet.is_char_boundary(target - start_index) && target < source_len {
- target = if forwards {
- target + 1
- } else {
- match target.checked_sub(1) {
- Some(target) => target,
- None => {
- break;
- }
- }
- };
- debug!("find_width_of_character_at_span: target=`{:?}`", target);
- }
- debug!("find_width_of_character_at_span: final target=`{:?}`", target);
-
- if forwards {
- (target - end_index) as u32
- } else {
- (end_index - target) as u32
- }
- }
-
- pub fn get_filemap(&self, filename: &FileName) -> Option<Lrc<FileMap>> {
- for fm in self.files.borrow().file_maps.iter() {
- if *filename == fm.name {
- return Some(fm.clone());
- }
- }
- None
- }
-
- /// For a global BytePos compute the local offset within the containing FileMap
- pub fn lookup_byte_offset(&self, bpos: BytePos) -> FileMapAndBytePos {
- let idx = self.lookup_filemap_idx(bpos);
- let fm = (*self.files.borrow().file_maps)[idx].clone();
- let offset = bpos - fm.start_pos;
- FileMapAndBytePos {fm: fm, pos: offset}
- }
-
- /// Converts an absolute BytePos to a CharPos relative to the filemap.
- pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
- let idx = self.lookup_filemap_idx(bpos);
- let map = &(*self.files.borrow().file_maps)[idx];
-
- // The number of extra bytes due to multibyte chars in the FileMap
- let mut total_extra_bytes = 0;
-
- for mbc in map.multibyte_chars.iter() {
- debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos);
- if mbc.pos < bpos {
- // every character is at least one byte, so we only
- // count the actual extra bytes.
- total_extra_bytes += mbc.bytes as u32 - 1;
- // We should never see a byte position in the middle of a
- // character
- assert!(bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32);
- } else {
- break;
- }
- }
-
- assert!(map.start_pos.to_u32() + total_extra_bytes <= bpos.to_u32());
- CharPos(bpos.to_usize() - map.start_pos.to_usize() - total_extra_bytes as usize)
- }
-
- // Return the index of the filemap (in self.files) which contains pos.
- pub fn lookup_filemap_idx(&self, pos: BytePos) -> usize {
- let files = self.files.borrow();
- let files = &files.file_maps;
- let count = files.len();
-
- // Binary search for the filemap.
- let mut a = 0;
- let mut b = count;
- while b - a > 1 {
- let m = (a + b) / 2;
- if files[m].start_pos > pos {
- b = m;
- } else {
- a = m;
- }
- }
-
- assert!(a < count, "position {} does not resolve to a source location", pos.to_usize());
-
- return a;
- }
-
- pub fn count_lines(&self) -> usize {
- self.files().iter().fold(0, |a, f| a + f.count_lines())
- }
-
-
- pub fn generate_fn_name_span(&self, span: Span) -> Option<Span> {
- let prev_span = self.span_extend_to_prev_str(span, "fn", true);
- self.span_to_snippet(prev_span).map(|snippet| {
- let len = snippet.find(|c: char| !c.is_alphanumeric() && c != '_')
- .expect("no label after fn");
- prev_span.with_hi(BytePos(prev_span.lo().0 + len as u32))
- }).ok()
- }
-
- /// Take the span of a type parameter in a function signature and try to generate a span for the
- /// function name (with generics) and a new snippet for this span with the pointed type
- /// parameter as a new local type parameter.
- ///
- /// For instance:
- /// ```rust,ignore (pseudo-Rust)
- /// // Given span
- /// fn my_function(param: T)
- /// // ^ Original span
- ///
- /// // Result
- /// fn my_function(param: T)
- /// // ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
- /// ```
- ///
- /// Attention: The method used is very fragile since it essentially duplicates the work of the
- /// parser. If you need to use this function or something similar, please consider updating the
- /// codemap functions and this function to something more robust.
- pub fn generate_local_type_param_snippet(&self, span: Span) -> Option<(Span, String)> {
- // Try to extend the span to the previous "fn" keyword to retrieve the function
- // signature
- let sugg_span = self.span_extend_to_prev_str(span, "fn", false);
- if sugg_span != span {
- if let Ok(snippet) = self.span_to_snippet(sugg_span) {
- // Consume the function name
- let mut offset = snippet.find(|c: char| !c.is_alphanumeric() && c != '_')
- .expect("no label after fn");
-
- // Consume the generics part of the function signature
- let mut bracket_counter = 0;
- let mut last_char = None;
- for c in snippet[offset..].chars() {
- match c {
- '<' => bracket_counter += 1,
- '>' => bracket_counter -= 1,
- '(' => if bracket_counter == 0 { break; }
- _ => {}
- }
- offset += c.len_utf8();
- last_char = Some(c);
- }
-
- // Adjust the suggestion span to encompass the function name with its generics
- let sugg_span = sugg_span.with_hi(BytePos(sugg_span.lo().0 + offset as u32));
-
- // Prepare the new suggested snippet to append the type parameter that triggered
- // the error in the generics of the function signature
- let mut new_snippet = if last_char == Some('>') {
- format!("{}, ", &snippet[..(offset - '>'.len_utf8())])
- } else {
- format!("{}<", &snippet[..offset])
- };
- new_snippet.push_str(&self.span_to_snippet(span).unwrap_or("T".to_string()));
- new_snippet.push('>');
-
- return Some((sugg_span, new_snippet));
- }
- }
-
- None
- }
-}
-
-impl CodeMapper for CodeMap {
- fn lookup_char_pos(&self, pos: BytePos) -> Loc {
- self.lookup_char_pos(pos)
- }
- fn span_to_lines(&self, sp: Span) -> FileLinesResult {
- self.span_to_lines(sp)
- }
- fn span_to_string(&self, sp: Span) -> String {
- self.span_to_string(sp)
- }
- fn span_to_filename(&self, sp: Span) -> FileName {
- self.span_to_filename(sp)
- }
- fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
- self.merge_spans(sp_lhs, sp_rhs)
- }
- fn call_span_if_macro(&self, sp: Span) -> Span {
- if self.span_to_filename(sp.clone()).is_macros() {
- let v = sp.macro_backtrace();
- if let Some(use_site) = v.last() {
- return use_site.call_site;
- }
- }
- sp
- }
- fn ensure_filemap_source_present(&self, file_map: Lrc<FileMap>) -> bool {
- file_map.add_external_src(
- || match file_map.name {
- FileName::Real(ref name) => self.file_loader.read_file(name).ok(),
- _ => None,
- }
- )
- }
- fn doctest_offset_line(&self, line: usize) -> usize {
- self.doctest_offset_line(line)
- }
-}
-
-#[derive(Clone)]
-pub struct FilePathMapping {
- mapping: Vec<(PathBuf, PathBuf)>,
-}
-
-impl FilePathMapping {
- pub fn empty() -> FilePathMapping {
- FilePathMapping {
- mapping: vec![]
- }
- }
-
- pub fn new(mapping: Vec<(PathBuf, PathBuf)>) -> FilePathMapping {
- FilePathMapping {
- mapping,
- }
- }
-
- /// Applies any path prefix substitution as defined by the mapping.
- /// The return value is the remapped path and a boolean indicating whether
- /// the path was affected by the mapping.
- pub fn map_prefix(&self, path: PathBuf) -> (PathBuf, bool) {
- // NOTE: We are iterating over the mapping entries from last to first
- // because entries specified later on the command line should
- // take precedence.
- for &(ref from, ref to) in self.mapping.iter().rev() {
- if let Ok(rest) = path.strip_prefix(from) {
- return (to.join(rest), true);
- }
- }
-
- (path, false)
- }
-}
-
-// _____________________________________________________________________________
-// Tests
-//
-
-#[cfg(test)]
-mod tests {
- use super::*;
- use rustc_data_structures::sync::Lrc;
-
- fn init_code_map() -> CodeMap {
- let cm = CodeMap::new(FilePathMapping::empty());
- cm.new_filemap(PathBuf::from("blork.rs").into(),
- "first line.\nsecond line".to_string());
- cm.new_filemap(PathBuf::from("empty.rs").into(),
- "".to_string());
- cm.new_filemap(PathBuf::from("blork2.rs").into(),
- "first line.\nsecond line".to_string());
- cm
- }
-
- #[test]
- fn t3() {
- // Test lookup_byte_offset
- let cm = init_code_map();
-
- let fmabp1 = cm.lookup_byte_offset(BytePos(23));
- assert_eq!(fmabp1.fm.name, PathBuf::from("blork.rs").into());
- assert_eq!(fmabp1.pos, BytePos(23));
-
- let fmabp1 = cm.lookup_byte_offset(BytePos(24));
- assert_eq!(fmabp1.fm.name, PathBuf::from("empty.rs").into());
- assert_eq!(fmabp1.pos, BytePos(0));
-
- let fmabp2 = cm.lookup_byte_offset(BytePos(25));
- assert_eq!(fmabp2.fm.name, PathBuf::from("blork2.rs").into());
- assert_eq!(fmabp2.pos, BytePos(0));
- }
-
- #[test]
- fn t4() {
- // Test bytepos_to_file_charpos
- let cm = init_code_map();
-
- let cp1 = cm.bytepos_to_file_charpos(BytePos(22));
- assert_eq!(cp1, CharPos(22));
-
- let cp2 = cm.bytepos_to_file_charpos(BytePos(25));
- assert_eq!(cp2, CharPos(0));
- }
-
- #[test]
- fn t5() {
- // Test zero-length filemaps.
- let cm = init_code_map();
-
- let loc1 = cm.lookup_char_pos(BytePos(22));
- assert_eq!(loc1.file.name, PathBuf::from("blork.rs").into());
- assert_eq!(loc1.line, 2);
- assert_eq!(loc1.col, CharPos(10));
-
- let loc2 = cm.lookup_char_pos(BytePos(25));
- assert_eq!(loc2.file.name, PathBuf::from("blork2.rs").into());
- assert_eq!(loc2.line, 1);
- assert_eq!(loc2.col, CharPos(0));
- }
-
- fn init_code_map_mbc() -> CodeMap {
- let cm = CodeMap::new(FilePathMapping::empty());
- // € is a three byte utf8 char.
- cm.new_filemap(PathBuf::from("blork.rs").into(),
- "fir€st €€€€ line.\nsecond line".to_string());
- cm.new_filemap(PathBuf::from("blork2.rs").into(),
- "first line€€.\n€ second line".to_string());
- cm
- }
-
- #[test]
- fn t6() {
- // Test bytepos_to_file_charpos in the presence of multi-byte chars
- let cm = init_code_map_mbc();
-
- let cp1 = cm.bytepos_to_file_charpos(BytePos(3));
- assert_eq!(cp1, CharPos(3));
-
- let cp2 = cm.bytepos_to_file_charpos(BytePos(6));
- assert_eq!(cp2, CharPos(4));
-
- let cp3 = cm.bytepos_to_file_charpos(BytePos(56));
- assert_eq!(cp3, CharPos(12));
-
- let cp4 = cm.bytepos_to_file_charpos(BytePos(61));
- assert_eq!(cp4, CharPos(15));
- }
-
- #[test]
- fn t7() {
- // Test span_to_lines for a span ending at the end of filemap
- let cm = init_code_map();
- let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
- let file_lines = cm.span_to_lines(span).unwrap();
-
- assert_eq!(file_lines.file.name, PathBuf::from("blork.rs").into());
- assert_eq!(file_lines.lines.len(), 1);
- assert_eq!(file_lines.lines[0].line_index, 1);
- }
-
- /// Given a string like " ~~~~~~~~~~~~ ", produces a span
- /// converting that range. The idea is that the string has the same
- /// length as the input, and we uncover the byte positions. Note
- /// that this can span lines and so on.
- fn span_from_selection(input: &str, selection: &str) -> Span {
- assert_eq!(input.len(), selection.len());
- let left_index = selection.find('~').unwrap() as u32;
- let right_index = selection.rfind('~').map(|x|x as u32).unwrap_or(left_index);
- Span::new(BytePos(left_index), BytePos(right_index + 1), NO_EXPANSION)
- }
-
- /// Test span_to_snippet and span_to_lines for a span converting 3
- /// lines in the middle of a file.
- #[test]
- fn span_to_snippet_and_lines_spanning_multiple_lines() {
- let cm = CodeMap::new(FilePathMapping::empty());
- let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n";
- let selection = " \n ~~\n~~~\n~~~~~ \n \n";
- cm.new_filemap(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
- let span = span_from_selection(inputtext, selection);
-
- // check that we are extracting the text we thought we were extracting
- assert_eq!(&cm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD");
-
- // check that span_to_lines gives us the complete result with the lines/cols we expected
- let lines = cm.span_to_lines(span).unwrap();
- let expected = vec![
- LineInfo { line_index: 1, start_col: CharPos(4), end_col: CharPos(6) },
- LineInfo { line_index: 2, start_col: CharPos(0), end_col: CharPos(3) },
- LineInfo { line_index: 3, start_col: CharPos(0), end_col: CharPos(5) }
- ];
- assert_eq!(lines.lines, expected);
- }
-
- #[test]
- fn t8() {
- // Test span_to_snippet for a span ending at the end of filemap
- let cm = init_code_map();
- let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
- let snippet = cm.span_to_snippet(span);
-
- assert_eq!(snippet, Ok("second line".to_string()));
- }
-
- #[test]
- fn t9() {
- // Test span_to_str for a span ending at the end of filemap
- let cm = init_code_map();
- let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
- let sstr = cm.span_to_string(span);
-
- assert_eq!(sstr, "blork.rs:2:1: 2:12");
- }
-
- /// Test failing to merge two spans on different lines
- #[test]
- fn span_merging_fail() {
- let cm = CodeMap::new(FilePathMapping::empty());
- let inputtext = "bbbb BB\ncc CCC\n";
- let selection1 = " ~~\n \n";
- let selection2 = " \n ~~~\n";
- cm.new_filemap(Path::new("blork.rs").to_owned().into(), inputtext.to_owned());
- let span1 = span_from_selection(inputtext, selection1);
- let span2 = span_from_selection(inputtext, selection2);
-
- assert!(cm.merge_spans(span1, span2).is_none());
- }
-
- /// Returns the span corresponding to the `n`th occurrence of
- /// `substring` in `source_text`.
- trait CodeMapExtension {
- fn span_substr(&self,
- file: &Lrc<FileMap>,
- source_text: &str,
- substring: &str,
- n: usize)
- -> Span;
- }
-
- impl CodeMapExtension for CodeMap {
- fn span_substr(&self,
- file: &Lrc<FileMap>,
- source_text: &str,
- substring: &str,
- n: usize)
- -> Span
- {
- println!("span_substr(file={:?}/{:?}, substring={:?}, n={})",
- file.name, file.start_pos, substring, n);
- let mut i = 0;
- let mut hi = 0;
- loop {
- let offset = source_text[hi..].find(substring).unwrap_or_else(|| {
- panic!("source_text `{}` does not have {} occurrences of `{}`, only {}",
- source_text, n, substring, i);
- });
- let lo = hi + offset;
- hi = lo + substring.len();
- if i == n {
- let span = Span::new(
- BytePos(lo as u32 + file.start_pos.0),
- BytePos(hi as u32 + file.start_pos.0),
- NO_EXPANSION,
- );
- assert_eq!(&self.span_to_snippet(span).unwrap()[..],
- substring);
- return span;
- }
- i += 1;
- }
- }
- }
-}
diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs
index 3364378..0e52434 100644
--- a/src/libsyntax/config.rs
+++ b/src/libsyntax/config.rs
@@ -12,12 +12,12 @@
use feature_gate::{feature_err, EXPLAIN_STMT_ATTR_SYNTAX, Features, get_features, GateIssue};
use {fold, attr};
use ast;
-use codemap::Spanned;
+use source_map::Spanned;
use edition::Edition;
use parse::{token, ParseSess};
+use OneVector;
use ptr::P;
-use util::small_vector::SmallVector;
/// A folder that strips out items that do not belong in the current configuration.
pub struct StripUnconfigured<'a> {
@@ -90,7 +90,7 @@
let cfg = parser.parse_meta_item()?;
parser.expect(&token::Comma)?;
let lo = parser.span.lo();
- let (path, tokens) = parser.parse_path_and_tokens()?;
+ let (path, tokens) = parser.parse_meta_item_unrestricted()?;
parser.expect(&token::CloseDelim(token::Paren))?;
Ok((cfg, path, tokens, parser.prev_span.with_lo(lo)))
}) {
@@ -319,22 +319,22 @@
Some(P(fold::noop_fold_expr(expr, self)))
}
- fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVector<ast::Stmt> {
+ fn fold_stmt(&mut self, stmt: ast::Stmt) -> OneVector<ast::Stmt> {
match self.configure_stmt(stmt) {
Some(stmt) => fold::noop_fold_stmt(stmt, self),
- None => return SmallVector::new(),
+ None => return OneVector::new(),
}
}
- fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_item(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> {
fold::noop_fold_item(configure!(self, item), self)
}
- fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector<ast::ImplItem> {
+ fn fold_impl_item(&mut self, item: ast::ImplItem) -> OneVector<ast::ImplItem> {
fold::noop_fold_impl_item(configure!(self, item), self)
}
- fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector<ast::TraitItem> {
+ fn fold_trait_item(&mut self, item: ast::TraitItem) -> OneVector<ast::TraitItem> {
fold::noop_fold_trait_item(configure!(self, item), self)
}
diff --git a/src/libsyntax/diagnostics/metadata.rs b/src/libsyntax/diagnostics/metadata.rs
index 61b0579..1438299 100644
--- a/src/libsyntax/diagnostics/metadata.rs
+++ b/src/libsyntax/diagnostics/metadata.rs
@@ -45,7 +45,7 @@
impl ErrorLocation {
/// Create an error location from a span.
pub fn from_span(ecx: &ExtCtxt, sp: Span) -> ErrorLocation {
- let loc = ecx.codemap().lookup_char_pos_adj(sp.lo());
+ let loc = ecx.source_map().lookup_char_pos_adj(sp.lo());
ErrorLocation {
filename: loc.filename,
line: loc.line
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs
index 72ce274..d044efa 100644
--- a/src/libsyntax/diagnostics/plugin.rs
+++ b/src/libsyntax/diagnostics/plugin.rs
@@ -13,15 +13,15 @@
use ast;
use ast::{Ident, Name};
-use codemap;
+use source_map;
use syntax_pos::Span;
use ext::base::{ExtCtxt, MacEager, MacResult};
use ext::build::AstBuilder;
use parse::token;
use ptr::P;
+use OneVector;
use symbol::{keywords, Symbol};
use tokenstream::{TokenTree};
-use util::small_vector::SmallVector;
use diagnostics::metadata::output_metadata;
@@ -131,7 +131,7 @@
let sym = Ident::with_empty_ctxt(Symbol::gensym(&format!(
"__register_diagnostic_{}", code
)));
- MacEager::items(SmallVector::many(vec![
+ MacEager::items(OneVector::many(vec![
ecx.item_mod(
span,
span,
@@ -214,7 +214,7 @@
),
);
- MacEager::items(SmallVector::many(vec![
+ MacEager::items(OneVector::many(vec![
P(ast::Item {
ident: *name,
attrs: Vec::new(),
@@ -223,7 +223,7 @@
ty,
expr,
),
- vis: codemap::respan(span.shrink_to_lo(), ast::VisibilityKind::Public),
+ vis: source_map::respan(span.shrink_to_lo(), ast::VisibilityKind::Public),
span,
tokens: None,
})
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index de391ee..154fe11 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -12,7 +12,7 @@
use ast::{self, Attribute, Name, PatKind, MetaItem};
use attr::HasAttrs;
-use codemap::{self, CodeMap, Spanned, respan};
+use source_map::{self, SourceMap, Spanned, respan};
use syntax_pos::{Span, MultiSpan, DUMMY_SP};
use edition::Edition;
use errors::{DiagnosticBuilder, DiagnosticId};
@@ -22,8 +22,9 @@
use parse::{self, parser, DirectoryOwnership};
use parse::token;
use ptr::P;
+use OneVector;
use symbol::{keywords, Ident, Symbol};
-use util::small_vector::SmallVector;
+use ThinVec;
use std::collections::HashMap;
use std::iter;
@@ -315,7 +316,7 @@
// Use a macro because forwarding to a simple function has type system issues
macro_rules! make_stmts_default {
($me:expr) => {
- $me.make_expr().map(|e| SmallVector::one(ast::Stmt {
+ $me.make_expr().map(|e| OneVector::one(ast::Stmt {
id: ast::DUMMY_NODE_ID,
span: e.span,
node: ast::StmtKind::Expr(e),
@@ -331,22 +332,22 @@
None
}
/// Create zero or more items.
- fn make_items(self: Box<Self>) -> Option<SmallVector<P<ast::Item>>> {
+ fn make_items(self: Box<Self>) -> Option<OneVector<P<ast::Item>>> {
None
}
/// Create zero or more impl items.
- fn make_impl_items(self: Box<Self>) -> Option<SmallVector<ast::ImplItem>> {
+ fn make_impl_items(self: Box<Self>) -> Option<OneVector<ast::ImplItem>> {
None
}
/// Create zero or more trait items.
- fn make_trait_items(self: Box<Self>) -> Option<SmallVector<ast::TraitItem>> {
+ fn make_trait_items(self: Box<Self>) -> Option<OneVector<ast::TraitItem>> {
None
}
/// Create zero or more items in an `extern {}` block
- fn make_foreign_items(self: Box<Self>) -> Option<SmallVector<ast::ForeignItem>> { None }
+ fn make_foreign_items(self: Box<Self>) -> Option<OneVector<ast::ForeignItem>> { None }
/// Create a pattern.
fn make_pat(self: Box<Self>) -> Option<P<ast::Pat>> {
@@ -357,7 +358,7 @@
///
/// By default this attempts to create an expression statement,
/// returning None if that fails.
- fn make_stmts(self: Box<Self>) -> Option<SmallVector<ast::Stmt>> {
+ fn make_stmts(self: Box<Self>) -> Option<OneVector<ast::Stmt>> {
make_stmts_default!(self)
}
@@ -393,11 +394,11 @@
make_MacEager! {
expr: P<ast::Expr>,
pat: P<ast::Pat>,
- items: SmallVector<P<ast::Item>>,
- impl_items: SmallVector<ast::ImplItem>,
- trait_items: SmallVector<ast::TraitItem>,
- foreign_items: SmallVector<ast::ForeignItem>,
- stmts: SmallVector<ast::Stmt>,
+ items: OneVector<P<ast::Item>>,
+ impl_items: OneVector<ast::ImplItem>,
+ trait_items: OneVector<ast::TraitItem>,
+ foreign_items: OneVector<ast::ForeignItem>,
+ stmts: OneVector<ast::Stmt>,
ty: P<ast::Ty>,
}
@@ -406,23 +407,23 @@
self.expr
}
- fn make_items(self: Box<Self>) -> Option<SmallVector<P<ast::Item>>> {
+ fn make_items(self: Box<Self>) -> Option<OneVector<P<ast::Item>>> {
self.items
}
- fn make_impl_items(self: Box<Self>) -> Option<SmallVector<ast::ImplItem>> {
+ fn make_impl_items(self: Box<Self>) -> Option<OneVector<ast::ImplItem>> {
self.impl_items
}
- fn make_trait_items(self: Box<Self>) -> Option<SmallVector<ast::TraitItem>> {
+ fn make_trait_items(self: Box<Self>) -> Option<OneVector<ast::TraitItem>> {
self.trait_items
}
- fn make_foreign_items(self: Box<Self>) -> Option<SmallVector<ast::ForeignItem>> {
+ fn make_foreign_items(self: Box<Self>) -> Option<OneVector<ast::ForeignItem>> {
self.foreign_items
}
- fn make_stmts(self: Box<Self>) -> Option<SmallVector<ast::Stmt>> {
+ fn make_stmts(self: Box<Self>) -> Option<OneVector<ast::Stmt>> {
match self.stmts.as_ref().map_or(0, |s| s.len()) {
0 => make_stmts_default!(self),
_ => self.stmts,
@@ -480,9 +481,9 @@
pub fn raw_expr(sp: Span) -> P<ast::Expr> {
P(ast::Expr {
id: ast::DUMMY_NODE_ID,
- node: ast::ExprKind::Lit(P(codemap::respan(sp, ast::LitKind::Bool(false)))),
+ node: ast::ExprKind::Lit(P(source_map::respan(sp, ast::LitKind::Bool(false)))),
span: sp,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
})
}
@@ -513,41 +514,41 @@
Some(P(DummyResult::raw_pat(self.span)))
}
- fn make_items(self: Box<DummyResult>) -> Option<SmallVector<P<ast::Item>>> {
+ fn make_items(self: Box<DummyResult>) -> Option<OneVector<P<ast::Item>>> {
// this code needs a comment... why not always just return the Some() ?
if self.expr_only {
None
} else {
- Some(SmallVector::new())
+ Some(OneVector::new())
}
}
- fn make_impl_items(self: Box<DummyResult>) -> Option<SmallVector<ast::ImplItem>> {
+ fn make_impl_items(self: Box<DummyResult>) -> Option<OneVector<ast::ImplItem>> {
if self.expr_only {
None
} else {
- Some(SmallVector::new())
+ Some(OneVector::new())
}
}
- fn make_trait_items(self: Box<DummyResult>) -> Option<SmallVector<ast::TraitItem>> {
+ fn make_trait_items(self: Box<DummyResult>) -> Option<OneVector<ast::TraitItem>> {
if self.expr_only {
None
} else {
- Some(SmallVector::new())
+ Some(OneVector::new())
}
}
- fn make_foreign_items(self: Box<Self>) -> Option<SmallVector<ast::ForeignItem>> {
+ fn make_foreign_items(self: Box<Self>) -> Option<OneVector<ast::ForeignItem>> {
if self.expr_only {
None
} else {
- Some(SmallVector::new())
+ Some(OneVector::new())
}
}
- fn make_stmts(self: Box<DummyResult>) -> Option<SmallVector<ast::Stmt>> {
- Some(SmallVector::one(ast::Stmt {
+ fn make_stmts(self: Box<DummyResult>) -> Option<OneVector<ast::Stmt>> {
+ Some(OneVector::one(ast::Stmt {
id: ast::DUMMY_NODE_ID,
node: ast::StmtKind::Expr(DummyResult::raw_expr(self.span)),
span: self.span,
@@ -835,7 +836,7 @@
pub fn new_parser_from_tts(&self, tts: &[tokenstream::TokenTree]) -> parser::Parser<'a> {
parse::stream_to_parser(self.parse_sess, tts.iter().cloned().collect())
}
- pub fn codemap(&self) -> &'a CodeMap { self.parse_sess.codemap() }
+ pub fn source_map(&self) -> &'a SourceMap { self.parse_sess.source_map() }
pub fn parse_sess(&self) -> &'a parse::ParseSess { self.parse_sess }
pub fn cfg(&self) -> &ast::CrateConfig { &self.parse_sess.config }
pub fn call_site(&self) -> Span {
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index 6135650..b1bed96 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -12,10 +12,11 @@
use ast::{self, Ident, Generics, Expr, BlockCheckMode, UnOp, PatKind};
use attr;
use syntax_pos::{Pos, Span, DUMMY_SP};
-use codemap::{dummy_spanned, respan, Spanned};
+use source_map::{dummy_spanned, respan, Spanned};
use ext::base::ExtCtxt;
use ptr::P;
use symbol::{Symbol, keywords};
+use ThinVec;
// Transitional re-exports so qquote can find the paths it is looking for
mod syntax {
@@ -519,7 +520,7 @@
init: Some(ex),
id: ast::DUMMY_NODE_ID,
span: sp,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
});
ast::Stmt {
id: ast::DUMMY_NODE_ID,
@@ -547,7 +548,7 @@
init: Some(ex),
id: ast::DUMMY_NODE_ID,
span: sp,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
});
ast::Stmt {
id: ast::DUMMY_NODE_ID,
@@ -564,7 +565,7 @@
init: None,
id: ast::DUMMY_NODE_ID,
span,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
});
ast::Stmt {
id: ast::DUMMY_NODE_ID,
@@ -603,7 +604,7 @@
id: ast::DUMMY_NODE_ID,
node,
span,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
})
}
@@ -678,7 +679,7 @@
expr: e,
span,
is_shorthand: false,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
}
}
fn expr_struct(&self, span: Span, path: ast::Path, fields: Vec<ast::Field>) -> P<ast::Expr> {
@@ -763,7 +764,7 @@
}
fn expr_fail(&self, span: Span, msg: Symbol) -> P<ast::Expr> {
- let loc = self.codemap().lookup_char_pos(span.lo());
+ let loc = self.source_map().lookup_char_pos(span.lo());
let expr_file = self.expr_str(span, Symbol::intern(&loc.file.name.to_string()));
let expr_line = self.expr_u32(span, loc.line as u32);
let expr_col = self.expr_u32(span, loc.col.to_usize() as u32 + 1);
diff --git a/src/libsyntax/ext/derive.rs b/src/libsyntax/ext/derive.rs
index 32ace93..80bbc61 100644
--- a/src/libsyntax/ext/derive.rs
+++ b/src/libsyntax/ext/derive.rs
@@ -10,7 +10,7 @@
use attr::HasAttrs;
use ast;
-use codemap::{hygiene, ExpnInfo, ExpnFormat};
+use source_map::{hygiene, ExpnInfo, ExpnFormat};
use ext::base::ExtCtxt;
use ext::build::AstBuilder;
use parse::parser::PathStyle;
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs
index 12941a8..b12b2c4 100644
--- a/src/libsyntax/ext/expand.rs
+++ b/src/libsyntax/ext/expand.rs
@@ -11,7 +11,7 @@
use ast::{self, Block, Ident, NodeId, PatKind, Path};
use ast::{MacStmtStyle, StmtKind, ItemKind};
use attr::{self, HasAttrs};
-use codemap::{ExpnInfo, MacroBang, MacroAttribute, dummy_spanned, respan};
+use source_map::{ExpnInfo, MacroBang, MacroAttribute, dummy_spanned, respan};
use config::{is_test_or_bench, StripUnconfigured};
use errors::{Applicability, FatalError};
use ext::base::*;
@@ -26,12 +26,12 @@
use parse::token::{self, Token};
use parse::parser::Parser;
use ptr::P;
+use OneVector;
use symbol::Symbol;
use symbol::keywords;
use syntax_pos::{Span, DUMMY_SP, FileName};
use syntax_pos::hygiene::ExpnFormat;
use tokenstream::{TokenStream, TokenTree};
-use util::small_vector::SmallVector;
use visit::{self, Visitor};
use std::collections::HashMap;
@@ -131,7 +131,7 @@
self.expand_fragment(AstFragment::$Kind(ast)).$make_ast()
})*)*
$($(fn $fold_ast_elt(&mut self, ast_elt: <$AstTy as IntoIterator>::Item) -> $AstTy {
- self.expand_fragment(AstFragment::$Kind(SmallVector::one(ast_elt))).$make_ast()
+ self.expand_fragment(AstFragment::$Kind(OneVector::one(ast_elt))).$make_ast()
})*)*
}
@@ -148,15 +148,15 @@
Expr(P<ast::Expr>) { "expression"; one fn fold_expr; fn visit_expr; fn make_expr; }
Pat(P<ast::Pat>) { "pattern"; one fn fold_pat; fn visit_pat; fn make_pat; }
Ty(P<ast::Ty>) { "type"; one fn fold_ty; fn visit_ty; fn make_ty; }
- Stmts(SmallVector<ast::Stmt>) { "statement"; many fn fold_stmt; fn visit_stmt; fn make_stmts; }
- Items(SmallVector<P<ast::Item>>) { "item"; many fn fold_item; fn visit_item; fn make_items; }
- TraitItems(SmallVector<ast::TraitItem>) {
+ Stmts(OneVector<ast::Stmt>) { "statement"; many fn fold_stmt; fn visit_stmt; fn make_stmts; }
+ Items(OneVector<P<ast::Item>>) { "item"; many fn fold_item; fn visit_item; fn make_items; }
+ TraitItems(OneVector<ast::TraitItem>) {
"trait item"; many fn fold_trait_item; fn visit_trait_item; fn make_trait_items;
}
- ImplItems(SmallVector<ast::ImplItem>) {
+ ImplItems(OneVector<ast::ImplItem>) {
"impl item"; many fn fold_impl_item; fn visit_impl_item; fn make_impl_items;
}
- ForeignItems(SmallVector<ast::ForeignItem>) {
+ ForeignItems(OneVector<ast::ForeignItem>) {
"foreign item"; many fn fold_foreign_item; fn visit_foreign_item; fn make_foreign_items;
}
}
@@ -267,7 +267,7 @@
pub fn expand_crate(&mut self, mut krate: ast::Crate) -> ast::Crate {
let mut module = ModuleData {
mod_path: vec![Ident::from_str(&self.cx.ecfg.crate_name)],
- directory: match self.cx.codemap().span_to_unmapped_path(krate.span) {
+ directory: match self.cx.source_map().span_to_unmapped_path(krate.span) {
FileName::Real(path) => path,
other => PathBuf::from(other.to_string()),
},
@@ -279,7 +279,7 @@
let orig_mod_span = krate.module.inner;
- let krate_item = AstFragment::Items(SmallVector::one(P(ast::Item {
+ let krate_item = AstFragment::Items(OneVector::one(P(ast::Item {
attrs: krate.attrs,
span: krate.span,
node: ast::ItemKind::Mod(krate.module),
@@ -327,7 +327,7 @@
// Unresolved macros produce dummy outputs as a recovery measure.
invocations.reverse();
let mut expanded_fragments = Vec::new();
- let mut derives = HashMap::new();
+ let mut derives: HashMap<Mark, Vec<_>> = HashMap::new();
let mut undetermined_invocations = Vec::new();
let (mut progress, mut force) = (false, !self.monotonic);
loop {
@@ -388,7 +388,7 @@
.map_attrs(|mut attrs| { attrs.retain(|a| a.path != "derive"); attrs });
let item_with_markers =
add_derived_markers(&mut self.cx, item.span(), &traits, item.clone());
- let derives = derives.entry(invoc.expansion_data.mark).or_insert_with(Vec::new);
+ let derives = derives.entry(invoc.expansion_data.mark).or_default();
for path in &traits {
let mark = Mark::fresh(self.cx.current_expansion.mark);
@@ -989,28 +989,28 @@
-> PResult<'a, AstFragment> {
Ok(match kind {
AstFragmentKind::Items => {
- let mut items = SmallVector::new();
+ let mut items = OneVector::new();
while let Some(item) = self.parse_item()? {
items.push(item);
}
AstFragment::Items(items)
}
AstFragmentKind::TraitItems => {
- let mut items = SmallVector::new();
+ let mut items = OneVector::new();
while self.token != token::Eof {
items.push(self.parse_trait_item(&mut false)?);
}
AstFragment::TraitItems(items)
}
AstFragmentKind::ImplItems => {
- let mut items = SmallVector::new();
+ let mut items = OneVector::new();
while self.token != token::Eof {
items.push(self.parse_impl_item(&mut false)?);
}
AstFragment::ImplItems(items)
}
AstFragmentKind::ForeignItems => {
- let mut items = SmallVector::new();
+ let mut items = OneVector::new();
while self.token != token::Eof {
if let Some(item) = self.parse_foreign_item()? {
items.push(item);
@@ -1019,7 +1019,7 @@
AstFragment::ForeignItems(items)
}
AstFragmentKind::Stmts => {
- let mut stmts = SmallVector::new();
+ let mut stmts = OneVector::new();
while self.token != token::Eof &&
// won't make progress on a `}`
self.token != token::CloseDelim(token::Brace) {
@@ -1086,12 +1086,12 @@
/// Folds the item allowing tests to be expanded because they are still nameable.
/// This should probably only be called with module items
- fn fold_nameable(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_nameable(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> {
fold::noop_fold_item(item, self)
}
/// Folds the item but doesn't allow tests to occur within it
- fn fold_unnameable(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_unnameable(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> {
let was_nameable = mem::replace(&mut self.tests_nameable, false);
let items = fold::noop_fold_item(item, self);
self.tests_nameable = was_nameable;
@@ -1124,9 +1124,7 @@
return attrs;
}
- if self.cx.ecfg.use_extern_macros_enabled() {
- attr = find_attr_invoc(&mut attrs);
- }
+ attr = find_attr_invoc(&mut attrs);
traits = collect_derives(&mut self.cx, &mut attrs);
attrs
});
@@ -1147,9 +1145,7 @@
return attrs;
}
- if self.cx.ecfg.use_extern_macros_enabled() {
- attr = find_attr_invoc(&mut attrs);
- }
+ attr = find_attr_invoc(&mut attrs);
attrs
});
@@ -1254,10 +1250,10 @@
})
}
- fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVector<ast::Stmt> {
+ fn fold_stmt(&mut self, stmt: ast::Stmt) -> OneVector<ast::Stmt> {
let mut stmt = match self.cfg.configure_stmt(stmt) {
Some(stmt) => stmt,
- None => return SmallVector::new(),
+ None => return OneVector::new(),
};
// we'll expand attributes on expressions separately
@@ -1313,7 +1309,7 @@
result
}
- fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_item(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> {
let item = configure!(self, item);
let (attr, traits, mut item) = self.classify_item(item);
@@ -1359,7 +1355,7 @@
module.directory.push(&*item.ident.as_str());
}
} else {
- let path = self.cx.parse_sess.codemap().span_to_unmapped_path(inner);
+ let path = self.cx.parse_sess.source_map().span_to_unmapped_path(inner);
let mut path = match path {
FileName::Real(path) => path,
other => PathBuf::from(other.to_string()),
@@ -1422,7 +1418,7 @@
ui
});
- SmallVector::many(
+ OneVector::many(
self.fold_unnameable(item).into_iter()
.chain(self.fold_unnameable(use_item)))
} else {
@@ -1433,7 +1429,7 @@
}
}
- fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector<ast::TraitItem> {
+ fn fold_trait_item(&mut self, item: ast::TraitItem) -> OneVector<ast::TraitItem> {
let item = configure!(self, item);
let (attr, traits, item) = self.classify_item(item);
@@ -1453,7 +1449,7 @@
}
}
- fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector<ast::ImplItem> {
+ fn fold_impl_item(&mut self, item: ast::ImplItem) -> OneVector<ast::ImplItem> {
let item = configure!(self, item);
let (attr, traits, item) = self.classify_item(item);
@@ -1490,7 +1486,7 @@
}
fn fold_foreign_item(&mut self,
- foreign_item: ast::ForeignItem) -> SmallVector<ast::ForeignItem> {
+ foreign_item: ast::ForeignItem) -> OneVector<ast::ForeignItem> {
let (attr, traits, foreign_item) = self.classify_item(foreign_item);
if attr.is_some() || !traits.is_empty() {
@@ -1567,7 +1563,7 @@
// Add this input file to the code map to make it available as
// dependency information
- self.cx.codemap().new_filemap(filename.into(), src);
+ self.cx.source_map().new_source_file(filename.into(), src);
let include_info = vec![
dummy_spanned(ast::NestedMetaItemKind::MetaItem(
@@ -1667,10 +1663,6 @@
fn proc_macro_expr = proc_macro_expr,
fn proc_macro_non_items = proc_macro_non_items,
}
-
- pub fn use_extern_macros_enabled(&self) -> bool {
- self.features.map_or(false, |features| features.use_extern_macros())
- }
}
// A Marker adds the given mark to the syntax context.
diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs
index 968cf50..18b4119 100644
--- a/src/libsyntax/ext/placeholders.rs
+++ b/src/libsyntax/ext/placeholders.rs
@@ -9,16 +9,17 @@
// except according to those terms.
use ast::{self, NodeId};
-use codemap::{DUMMY_SP, dummy_spanned};
+use source_map::{DUMMY_SP, dummy_spanned};
use ext::base::ExtCtxt;
use ext::expand::{AstFragment, AstFragmentKind};
use ext::hygiene::Mark;
use tokenstream::TokenStream;
use fold::*;
use ptr::P;
+use OneVector;
use symbol::keywords;
+use ThinVec;
use util::move_map::MoveMap;
-use util::small_vector::SmallVector;
use std::collections::HashMap;
@@ -38,31 +39,31 @@
let span = DUMMY_SP;
let expr_placeholder = || P(ast::Expr {
id, span,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
node: ast::ExprKind::Mac(mac_placeholder()),
});
match kind {
AstFragmentKind::Expr => AstFragment::Expr(expr_placeholder()),
AstFragmentKind::OptExpr => AstFragment::OptExpr(Some(expr_placeholder())),
- AstFragmentKind::Items => AstFragment::Items(SmallVector::one(P(ast::Item {
+ AstFragmentKind::Items => AstFragment::Items(OneVector::one(P(ast::Item {
id, span, ident, vis, attrs,
node: ast::ItemKind::Mac(mac_placeholder()),
tokens: None,
}))),
- AstFragmentKind::TraitItems => AstFragment::TraitItems(SmallVector::one(ast::TraitItem {
+ AstFragmentKind::TraitItems => AstFragment::TraitItems(OneVector::one(ast::TraitItem {
id, span, ident, attrs, generics,
node: ast::TraitItemKind::Macro(mac_placeholder()),
tokens: None,
})),
- AstFragmentKind::ImplItems => AstFragment::ImplItems(SmallVector::one(ast::ImplItem {
+ AstFragmentKind::ImplItems => AstFragment::ImplItems(OneVector::one(ast::ImplItem {
id, span, ident, vis, attrs, generics,
node: ast::ImplItemKind::Macro(mac_placeholder()),
defaultness: ast::Defaultness::Final,
tokens: None,
})),
AstFragmentKind::ForeignItems =>
- AstFragment::ForeignItems(SmallVector::one(ast::ForeignItem {
+ AstFragment::ForeignItems(OneVector::one(ast::ForeignItem {
id, span, ident, vis, attrs,
node: ast::ForeignItemKind::Macro(mac_placeholder()),
})),
@@ -72,8 +73,8 @@
AstFragmentKind::Ty => AstFragment::Ty(P(ast::Ty {
id, span, node: ast::TyKind::Mac(mac_placeholder()),
})),
- AstFragmentKind::Stmts => AstFragment::Stmts(SmallVector::one({
- let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ast::ThinVec::new()));
+ AstFragmentKind::Stmts => AstFragment::Stmts(OneVector::one({
+ let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ThinVec::new()));
ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) }
})),
}
@@ -114,31 +115,31 @@
}
impl<'a, 'b> Folder for PlaceholderExpander<'a, 'b> {
- fn fold_item(&mut self, item: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_item(&mut self, item: P<ast::Item>) -> OneVector<P<ast::Item>> {
match item.node {
ast::ItemKind::Mac(_) => return self.remove(item.id).make_items(),
- ast::ItemKind::MacroDef(_) => return SmallVector::one(item),
+ ast::ItemKind::MacroDef(_) => return OneVector::one(item),
_ => {}
}
noop_fold_item(item, self)
}
- fn fold_trait_item(&mut self, item: ast::TraitItem) -> SmallVector<ast::TraitItem> {
+ fn fold_trait_item(&mut self, item: ast::TraitItem) -> OneVector<ast::TraitItem> {
match item.node {
ast::TraitItemKind::Macro(_) => self.remove(item.id).make_trait_items(),
_ => noop_fold_trait_item(item, self),
}
}
- fn fold_impl_item(&mut self, item: ast::ImplItem) -> SmallVector<ast::ImplItem> {
+ fn fold_impl_item(&mut self, item: ast::ImplItem) -> OneVector<ast::ImplItem> {
match item.node {
ast::ImplItemKind::Macro(_) => self.remove(item.id).make_impl_items(),
_ => noop_fold_impl_item(item, self),
}
}
- fn fold_foreign_item(&mut self, item: ast::ForeignItem) -> SmallVector<ast::ForeignItem> {
+ fn fold_foreign_item(&mut self, item: ast::ForeignItem) -> OneVector<ast::ForeignItem> {
match item.node {
ast::ForeignItemKind::Macro(_) => self.remove(item.id).make_foreign_items(),
_ => noop_fold_foreign_item(item, self),
@@ -159,7 +160,7 @@
}
}
- fn fold_stmt(&mut self, stmt: ast::Stmt) -> SmallVector<ast::Stmt> {
+ fn fold_stmt(&mut self, stmt: ast::Stmt) -> OneVector<ast::Stmt> {
let (style, mut stmts) = match stmt.node {
ast::StmtKind::Mac(mac) => (mac.1, self.remove(stmt.id).make_stmts()),
_ => return noop_fold_stmt(stmt, self),
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index 1ace4d4..13a139d 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -9,7 +9,7 @@
// except according to those terms.
use ast::{self, Arg, Arm, Block, Expr, Item, Pat, Stmt, Ty};
-use codemap::respan;
+use source_map::respan;
use syntax_pos::Span;
use ext::base::ExtCtxt;
use ext::base;
@@ -28,18 +28,19 @@
pub mod rt {
use ast;
- use codemap::Spanned;
+ use source_map::Spanned;
use ext::base::ExtCtxt;
use parse::{self, classify};
use parse::token::{self, Token};
use ptr::P;
use symbol::Symbol;
+ use ThinVec;
use tokenstream::{self, TokenTree, TokenStream};
pub use parse::new_parser_from_tts;
pub use syntax_pos::{BytePos, Span, DUMMY_SP, FileName};
- pub use codemap::{dummy_spanned};
+ pub use source_map::{dummy_spanned};
pub trait ToTokens {
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree>;
@@ -274,7 +275,7 @@
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::Lit(P(self.clone())),
span: DUMMY_SP,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
}).to_tokens(cx)
}
}
@@ -305,7 +306,7 @@
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::Lit(P(dummy_spanned(lit))),
span: DUMMY_SP,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
});
if *self >= 0 {
return lit.to_tokens(cx);
@@ -314,7 +315,7 @@
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::Unary(ast::UnOp::Neg, lit),
span: DUMMY_SP,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
}).to_tokens(cx)
}
}
@@ -801,7 +802,7 @@
// they happen to have a compiler on hand). Over all, the phase distinction
// just makes quotes "hard to attribute". Possibly this could be fixed
// by recreating some of the original qq machinery in the tt regime
- // (pushing fake FileMaps onto the parser to account for original sites
+ // (pushing fake SourceFiles onto the parser to account for original sites
// of quotes, for example) but at this point it seems not likely to be
// worth the hassle.
diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs
index 0c36c07..19a204c 100644
--- a/src/libsyntax/ext/source_util.rs
+++ b/src/libsyntax/ext/source_util.rs
@@ -17,9 +17,9 @@
use parse;
use print::pprust;
use ptr::P;
+use OneVector;
use symbol::Symbol;
use tokenstream;
-use util::small_vector::SmallVector;
use std::fs::File;
use std::io::prelude::*;
@@ -36,7 +36,7 @@
base::check_zero_tts(cx, sp, tts, "line!");
let topmost = cx.expansion_cause().unwrap_or(sp);
- let loc = cx.codemap().lookup_char_pos(topmost.lo());
+ let loc = cx.source_map().lookup_char_pos(topmost.lo());
base::MacEager::expr(cx.expr_u32(topmost, loc.line as u32))
}
@@ -47,7 +47,7 @@
base::check_zero_tts(cx, sp, tts, "column!");
let topmost = cx.expansion_cause().unwrap_or(sp);
- let loc = cx.codemap().lookup_char_pos(topmost.lo());
+ let loc = cx.source_map().lookup_char_pos(topmost.lo());
base::MacEager::expr(cx.expr_u32(topmost, loc.col.to_usize() as u32 + 1))
}
@@ -63,14 +63,14 @@
}
/// file!(): expands to the current filename */
-/// The filemap (`loc.file`) contains a bunch more information we could spit
+/// The source_file (`loc.file`) contains a bunch more information we could spit
/// out if we wanted.
pub fn expand_file(cx: &mut ExtCtxt, sp: Span, tts: &[tokenstream::TokenTree])
-> Box<dyn base::MacResult+'static> {
base::check_zero_tts(cx, sp, tts, "file!");
let topmost = cx.expansion_cause().unwrap_or(sp);
- let loc = cx.codemap().lookup_char_pos(topmost.lo());
+ let loc = cx.source_map().lookup_char_pos(topmost.lo());
base::MacEager::expr(cx.expr_str(topmost, Symbol::intern(&loc.file.name.to_string())))
}
@@ -111,8 +111,8 @@
Some(panictry!(self.p.parse_expr()))
}
fn make_items(mut self: Box<ExpandResult<'a>>)
- -> Option<SmallVector<P<ast::Item>>> {
- let mut ret = SmallVector::new();
+ -> Option<OneVector<P<ast::Item>>> {
+ let mut ret = OneVector::new();
while self.p.token != token::Eof {
match panictry!(self.p.parse_item()) {
Some(item) => ret.push(item),
@@ -154,7 +154,7 @@
// Add this input file to the code map to make it available as
// dependency information
- cx.codemap().new_filemap(file.into(), src);
+ cx.source_map().new_source_file(file.into(), src);
base::MacEager::expr(cx.expr_str(sp, interned_src))
}
@@ -184,7 +184,7 @@
Ok(..) => {
// Add this input file to the code map to make it available as
// dependency information, but don't enter it's contents
- cx.codemap().new_filemap(file.into(), "".to_string());
+ cx.source_map().new_source_file(file.into(), "".to_string());
base::MacEager::expr(cx.expr_lit(sp, ast::LitKind::ByteStr(Lrc::new(bytes))))
}
@@ -199,7 +199,7 @@
// after macro expansion (that is, they are unhygienic).
if !arg.is_absolute() {
let callsite = sp.source_callsite();
- let mut path = match cx.codemap().span_to_unmapped_path(callsite) {
+ let mut path = match cx.source_map().span_to_unmapped_path(callsite) {
FileName::Real(path) => path,
other => panic!("cannot resolve relative path in non-file source `{}`", other),
};
diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs
index 3046525..82f88d1 100644
--- a/src/libsyntax/ext/tt/macro_parser.rs
+++ b/src/libsyntax/ext/tt/macro_parser.rs
@@ -92,9 +92,9 @@
use parse::parser::{Parser, PathStyle};
use parse::token::{self, DocComment, Nonterminal, Token};
use print::pprust;
+use OneVector;
use symbol::keywords;
use tokenstream::TokenStream;
-use util::small_vector::SmallVector;
use std::mem;
use std::ops::{Deref, DerefMut};
@@ -440,10 +440,10 @@
/// A `ParseResult`. Note that matches are kept track of through the items generated.
fn inner_parse_loop<'a>(
sess: &ParseSess,
- cur_items: &mut SmallVector<MatcherPosHandle<'a>>,
+ cur_items: &mut OneVector<MatcherPosHandle<'a>>,
next_items: &mut Vec<MatcherPosHandle<'a>>,
- eof_items: &mut SmallVector<MatcherPosHandle<'a>>,
- bb_items: &mut SmallVector<MatcherPosHandle<'a>>,
+ eof_items: &mut OneVector<MatcherPosHandle<'a>>,
+ bb_items: &mut OneVector<MatcherPosHandle<'a>>,
token: &Token,
span: syntax_pos::Span,
) -> ParseResult<()> {
@@ -644,15 +644,15 @@
// This MatcherPos instance is allocated on the stack. All others -- and
// there are frequently *no* others! -- are allocated on the heap.
let mut initial = initial_matcher_pos(ms, parser.span.lo());
- let mut cur_items = SmallVector::one(MatcherPosHandle::Ref(&mut initial));
+ let mut cur_items = OneVector::one(MatcherPosHandle::Ref(&mut initial));
let mut next_items = Vec::new();
loop {
// Matcher positions black-box parsed by parser.rs (`parser`)
- let mut bb_items = SmallVector::new();
+ let mut bb_items = OneVector::new();
// Matcher positions that would be valid if the macro invocation was over now
- let mut eof_items = SmallVector::new();
+ let mut eof_items = OneVector::new();
assert!(next_items.is_empty());
// Process `cur_items` until either we have finished the input or we need to get some
diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs
index e7e9461..770561f 100644
--- a/src/libsyntax/ext/tt/macro_rules.rs
+++ b/src/libsyntax/ext/tt/macro_rules.rs
@@ -88,8 +88,7 @@
fn trace_macros_note(cx: &mut ExtCtxt, sp: Span, message: String) {
let sp = sp.macro_backtrace().last().map(|trace| trace.call_site).unwrap_or(sp);
- let values: &mut Vec<String> = cx.expansions.entry(sp).or_insert_with(Vec::new);
- values.push(message);
+ cx.expansions.entry(sp).or_default().push(message);
}
/// Given `lhses` and `rhses`, this is the new macro we create
@@ -181,7 +180,7 @@
for lhs in lhses { // try each arm's matchers
let lhs_tt = match *lhs {
quoted::TokenTree::Delimited(_, ref delim) => &delim.tts[..],
- _ => cx.span_bug(sp, "malformed macro lhs")
+ _ => continue,
};
match TokenTree::parse(cx, lhs_tt, arg.clone()) {
Success(_) => {
@@ -191,7 +190,7 @@
err.span_suggestion_short(
comma_span,
"missing comma here",
- ",".to_string(),
+ ", ".to_string(),
);
}
}
diff --git a/src/libsyntax/ext/tt/transcribe.rs b/src/libsyntax/ext/tt/transcribe.rs
index 1cdb6b0..d451227 100644
--- a/src/libsyntax/ext/tt/transcribe.rs
+++ b/src/libsyntax/ext/tt/transcribe.rs
@@ -15,9 +15,9 @@
use ext::tt::quoted;
use fold::noop_fold_tt;
use parse::token::{self, Token, NtTT};
+use OneVector;
use syntax_pos::{Span, DUMMY_SP};
use tokenstream::{TokenStream, TokenTree, Delimited};
-use util::small_vector::SmallVector;
use std::rc::Rc;
use rustc_data_structures::sync::Lrc;
@@ -70,7 +70,7 @@
interp: Option<HashMap<Ident, Rc<NamedMatch>>>,
src: Vec<quoted::TokenTree>)
-> TokenStream {
- let mut stack = SmallVector::one(Frame::new(src));
+ let mut stack = OneVector::one(Frame::new(src));
let interpolations = interp.unwrap_or_else(HashMap::new); /* just a convenience */
let mut repeats = Vec::new();
let mut result: Vec<TokenStream> = Vec::new();
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 65eeaff..74f573f 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -29,7 +29,7 @@
use rustc_target::spec::abi::Abi;
use ast::{self, NodeId, PatKind, RangeEnd};
use attr;
-use codemap::Spanned;
+use source_map::Spanned;
use edition::{ALL_EDITIONS, Edition};
use syntax_pos::{Span, DUMMY_SP};
use errors::{DiagnosticBuilder, Handler};
@@ -81,17 +81,6 @@
{
$(f(stringify!($feature), self.$feature);)+
}
-
- pub fn use_extern_macros(&self) -> bool {
- // A number of "advanced" macro features enable
- // macro modularization (`use_extern_macros`) implicitly.
- self.use_extern_macros || self.decl_macro ||
- self.tool_attributes || self.custom_attribute ||
- self.macros_in_extern || self.proc_macro_path_invoc ||
- self.proc_macro_mod || self.proc_macro_expr ||
- self.proc_macro_non_items || self.proc_macro_gen ||
- self.stmt_expr_attributes
- }
}
};
@@ -138,7 +127,7 @@
(active, thread_local, "1.0.0", Some(29594), None),
(active, trace_macros, "1.0.0", Some(29598), None),
- // rustc internal, for now:
+ // rustc internal, for now
(active, intrinsics, "1.0.0", None, None),
(active, lang_items, "1.0.0", None, None),
(active, format_args_nl, "1.29.0", None, None),
@@ -168,6 +157,7 @@
(active, optin_builtin_traits, "1.0.0", Some(13231), None),
// Allows use of #[staged_api]
+ //
// rustc internal
(active, staged_api, "1.0.0", None, None),
@@ -245,24 +235,25 @@
// Allows associated type defaults
(active, associated_type_defaults, "1.2.0", Some(29661), None),
- // allow `repr(simd)`, and importing the various simd intrinsics
+ // Allows `repr(simd)`, and importing the various simd intrinsics
(active, repr_simd, "1.4.0", Some(27731), None),
- // allow `extern "platform-intrinsic" { ... }`
+ // Allows `extern "platform-intrinsic" { ... }`
(active, platform_intrinsics, "1.4.0", Some(27731), None),
- // allow `#[unwind(..)]`
+ // Allows `#[unwind(..)]`
// rustc internal for rust runtime
(active, unwind_attributes, "1.4.0", None, None),
- // allow the use of `#[naked]` on functions.
+ // Allows the use of `#[naked]` on functions.
(active, naked_functions, "1.9.0", Some(32408), None),
- // allow `#[no_debug]`
+ // Allows `#[no_debug]`
(active, no_debug, "1.5.0", Some(29721), None),
- // allow `#[omit_gdb_pretty_printer_section]`
- // rustc internal.
+ // Allows `#[omit_gdb_pretty_printer_section]`
+ //
+ // rustc internal
(active, omit_gdb_pretty_printer_section, "1.5.0", None, None),
// Allows cfg(target_vendor = "...").
@@ -292,10 +283,10 @@
// The `!` type. Does not imply exhaustive_patterns (below) any more.
(active, never_type, "1.13.0", Some(35121), None),
- // Allows exhaustive pattern matching on types that contain uninhabited types.
+ // Allows exhaustive pattern matching on types that contain uninhabited types
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
- // Allows all literals in attribute lists and values of key-value pairs.
+ // Allows all literals in attribute lists and values of key-value pairs
(active, attr_literals, "1.13.0", Some(34981), None),
// Allows untagged unions `union U { ... }`
@@ -308,8 +299,6 @@
// Allows #[link(..., cfg(..))]
(active, link_cfg, "1.14.0", Some(37406), None),
- (active, use_extern_macros, "1.15.0", Some(35896), Some(Edition::Edition2018)),
-
// `extern "ptx-*" fn()`
(active, abi_ptx, "1.15.0", Some(38788), None),
@@ -334,6 +323,7 @@
(active, sanitizer_runtime, "1.17.0", None, None),
// Used to identify crates that contain the profiler runtime
+ //
// rustc internal
(active, profiler_runtime, "1.18.0", None, None),
@@ -391,7 +381,7 @@
// extern types
(active, extern_types, "1.23.0", Some(43467), None),
- // Allow trait methods with arbitrary self types
+ // Allows trait methods with arbitrary self types
(active, arbitrary_self_types, "1.23.0", Some(44874), None),
// `crate` in paths
@@ -400,7 +390,7 @@
// In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`)
(active, in_band_lifetimes, "1.23.0", Some(44524), None),
- // generic associated types (RFC 1598)
+ // Generic associated types (RFC 1598)
(active, generic_associated_types, "1.23.0", Some(44265), None),
// Resolve absolute paths as paths from other crates
@@ -452,6 +442,7 @@
(active, mmx_target_feature, "1.27.0", Some(44839), None),
(active, sse4a_target_feature, "1.27.0", Some(44839), None),
(active, tbm_target_feature, "1.27.0", Some(44839), None),
+ (active, wasm_target_feature, "1.30.0", Some(44839), None),
// Allows macro invocations of the form `#[foo::bar]`
(active, proc_macro_path_invoc, "1.27.0", Some(38356), None),
@@ -474,7 +465,7 @@
// Scoped lints
(active, tool_lints, "1.28.0", Some(44690), None),
- // allow irrefutable patterns in if-let and while-let statements (RFC 2086)
+ // Allows irrefutable patterns in if-let and while-let statements (RFC 2086)
(active, irrefutable_let_patterns, "1.27.0", Some(44495), None),
// Allows use of the :literal macro fragment specifier (RFC 1576)
@@ -503,6 +494,18 @@
// impl<I:Iterator> Iterator for &mut Iterator
// impl Debug for Foo<'_>
(active, impl_header_lifetime_elision, "1.30.0", Some(15872), Some(Edition::Edition2018)),
+
+ // Support for arbitrary delimited token streams in non-macro attributes
+ (active, unrestricted_attribute_tokens, "1.30.0", Some(44690), None),
+
+ // Allows `use x::y;` to resolve through `self::x`, not just `::x`
+ (active, uniform_paths, "1.30.0", Some(53130), None),
+
+ // Allows `Self` in type definitions
+ (active, self_in_typedefs, "1.30.0", Some(49303), None),
+
+ // unsized rvalues at arguments and parameters
+ (active, unsized_locals, "1.30.0", Some(48055), None),
);
declare_features! (
@@ -528,7 +531,7 @@
(removed, advanced_slice_patterns, "1.0.0", Some(23121), None,
Some("merged into `#![feature(slice_patterns)]`")),
(removed, macro_reexport, "1.0.0", Some(29638), None,
- Some("subsumed by `#![feature(use_extern_macros)]` and `pub use`")),
+ Some("subsumed by `pub use`")),
);
declare_features! (
@@ -645,6 +648,9 @@
(accepted, repr_transparent, "1.28.0", Some(43036), None),
// Defining procedural macros in `proc-macro` crates
(accepted, proc_macro, "1.29.0", Some(38356), None),
+ // Allows importing and reexporting macros with `use`,
+ // enables macro modularization in general.
+ (accepted, use_extern_macros, "1.30.0", Some(35896), None),
);
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -720,8 +726,7 @@
}
pub fn is_builtin_attr(attr: &ast::Attribute) -> bool {
- BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.path == builtin_name) ||
- attr.name().as_str().starts_with("rustc_")
+ BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.path == builtin_name)
}
// Attributes that have a special meaning to rustc or rustdoc
@@ -1520,25 +1525,29 @@
}
}
- // allow attr_literals in #[repr(align(x))] and #[repr(packed(n))]
- let mut allow_attr_literal = false;
- if attr.path == "repr" {
- if let Some(content) = attr.meta_item_list() {
- allow_attr_literal = content.iter().any(
- |c| c.check_name("align") || c.check_name("packed"));
- }
- }
+ if !self.context.features.unrestricted_attribute_tokens {
+ // Unfortunately, `parse_meta` cannot be called speculatively because it can report
+ // errors by itself, so we have to call it only if the feature is disabled.
+ match attr.parse_meta(self.context.parse_sess) {
+ Ok(meta) => {
+ // allow attr_literals in #[repr(align(x))] and #[repr(packed(n))]
+ let mut allow_attr_literal = false;
+ if attr.path == "repr" {
+ if let Some(content) = meta.meta_item_list() {
+ allow_attr_literal = content.iter().any(
+ |c| c.check_name("align") || c.check_name("packed"));
+ }
+ }
- if self.context.features.use_extern_macros() && attr::is_known(attr) {
- return
- }
-
- if !allow_attr_literal {
- let meta = panictry!(attr.parse_meta(self.context.parse_sess));
- if contains_novel_literal(&meta) {
- gate_feature_post!(&self, attr_literals, attr.span,
- "non-string literals in attributes, or string \
- literals in top-level positions, are experimental");
+ if !allow_attr_literal && contains_novel_literal(&meta) {
+ gate_feature_post!(&self, attr_literals, attr.span,
+ "non-string literals in attributes, or string \
+ literals in top-level positions, are experimental");
+ }
+ }
+ Err(mut err) => {
+ err.help("try enabling `#![feature(unrestricted_attribute_tokens)]`").emit()
+ }
}
}
}
@@ -1547,7 +1556,7 @@
if !name.as_str().is_ascii() {
gate_feature_post!(&self,
non_ascii_idents,
- self.context.parse_sess.codemap().def_span(sp),
+ self.context.parse_sess.source_map().def_span(sp),
"non-ascii idents are not fully supported.");
}
}
@@ -1912,10 +1921,23 @@
err.emit();
}
+ // Some features are known to be incomplete and using them is likely to have
+ // unanticipated results, such as compiler crashes. We warn the user about these
+ // to alert them.
+ let incomplete_features = ["generic_associated_types"];
+
let mut features = Features::new();
let mut edition_enabled_features = FxHashMap();
- for &(name, .., f_edition, set) in ACTIVE_FEATURES.iter() {
+ for &edition in ALL_EDITIONS {
+ if edition <= crate_edition {
+ // The `crate_edition` implies its respective umbrella feature-gate
+ // (i.e. `#![feature(rust_20XX_preview)]` isn't needed on edition 20XX).
+ edition_enabled_features.insert(Symbol::intern(edition.feature_name()), edition);
+ }
+ }
+
+ for &(name, .., f_edition, set) in ACTIVE_FEATURES {
if let Some(f_edition) = f_edition {
if f_edition <= crate_edition {
set(&mut features, DUMMY_SP);
@@ -1924,6 +1946,54 @@
}
}
+ // Process the edition umbrella feature-gates first, to ensure
+ // `edition_enabled_features` is completed before it's queried.
+ for attr in krate_attrs {
+ if !attr.check_name("feature") {
+ continue
+ }
+
+ let list = match attr.meta_item_list() {
+ Some(list) => list,
+ None => continue,
+ };
+
+ for mi in list {
+ let name = if let Some(word) = mi.word() {
+ word.name()
+ } else {
+ continue
+ };
+
+ if incomplete_features.iter().any(|f| *f == name.as_str()) {
+ span_handler.struct_span_warn(
+ mi.span,
+ &format!(
+ "the feature `{}` is incomplete and may cause the compiler to crash",
+ name
+ )
+ ).emit();
+ }
+
+ if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) {
+ if *edition <= crate_edition {
+ continue;
+ }
+
+ for &(name, .., f_edition, set) in ACTIVE_FEATURES {
+ if let Some(f_edition) = f_edition {
+ if f_edition <= *edition {
+ // FIXME(Manishearth) there is currently no way to set
+ // lib features by edition
+ set(&mut features, DUMMY_SP);
+ edition_enabled_features.insert(Symbol::intern(name), *edition);
+ }
+ }
+ }
+ }
+ }
+ }
+
for attr in krate_attrs {
if !attr.check_name("feature") {
continue
@@ -1947,39 +2017,26 @@
continue
};
- if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) {
- if *edition <= crate_edition {
- continue
- }
+ if let Some(edition) = edition_enabled_features.get(&name) {
+ struct_span_warn!(
+ span_handler,
+ mi.span,
+ E0705,
+ "the feature `{}` is included in the Rust {} edition",
+ name,
+ edition,
+ ).emit();
+ continue;
+ }
- for &(name, .., f_edition, set) in ACTIVE_FEATURES.iter() {
- if let Some(f_edition) = f_edition {
- if f_edition <= *edition {
- // FIXME(Manishearth) there is currently no way to set
- // lib features by edition
- set(&mut features, DUMMY_SP);
- edition_enabled_features.insert(Symbol::intern(name), *edition);
- }
- }
- }
-
- continue
+ if ALL_EDITIONS.iter().any(|e| name == e.feature_name()) {
+ // Handled in the separate loop above.
+ continue;
}
if let Some((.., set)) = ACTIVE_FEATURES.iter().find(|f| name == f.0) {
- if let Some(edition) = edition_enabled_features.get(&name) {
- struct_span_warn!(
- span_handler,
- mi.span,
- E0705,
- "the feature `{}` is included in the Rust {} edition",
- name,
- edition,
- ).emit();
- } else {
- set(&mut features, mi.span);
- features.declared_lang_features.push((name, mi.span, None));
- }
+ set(&mut features, mi.span);
+ features.declared_lang_features.push((name, mi.span, None));
continue
}
diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs
index 9d5982c..50a49e2 100644
--- a/src/libsyntax/fold.rs
+++ b/src/libsyntax/fold.rs
@@ -21,12 +21,13 @@
use ast::*;
use ast;
use syntax_pos::Span;
-use codemap::{Spanned, respan};
+use source_map::{Spanned, respan};
use parse::token::{self, Token};
use ptr::P;
+use OneVector;
use symbol::keywords;
+use ThinVec;
use tokenstream::*;
-use util::small_vector::SmallVector;
use util::move_map::MoveMap;
use rustc_data_structures::sync::Lrc;
@@ -60,7 +61,7 @@
noop_fold_use_tree(use_tree, self)
}
- fn fold_foreign_item(&mut self, ni: ForeignItem) -> SmallVector<ForeignItem> {
+ fn fold_foreign_item(&mut self, ni: ForeignItem) -> OneVector<ForeignItem> {
noop_fold_foreign_item(ni, self)
}
@@ -68,7 +69,7 @@
noop_fold_foreign_item_simple(ni, self)
}
- fn fold_item(&mut self, i: P<Item>) -> SmallVector<P<Item>> {
+ fn fold_item(&mut self, i: P<Item>) -> OneVector<P<Item>> {
noop_fold_item(i, self)
}
@@ -88,11 +89,11 @@
noop_fold_item_kind(i, self)
}
- fn fold_trait_item(&mut self, i: TraitItem) -> SmallVector<TraitItem> {
+ fn fold_trait_item(&mut self, i: TraitItem) -> OneVector<TraitItem> {
noop_fold_trait_item(i, self)
}
- fn fold_impl_item(&mut self, i: ImplItem) -> SmallVector<ImplItem> {
+ fn fold_impl_item(&mut self, i: ImplItem) -> OneVector<ImplItem> {
noop_fold_impl_item(i, self)
}
@@ -108,7 +109,7 @@
noop_fold_block(b, self)
}
- fn fold_stmt(&mut self, s: Stmt) -> SmallVector<Stmt> {
+ fn fold_stmt(&mut self, s: Stmt) -> OneVector<Stmt> {
noop_fold_stmt(s, self)
}
@@ -960,8 +961,8 @@
}
pub fn noop_fold_trait_item<T: Folder>(i: TraitItem, folder: &mut T)
- -> SmallVector<TraitItem> {
- SmallVector::one(TraitItem {
+ -> OneVector<TraitItem> {
+ OneVector::one(TraitItem {
id: folder.new_id(i.id),
ident: folder.fold_ident(i.ident),
attrs: fold_attrs(i.attrs, folder),
@@ -989,8 +990,8 @@
}
pub fn noop_fold_impl_item<T: Folder>(i: ImplItem, folder: &mut T)
- -> SmallVector<ImplItem> {
- SmallVector::one(ImplItem {
+ -> OneVector<ImplItem> {
+ OneVector::one(ImplItem {
id: folder.new_id(i.id),
vis: folder.fold_vis(i.vis),
ident: folder.fold_ident(i.ident),
@@ -1065,8 +1066,8 @@
}
// fold one item into possibly many items
-pub fn noop_fold_item<T: Folder>(i: P<Item>, folder: &mut T) -> SmallVector<P<Item>> {
- SmallVector::one(i.map(|i| folder.fold_item_simple(i)))
+pub fn noop_fold_item<T: Folder>(i: P<Item>, folder: &mut T) -> OneVector<P<Item>> {
+ OneVector::one(i.map(|i| folder.fold_item_simple(i)))
}
// fold one item into exactly one item
@@ -1087,8 +1088,8 @@
}
pub fn noop_fold_foreign_item<T: Folder>(ni: ForeignItem, folder: &mut T)
--> SmallVector<ForeignItem> {
- SmallVector::one(folder.fold_foreign_item_simple(ni))
+-> OneVector<ForeignItem> {
+ OneVector::one(folder.fold_foreign_item_simple(ni))
}
pub fn noop_fold_foreign_item_simple<T: Folder>(ni: ForeignItem, folder: &mut T) -> ForeignItem {
@@ -1366,7 +1367,7 @@
es.move_flat_map(|e| folder.fold_opt_expr(e))
}
-pub fn noop_fold_stmt<T: Folder>(Stmt {node, span, id}: Stmt, folder: &mut T) -> SmallVector<Stmt> {
+pub fn noop_fold_stmt<T: Folder>(Stmt {node, span, id}: Stmt, folder: &mut T) -> OneVector<Stmt> {
let id = folder.new_id(id);
let span = folder.new_span(span);
noop_fold_stmt_kind(node, folder).into_iter().map(|node| {
@@ -1374,9 +1375,9 @@
}).collect()
}
-pub fn noop_fold_stmt_kind<T: Folder>(node: StmtKind, folder: &mut T) -> SmallVector<StmtKind> {
+pub fn noop_fold_stmt_kind<T: Folder>(node: StmtKind, folder: &mut T) -> OneVector<StmtKind> {
match node {
- StmtKind::Local(local) => SmallVector::one(StmtKind::Local(folder.fold_local(local))),
+ StmtKind::Local(local) => OneVector::one(StmtKind::Local(folder.fold_local(local))),
StmtKind::Item(item) => folder.fold_item(item).into_iter().map(StmtKind::Item).collect(),
StmtKind::Expr(expr) => {
folder.fold_opt_expr(expr).into_iter().map(StmtKind::Expr).collect()
@@ -1384,7 +1385,7 @@
StmtKind::Semi(expr) => {
folder.fold_opt_expr(expr).into_iter().map(StmtKind::Semi).collect()
}
- StmtKind::Mac(mac) => SmallVector::one(StmtKind::Mac(mac.map(|(mac, semi, attrs)| {
+ StmtKind::Mac(mac) => OneVector::one(StmtKind::Mac(mac.map(|(mac, semi, attrs)| {
(folder.fold_mac(mac), semi, fold_attrs(attrs.into(), folder).into())
}))),
}
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs
index 65de1503..b0cf29e 100644
--- a/src/libsyntax/json.rs
+++ b/src/libsyntax/json.rs
@@ -19,10 +19,10 @@
// FIXME spec the JSON output properly.
-use codemap::{CodeMap, FilePathMapping};
+use source_map::{SourceMap, FilePathMapping};
use syntax_pos::{self, MacroBacktrace, Span, SpanLabel, MultiSpan};
use errors::registry::Registry;
-use errors::{DiagnosticBuilder, SubDiagnostic, CodeSuggestion, CodeMapper};
+use errors::{DiagnosticBuilder, SubDiagnostic, CodeSuggestion, SourceMapper};
use errors::{DiagnosticId, Applicability};
use errors::emitter::{Emitter, EmitterWriter};
@@ -36,14 +36,14 @@
pub struct JsonEmitter {
dst: Box<dyn Write + Send>,
registry: Option<Registry>,
- cm: Lrc<dyn CodeMapper + sync::Send + sync::Sync>,
+ cm: Lrc<dyn SourceMapper + sync::Send + sync::Sync>,
pretty: bool,
ui_testing: bool,
}
impl JsonEmitter {
pub fn stderr(registry: Option<Registry>,
- code_map: Lrc<CodeMap>,
+ code_map: Lrc<SourceMap>,
pretty: bool) -> JsonEmitter {
JsonEmitter {
dst: Box::new(io::stderr()),
@@ -56,13 +56,13 @@
pub fn basic(pretty: bool) -> JsonEmitter {
let file_path_mapping = FilePathMapping::empty();
- JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)),
+ JsonEmitter::stderr(None, Lrc::new(SourceMap::new(file_path_mapping)),
pretty)
}
pub fn new(dst: Box<dyn Write + Send>,
registry: Option<Registry>,
- code_map: Lrc<CodeMap>,
+ code_map: Lrc<SourceMap>,
pretty: bool) -> JsonEmitter {
JsonEmitter {
dst,
@@ -340,7 +340,7 @@
}
impl DiagnosticSpanLine {
- fn line_from_filemap(fm: &syntax_pos::FileMap,
+ fn line_from_source_file(fm: &syntax_pos::SourceFile,
index: usize,
h_start: usize,
h_end: usize)
@@ -362,7 +362,7 @@
lines.lines
.iter()
.map(|line| {
- DiagnosticSpanLine::line_from_filemap(fm,
+ DiagnosticSpanLine::line_from_source_file(fm,
line.line_index,
line.start_col.0 + 1,
line.end_col.0 + 1)
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs
index c8e6062..289f023 100644
--- a/src/libsyntax/lib.rs
+++ b/src/libsyntax/lib.rs
@@ -21,11 +21,13 @@
#![feature(crate_visibility_modifier)]
#![feature(macro_at_most_once_rep)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(rustc_attrs)]
#![feature(rustc_diagnostic_macros)]
#![feature(slice_sort_by_cached_key)]
#![feature(str_escape)]
#![feature(unicode_internals)]
+#![feature(catch_expr)]
#![recursion_limit="256"]
@@ -43,6 +45,8 @@
use rustc_data_structures::sync::Lock;
use rustc_data_structures::bitvec::BitVector;
+pub use rustc_data_structures::small_vec::OneVector;
+pub use rustc_data_structures::thin_vec::ThinVec;
use ast::AttrId;
// A variant of 'try!' that panics on an Err. This is used as a crutch on the
@@ -122,14 +126,13 @@
pub mod parser;
#[cfg(test)]
pub mod parser_testing;
- pub mod small_vector;
pub mod move_map;
- mod thin_vec;
- pub use self::thin_vec::ThinVec;
-
mod rc_slice;
pub use self::rc_slice::RcSlice;
+
+ mod rc_vec;
+ pub use self::rc_vec::RcVec;
}
pub mod json;
@@ -142,7 +145,7 @@
pub mod ast;
pub mod attr;
-pub mod codemap;
+pub mod source_map;
#[macro_use]
pub mod config;
pub mod entry;
diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs
index 4d59f64..a240604 100644
--- a/src/libsyntax/parse/attr.rs
+++ b/src/libsyntax/parse/attr.rs
@@ -10,11 +10,11 @@
use attr;
use ast;
-use codemap::respan;
+use source_map::respan;
use parse::{SeqSep, PResult};
-use parse::token::{self, Nonterminal};
+use parse::token::{self, Nonterminal, DelimToken};
use parse::parser::{Parser, TokenType, PathStyle};
-use tokenstream::TokenStream;
+use tokenstream::{TokenStream, TokenTree};
#[derive(Debug)]
enum InnerAttributeParsePolicy<'a> {
@@ -116,7 +116,7 @@
};
self.expect(&token::OpenDelim(token::Bracket))?;
- let (path, tokens) = self.parse_path_and_tokens()?;
+ let (path, tokens) = self.parse_meta_item_unrestricted()?;
self.expect(&token::CloseDelim(token::Bracket))?;
let hi = self.prev_span;
@@ -138,7 +138,16 @@
})
}
- crate fn parse_path_and_tokens(&mut self) -> PResult<'a, (ast::Path, TokenStream)> {
+ /// Parse an inner part of attribute - path and following tokens.
+ /// The tokens must be either a delimited token stream, or empty token stream,
+ /// or the "legacy" key-value form.
+ /// PATH `(` TOKEN_STREAM `)`
+ /// PATH `[` TOKEN_STREAM `]`
+ /// PATH `{` TOKEN_STREAM `}`
+ /// PATH
+ /// PATH `=` TOKEN_TREE
+ /// The delimiters or `=` are still put into the resulting token stream.
+ crate fn parse_meta_item_unrestricted(&mut self) -> PResult<'a, (ast::Path, TokenStream)> {
let meta = match self.token {
token::Interpolated(ref nt) => match nt.0 {
Nonterminal::NtMeta(ref meta) => Some(meta.clone()),
@@ -150,7 +159,22 @@
self.bump();
(meta.ident, meta.node.tokens(meta.span))
} else {
- (self.parse_path(PathStyle::Mod)?, self.parse_tokens())
+ let path = self.parse_path(PathStyle::Mod)?;
+ let tokens = if self.check(&token::OpenDelim(DelimToken::Paren)) ||
+ self.check(&token::OpenDelim(DelimToken::Bracket)) ||
+ self.check(&token::OpenDelim(DelimToken::Brace)) {
+ self.parse_token_tree().into()
+ } else if self.eat(&token::Eq) {
+ let eq = TokenTree::Token(self.prev_span, token::Eq);
+ let tree = match self.token {
+ token::CloseDelim(_) | token::Eof => self.unexpected()?,
+ _ => self.parse_token_tree(),
+ };
+ TokenStream::concat(vec![eq.into(), tree.into()])
+ } else {
+ TokenStream::empty()
+ };
+ (path, tokens)
})
}
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index 20a585b..dde0466 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -11,7 +11,7 @@
pub use self::CommentStyle::*;
use ast;
-use codemap::CodeMap;
+use source_map::SourceMap;
use syntax_pos::{BytePos, CharPos, Pos, FileName};
use parse::lexer::{is_block_doc_comment, is_pattern_whitespace};
use parse::lexer::{self, ParseSess, StringReader, TokenAndSpan};
@@ -63,6 +63,7 @@
if !lines.is_empty() && lines[0].chars().all(|c| c == '*') {
i += 1;
}
+
while i < j && lines[i].trim().is_empty() {
i += 1;
}
@@ -74,9 +75,11 @@
.all(|c| c == '*') {
j -= 1;
}
+
while j > i && lines[j - 1].trim().is_empty() {
j -= 1;
}
+
lines[i..j].to_vec()
}
@@ -85,6 +88,7 @@
let mut i = usize::MAX;
let mut can_trim = true;
let mut first = true;
+
for line in &lines {
for (j, c) in line.chars().enumerate() {
if j > i || !"* \t".contains(c) {
@@ -119,7 +123,8 @@
}
// one-line comments lose their prefix
- const ONELINERS: &'static [&'static str] = &["///!", "///", "//!", "//"];
+ const ONELINERS: &[&str] = &["///!", "///", "//!", "//"];
+
for prefix in ONELINERS {
if comment.starts_with(*prefix) {
return (&comment[prefix.len()..]).to_string();
@@ -205,6 +210,7 @@
let len = s.len();
let mut col = col.to_usize();
let mut cursor: usize = 0;
+
while col > 0 && cursor < len {
let ch = char_at(s, cursor);
if !ch.is_whitespace() {
@@ -213,7 +219,8 @@
cursor += ch.len_utf8();
col -= 1;
}
- return Some(cursor);
+
+ Some(cursor)
}
fn trim_whitespace_prefix_and_push_line(lines: &mut Vec<String>, s: String, col: CharPos) {
@@ -240,17 +247,19 @@
let mut lines: Vec<String> = Vec::new();
// Count the number of chars since the start of the line by rescanning.
- let mut src_index = rdr.src_index(rdr.filemap.line_begin_pos(rdr.pos));
+ let mut src_index = rdr.src_index(rdr.source_file.line_begin_pos(rdr.pos));
let end_src_index = rdr.src_index(rdr.pos);
assert!(src_index <= end_src_index,
"src_index={}, end_src_index={}, line_begin_pos={}",
- src_index, end_src_index, rdr.filemap.line_begin_pos(rdr.pos).to_u32());
+ src_index, end_src_index, rdr.source_file.line_begin_pos(rdr.pos).to_u32());
let mut n = 0;
+
while src_index < end_src_index {
let c = char_at(&rdr.src, src_index);
src_index += c.len_utf8();
n += 1;
}
+
let col = CharPos(n);
rdr.bump();
@@ -358,18 +367,19 @@
// it appears this function is called only from pprust... that's
// probably not a good thing.
pub fn gather_comments_and_literals(sess: &ParseSess, path: FileName, srdr: &mut dyn Read)
- -> (Vec<Comment>, Vec<Literal>) {
- let mut src = Vec::new();
- srdr.read_to_end(&mut src).unwrap();
- let src = String::from_utf8(src).unwrap();
- let cm = CodeMap::new(sess.codemap().path_mapping().clone());
- let filemap = cm.new_filemap(path, src);
- let mut rdr = lexer::StringReader::new_raw(sess, filemap, None);
+ -> (Vec<Comment>, Vec<Literal>)
+{
+ let mut src = String::new();
+ srdr.read_to_string(&mut src).unwrap();
+ let cm = SourceMap::new(sess.source_map().path_mapping().clone());
+ let source_file = cm.new_source_file(path, src);
+ let mut rdr = lexer::StringReader::new_raw(sess, source_file, None);
let mut comments: Vec<Comment> = Vec::new();
let mut literals: Vec<Literal> = Vec::new();
let mut code_to_the_left = false; // Only code
let mut anything_to_the_left = false; // Code or comments
+
while !rdr.is_eof() {
loop {
// Eat all the whitespace and count blank lines.
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index f9b9e95..448ff96 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -10,7 +10,7 @@
use ast::{self, Ident};
use syntax_pos::{self, BytePos, CharPos, Pos, Span, NO_EXPANSION};
-use codemap::{CodeMap, FilePathMapping};
+use source_map::{SourceMap, FilePathMapping};
use errors::{Applicability, FatalError, DiagnosticBuilder};
use parse::{token, ParseSess};
use str::char_at;
@@ -43,13 +43,13 @@
pub struct StringReader<'a> {
pub sess: &'a ParseSess,
- /// The absolute offset within the codemap of the next character to read
+ /// The absolute offset within the source_map of the next character to read
pub next_pos: BytePos,
- /// The absolute offset within the codemap of the current character
+ /// The absolute offset within the source_map of the current character
pub pos: BytePos,
/// The current character (which has been read from self.pos)
pub ch: Option<char>,
- pub filemap: Lrc<syntax_pos::FileMap>,
+ pub source_file: Lrc<syntax_pos::SourceFile>,
/// Stop reading src at this index.
pub end_src_index: usize,
// cached:
@@ -58,7 +58,7 @@
peek_span_src_raw: Span,
fatal_errs: Vec<DiagnosticBuilder<'a>>,
// cache a direct reference to the source text, so that we don't have to
- // retrieve it via `self.filemap.src.as_ref().unwrap()` all the time.
+ // retrieve it via `self.source_file.src.as_ref().unwrap()` all the time.
src: Lrc<String>,
/// Stack of open delimiters and their spans. Used for error message.
token: token::Token,
@@ -67,29 +67,30 @@
span_src_raw: Span,
open_braces: Vec<(token::DelimToken, Span)>,
crate override_span: Option<Span>,
+ last_unclosed_found_span: Option<Span>,
}
impl<'a> StringReader<'a> {
fn mk_sp(&self, lo: BytePos, hi: BytePos) -> Span {
self.mk_sp_and_raw(lo, hi).0
}
+
fn mk_sp_and_raw(&self, lo: BytePos, hi: BytePos) -> (Span, Span) {
let raw = Span::new(lo, hi, NO_EXPANSION);
- let real = unwrap_or!(self.override_span, raw);
+ let real = self.override_span.unwrap_or(raw);
+
(real, raw)
}
+
fn mk_ident(&self, string: &str) -> Ident {
let mut ident = Ident::from_str(string);
if let Some(span) = self.override_span {
ident.span = span;
}
+
ident
}
- fn next_token(&mut self) -> TokenAndSpan where Self: Sized {
- let res = self.try_next_token();
- self.unwrap_or_abort(res)
- }
fn unwrap_or_abort(&mut self, res: Result<TokenAndSpan, ()>) -> TokenAndSpan {
match res {
Ok(tok) => tok,
@@ -99,6 +100,25 @@
}
}
}
+
+ fn next_token(&mut self) -> TokenAndSpan where Self: Sized {
+ let res = self.try_next_token();
+ self.unwrap_or_abort(res)
+ }
+
+ /// Return the next token. EFFECT: advances the string_reader.
+ pub fn try_next_token(&mut self) -> Result<TokenAndSpan, ()> {
+ assert!(self.fatal_errs.is_empty());
+ let ret_val = TokenAndSpan {
+ tok: replace(&mut self.peek_tok, token::Whitespace),
+ sp: self.peek_span,
+ };
+ self.advance_token()?;
+ self.span_src_raw = self.peek_span_src_raw;
+
+ Ok(ret_val)
+ }
+
fn try_real_token(&mut self) -> Result<TokenAndSpan, ()> {
let mut t = self.try_next_token()?;
loop {
@@ -109,36 +129,32 @@
_ => break,
}
}
+
self.token = t.tok.clone();
self.span = t.sp;
+
Ok(t)
}
+
pub fn real_token(&mut self) -> TokenAndSpan {
let res = self.try_real_token();
self.unwrap_or_abort(res)
}
+
+ #[inline]
fn is_eof(&self) -> bool {
self.ch.is_none()
}
- /// Return the next token. EFFECT: advances the string_reader.
- pub fn try_next_token(&mut self) -> Result<TokenAndSpan, ()> {
- assert!(self.fatal_errs.is_empty());
- let ret_val = TokenAndSpan {
- tok: replace(&mut self.peek_tok, token::Whitespace),
- sp: self.peek_span,
- };
- self.advance_token()?;
- self.span_src_raw = self.peek_span_src_raw;
- Ok(ret_val)
- }
fn fail_unterminated_raw_string(&self, pos: BytePos, hash_count: u16) {
let mut err = self.struct_span_fatal(pos, pos, "unterminated raw string");
err.span_label(self.mk_sp(pos, pos), "unterminated raw string");
+
if hash_count > 0 {
err.note(&format!("this raw string should be terminated with `\"{}`",
"#".repeat(hash_count as usize)));
}
+
err.emit();
FatalError.raise();
}
@@ -146,12 +162,15 @@
fn fatal(&self, m: &str) -> FatalError {
self.fatal_span(self.peek_span, m)
}
+
pub fn emit_fatal_errors(&mut self) {
for err in &mut self.fatal_errs {
err.emit();
}
+
self.fatal_errs.clear();
}
+
pub fn peek(&self) -> TokenAndSpan {
// FIXME(pcwalton): Bad copy!
TokenAndSpan {
@@ -161,28 +180,31 @@
}
/// For comments.rs, which hackily pokes into next_pos and ch
- fn new_raw(sess: &'a ParseSess, filemap: Lrc<syntax_pos::FileMap>,
- override_span: Option<Span>) -> Self {
- let mut sr = StringReader::new_raw_internal(sess, filemap, override_span);
+ fn new_raw(sess: &'a ParseSess,
+ source_file: Lrc<syntax_pos::SourceFile>,
+ override_span: Option<Span>) -> Self {
+ let mut sr = StringReader::new_raw_internal(sess, source_file, override_span);
sr.bump();
+
sr
}
- fn new_raw_internal(sess: &'a ParseSess, filemap: Lrc<syntax_pos::FileMap>,
- override_span: Option<Span>) -> Self {
- if filemap.src.is_none() {
- sess.span_diagnostic.bug(&format!("Cannot lex filemap without source: {}",
- filemap.name));
+ fn new_raw_internal(sess: &'a ParseSess, source_file: Lrc<syntax_pos::SourceFile>,
+ override_span: Option<Span>) -> Self
+ {
+ if source_file.src.is_none() {
+ sess.span_diagnostic.bug(&format!("Cannot lex source_file without source: {}",
+ source_file.name));
}
- let src = (*filemap.src.as_ref().unwrap()).clone();
+ let src = (*source_file.src.as_ref().unwrap()).clone();
StringReader {
sess,
- next_pos: filemap.start_pos,
- pos: filemap.start_pos,
+ next_pos: source_file.start_pos,
+ pos: source_file.start_pos,
ch: Some('\n'),
- filemap,
+ source_file,
end_src_index: src.len(),
// dummy values; not read
peek_tok: token::Eof,
@@ -195,22 +217,25 @@
span_src_raw: syntax_pos::DUMMY_SP,
open_braces: Vec::new(),
override_span,
+ last_unclosed_found_span: None,
}
}
- pub fn new(sess: &'a ParseSess, filemap: Lrc<syntax_pos::FileMap>, override_span: Option<Span>)
- -> Self {
- let mut sr = StringReader::new_raw(sess, filemap, override_span);
+ pub fn new(sess: &'a ParseSess,
+ source_file: Lrc<syntax_pos::SourceFile>,
+ override_span: Option<Span>) -> Self {
+ let mut sr = StringReader::new_raw(sess, source_file, override_span);
if sr.advance_token().is_err() {
sr.emit_fatal_errors();
FatalError.raise();
}
+
sr
}
pub fn retokenize(sess: &'a ParseSess, mut span: Span) -> Self {
- let begin = sess.codemap().lookup_byte_offset(span.lo());
- let end = sess.codemap().lookup_byte_offset(span.hi());
+ let begin = sess.source_map().lookup_byte_offset(span.lo());
+ let end = sess.source_map().lookup_byte_offset(span.hi());
// Make the range zero-length if the span is invalid.
if span.lo() > span.hi() || begin.fm.start_pos != end.fm.start_pos {
@@ -229,9 +254,11 @@
sr.emit_fatal_errors();
FatalError.raise();
}
+
sr
}
+ #[inline]
fn ch_is(&self, c: char) -> bool {
self.ch == Some(c)
}
@@ -276,26 +303,23 @@
let mut m = m.to_string();
m.push_str(": ");
Self::push_escaped_char_for_msg(&mut m, c);
+
self.fatal_span_(from_pos, to_pos, &m[..])
}
- fn struct_span_fatal(&self,
- from_pos: BytePos,
- to_pos: BytePos,
- m: &str)
- -> DiagnosticBuilder<'a> {
+ fn struct_span_fatal(&self, from_pos: BytePos, to_pos: BytePos, m: &str)
+ -> DiagnosticBuilder<'a>
+ {
self.sess.span_diagnostic.struct_span_fatal(self.mk_sp(from_pos, to_pos), m)
}
- fn struct_fatal_span_char(&self,
- from_pos: BytePos,
- to_pos: BytePos,
- m: &str,
- c: char)
- -> DiagnosticBuilder<'a> {
+ fn struct_fatal_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char)
+ -> DiagnosticBuilder<'a>
+ {
let mut m = m.to_string();
m.push_str(": ");
Self::push_escaped_char_for_msg(&mut m, c);
+
self.sess.span_diagnostic.struct_span_fatal(self.mk_sp(from_pos, to_pos), &m[..])
}
@@ -307,15 +331,14 @@
Self::push_escaped_char_for_msg(&mut m, c);
self.err_span_(from_pos, to_pos, &m[..]);
}
- fn struct_err_span_char(&self,
- from_pos: BytePos,
- to_pos: BytePos,
- m: &str,
- c: char)
- -> DiagnosticBuilder<'a> {
+
+ fn struct_err_span_char(&self, from_pos: BytePos, to_pos: BytePos, m: &str, c: char)
+ -> DiagnosticBuilder<'a>
+ {
let mut m = m.to_string();
m.push_str(": ");
Self::push_escaped_char_for_msg(&mut m, c);
+
self.sess.span_diagnostic.struct_span_err(self.mk_sp(from_pos, to_pos), &m[..])
}
@@ -324,6 +347,7 @@
fn fatal_span_verbose(&self, from_pos: BytePos, to_pos: BytePos, mut m: String) -> FatalError {
m.push_str(": ");
m.push_str(&self.src[self.src_index(from_pos)..self.src_index(to_pos)]);
+
self.fatal_span_(from_pos, to_pos, &m[..])
}
@@ -340,8 +364,8 @@
if self.is_eof() {
self.peek_tok = token::Eof;
let (real, raw) = self.mk_sp_and_raw(
- self.filemap.end_pos,
- self.filemap.end_pos,
+ self.source_file.end_pos,
+ self.source_file.end_pos,
);
self.peek_span = real;
self.peek_span_src_raw = raw;
@@ -354,12 +378,13 @@
};
}
}
+
Ok(())
}
#[inline]
fn src_index(&self, pos: BytePos) -> usize {
- (pos - self.filemap.start_pos).to_usize()
+ (pos - self.source_file.start_pos).to_usize()
}
/// Calls `f` with a string slice of the source text spanning from `start`
@@ -443,7 +468,7 @@
}
/// Advance the StringReader by one character. If a newline is
- /// discovered, add it to the FileMap's list of line start offsets.
+ /// discovered, add it to the SourceFile's list of line start offsets.
crate fn bump(&mut self) {
let next_src_index = self.src_index(self.next_pos);
if next_src_index < self.end_src_index {
@@ -468,6 +493,7 @@
}
}
+ #[inline]
fn nextch_is(&self, c: char) -> bool {
self.nextch() == Some(c)
}
@@ -484,6 +510,7 @@
None
}
+ #[inline]
fn nextnextch_is(&self, c: char) -> bool {
self.nextnextch() == Some(c)
}
@@ -493,8 +520,10 @@
if !ident_start(self.ch) {
return None;
}
+
let start = self.pos;
self.bump();
+
while ident_continue(self.ch) {
self.bump();
}
@@ -593,8 +622,8 @@
// I guess this is the only way to figure out if
// we're at the beginning of the file...
- let cmap = CodeMap::new(FilePathMapping::empty());
- cmap.files.borrow_mut().file_maps.push(self.filemap.clone());
+ let cmap = SourceMap::new(FilePathMapping::empty());
+ cmap.files.borrow_mut().file_maps.push(self.source_file.clone());
let loc = cmap.lookup_char_pos_adj(self.pos);
debug!("Skipping a shebang");
if loc.line == 1 && loc.col == CharPos(0) {
@@ -709,6 +738,7 @@
fn scan_digits(&mut self, real_radix: u32, scan_radix: u32) -> usize {
assert!(real_radix <= scan_radix);
let mut len = 0;
+
loop {
let c = self.ch;
if c == Some('_') {
@@ -736,31 +766,29 @@
/// Lex a LIT_INTEGER or a LIT_FLOAT
fn scan_number(&mut self, c: char) -> token::Lit {
- let num_digits;
let mut base = 10;
let start_bpos = self.pos;
-
self.bump();
- if c == '0' {
+ let num_digits = if c == '0' {
match self.ch.unwrap_or('\0') {
'b' => {
self.bump();
base = 2;
- num_digits = self.scan_digits(2, 10);
+ self.scan_digits(2, 10)
}
'o' => {
self.bump();
base = 8;
- num_digits = self.scan_digits(8, 10);
+ self.scan_digits(8, 10)
}
'x' => {
self.bump();
base = 16;
- num_digits = self.scan_digits(16, 16);
+ self.scan_digits(16, 16)
}
'0'..='9' | '_' | '.' | 'e' | 'E' => {
- num_digits = self.scan_digits(10, 10) + 1;
+ self.scan_digits(10, 10) + 1
}
_ => {
// just a 0
@@ -768,15 +796,14 @@
}
}
} else if c.is_digit(10) {
- num_digits = self.scan_digits(10, 10) + 1;
+ self.scan_digits(10, 10) + 1
} else {
- num_digits = 0;
- }
+ 0
+ };
if num_digits == 0 {
- self.err_span_(start_bpos,
- self.pos,
- "no valid digits found for number");
+ self.err_span_(start_bpos, self.pos, "no valid digits found for number");
+
return token::Integer(Symbol::intern("0"));
}
@@ -794,6 +821,7 @@
}
let pos = self.pos;
self.check_float_base(start_bpos, pos, base);
+
token::Float(self.name_from(start_bpos))
} else {
// it might be a float if it has an exponent
@@ -873,7 +901,8 @@
first_source_char: char,
ascii_only: bool,
delim: char)
- -> bool {
+ -> bool
+ {
match first_source_char {
'\\' => {
// '\X' for some X must be a character constant:
@@ -1008,6 +1037,7 @@
"overlong unicode escape (must have at most 6 hex digits)");
valid = false;
}
+
loop {
match self.ch {
Some('}') => {
@@ -1043,6 +1073,7 @@
}
self.bump();
}
+
valid
}
@@ -1050,9 +1081,11 @@
fn scan_float_exponent(&mut self) {
if self.ch_is('e') || self.ch_is('E') {
self.bump();
+
if self.ch_is('-') || self.ch_is('+') {
self.bump();
}
+
if self.scan_digits(10, 10) == 0 {
let mut err = self.struct_span_fatal(
self.pos, self.next_pos,
@@ -1125,6 +1158,7 @@
('b', Some('r'), Some('#')) => (false, false),
_ => (true, false),
};
+
if is_ident_start {
let raw_start = self.pos;
if is_raw_ident {
@@ -1135,6 +1169,7 @@
let start = self.pos;
self.bump();
+
while ident_continue(self.ch) {
self.bump();
}
@@ -1142,16 +1177,19 @@
return Ok(self.with_str_from(start, |string| {
// FIXME: perform NFKC normalization here. (Issue #2253)
let ident = self.mk_ident(string);
+
if is_raw_ident && (ident.is_path_segment_keyword() ||
ident.name == keywords::Underscore.name()) {
self.fatal_span_(raw_start, self.pos,
&format!("`r#{}` is not currently supported.", ident.name)
).raise();
}
+
if is_raw_ident {
let span = self.mk_sp(raw_start, self.pos);
self.sess.raw_identifier_spans.borrow_mut().push(span);
}
+
token::Ident(ident, is_raw_ident)
}));
}
@@ -1337,14 +1375,11 @@
return Ok(token::Lifetime(ident));
}
- let valid = self.scan_char_or_byte(start,
- c2,
- // ascii_only =
- false,
- '\'');
+ let valid = self.scan_char_or_byte(start, c2, /* ascii_only */ false, '\'');
if !self.ch_is('\'') {
let pos = self.pos;
+
loop {
self.bump();
if self.ch_is('\'') {
@@ -1370,6 +1405,7 @@
break;
}
}
+
self.fatal_span_verbose(start_with_quote, pos,
String::from("character literal may only contain one codepoint")).raise();
}
@@ -1379,8 +1415,10 @@
} else {
Symbol::intern("0")
};
+
self.bump(); // advance ch past token
let suffix = self.scan_optional_raw_name();
+
Ok(token::Literal(token::Char(id), suffix))
}
'b' => {
@@ -1392,12 +1430,14 @@
_ => unreachable!(), // Should have been a token::Ident above.
};
let suffix = self.scan_optional_raw_name();
+
Ok(token::Literal(lit, suffix))
}
'"' => {
let start_bpos = self.pos;
let mut valid = true;
self.bump();
+
while !self.ch_is('"') {
if self.is_eof() {
let last_bpos = self.pos;
@@ -1409,11 +1449,7 @@
let ch_start = self.pos;
let ch = self.ch.unwrap();
self.bump();
- valid &= self.scan_char_or_byte(ch_start,
- ch,
- // ascii_only =
- false,
- '"');
+ valid &= self.scan_char_or_byte(ch_start, ch, /* ascii_only */ false, '"');
}
// adjust for the ASCII " at the start of the literal
let id = if valid {
@@ -1423,6 +1459,7 @@
};
self.bump();
let suffix = self.scan_optional_raw_name();
+
Ok(token::Literal(token::Str_(id), suffix))
}
'r' => {
@@ -1492,6 +1529,7 @@
}
self.bump();
}
+
self.bump();
let id = if valid {
self.name_from_to(content_start_bpos, content_end_bpos)
@@ -1499,6 +1537,7 @@
Symbol::intern("??")
};
let suffix = self.scan_optional_raw_name();
+
Ok(token::Literal(token::StrRaw(id, hash_count), suffix))
}
'-' => {
@@ -1555,6 +1594,7 @@
c);
unicode_chars::check_for_substitution(self, c, &mut err);
self.fatal_errs.push(err);
+
Err(())
}
}
@@ -1572,9 +1612,11 @@
val.push(self.ch.unwrap());
self.bump();
}
+
if self.ch_is('\n') {
self.bump();
}
+
val
}
@@ -1626,9 +1668,11 @@
Symbol::intern("?")
};
self.bump(); // advance ch past token
+
token::Byte(id)
}
+ #[inline]
fn scan_byte_escape(&mut self, delim: char, below_0x7f_only: bool) -> bool {
self.scan_hex_digits(2, delim, below_0x7f_only)
}
@@ -1653,12 +1697,14 @@
true,
'"');
}
+
let id = if valid {
self.name_from(start)
} else {
Symbol::intern("??")
};
self.bump();
+
token::ByteStr(id)
}
@@ -1716,25 +1762,26 @@
}
self.bump();
}
+
self.bump();
- token::ByteStrRaw(self.name_from_to(content_start_bpos, content_end_bpos),
- hash_count)
+
+ token::ByteStrRaw(self.name_from_to(content_start_bpos, content_end_bpos), hash_count)
}
}
// This tests the character for the unicode property 'PATTERN_WHITE_SPACE' which
// is guaranteed to be forward compatible. http://unicode.org/reports/tr31/#R3
+#[inline]
crate fn is_pattern_whitespace(c: Option<char>) -> bool {
c.map_or(false, Pattern_White_Space)
}
+#[inline]
fn in_range(c: Option<char>, lo: char, hi: char) -> bool {
- match c {
- Some(c) => lo <= c && c <= hi,
- _ => false,
- }
+ c.map_or(false, |c| lo <= c && c <= hi)
}
+#[inline]
fn is_dec_digit(c: Option<char>) -> bool {
in_range(c, '0', '9')
}
@@ -1780,7 +1827,7 @@
use ast::{Ident, CrateConfig};
use symbol::Symbol;
use syntax_pos::{BytePos, Span, NO_EXPANSION};
- use codemap::CodeMap;
+ use source_map::SourceMap;
use errors;
use feature_gate::UnstableFeatures;
use parse::token;
@@ -1790,7 +1837,7 @@
use diagnostics::plugin::ErrorMap;
use rustc_data_structures::sync::Lock;
use with_globals;
- fn mk_sess(cm: Lrc<CodeMap>) -> ParseSess {
+ fn mk_sess(cm: Lrc<SourceMap>) -> ParseSess {
let emitter = errors::emitter::EmitterWriter::new(Box::new(io::sink()),
Some(cm.clone()),
false,
@@ -1810,18 +1857,18 @@
}
// open a string reader for the given string
- fn setup<'a>(cm: &CodeMap,
+ fn setup<'a>(cm: &SourceMap,
sess: &'a ParseSess,
teststr: String)
-> StringReader<'a> {
- let fm = cm.new_filemap(PathBuf::from("zebra.rs").into(), teststr);
+ let fm = cm.new_source_file(PathBuf::from("zebra.rs").into(), teststr);
StringReader::new(sess, fm, None)
}
#[test]
fn t1() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
let mut string_reader = setup(&cm,
&sh,
@@ -1869,7 +1916,7 @@
#[test]
fn doublecolonparsing() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
check_tokenization(setup(&cm, &sh, "a b".to_string()),
vec![mk_ident("a"), token::Whitespace, mk_ident("b")]);
@@ -1879,7 +1926,7 @@
#[test]
fn dcparsing_2() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
check_tokenization(setup(&cm, &sh, "a::b".to_string()),
vec![mk_ident("a"), token::ModSep, mk_ident("b")]);
@@ -1889,7 +1936,7 @@
#[test]
fn dcparsing_3() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
check_tokenization(setup(&cm, &sh, "a ::b".to_string()),
vec![mk_ident("a"), token::Whitespace, token::ModSep, mk_ident("b")]);
@@ -1899,7 +1946,7 @@
#[test]
fn dcparsing_4() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
check_tokenization(setup(&cm, &sh, "a:: b".to_string()),
vec![mk_ident("a"), token::ModSep, token::Whitespace, mk_ident("b")]);
@@ -1909,7 +1956,7 @@
#[test]
fn character_a() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
assert_eq!(setup(&cm, &sh, "'a'".to_string()).next_token().tok,
token::Literal(token::Char(Symbol::intern("a")), None));
@@ -1919,7 +1966,7 @@
#[test]
fn character_space() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
assert_eq!(setup(&cm, &sh, "' '".to_string()).next_token().tok,
token::Literal(token::Char(Symbol::intern(" ")), None));
@@ -1929,7 +1976,7 @@
#[test]
fn character_escaped() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
assert_eq!(setup(&cm, &sh, "'\\n'".to_string()).next_token().tok,
token::Literal(token::Char(Symbol::intern("\\n")), None));
@@ -1939,7 +1986,7 @@
#[test]
fn lifetime_name() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
assert_eq!(setup(&cm, &sh, "'abc".to_string()).next_token().tok,
token::Lifetime(Ident::from_str("'abc")));
@@ -1949,7 +1996,7 @@
#[test]
fn raw_string() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
assert_eq!(setup(&cm, &sh, "r###\"\"#a\\b\x00c\"\"###".to_string())
.next_token()
@@ -1961,7 +2008,7 @@
#[test]
fn literal_suffixes() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
macro_rules! test {
($input: expr, $tok_type: ident, $tok_contents: expr) => {{
@@ -2007,7 +2054,7 @@
#[test]
fn nested_block_comments() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
let mut lexer = setup(&cm, &sh, "/* /* */ */'a'".to_string());
match lexer.next_token().tok {
@@ -2022,7 +2069,7 @@
#[test]
fn crlf_comments() {
with_globals(|| {
- let cm = Lrc::new(CodeMap::new(FilePathMapping::empty()));
+ let cm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
let sh = mk_sess(cm.clone());
let mut lexer = setup(&cm, &sh, "// test\r\n/// test\r\n".to_string());
let comment = lexer.next_token();
diff --git a/src/libsyntax/parse/lexer/tokentrees.rs b/src/libsyntax/parse/lexer/tokentrees.rs
index 36c220f..e2fd7fa 100644
--- a/src/libsyntax/parse/lexer/tokentrees.rs
+++ b/src/libsyntax/parse/lexer/tokentrees.rs
@@ -17,9 +17,11 @@
// Parse a stream of tokens into a list of `TokenTree`s, up to an `Eof`.
crate fn parse_all_token_trees(&mut self) -> PResult<'a, TokenStream> {
let mut tts = Vec::new();
+
while self.token != token::Eof {
tts.push(self.parse_token_tree()?);
}
+
Ok(TokenStream::concat(tts))
}
@@ -30,6 +32,7 @@
if let token::CloseDelim(..) = self.token {
return TokenStream::concat(tts);
}
+
match self.parse_token_tree() {
Ok(tree) => tts.push(tree),
Err(mut e) => {
@@ -48,6 +51,7 @@
for &(_, sp) in &self.open_braces {
err.span_help(sp, "did you mean to close this delimiter?");
}
+
Err(err)
},
token::OpenDelim(delim) => {
@@ -77,16 +81,23 @@
// Incorrect delimiter.
token::CloseDelim(other) => {
let token_str = token_to_string(&self.token);
- let msg = format!("incorrect close delimiter: `{}`", token_str);
- let mut err = self.sess.span_diagnostic.struct_span_err(self.span, &msg);
- // This is a conservative error: only report the last unclosed delimiter.
- // The previous unclosed delimiters could actually be closed! The parser
- // just hasn't gotten to them yet.
- if let Some(&(_, sp)) = self.open_braces.last() {
- err.span_note(sp, "unclosed delimiter");
- };
- err.emit();
-
+ if self.last_unclosed_found_span != Some(self.span) {
+ // do not complain about the same unclosed delimiter multiple times
+ self.last_unclosed_found_span = Some(self.span);
+ let msg = format!("incorrect close delimiter: `{}`", token_str);
+ let mut err = self.sess.span_diagnostic.struct_span_err(
+ self.span,
+ &msg,
+ );
+ err.span_label(self.span, "incorrect close delimiter");
+ // This is a conservative error: only report the last unclosed
+ // delimiter. The previous unclosed delimiters could actually be
+ // closed! The parser just hasn't gotten to them yet.
+ if let Some(&(_, sp)) = self.open_braces.last() {
+ err.span_label(sp, "unclosed delimiter");
+ };
+ err.emit();
+ }
self.open_braces.pop().unwrap();
// If the incorrect delimiter matches an earlier opening
@@ -118,7 +129,8 @@
// matching opening delimiter).
let token_str = token_to_string(&self.token);
let msg = format!("unexpected close delimiter: `{}`", token_str);
- let err = self.sess.span_diagnostic.struct_span_err(self.span, &msg);
+ let mut err = self.sess.span_diagnostic.struct_span_err(self.span, &msg);
+ err.span_label(self.span, "unexpected close delimiter");
Err(err)
},
_ => {
@@ -129,6 +141,7 @@
let raw = self.span_src_raw;
self.real_token();
let is_joint = raw.hi() == self.span_src_raw.lo() && token::is_op(&self.token);
+
Ok(if is_joint { tt.joint() } else { tt.into() })
}
}
diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs
index a32b515..88ff858 100644
--- a/src/libsyntax/parse/lexer/unicode_chars.rs
+++ b/src/libsyntax/parse/lexer/unicode_chars.rs
@@ -15,7 +15,7 @@
use errors::DiagnosticBuilder;
use super::StringReader;
-const UNICODE_ARRAY: &'static [(char, &'static str, char)] = &[
+const UNICODE_ARRAY: &[(char, &str, char)] = &[
('
', "Line Separator", ' '),
('
', "Paragraph Separator", ' '),
(' ', "Ogham Space mark", ' '),
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs
index d029509..adf0119 100644
--- a/src/libsyntax/parse/mod.rs
+++ b/src/libsyntax/parse/mod.rs
@@ -13,8 +13,8 @@
use rustc_data_structures::sync::{Lrc, Lock};
use ast::{self, CrateConfig, NodeId};
use early_buffered_lints::{BufferedEarlyLint, BufferedEarlyLintId};
-use codemap::{CodeMap, FilePathMapping};
-use syntax_pos::{Span, FileMap, FileName, MultiSpan};
+use source_map::{SourceMap, FilePathMapping};
+use syntax_pos::{Span, SourceFile, FileName, MultiSpan};
use errors::{Handler, ColorConfig, DiagnosticBuilder};
use feature_gate::UnstableFeatures;
use parse::parser::Parser;
@@ -57,13 +57,13 @@
pub non_modrs_mods: Lock<Vec<(ast::Ident, Span)>>,
/// Used to determine and report recursive mod inclusions
included_mod_stack: Lock<Vec<PathBuf>>,
- code_map: Lrc<CodeMap>,
+ code_map: Lrc<SourceMap>,
pub buffered_lints: Lock<Vec<BufferedEarlyLint>>,
}
impl ParseSess {
pub fn new(file_path_mapping: FilePathMapping) -> Self {
- let cm = Lrc::new(CodeMap::new(file_path_mapping));
+ let cm = Lrc::new(SourceMap::new(file_path_mapping));
let handler = Handler::with_tty_emitter(ColorConfig::Auto,
true,
false,
@@ -71,7 +71,7 @@
ParseSess::with_span_handler(handler, cm)
}
- pub fn with_span_handler(handler: Handler, code_map: Lrc<CodeMap>) -> ParseSess {
+ pub fn with_span_handler(handler: Handler, code_map: Lrc<SourceMap>) -> ParseSess {
ParseSess {
span_diagnostic: handler,
unstable_features: UnstableFeatures::from_environment(),
@@ -86,7 +86,7 @@
}
}
- pub fn codemap(&self) -> &CodeMap {
+ pub fn source_map(&self) -> &SourceMap {
&self.code_map
}
@@ -171,13 +171,13 @@
pub fn parse_stream_from_source_str(name: FileName, source: String, sess: &ParseSess,
override_span: Option<Span>)
-> TokenStream {
- filemap_to_stream(sess, sess.codemap().new_filemap(name, source), override_span)
+ source_file_to_stream(sess, sess.source_map().new_source_file(name, source), override_span)
}
// Create a new parser from a source string
pub fn new_parser_from_source_str(sess: &ParseSess, name: FileName, source: String)
-> Parser {
- let mut parser = filemap_to_parser(sess, sess.codemap().new_filemap(name, source));
+ let mut parser = source_file_to_parser(sess, sess.source_map().new_source_file(name, source));
parser.recurse_into_file_modules = false;
parser
}
@@ -185,27 +185,27 @@
/// Create a new parser, handling errors as appropriate
/// if the file doesn't exist
pub fn new_parser_from_file<'a>(sess: &'a ParseSess, path: &Path) -> Parser<'a> {
- filemap_to_parser(sess, file_to_filemap(sess, path, None))
+ source_file_to_parser(sess, file_to_source_file(sess, path, None))
}
/// Given a session, a crate config, a path, and a span, add
-/// the file at the given path to the codemap, and return a parser.
+/// the file at the given path to the source_map, and return a parser.
/// On an error, use the given span as the source of the problem.
crate fn new_sub_parser_from_file<'a>(sess: &'a ParseSess,
path: &Path,
directory_ownership: DirectoryOwnership,
module_name: Option<String>,
sp: Span) -> Parser<'a> {
- let mut p = filemap_to_parser(sess, file_to_filemap(sess, path, Some(sp)));
+ let mut p = source_file_to_parser(sess, file_to_source_file(sess, path, Some(sp)));
p.directory.ownership = directory_ownership;
p.root_module_name = module_name;
p
}
-/// Given a filemap and config, return a parser
-fn filemap_to_parser(sess: & ParseSess, filemap: Lrc<FileMap>) -> Parser {
- let end_pos = filemap.end_pos;
- let mut parser = stream_to_parser(sess, filemap_to_stream(sess, filemap, None));
+/// Given a source_file and config, return a parser
+fn source_file_to_parser(sess: & ParseSess, source_file: Lrc<SourceFile>) -> Parser {
+ let end_pos = source_file.end_pos;
+ let mut parser = stream_to_parser(sess, source_file_to_stream(sess, source_file, None));
if parser.token == token::Eof && parser.span.is_dummy() {
parser.span = Span::new(end_pos, end_pos, parser.span.ctxt());
@@ -224,11 +224,11 @@
// base abstractions
/// Given a session and a path and an optional span (for error reporting),
-/// add the path to the session's codemap and return the new filemap.
-fn file_to_filemap(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
- -> Lrc<FileMap> {
- match sess.codemap().load_file(path) {
- Ok(filemap) => filemap,
+/// add the path to the session's source_map and return the new source_file.
+fn file_to_source_file(sess: &ParseSess, path: &Path, spanopt: Option<Span>)
+ -> Lrc<SourceFile> {
+ match sess.source_map().load_file(path) {
+ Ok(source_file) => source_file,
Err(e) => {
let msg = format!("couldn't read {:?}: {}", path.display(), e);
match spanopt {
@@ -239,10 +239,11 @@
}
}
-/// Given a filemap, produce a sequence of token-trees
-pub fn filemap_to_stream(sess: &ParseSess, filemap: Lrc<FileMap>, override_span: Option<Span>)
- -> TokenStream {
- let mut srdr = lexer::StringReader::new(sess, filemap, override_span);
+/// Given a source_file, produce a sequence of token-trees
+pub fn source_file_to_stream(sess: &ParseSess,
+ source_file: Lrc<SourceFile>,
+ override_span: Option<Span>) -> TokenStream {
+ let mut srdr = lexer::StringReader::new(sess, source_file, override_span);
srdr.real_token();
panictry!(srdr.parse_all_token_trees())
}
@@ -969,7 +970,7 @@
let span = tts.iter().rev().next().unwrap().span();
- match sess.codemap().span_to_snippet(span) {
+ match sess.source_map().span_to_snippet(span) {
Ok(s) => assert_eq!(&s[..], "{ body }"),
Err(_) => panic!("could not get snippet"),
}
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 9011b6e..b1e2e69 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -42,9 +42,9 @@
use ast::{BinOpKind, UnOp};
use ast::{RangeEnd, RangeSyntax};
use {ast, attr};
-use codemap::{self, CodeMap, Spanned, respan};
+use source_map::{self, SourceMap, Spanned, respan};
use syntax_pos::{self, Span, MultiSpan, BytePos, FileName, edition::Edition};
-use errors::{self, Applicability, DiagnosticBuilder};
+use errors::{self, Applicability, DiagnosticBuilder, DiagnosticId};
use parse::{self, SeqSep, classify, token};
use parse::lexer::TokenAndSpan;
use parse::lexer::comments::{doc_comment_style, strip_doc_comment_decoration};
@@ -53,9 +53,9 @@
use print::pprust;
use ptr::P;
use parse::PResult;
+use ThinVec;
use tokenstream::{self, Delimited, ThinTokenStream, TokenTree, TokenStream};
use symbol::{Symbol, keywords};
-use util::ThinVec;
use std::borrow::Cow;
use std::cmp;
@@ -577,7 +577,7 @@
if let Some(directory) = directory {
parser.directory = directory;
} else if !parser.span.is_dummy() {
- if let FileName::Real(mut path) = sess.codemap().span_to_unmapped_path(parser.span) {
+ if let FileName::Real(mut path) = sess.source_map().span_to_unmapped_path(parser.span) {
path.pop();
parser.directory.path = Cow::from(path);
}
@@ -652,10 +652,10 @@
// EOF, don't want to point at the following char, but rather the last token
self.prev_span
} else {
- self.sess.codemap().next_point(self.prev_span)
+ self.sess.source_map().next_point(self.prev_span)
};
let label_exp = format!("expected `{}`", token_str);
- let cm = self.sess.codemap();
+ let cm = self.sess.source_map();
match (cm.lookup_line(self.span.lo()), cm.lookup_line(sp.lo())) {
(Ok(ref a), Ok(ref b)) if a.line == b.line => {
// When the spans are in the same line, it means that the only content
@@ -720,14 +720,14 @@
expect.clone()
};
(format!("expected one of {}, found `{}`", expect, actual),
- (self.sess.codemap().next_point(self.prev_span),
+ (self.sess.source_map().next_point(self.prev_span),
format!("expected one of {} here", short_expect)))
} else if expected.is_empty() {
(format!("unexpected token: `{}`", actual),
(self.prev_span, "unexpected token after this".to_string()))
} else {
(format!("expected {}, found `{}`", expect, actual),
- (self.sess.codemap().next_point(self.prev_span),
+ (self.sess.source_map().next_point(self.prev_span),
format!("expected {} here", expect)))
};
let mut err = self.fatal(&msg_exp);
@@ -738,7 +738,7 @@
label_sp
};
- let cm = self.sess.codemap();
+ let cm = self.sess.source_map();
match (cm.lookup_line(self.span.lo()), cm.lookup_line(sp.lo())) {
(Ok(ref a), Ok(ref b)) if a.line == b.line => {
// When the spans are in the same line, it means that the only content between
@@ -825,7 +825,7 @@
///
/// This method will automatically add `tok` to `expected_tokens` if `tok` is not
/// encountered.
- fn check(&mut self, tok: &token::Token) -> bool {
+ crate fn check(&mut self, tok: &token::Token) -> bool {
let is_present = self.token == *tok;
if !is_present { self.expected_tokens.push(TokenType::Token(tok.clone())); }
is_present
@@ -1371,7 +1371,7 @@
let ident = self.parse_ident()?;
let mut generics = self.parse_generics()?;
- let d = self.parse_fn_decl_with_self(|p: &mut Parser<'a>|{
+ let d = self.parse_fn_decl_with_self(|p: &mut Parser<'a>| {
// This is somewhat dubious; We don't want to allow
// argument names to be left off if there is a
// definition...
@@ -1753,21 +1753,59 @@
(pat, self.parse_ty()?)
} else {
debug!("parse_arg_general ident_to_pat");
- let ident = Ident::new(keywords::Invalid.name(), self.prev_span);
- let ty = self.parse_ty()?;
- let pat = P(Pat {
- id: ast::DUMMY_NODE_ID,
- node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), ident, None),
- span: ty.span,
- });
- (pat, ty)
+
+ let parser_snapshot_before_pat = self.clone();
+
+ // We're going to try parsing the argument as a pattern (even though it's not
+ // allowed). This way we can provide better errors to the user.
+ let pat_arg: PResult<'a, _> = do catch {
+ let pat = self.parse_pat()?;
+ self.expect(&token::Colon)?;
+ (pat, self.parse_ty()?)
+ };
+
+ match pat_arg {
+ Ok((pat, ty)) => {
+ let mut err = self.diagnostic().struct_span_err_with_code(
+ pat.span,
+ "patterns aren't allowed in methods without bodies",
+ DiagnosticId::Error("E0642".into()),
+ );
+ err.span_suggestion_short_with_applicability(
+ pat.span,
+ "give this argument a name or use an underscore to ignore it",
+ "_".to_owned(),
+ Applicability::MachineApplicable,
+ );
+ err.emit();
+ // Pretend the pattern is `_`, to avoid duplicate errors from AST validation.
+ let pat = P(Pat {
+ node: PatKind::Wild,
+ span: pat.span,
+ id: ast::DUMMY_NODE_ID
+ });
+ (pat, ty)
+ }
+ Err(mut err) => {
+ err.cancel();
+ // Recover from attempting to parse the argument as a pattern. This means
+ // the type is alone, with no name, e.g. `fn foo(u32)`.
+ mem::replace(self, parser_snapshot_before_pat);
+ debug!("parse_arg_general ident_to_pat");
+ let ident = Ident::new(keywords::Invalid.name(), self.prev_span);
+ let ty = self.parse_ty()?;
+ let pat = P(Pat {
+ id: ast::DUMMY_NODE_ID,
+ node: PatKind::Ident(
+ BindingMode::ByValue(Mutability::Immutable), ident, None),
+ span: ty.span,
+ });
+ (pat, ty)
+ }
+ }
};
- Ok(Arg {
- ty,
- pat,
- id: ast::DUMMY_NODE_ID,
- })
+ Ok(Arg { ty, pat, id: ast::DUMMY_NODE_ID })
}
/// Parse a single function argument
@@ -1841,7 +1879,7 @@
let lit = self.parse_lit_token()?;
lit
};
- Ok(codemap::Spanned { node: lit, span: lo.to(self.prev_span) })
+ Ok(source_map::Spanned { node: lit, span: lo.to(self.prev_span) })
}
/// matches '-' lit | lit (cf. ast_validation::AstValidator::check_expr_within_pat)
@@ -2147,7 +2185,7 @@
pub fn mk_mac_expr(&mut self, span: Span, m: Mac_, attrs: ThinVec<Attribute>) -> P<Expr> {
P(Expr {
id: ast::DUMMY_NODE_ID,
- node: ExprKind::Mac(codemap::Spanned {node: m, span: span}),
+ node: ExprKind::Mac(source_map::Spanned {node: m, span: span}),
span,
attrs,
})
@@ -2864,7 +2902,7 @@
self.this_token_descr()));
// span the `not` plus trailing whitespace to avoid
// trailing whitespace after the `!` in our suggestion
- let to_replace = self.sess.codemap()
+ let to_replace = self.sess.source_map()
.span_until_non_whitespace(lo.to(self.span));
err.span_suggestion_short_with_applicability(
to_replace,
@@ -2962,7 +3000,7 @@
Err(mut err) => {
err.span_label(self.span,
"expecting a type here because of type ascription");
- let cm = self.sess.codemap();
+ let cm = self.sess.source_map();
let cur_pos = cm.lookup_char_pos(self.span.lo());
let op_pos = cm.lookup_char_pos(cur_op_span.hi());
if cur_pos.line != op_pos.line {
@@ -3036,7 +3074,7 @@
AssocOp::Equal | AssocOp::Less | AssocOp::LessEqual | AssocOp::NotEqual |
AssocOp::Greater | AssocOp::GreaterEqual => {
let ast_op = op.to_ast_binop().unwrap();
- let binary = self.mk_binary(codemap::respan(cur_op_span, ast_op), lhs, rhs);
+ let binary = self.mk_binary(source_map::respan(cur_op_span, ast_op), lhs, rhs);
self.mk_expr(span, binary, ThinVec::new())
}
AssocOp::Assign =>
@@ -3056,7 +3094,7 @@
token::Shl => BinOpKind::Shl,
token::Shr => BinOpKind::Shr,
};
- let aopexpr = self.mk_assign_op(codemap::respan(cur_op_span, aop), lhs, rhs);
+ let aopexpr = self.mk_assign_op(source_map::respan(cur_op_span, aop), lhs, rhs);
self.mk_expr(span, aopexpr, ThinVec::new())
}
AssocOp::As | AssocOp::Colon | AssocOp::DotDot | AssocOp::DotDotEq => {
@@ -3123,7 +3161,7 @@
id: ast::DUMMY_NODE_ID
}));
- let expr_str = self.sess.codemap().span_to_snippet(expr.span)
+ let expr_str = self.sess.source_map().span_to_snippet(expr.span)
.unwrap_or(pprust::expr_to_string(&expr));
err.span_suggestion_with_applicability(
expr.span,
@@ -3239,7 +3277,7 @@
// return. This won't catch blocks with an explicit `return`, but that would be caught by
// the dead code lint.
if self.eat_keyword(keywords::Else) || !cond.returns() {
- let sp = self.sess.codemap().next_point(lo);
+ let sp = self.sess.source_map().next_point(lo);
let mut err = self.diagnostic()
.struct_span_err(sp, "missing condition for `if` statemement");
err.span_label(sp, "expected if condition here");
@@ -3489,7 +3527,7 @@
&& self.token != token::CloseDelim(token::Brace);
if require_comma {
- let cm = self.sess.codemap();
+ let cm = self.sess.source_map();
self.expect_one_of(&[token::Comma], &[token::CloseDelim(token::Brace)])
.map_err(|mut err| {
match (cm.span_to_lines(expr.span), cm.span_to_lines(arm_start_span)) {
@@ -3698,7 +3736,7 @@
&mut self,
lo: Span,
attrs: Vec<Attribute>
- ) -> PResult<'a, codemap::Spanned<ast::FieldPat>> {
+ ) -> PResult<'a, source_map::Spanned<ast::FieldPat>> {
// Check if a colon exists one ahead. This means we're parsing a fieldname.
let hi;
let (subpat, fieldname, is_shorthand) = if self.look_ahead(1, |t| t == &token::Colon) {
@@ -3741,7 +3779,7 @@
(subpat, fieldname, true)
};
- Ok(codemap::Spanned {
+ Ok(source_map::Spanned {
span: lo.to(hi),
node: ast::FieldPat {
ident: fieldname,
@@ -3753,7 +3791,7 @@
}
/// Parse the fields of a struct-like pattern
- fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<codemap::Spanned<ast::FieldPat>>, bool)> {
+ fn parse_pat_fields(&mut self) -> PResult<'a, (Vec<source_map::Spanned<ast::FieldPat>>, bool)> {
let mut fields = Vec::new();
let mut etc = false;
let mut ate_comma = true;
@@ -3799,7 +3837,7 @@
err.span_label(self.span, "expected `}`");
let mut comma_sp = None;
if self.token == token::Comma { // Issue #49257
- etc_sp = etc_sp.to(self.sess.codemap().span_until_non_whitespace(self.span));
+ etc_sp = etc_sp.to(self.sess.source_map().span_until_non_whitespace(self.span));
err.span_label(etc_sp,
"`..` must be at the end and cannot have a trailing comma");
comma_sp = Some(self.span);
@@ -3917,7 +3955,7 @@
let seq_span = pat.span.to(self.prev_span);
let mut err = self.struct_span_err(comma_span,
"unexpected `,` in pattern");
- if let Ok(seq_snippet) = self.sess.codemap().span_to_snippet(seq_span) {
+ if let Ok(seq_snippet) = self.sess.source_map().span_to_snippet(seq_span) {
err.span_suggestion_with_applicability(
seq_span,
"try adding parentheses",
@@ -4182,7 +4220,7 @@
let parser_snapshot_after_type = self.clone();
mem::replace(self, parser_snapshot_before_type);
- let snippet = self.sess.codemap().span_to_snippet(pat.span).unwrap();
+ let snippet = self.sess.source_map().span_to_snippet(pat.span).unwrap();
err.span_label(pat.span, format!("while parsing the type for `{}`", snippet));
(Some((parser_snapshot_after_type, colon_sp, err)), None)
}
@@ -4480,7 +4518,7 @@
}
} else if let Some(macro_def) = self.eat_macro_def(
&attrs,
- &codemap::respan(lo, VisibilityKind::Inherited),
+ &source_map::respan(lo, VisibilityKind::Inherited),
lo,
)? {
Stmt {
@@ -4681,7 +4719,12 @@
if !self.eat(&token::OpenDelim(token::Brace)) {
let sp = self.span;
let tok = self.this_token_to_string();
+ let mut do_not_suggest_help = false;
let mut e = self.span_fatal(sp, &format!("expected `{{`, found `{}`", tok));
+ if self.token.is_keyword(keywords::In) || self.token == token::Colon {
+ do_not_suggest_help = true;
+ e.span_label(sp, "expected `{`");
+ }
// Check to see if the user has written something like
//
@@ -4691,7 +4734,8 @@
// Which is valid in other languages, but not Rust.
match self.parse_stmt_without_recovery(false) {
Ok(Some(stmt)) => {
- if self.look_ahead(1, |t| t == &token::OpenDelim(token::Brace)) {
+ if self.look_ahead(1, |t| t == &token::OpenDelim(token::Brace))
+ || do_not_suggest_help {
// if the next token is an open brace (e.g., `if a b {`), the place-
// inside-a-block suggestion would be more likely wrong than right
return Err(e);
@@ -5354,7 +5398,7 @@
_ => return Ok(None),
};
- let eself = codemap::respan(eself_lo.to(eself_hi), eself);
+ let eself = source_map::respan(eself_lo.to(eself_hi), eself);
Ok(Some(Arg::from_self(eself, eself_ident)))
}
@@ -5995,7 +6039,7 @@
err.emit();
} else {
if seen_comma == false {
- let sp = self.sess.codemap().next_point(previous_span);
+ let sp = self.sess.source_map().next_point(previous_span);
err.span_suggestion_with_applicability(
sp,
"missing comma here",
@@ -6007,7 +6051,7 @@
}
}
_ => {
- let sp = self.sess.codemap().next_point(self.prev_span);
+ let sp = self.sess.source_map().next_point(self.prev_span);
let mut err = self.struct_span_err(sp, &format!("expected `,`, or `}}`, found `{}`",
self.this_token_to_string()));
if self.token.is_ident() {
@@ -6278,7 +6322,7 @@
id: ast::Ident,
relative: Option<ast::Ident>,
dir_path: &Path,
- codemap: &CodeMap) -> ModulePath
+ source_map: &SourceMap) -> ModulePath
{
// If we're in a foo.rs file instead of a mod.rs file,
// we need to look for submodules in
@@ -6298,8 +6342,8 @@
relative_prefix, mod_name, path::MAIN_SEPARATOR);
let default_path = dir_path.join(&default_path_str);
let secondary_path = dir_path.join(&secondary_path_str);
- let default_exists = codemap.file_exists(&default_path);
- let secondary_exists = codemap.file_exists(&secondary_path);
+ let default_exists = source_map.file_exists(&default_path);
+ let secondary_exists = source_map.file_exists(&secondary_path);
let result = match (default_exists, secondary_exists) {
(true, false) => Ok(ModulePathSuccess {
@@ -6374,7 +6418,7 @@
DirectoryOwnership::UnownedViaMod(_) => None,
};
let paths = Parser::default_submod_path(
- id, relative, &self.directory.path, self.sess.codemap());
+ id, relative, &self.directory.path, self.sess.source_map());
match self.directory.ownership {
DirectoryOwnership::Owned { .. } => {
@@ -6401,7 +6445,7 @@
let mut err = self.diagnostic().struct_span_err(id_sp,
"cannot declare a new module at this location");
if !id_sp.is_dummy() {
- let src_path = self.sess.codemap().span_to_filename(id_sp);
+ let src_path = self.sess.source_map().span_to_filename(id_sp);
if let FileName::Real(src_path) = src_path {
if let Some(stem) = src_path.file_stem() {
let mut dest_path = src_path.clone();
@@ -7163,7 +7207,7 @@
sp, &suggestion, format!(" {} ", kw), Applicability::MachineApplicable
);
} else {
- if let Ok(snippet) = self.sess.codemap().span_to_snippet(ident_sp) {
+ if let Ok(snippet) = self.sess.source_map().span_to_snippet(ident_sp) {
err.span_suggestion_with_applicability(
full_sp,
"if you meant to call a macro, try",
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 54ce06f..3065e79 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -16,7 +16,7 @@
use ast::{Attribute, MacDelimiter, GenericArg};
use util::parser::{self, AssocOp, Fixity};
use attr;
-use codemap::{self, CodeMap, Spanned};
+use source_map::{self, SourceMap, Spanned};
use syntax_pos::{self, BytePos};
use syntax_pos::hygiene::{Mark, SyntaxContext};
use parse::token::{self, BinOpToken, Token};
@@ -57,7 +57,7 @@
pub struct State<'a> {
pub s: pp::Printer<'a>,
- cm: Option<&'a CodeMap>,
+ cm: Option<&'a SourceMap>,
comments: Option<Vec<comments::Comment> >,
literals: Peekable<vec::IntoIter<comments::Literal>>,
cur_cmnt: usize,
@@ -84,7 +84,7 @@
/// Requires you to pass an input filename and reader so that
/// it can scan the input text for comments and literals to
/// copy forward.
-pub fn print_crate<'a>(cm: &'a CodeMap,
+pub fn print_crate<'a>(cm: &'a SourceMap,
sess: &ParseSess,
krate: &ast::Crate,
filename: FileName,
@@ -118,7 +118,7 @@
}
impl<'a> State<'a> {
- pub fn new_from_input(cm: &'a CodeMap,
+ pub fn new_from_input(cm: &'a SourceMap,
sess: &ParseSess,
filename: FileName,
input: &mut dyn Read,
@@ -138,7 +138,7 @@
if is_expanded { None } else { Some(lits) })
}
- pub fn new(cm: &'a CodeMap,
+ pub fn new(cm: &'a SourceMap,
out: Box<dyn Write+'a>,
ann: &'a dyn PpAnn,
comments: Option<Vec<comments::Comment>>,
@@ -380,7 +380,7 @@
to_string(|s| {
s.head("")?;
s.print_fn(decl, header, Some(name),
- generics, &codemap::dummy_spanned(ast::VisibilityKind::Inherited))?;
+ generics, &source_map::dummy_spanned(ast::VisibilityKind::Inherited))?;
s.end()?; // Close the head box
s.end() // Close the outer box
})
@@ -1606,7 +1606,7 @@
ti.ident,
ty,
default.as_ref().map(|expr| &**expr),
- &codemap::respan(ti.span.shrink_to_lo(), ast::VisibilityKind::Inherited),
+ &source_map::respan(ti.span.shrink_to_lo(), ast::VisibilityKind::Inherited),
)?;
}
ast::TraitItemKind::Method(ref sig, ref body) => {
@@ -1617,7 +1617,7 @@
ti.ident,
&ti.generics,
sig,
- &codemap::respan(ti.span.shrink_to_lo(), ast::VisibilityKind::Inherited),
+ &source_map::respan(ti.span.shrink_to_lo(), ast::VisibilityKind::Inherited),
)?;
if let Some(ref body) = *body {
self.nbsp()?;
@@ -3085,7 +3085,7 @@
ast::FnHeader { unsafety, abi, ..ast::FnHeader::default() },
name,
&generics,
- &codemap::dummy_spanned(ast::VisibilityKind::Inherited))?;
+ &source_map::dummy_spanned(ast::VisibilityKind::Inherited))?;
self.end()
}
@@ -3185,7 +3185,7 @@
use super::*;
use ast;
- use codemap;
+ use source_map;
use syntax_pos;
use with_globals;
@@ -3205,7 +3205,7 @@
&decl,
ast::FnHeader {
unsafety: ast::Unsafety::Normal,
- constness: codemap::dummy_spanned(ast::Constness::NotConst),
+ constness: source_map::dummy_spanned(ast::Constness::NotConst),
asyncness: ast::IsAsync::NotAsync,
abi: Abi::Rust,
},
@@ -3222,7 +3222,7 @@
with_globals(|| {
let ident = ast::Ident::from_str("principal_skinner");
- let var = codemap::respan(syntax_pos::DUMMY_SP, ast::Variant_ {
+ let var = source_map::respan(syntax_pos::DUMMY_SP, ast::Variant_ {
ident,
attrs: Vec::new(),
// making this up as I go.... ?
diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs
new file mode 100644
index 0000000..c65931a
--- /dev/null
+++ b/src/libsyntax/source_map.rs
@@ -0,0 +1,1237 @@
+// Copyright 2012 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.
+
+//! The SourceMap tracks all the source code used within a single crate, mapping
+//! from integer byte positions to the original source code location. Each bit
+//! of source parsed during crate parsing (typically files, in-memory strings,
+//! or various bits of macro expansion) cover a continuous range of bytes in the
+//! SourceMap and are represented by SourceFiles. Byte positions are stored in
+//! `spans` and used pervasively in the compiler. They are absolute positions
+//! within the SourceMap, which upon request can be converted to line and column
+//! information, source code snippets, etc.
+
+
+pub use syntax_pos::*;
+pub use syntax_pos::hygiene::{ExpnFormat, ExpnInfo};
+pub use self::ExpnFormat::*;
+
+use rustc_data_structures::fx::FxHashMap;
+use rustc_data_structures::stable_hasher::StableHasher;
+use rustc_data_structures::sync::{Lrc, Lock, LockGuard};
+use std::cmp;
+use std::hash::Hash;
+use std::path::{Path, PathBuf};
+
+use std::env;
+use std::fs;
+use std::io::{self, Read};
+use errors::SourceMapper;
+
+/// Return the span itself if it doesn't come from a macro expansion,
+/// otherwise return the call site span up to the `enclosing_sp` by
+/// following the `expn_info` chain.
+pub fn original_sp(sp: Span, enclosing_sp: Span) -> Span {
+ let call_site1 = sp.ctxt().outer().expn_info().map(|ei| ei.call_site);
+ let call_site2 = enclosing_sp.ctxt().outer().expn_info().map(|ei| ei.call_site);
+ match (call_site1, call_site2) {
+ (None, _) => sp,
+ (Some(call_site1), Some(call_site2)) if call_site1 == call_site2 => sp,
+ (Some(call_site1), _) => original_sp(call_site1, enclosing_sp),
+ }
+}
+
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
+pub struct Spanned<T> {
+ pub node: T,
+ pub span: Span,
+}
+
+pub fn respan<T>(sp: Span, t: T) -> Spanned<T> {
+ Spanned {node: t, span: sp}
+}
+
+pub fn dummy_spanned<T>(t: T) -> Spanned<T> {
+ respan(DUMMY_SP, t)
+}
+
+// _____________________________________________________________________________
+// SourceFile, MultiByteChar, FileName, FileLines
+//
+
+/// An abstraction over the fs operations used by the Parser.
+pub trait FileLoader {
+ /// Query the existence of a file.
+ fn file_exists(&self, path: &Path) -> bool;
+
+ /// Return an absolute path to a file, if possible.
+ fn abs_path(&self, path: &Path) -> Option<PathBuf>;
+
+ /// Read the contents of an UTF-8 file into memory.
+ fn read_file(&self, path: &Path) -> io::Result<String>;
+}
+
+/// A FileLoader that uses std::fs to load real files.
+pub struct RealFileLoader;
+
+impl FileLoader for RealFileLoader {
+ fn file_exists(&self, path: &Path) -> bool {
+ fs::metadata(path).is_ok()
+ }
+
+ fn abs_path(&self, path: &Path) -> Option<PathBuf> {
+ if path.is_absolute() {
+ Some(path.to_path_buf())
+ } else {
+ env::current_dir()
+ .ok()
+ .map(|cwd| cwd.join(path))
+ }
+ }
+
+ fn read_file(&self, path: &Path) -> io::Result<String> {
+ let mut src = String::new();
+ fs::File::open(path)?.read_to_string(&mut src)?;
+ Ok(src)
+ }
+}
+
+// This is a SourceFile identifier that is used to correlate SourceFiles between
+// subsequent compilation sessions (which is something we need to do during
+// incremental compilation).
+#[derive(Copy, Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Debug)]
+pub struct StableFilemapId(u128);
+
+impl StableFilemapId {
+ pub fn new(source_file: &SourceFile) -> StableFilemapId {
+ let mut hasher = StableHasher::new();
+
+ source_file.name.hash(&mut hasher);
+ source_file.name_was_remapped.hash(&mut hasher);
+ source_file.unmapped_path.hash(&mut hasher);
+
+ StableFilemapId(hasher.finish())
+ }
+}
+
+// _____________________________________________________________________________
+// SourceMap
+//
+
+pub(super) struct SourceMapFiles {
+ pub(super) file_maps: Vec<Lrc<SourceFile>>,
+ stable_id_to_source_file: FxHashMap<StableFilemapId, Lrc<SourceFile>>
+}
+
+pub struct SourceMap {
+ pub(super) files: Lock<SourceMapFiles>,
+ file_loader: Box<dyn FileLoader + Sync + Send>,
+ // This is used to apply the file path remapping as specified via
+ // --remap-path-prefix to all SourceFiles allocated within this SourceMap.
+ path_mapping: FilePathMapping,
+ /// In case we are in a doctest, replace all file names with the PathBuf,
+ /// and add the given offsets to the line info
+ doctest_offset: Option<(FileName, isize)>,
+}
+
+impl SourceMap {
+ pub fn new(path_mapping: FilePathMapping) -> SourceMap {
+ SourceMap {
+ files: Lock::new(SourceMapFiles {
+ file_maps: Vec::new(),
+ stable_id_to_source_file: FxHashMap(),
+ }),
+ file_loader: Box::new(RealFileLoader),
+ path_mapping,
+ doctest_offset: None,
+ }
+ }
+
+ pub fn new_doctest(path_mapping: FilePathMapping,
+ file: FileName, line: isize) -> SourceMap {
+ SourceMap {
+ doctest_offset: Some((file, line)),
+ ..SourceMap::new(path_mapping)
+ }
+
+ }
+
+ pub fn with_file_loader(file_loader: Box<dyn FileLoader + Sync + Send>,
+ path_mapping: FilePathMapping)
+ -> SourceMap {
+ SourceMap {
+ files: Lock::new(SourceMapFiles {
+ file_maps: Vec::new(),
+ stable_id_to_source_file: FxHashMap(),
+ }),
+ file_loader: file_loader,
+ path_mapping,
+ doctest_offset: None,
+ }
+ }
+
+ pub fn path_mapping(&self) -> &FilePathMapping {
+ &self.path_mapping
+ }
+
+ pub fn file_exists(&self, path: &Path) -> bool {
+ self.file_loader.file_exists(path)
+ }
+
+ pub fn load_file(&self, path: &Path) -> io::Result<Lrc<SourceFile>> {
+ let src = self.file_loader.read_file(path)?;
+ let filename = if let Some((ref name, _)) = self.doctest_offset {
+ name.clone()
+ } else {
+ path.to_owned().into()
+ };
+ Ok(self.new_source_file(filename, src))
+ }
+
+ pub fn files(&self) -> LockGuard<Vec<Lrc<SourceFile>>> {
+ LockGuard::map(self.files.borrow(), |files| &mut files.file_maps)
+ }
+
+ pub fn source_file_by_stable_id(&self, stable_id: StableFilemapId) -> Option<Lrc<SourceFile>> {
+ self.files.borrow().stable_id_to_source_file.get(&stable_id).map(|fm| fm.clone())
+ }
+
+ fn next_start_pos(&self) -> usize {
+ match self.files.borrow().file_maps.last() {
+ None => 0,
+ // Add one so there is some space between files. This lets us distinguish
+ // positions in the source_map, even in the presence of zero-length files.
+ Some(last) => last.end_pos.to_usize() + 1,
+ }
+ }
+
+ /// Creates a new source_file.
+ /// This does not ensure that only one SourceFile exists per file name.
+ pub fn new_source_file(&self, filename: FileName, src: String) -> Lrc<SourceFile> {
+ let start_pos = self.next_start_pos();
+
+ // The path is used to determine the directory for loading submodules and
+ // include files, so it must be before remapping.
+ // Note that filename may not be a valid path, eg it may be `<anon>` etc,
+ // but this is okay because the directory determined by `path.pop()` will
+ // be empty, so the working directory will be used.
+ let unmapped_path = filename.clone();
+
+ let (filename, was_remapped) = match filename {
+ FileName::Real(filename) => {
+ let (filename, was_remapped) = self.path_mapping.map_prefix(filename);
+ (FileName::Real(filename), was_remapped)
+ },
+ other => (other, false),
+ };
+ let source_file = Lrc::new(SourceFile::new(
+ filename,
+ was_remapped,
+ unmapped_path,
+ src,
+ Pos::from_usize(start_pos),
+ ));
+
+ let mut files = self.files.borrow_mut();
+
+ files.file_maps.push(source_file.clone());
+ files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
+ source_file.clone());
+
+ source_file
+ }
+
+ /// Allocates a new SourceFile representing a source file from an external
+ /// crate. The source code of such an "imported source_file" is not available,
+ /// but we still know enough to generate accurate debuginfo location
+ /// information for things inlined from other crates.
+ pub fn new_imported_source_file(&self,
+ filename: FileName,
+ name_was_remapped: bool,
+ crate_of_origin: u32,
+ src_hash: u128,
+ name_hash: u128,
+ source_len: usize,
+ mut file_local_lines: Vec<BytePos>,
+ mut file_local_multibyte_chars: Vec<MultiByteChar>,
+ mut file_local_non_narrow_chars: Vec<NonNarrowChar>)
+ -> Lrc<SourceFile> {
+ let start_pos = self.next_start_pos();
+
+ let end_pos = Pos::from_usize(start_pos + source_len);
+ let start_pos = Pos::from_usize(start_pos);
+
+ for pos in &mut file_local_lines {
+ *pos = *pos + start_pos;
+ }
+
+ for mbc in &mut file_local_multibyte_chars {
+ mbc.pos = mbc.pos + start_pos;
+ }
+
+ for swc in &mut file_local_non_narrow_chars {
+ *swc = *swc + start_pos;
+ }
+
+ let source_file = Lrc::new(SourceFile {
+ name: filename,
+ name_was_remapped,
+ unmapped_path: None,
+ crate_of_origin,
+ src: None,
+ src_hash,
+ external_src: Lock::new(ExternalSource::AbsentOk),
+ start_pos,
+ end_pos,
+ lines: file_local_lines,
+ multibyte_chars: file_local_multibyte_chars,
+ non_narrow_chars: file_local_non_narrow_chars,
+ name_hash,
+ });
+
+ let mut files = self.files.borrow_mut();
+
+ files.file_maps.push(source_file.clone());
+ files.stable_id_to_source_file.insert(StableFilemapId::new(&source_file),
+ source_file.clone());
+
+ source_file
+ }
+
+ pub fn mk_substr_filename(&self, sp: Span) -> String {
+ let pos = self.lookup_char_pos(sp.lo());
+ format!("<{}:{}:{}>",
+ pos.file.name,
+ pos.line,
+ pos.col.to_usize() + 1)
+ }
+
+ // If there is a doctest_offset, apply it to the line
+ pub fn doctest_offset_line(&self, mut orig: usize) -> usize {
+ if let Some((_, line)) = self.doctest_offset {
+ if line >= 0 {
+ orig = orig + line as usize;
+ } else {
+ orig = orig - (-line) as usize;
+ }
+ }
+ orig
+ }
+
+ /// Lookup source information about a BytePos
+ pub fn lookup_char_pos(&self, pos: BytePos) -> Loc {
+ let chpos = self.bytepos_to_file_charpos(pos);
+ match self.lookup_line(pos) {
+ Ok(SourceFileAndLine { fm: f, line: a }) => {
+ let line = a + 1; // Line numbers start at 1
+ let linebpos = f.lines[a];
+ let linechpos = self.bytepos_to_file_charpos(linebpos);
+ let col = chpos - linechpos;
+
+ let col_display = {
+ let start_width_idx = f
+ .non_narrow_chars
+ .binary_search_by_key(&linebpos, |x| x.pos())
+ .unwrap_or_else(|x| x);
+ let end_width_idx = f
+ .non_narrow_chars
+ .binary_search_by_key(&pos, |x| x.pos())
+ .unwrap_or_else(|x| x);
+ let special_chars = end_width_idx - start_width_idx;
+ let non_narrow: usize = f
+ .non_narrow_chars[start_width_idx..end_width_idx]
+ .into_iter()
+ .map(|x| x.width())
+ .sum();
+ col.0 - special_chars + non_narrow
+ };
+ debug!("byte pos {:?} is on the line at byte pos {:?}",
+ pos, linebpos);
+ debug!("char pos {:?} is on the line at char pos {:?}",
+ chpos, linechpos);
+ debug!("byte is on line: {}", line);
+ assert!(chpos >= linechpos);
+ Loc {
+ file: f,
+ line,
+ col,
+ col_display,
+ }
+ }
+ Err(f) => {
+ let col_display = {
+ let end_width_idx = f
+ .non_narrow_chars
+ .binary_search_by_key(&pos, |x| x.pos())
+ .unwrap_or_else(|x| x);
+ let non_narrow: usize = f
+ .non_narrow_chars[0..end_width_idx]
+ .into_iter()
+ .map(|x| x.width())
+ .sum();
+ chpos.0 - end_width_idx + non_narrow
+ };
+ Loc {
+ file: f,
+ line: 0,
+ col: chpos,
+ col_display,
+ }
+ }
+ }
+ }
+
+ // If the relevant source_file is empty, we don't return a line number.
+ pub fn lookup_line(&self, pos: BytePos) -> Result<SourceFileAndLine, Lrc<SourceFile>> {
+ let idx = self.lookup_source_file_idx(pos);
+
+ let f = (*self.files.borrow().file_maps)[idx].clone();
+
+ match f.lookup_line(pos) {
+ Some(line) => Ok(SourceFileAndLine { fm: f, line: line }),
+ None => Err(f)
+ }
+ }
+
+ pub fn lookup_char_pos_adj(&self, pos: BytePos) -> LocWithOpt {
+ let loc = self.lookup_char_pos(pos);
+ LocWithOpt {
+ filename: loc.file.name.clone(),
+ line: loc.line,
+ col: loc.col,
+ file: Some(loc.file)
+ }
+ }
+
+ /// Returns `Some(span)`, a union of the lhs and rhs span. The lhs must precede the rhs. If
+ /// there are gaps between lhs and rhs, the resulting union will cross these gaps.
+ /// For this to work, the spans have to be:
+ ///
+ /// * the ctxt of both spans much match
+ /// * the lhs span needs to end on the same line the rhs span begins
+ /// * the lhs span must start at or before the rhs span
+ pub fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
+ // make sure we're at the same expansion id
+ if sp_lhs.ctxt() != sp_rhs.ctxt() {
+ return None;
+ }
+
+ let lhs_end = match self.lookup_line(sp_lhs.hi()) {
+ Ok(x) => x,
+ Err(_) => return None
+ };
+ let rhs_begin = match self.lookup_line(sp_rhs.lo()) {
+ Ok(x) => x,
+ Err(_) => return None
+ };
+
+ // if we must cross lines to merge, don't merge
+ if lhs_end.line != rhs_begin.line {
+ return None;
+ }
+
+ // ensure these follow the expected order and we don't overlap
+ if (sp_lhs.lo() <= sp_rhs.lo()) && (sp_lhs.hi() <= sp_rhs.lo()) {
+ Some(sp_lhs.to(sp_rhs))
+ } else {
+ None
+ }
+ }
+
+ pub fn span_to_string(&self, sp: Span) -> String {
+ if self.files.borrow().file_maps.is_empty() && sp.is_dummy() {
+ return "no-location".to_string();
+ }
+
+ let lo = self.lookup_char_pos_adj(sp.lo());
+ let hi = self.lookup_char_pos_adj(sp.hi());
+ format!("{}:{}:{}: {}:{}",
+ lo.filename,
+ lo.line,
+ lo.col.to_usize() + 1,
+ hi.line,
+ hi.col.to_usize() + 1)
+ }
+
+ pub fn span_to_filename(&self, sp: Span) -> FileName {
+ self.lookup_char_pos(sp.lo()).file.name.clone()
+ }
+
+ pub fn span_to_unmapped_path(&self, sp: Span) -> FileName {
+ self.lookup_char_pos(sp.lo()).file.unmapped_path.clone()
+ .expect("SourceMap::span_to_unmapped_path called for imported SourceFile?")
+ }
+
+ pub fn is_multiline(&self, sp: Span) -> bool {
+ let lo = self.lookup_char_pos(sp.lo());
+ let hi = self.lookup_char_pos(sp.hi());
+ lo.line != hi.line
+ }
+
+ pub fn span_to_lines(&self, sp: Span) -> FileLinesResult {
+ debug!("span_to_lines(sp={:?})", sp);
+
+ if sp.lo() > sp.hi() {
+ return Err(SpanLinesError::IllFormedSpan(sp));
+ }
+
+ let lo = self.lookup_char_pos(sp.lo());
+ debug!("span_to_lines: lo={:?}", lo);
+ let hi = self.lookup_char_pos(sp.hi());
+ debug!("span_to_lines: hi={:?}", hi);
+
+ if lo.file.start_pos != hi.file.start_pos {
+ return Err(SpanLinesError::DistinctSources(DistinctSources {
+ begin: (lo.file.name.clone(), lo.file.start_pos),
+ end: (hi.file.name.clone(), hi.file.start_pos),
+ }));
+ }
+ assert!(hi.line >= lo.line);
+
+ let mut lines = Vec::with_capacity(hi.line - lo.line + 1);
+
+ // The span starts partway through the first line,
+ // but after that it starts from offset 0.
+ let mut start_col = lo.col;
+
+ // For every line but the last, it extends from `start_col`
+ // and to the end of the line. Be careful because the line
+ // numbers in Loc are 1-based, so we subtract 1 to get 0-based
+ // lines.
+ for line_index in lo.line-1 .. hi.line-1 {
+ let line_len = lo.file.get_line(line_index)
+ .map(|s| s.chars().count())
+ .unwrap_or(0);
+ lines.push(LineInfo { line_index,
+ start_col,
+ end_col: CharPos::from_usize(line_len) });
+ start_col = CharPos::from_usize(0);
+ }
+
+ // For the last line, it extends from `start_col` to `hi.col`:
+ lines.push(LineInfo { line_index: hi.line - 1,
+ start_col,
+ end_col: hi.col });
+
+ Ok(FileLines {file: lo.file, lines: lines})
+ }
+
+ /// Extract the source surrounding the given `Span` using the `extract_source` function. The
+ /// extract function takes three arguments: a string slice containing the source, an index in
+ /// the slice for the beginning of the span and an index in the slice for the end of the span.
+ fn span_to_source<F>(&self, sp: Span, extract_source: F) -> Result<String, SpanSnippetError>
+ where F: Fn(&str, usize, usize) -> String
+ {
+ if sp.lo() > sp.hi() {
+ return Err(SpanSnippetError::IllFormedSpan(sp));
+ }
+
+ let local_begin = self.lookup_byte_offset(sp.lo());
+ let local_end = self.lookup_byte_offset(sp.hi());
+
+ if local_begin.fm.start_pos != local_end.fm.start_pos {
+ return Err(SpanSnippetError::DistinctSources(DistinctSources {
+ begin: (local_begin.fm.name.clone(),
+ local_begin.fm.start_pos),
+ end: (local_end.fm.name.clone(),
+ local_end.fm.start_pos)
+ }));
+ } else {
+ self.ensure_source_file_source_present(local_begin.fm.clone());
+
+ let start_index = local_begin.pos.to_usize();
+ let end_index = local_end.pos.to_usize();
+ let source_len = (local_begin.fm.end_pos -
+ local_begin.fm.start_pos).to_usize();
+
+ if start_index > end_index || end_index > source_len {
+ return Err(SpanSnippetError::MalformedForCodemap(
+ MalformedCodemapPositions {
+ name: local_begin.fm.name.clone(),
+ source_len,
+ begin_pos: local_begin.pos,
+ end_pos: local_end.pos,
+ }));
+ }
+
+ if let Some(ref src) = local_begin.fm.src {
+ return Ok(extract_source(src, start_index, end_index));
+ } else if let Some(src) = local_begin.fm.external_src.borrow().get_source() {
+ return Ok(extract_source(src, start_index, end_index));
+ } else {
+ return Err(SpanSnippetError::SourceNotAvailable {
+ filename: local_begin.fm.name.clone()
+ });
+ }
+ }
+ }
+
+ /// Return the source snippet as `String` corresponding to the given `Span`
+ pub fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError> {
+ self.span_to_source(sp, |src, start_index, end_index| src[start_index..end_index]
+ .to_string())
+ }
+
+ /// Return the source snippet as `String` before the given `Span`
+ pub fn span_to_prev_source(&self, sp: Span) -> Result<String, SpanSnippetError> {
+ self.span_to_source(sp, |src, start_index, _| src[..start_index].to_string())
+ }
+
+ /// Extend the given `Span` to just after the previous occurrence of `c`. Return the same span
+ /// if no character could be found or if an error occurred while retrieving the code snippet.
+ pub fn span_extend_to_prev_char(&self, sp: Span, c: char) -> Span {
+ if let Ok(prev_source) = self.span_to_prev_source(sp) {
+ let prev_source = prev_source.rsplit(c).nth(0).unwrap_or("").trim_left();
+ if !prev_source.is_empty() && !prev_source.contains('\n') {
+ return sp.with_lo(BytePos(sp.lo().0 - prev_source.len() as u32));
+ }
+ }
+
+ sp
+ }
+
+ /// Extend the given `Span` to just after the previous occurrence of `pat` when surrounded by
+ /// whitespace. Return the same span if no character could be found or if an error occurred
+ /// while retrieving the code snippet.
+ pub fn span_extend_to_prev_str(&self, sp: Span, pat: &str, accept_newlines: bool) -> Span {
+ // assure that the pattern is delimited, to avoid the following
+ // fn my_fn()
+ // ^^^^ returned span without the check
+ // ---------- correct span
+ for ws in &[" ", "\t", "\n"] {
+ let pat = pat.to_owned() + ws;
+ if let Ok(prev_source) = self.span_to_prev_source(sp) {
+ let prev_source = prev_source.rsplit(&pat).nth(0).unwrap_or("").trim_left();
+ if !prev_source.is_empty() && (!prev_source.contains('\n') || accept_newlines) {
+ return sp.with_lo(BytePos(sp.lo().0 - prev_source.len() as u32));
+ }
+ }
+ }
+
+ sp
+ }
+
+ /// Given a `Span`, try to get a shorter span ending before the first occurrence of `c` `char`
+ pub fn span_until_char(&self, sp: Span, c: char) -> Span {
+ match self.span_to_snippet(sp) {
+ Ok(snippet) => {
+ let snippet = snippet.split(c).nth(0).unwrap_or("").trim_right();
+ if !snippet.is_empty() && !snippet.contains('\n') {
+ sp.with_hi(BytePos(sp.lo().0 + snippet.len() as u32))
+ } else {
+ sp
+ }
+ }
+ _ => sp,
+ }
+ }
+
+ /// Given a `Span`, try to get a shorter span ending just after the first occurrence of `char`
+ /// `c`.
+ pub fn span_through_char(&self, sp: Span, c: char) -> Span {
+ if let Ok(snippet) = self.span_to_snippet(sp) {
+ if let Some(offset) = snippet.find(c) {
+ return sp.with_hi(BytePos(sp.lo().0 + (offset + c.len_utf8()) as u32));
+ }
+ }
+ sp
+ }
+
+ /// Given a `Span`, get a new `Span` covering the first token and all its trailing whitespace or
+ /// the original `Span`.
+ ///
+ /// If `sp` points to `"let mut x"`, then a span pointing at `"let "` will be returned.
+ pub fn span_until_non_whitespace(&self, sp: Span) -> Span {
+ let mut whitespace_found = false;
+
+ self.span_take_while(sp, |c| {
+ if !whitespace_found && c.is_whitespace() {
+ whitespace_found = true;
+ }
+
+ if whitespace_found && !c.is_whitespace() {
+ false
+ } else {
+ true
+ }
+ })
+ }
+
+ /// Given a `Span`, get a new `Span` covering the first token without its trailing whitespace or
+ /// the original `Span` in case of error.
+ ///
+ /// If `sp` points to `"let mut x"`, then a span pointing at `"let"` will be returned.
+ pub fn span_until_whitespace(&self, sp: Span) -> Span {
+ self.span_take_while(sp, |c| !c.is_whitespace())
+ }
+
+ /// Given a `Span`, get a shorter one until `predicate` yields false.
+ pub fn span_take_while<P>(&self, sp: Span, predicate: P) -> Span
+ where P: for <'r> FnMut(&'r char) -> bool
+ {
+ if let Ok(snippet) = self.span_to_snippet(sp) {
+ let offset = snippet.chars()
+ .take_while(predicate)
+ .map(|c| c.len_utf8())
+ .sum::<usize>();
+
+ sp.with_hi(BytePos(sp.lo().0 + (offset as u32)))
+ } else {
+ sp
+ }
+ }
+
+ pub fn def_span(&self, sp: Span) -> Span {
+ self.span_until_char(sp, '{')
+ }
+
+ /// Returns a new span representing just the start-point of this span
+ pub fn start_point(&self, sp: Span) -> Span {
+ let pos = sp.lo().0;
+ let width = self.find_width_of_character_at_span(sp, false);
+ let corrected_start_position = pos.checked_add(width).unwrap_or(pos);
+ let end_point = BytePos(cmp::max(corrected_start_position, sp.lo().0));
+ sp.with_hi(end_point)
+ }
+
+ /// Returns a new span representing just the end-point of this span
+ pub fn end_point(&self, sp: Span) -> Span {
+ let pos = sp.hi().0;
+
+ let width = self.find_width_of_character_at_span(sp, false);
+ let corrected_end_position = pos.checked_sub(width).unwrap_or(pos);
+
+ let end_point = BytePos(cmp::max(corrected_end_position, sp.lo().0));
+ sp.with_lo(end_point)
+ }
+
+ /// Returns a new span representing the next character after the end-point of this span
+ pub fn next_point(&self, sp: Span) -> Span {
+ let start_of_next_point = sp.hi().0;
+
+ let width = self.find_width_of_character_at_span(sp, true);
+ // If the width is 1, then the next span should point to the same `lo` and `hi`. However,
+ // in the case of a multibyte character, where the width != 1, the next span should
+ // span multiple bytes to include the whole character.
+ let end_of_next_point = start_of_next_point.checked_add(
+ width - 1).unwrap_or(start_of_next_point);
+
+ let end_of_next_point = BytePos(cmp::max(sp.lo().0 + 1, end_of_next_point));
+ Span::new(BytePos(start_of_next_point), end_of_next_point, sp.ctxt())
+ }
+
+ /// Finds the width of a character, either before or after the provided span.
+ fn find_width_of_character_at_span(&self, sp: Span, forwards: bool) -> u32 {
+ // Disregard malformed spans and assume a one-byte wide character.
+ if sp.lo() >= sp.hi() {
+ debug!("find_width_of_character_at_span: early return malformed span");
+ return 1;
+ }
+
+ let local_begin = self.lookup_byte_offset(sp.lo());
+ let local_end = self.lookup_byte_offset(sp.hi());
+ debug!("find_width_of_character_at_span: local_begin=`{:?}`, local_end=`{:?}`",
+ local_begin, local_end);
+
+ let start_index = local_begin.pos.to_usize();
+ let end_index = local_end.pos.to_usize();
+ debug!("find_width_of_character_at_span: start_index=`{:?}`, end_index=`{:?}`",
+ start_index, end_index);
+
+ // Disregard indexes that are at the start or end of their spans, they can't fit bigger
+ // characters.
+ if (!forwards && end_index == usize::min_value()) ||
+ (forwards && start_index == usize::max_value()) {
+ debug!("find_width_of_character_at_span: start or end of span, cannot be multibyte");
+ return 1;
+ }
+
+ let source_len = (local_begin.fm.end_pos - local_begin.fm.start_pos).to_usize();
+ debug!("find_width_of_character_at_span: source_len=`{:?}`", source_len);
+ // Ensure indexes are also not malformed.
+ if start_index > end_index || end_index > source_len {
+ debug!("find_width_of_character_at_span: source indexes are malformed");
+ return 1;
+ }
+
+ let src = local_begin.fm.external_src.borrow();
+
+ // We need to extend the snippet to the end of the src rather than to end_index so when
+ // searching forwards for boundaries we've got somewhere to search.
+ let snippet = if let Some(ref src) = local_begin.fm.src {
+ let len = src.len();
+ (&src[start_index..len])
+ } else if let Some(src) = src.get_source() {
+ let len = src.len();
+ (&src[start_index..len])
+ } else {
+ return 1;
+ };
+ debug!("find_width_of_character_at_span: snippet=`{:?}`", snippet);
+
+ let mut target = if forwards { end_index + 1 } else { end_index - 1 };
+ debug!("find_width_of_character_at_span: initial target=`{:?}`", target);
+
+ while !snippet.is_char_boundary(target - start_index) && target < source_len {
+ target = if forwards {
+ target + 1
+ } else {
+ match target.checked_sub(1) {
+ Some(target) => target,
+ None => {
+ break;
+ }
+ }
+ };
+ debug!("find_width_of_character_at_span: target=`{:?}`", target);
+ }
+ debug!("find_width_of_character_at_span: final target=`{:?}`", target);
+
+ if forwards {
+ (target - end_index) as u32
+ } else {
+ (end_index - target) as u32
+ }
+ }
+
+ pub fn get_source_file(&self, filename: &FileName) -> Option<Lrc<SourceFile>> {
+ for fm in self.files.borrow().file_maps.iter() {
+ if *filename == fm.name {
+ return Some(fm.clone());
+ }
+ }
+ None
+ }
+
+ /// For a global BytePos compute the local offset within the containing SourceFile
+ pub fn lookup_byte_offset(&self, bpos: BytePos) -> SourceFileAndBytePos {
+ let idx = self.lookup_source_file_idx(bpos);
+ let fm = (*self.files.borrow().file_maps)[idx].clone();
+ let offset = bpos - fm.start_pos;
+ SourceFileAndBytePos {fm: fm, pos: offset}
+ }
+
+ /// Converts an absolute BytePos to a CharPos relative to the source_file.
+ pub fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos {
+ let idx = self.lookup_source_file_idx(bpos);
+ let map = &(*self.files.borrow().file_maps)[idx];
+
+ // The number of extra bytes due to multibyte chars in the SourceFile
+ let mut total_extra_bytes = 0;
+
+ for mbc in map.multibyte_chars.iter() {
+ debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos);
+ if mbc.pos < bpos {
+ // every character is at least one byte, so we only
+ // count the actual extra bytes.
+ total_extra_bytes += mbc.bytes as u32 - 1;
+ // We should never see a byte position in the middle of a
+ // character
+ assert!(bpos.to_u32() >= mbc.pos.to_u32() + mbc.bytes as u32);
+ } else {
+ break;
+ }
+ }
+
+ assert!(map.start_pos.to_u32() + total_extra_bytes <= bpos.to_u32());
+ CharPos(bpos.to_usize() - map.start_pos.to_usize() - total_extra_bytes as usize)
+ }
+
+ // Return the index of the source_file (in self.files) which contains pos.
+ pub fn lookup_source_file_idx(&self, pos: BytePos) -> usize {
+ let files = self.files.borrow();
+ let files = &files.file_maps;
+ let count = files.len();
+
+ // Binary search for the source_file.
+ let mut a = 0;
+ let mut b = count;
+ while b - a > 1 {
+ let m = (a + b) / 2;
+ if files[m].start_pos > pos {
+ b = m;
+ } else {
+ a = m;
+ }
+ }
+
+ assert!(a < count, "position {} does not resolve to a source location", pos.to_usize());
+
+ return a;
+ }
+
+ pub fn count_lines(&self) -> usize {
+ self.files().iter().fold(0, |a, f| a + f.count_lines())
+ }
+
+
+ pub fn generate_fn_name_span(&self, span: Span) -> Option<Span> {
+ let prev_span = self.span_extend_to_prev_str(span, "fn", true);
+ self.span_to_snippet(prev_span).map(|snippet| {
+ let len = snippet.find(|c: char| !c.is_alphanumeric() && c != '_')
+ .expect("no label after fn");
+ prev_span.with_hi(BytePos(prev_span.lo().0 + len as u32))
+ }).ok()
+ }
+
+ /// Take the span of a type parameter in a function signature and try to generate a span for the
+ /// function name (with generics) and a new snippet for this span with the pointed type
+ /// parameter as a new local type parameter.
+ ///
+ /// For instance:
+ /// ```rust,ignore (pseudo-Rust)
+ /// // Given span
+ /// fn my_function(param: T)
+ /// // ^ Original span
+ ///
+ /// // Result
+ /// fn my_function(param: T)
+ /// // ^^^^^^^^^^^ Generated span with snippet `my_function<T>`
+ /// ```
+ ///
+ /// Attention: The method used is very fragile since it essentially duplicates the work of the
+ /// parser. If you need to use this function or something similar, please consider updating the
+ /// source_map functions and this function to something more robust.
+ pub fn generate_local_type_param_snippet(&self, span: Span) -> Option<(Span, String)> {
+ // Try to extend the span to the previous "fn" keyword to retrieve the function
+ // signature
+ let sugg_span = self.span_extend_to_prev_str(span, "fn", false);
+ if sugg_span != span {
+ if let Ok(snippet) = self.span_to_snippet(sugg_span) {
+ // Consume the function name
+ let mut offset = snippet.find(|c: char| !c.is_alphanumeric() && c != '_')
+ .expect("no label after fn");
+
+ // Consume the generics part of the function signature
+ let mut bracket_counter = 0;
+ let mut last_char = None;
+ for c in snippet[offset..].chars() {
+ match c {
+ '<' => bracket_counter += 1,
+ '>' => bracket_counter -= 1,
+ '(' => if bracket_counter == 0 { break; }
+ _ => {}
+ }
+ offset += c.len_utf8();
+ last_char = Some(c);
+ }
+
+ // Adjust the suggestion span to encompass the function name with its generics
+ let sugg_span = sugg_span.with_hi(BytePos(sugg_span.lo().0 + offset as u32));
+
+ // Prepare the new suggested snippet to append the type parameter that triggered
+ // the error in the generics of the function signature
+ let mut new_snippet = if last_char == Some('>') {
+ format!("{}, ", &snippet[..(offset - '>'.len_utf8())])
+ } else {
+ format!("{}<", &snippet[..offset])
+ };
+ new_snippet.push_str(&self.span_to_snippet(span).unwrap_or("T".to_string()));
+ new_snippet.push('>');
+
+ return Some((sugg_span, new_snippet));
+ }
+ }
+
+ None
+ }
+}
+
+impl SourceMapper for SourceMap {
+ fn lookup_char_pos(&self, pos: BytePos) -> Loc {
+ self.lookup_char_pos(pos)
+ }
+ fn span_to_lines(&self, sp: Span) -> FileLinesResult {
+ self.span_to_lines(sp)
+ }
+ fn span_to_string(&self, sp: Span) -> String {
+ self.span_to_string(sp)
+ }
+ fn span_to_filename(&self, sp: Span) -> FileName {
+ self.span_to_filename(sp)
+ }
+ fn merge_spans(&self, sp_lhs: Span, sp_rhs: Span) -> Option<Span> {
+ self.merge_spans(sp_lhs, sp_rhs)
+ }
+ fn call_span_if_macro(&self, sp: Span) -> Span {
+ if self.span_to_filename(sp.clone()).is_macros() {
+ let v = sp.macro_backtrace();
+ if let Some(use_site) = v.last() {
+ return use_site.call_site;
+ }
+ }
+ sp
+ }
+ fn ensure_source_file_source_present(&self, file_map: Lrc<SourceFile>) -> bool {
+ file_map.add_external_src(
+ || match file_map.name {
+ FileName::Real(ref name) => self.file_loader.read_file(name).ok(),
+ _ => None,
+ }
+ )
+ }
+ fn doctest_offset_line(&self, line: usize) -> usize {
+ self.doctest_offset_line(line)
+ }
+}
+
+#[derive(Clone)]
+pub struct FilePathMapping {
+ mapping: Vec<(PathBuf, PathBuf)>,
+}
+
+impl FilePathMapping {
+ pub fn empty() -> FilePathMapping {
+ FilePathMapping {
+ mapping: vec![]
+ }
+ }
+
+ pub fn new(mapping: Vec<(PathBuf, PathBuf)>) -> FilePathMapping {
+ FilePathMapping {
+ mapping,
+ }
+ }
+
+ /// Applies any path prefix substitution as defined by the mapping.
+ /// The return value is the remapped path and a boolean indicating whether
+ /// the path was affected by the mapping.
+ pub fn map_prefix(&self, path: PathBuf) -> (PathBuf, bool) {
+ // NOTE: We are iterating over the mapping entries from last to first
+ // because entries specified later on the command line should
+ // take precedence.
+ for &(ref from, ref to) in self.mapping.iter().rev() {
+ if let Ok(rest) = path.strip_prefix(from) {
+ return (to.join(rest), true);
+ }
+ }
+
+ (path, false)
+ }
+}
+
+// _____________________________________________________________________________
+// Tests
+//
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use rustc_data_structures::sync::Lrc;
+
+ fn init_code_map() -> SourceMap {
+ let cm = SourceMap::new(FilePathMapping::empty());
+ cm.new_source_file(PathBuf::from("blork.rs").into(),
+ "first line.\nsecond line".to_string());
+ cm.new_source_file(PathBuf::from("empty.rs").into(),
+ "".to_string());
+ cm.new_source_file(PathBuf::from("blork2.rs").into(),
+ "first line.\nsecond line".to_string());
+ cm
+ }
+
+ #[test]
+ fn t3() {
+ // Test lookup_byte_offset
+ let cm = init_code_map();
+
+ let fmabp1 = cm.lookup_byte_offset(BytePos(23));
+ assert_eq!(fmabp1.fm.name, PathBuf::from("blork.rs").into());
+ assert_eq!(fmabp1.pos, BytePos(23));
+
+ let fmabp1 = cm.lookup_byte_offset(BytePos(24));
+ assert_eq!(fmabp1.fm.name, PathBuf::from("empty.rs").into());
+ assert_eq!(fmabp1.pos, BytePos(0));
+
+ let fmabp2 = cm.lookup_byte_offset(BytePos(25));
+ assert_eq!(fmabp2.fm.name, PathBuf::from("blork2.rs").into());
+ assert_eq!(fmabp2.pos, BytePos(0));
+ }
+
+ #[test]
+ fn t4() {
+ // Test bytepos_to_file_charpos
+ let cm = init_code_map();
+
+ let cp1 = cm.bytepos_to_file_charpos(BytePos(22));
+ assert_eq!(cp1, CharPos(22));
+
+ let cp2 = cm.bytepos_to_file_charpos(BytePos(25));
+ assert_eq!(cp2, CharPos(0));
+ }
+
+ #[test]
+ fn t5() {
+ // Test zero-length source_files.
+ let cm = init_code_map();
+
+ let loc1 = cm.lookup_char_pos(BytePos(22));
+ assert_eq!(loc1.file.name, PathBuf::from("blork.rs").into());
+ assert_eq!(loc1.line, 2);
+ assert_eq!(loc1.col, CharPos(10));
+
+ let loc2 = cm.lookup_char_pos(BytePos(25));
+ assert_eq!(loc2.file.name, PathBuf::from("blork2.rs").into());
+ assert_eq!(loc2.line, 1);
+ assert_eq!(loc2.col, CharPos(0));
+ }
+
+ fn init_code_map_mbc() -> SourceMap {
+ let cm = SourceMap::new(FilePathMapping::empty());
+ // € is a three byte utf8 char.
+ cm.new_source_file(PathBuf::from("blork.rs").into(),
+ "fir€st €€€€ line.\nsecond line".to_string());
+ cm.new_source_file(PathBuf::from("blork2.rs").into(),
+ "first line€€.\n€ second line".to_string());
+ cm
+ }
+
+ #[test]
+ fn t6() {
+ // Test bytepos_to_file_charpos in the presence of multi-byte chars
+ let cm = init_code_map_mbc();
+
+ let cp1 = cm.bytepos_to_file_charpos(BytePos(3));
+ assert_eq!(cp1, CharPos(3));
+
+ let cp2 = cm.bytepos_to_file_charpos(BytePos(6));
+ assert_eq!(cp2, CharPos(4));
+
+ let cp3 = cm.bytepos_to_file_charpos(BytePos(56));
+ assert_eq!(cp3, CharPos(12));
+
+ let cp4 = cm.bytepos_to_file_charpos(BytePos(61));
+ assert_eq!(cp4, CharPos(15));
+ }
+
+ #[test]
+ fn t7() {
+ // Test span_to_lines for a span ending at the end of source_file
+ let cm = init_code_map();
+ let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
+ let file_lines = cm.span_to_lines(span).unwrap();
+
+ assert_eq!(file_lines.file.name, PathBuf::from("blork.rs").into());
+ assert_eq!(file_lines.lines.len(), 1);
+ assert_eq!(file_lines.lines[0].line_index, 1);
+ }
+
+ /// Given a string like " ~~~~~~~~~~~~ ", produces a span
+ /// converting that range. The idea is that the string has the same
+ /// length as the input, and we uncover the byte positions. Note
+ /// that this can span lines and so on.
+ fn span_from_selection(input: &str, selection: &str) -> Span {
+ assert_eq!(input.len(), selection.len());
+ let left_index = selection.find('~').unwrap() as u32;
+ let right_index = selection.rfind('~').map(|x|x as u32).unwrap_or(left_index);
+ Span::new(BytePos(left_index), BytePos(right_index + 1), NO_EXPANSION)
+ }
+
+ /// Test span_to_snippet and span_to_lines for a span converting 3
+ /// lines in the middle of a file.
+ #[test]
+ fn span_to_snippet_and_lines_spanning_multiple_lines() {
+ let cm = SourceMap::new(FilePathMapping::empty());
+ let inputtext = "aaaaa\nbbbbBB\nCCC\nDDDDDddddd\neee\n";
+ let selection = " \n ~~\n~~~\n~~~~~ \n \n";
+ cm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_string());
+ let span = span_from_selection(inputtext, selection);
+
+ // check that we are extracting the text we thought we were extracting
+ assert_eq!(&cm.span_to_snippet(span).unwrap(), "BB\nCCC\nDDDDD");
+
+ // check that span_to_lines gives us the complete result with the lines/cols we expected
+ let lines = cm.span_to_lines(span).unwrap();
+ let expected = vec![
+ LineInfo { line_index: 1, start_col: CharPos(4), end_col: CharPos(6) },
+ LineInfo { line_index: 2, start_col: CharPos(0), end_col: CharPos(3) },
+ LineInfo { line_index: 3, start_col: CharPos(0), end_col: CharPos(5) }
+ ];
+ assert_eq!(lines.lines, expected);
+ }
+
+ #[test]
+ fn t8() {
+ // Test span_to_snippet for a span ending at the end of source_file
+ let cm = init_code_map();
+ let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
+ let snippet = cm.span_to_snippet(span);
+
+ assert_eq!(snippet, Ok("second line".to_string()));
+ }
+
+ #[test]
+ fn t9() {
+ // Test span_to_str for a span ending at the end of source_file
+ let cm = init_code_map();
+ let span = Span::new(BytePos(12), BytePos(23), NO_EXPANSION);
+ let sstr = cm.span_to_string(span);
+
+ assert_eq!(sstr, "blork.rs:2:1: 2:12");
+ }
+
+ /// Test failing to merge two spans on different lines
+ #[test]
+ fn span_merging_fail() {
+ let cm = SourceMap::new(FilePathMapping::empty());
+ let inputtext = "bbbb BB\ncc CCC\n";
+ let selection1 = " ~~\n \n";
+ let selection2 = " \n ~~~\n";
+ cm.new_source_file(Path::new("blork.rs").to_owned().into(), inputtext.to_owned());
+ let span1 = span_from_selection(inputtext, selection1);
+ let span2 = span_from_selection(inputtext, selection2);
+
+ assert!(cm.merge_spans(span1, span2).is_none());
+ }
+
+ /// Returns the span corresponding to the `n`th occurrence of
+ /// `substring` in `source_text`.
+ trait SourceMapExtension {
+ fn span_substr(&self,
+ file: &Lrc<SourceFile>,
+ source_text: &str,
+ substring: &str,
+ n: usize)
+ -> Span;
+ }
+
+ impl SourceMapExtension for SourceMap {
+ fn span_substr(&self,
+ file: &Lrc<SourceFile>,
+ source_text: &str,
+ substring: &str,
+ n: usize)
+ -> Span
+ {
+ println!("span_substr(file={:?}/{:?}, substring={:?}, n={})",
+ file.name, file.start_pos, substring, n);
+ let mut i = 0;
+ let mut hi = 0;
+ loop {
+ let offset = source_text[hi..].find(substring).unwrap_or_else(|| {
+ panic!("source_text `{}` does not have {} occurrences of `{}`, only {}",
+ source_text, n, substring, i);
+ });
+ let lo = hi + offset;
+ hi = lo + substring.len();
+ if i == n {
+ let span = Span::new(
+ BytePos(lo as u32 + file.start_pos.0),
+ BytePos(hi as u32 + file.start_pos.0),
+ NO_EXPANSION,
+ );
+ assert_eq!(&self.span_to_snippet(span).unwrap()[..],
+ substring);
+ return span;
+ }
+ i += 1;
+ }
+ }
+ }
+}
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs
index 68121d4..1210f33 100644
--- a/src/libsyntax/std_inject.rs
+++ b/src/libsyntax/std_inject.rs
@@ -11,15 +11,17 @@
use ast;
use attr;
use std::cell::Cell;
+use std::iter;
+use edition::Edition;
use ext::hygiene::{Mark, SyntaxContext};
use symbol::{Symbol, keywords};
use syntax_pos::{DUMMY_SP, Span};
-use codemap::{ExpnInfo, MacroAttribute, dummy_spanned, hygiene, respan};
+use source_map::{ExpnInfo, MacroAttribute, dummy_spanned, hygiene, respan};
use ptr::P;
use tokenstream::TokenStream;
/// Craft a span that will be ignored by the stability lint's
-/// call to codemap's `is_internal` check.
+/// call to source_map's `is_internal` check.
/// The expanded code uses the unstable `#[prelude_import]` attribute.
fn ignored_span(sp: Span) -> Span {
let mark = Mark::fresh(Mark::root());
@@ -43,7 +45,13 @@
static INJECTED_CRATE_NAME: Cell<Option<&'static str>> = Cell::new(None);
}
-pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option<&str>) -> ast::Crate {
+pub fn maybe_inject_crates_ref(
+ mut krate: ast::Crate,
+ alt_std_name: Option<&str>,
+ edition: Edition,
+) -> ast::Crate {
+ let rust_2018 = edition >= Edition::Edition2018;
+
// the first name in this list is the crate name of the crate with the prelude
let names: &[&str] = if attr::contains_name(&krate.attrs, "no_core") {
return krate;
@@ -58,14 +66,27 @@
};
// .rev() to preserve ordering above in combination with insert(0, ...)
- for name in names.iter().rev() {
+ let alt_std_name = alt_std_name.map(Symbol::intern);
+ for orig_name in names.iter().rev() {
+ let orig_name = Symbol::intern(orig_name);
+ let mut rename = orig_name;
+ // HACK(eddyb) gensym the injected crates on the Rust 2018 edition,
+ // so they don't accidentally interfere with the new import paths.
+ if rust_2018 {
+ rename = orig_name.gensymed();
+ }
+ let orig_name = if rename != orig_name {
+ Some(orig_name)
+ } else {
+ None
+ };
krate.module.items.insert(0, P(ast::Item {
attrs: vec![attr::mk_attr_outer(DUMMY_SP,
attr::mk_attr_id(),
attr::mk_word_item(ast::Ident::from_str("macro_use")))],
vis: dummy_spanned(ast::VisibilityKind::Inherited),
- node: ast::ItemKind::ExternCrate(alt_std_name.map(Symbol::intern)),
- ident: ast::Ident::from_str(name),
+ node: ast::ItemKind::ExternCrate(alt_std_name.or(orig_name)),
+ ident: ast::Ident::with_empty_ctxt(rename),
id: ast::DUMMY_NODE_ID,
span: DUMMY_SP,
tokens: None,
@@ -91,9 +112,11 @@
vis: respan(span.shrink_to_lo(), ast::VisibilityKind::Inherited),
node: ast::ItemKind::Use(P(ast::UseTree {
prefix: ast::Path {
- segments: [name, "prelude", "v1"].into_iter().map(|name| {
- ast::PathSegment::from_ident(ast::Ident::from_str(name))
- }).collect(),
+ segments: iter::once(keywords::CrateRoot.ident())
+ .chain(
+ [name, "prelude", "v1"].iter().cloned()
+ .map(ast::Ident::from_str)
+ ).map(ast::PathSegment::from_ident).collect(),
span,
},
kind: ast::UseTreeKind::Glob,
diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs
index d8b8d13..988f50b 100644
--- a/src/libsyntax/test.rs
+++ b/src/libsyntax/test.rs
@@ -20,9 +20,9 @@
use std::mem;
use std::vec;
use attr::{self, HasAttrs};
-use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, FileMap, BytePos};
+use syntax_pos::{self, DUMMY_SP, NO_EXPANSION, Span, SourceFile, BytePos};
-use codemap::{self, CodeMap, ExpnInfo, MacroAttribute, dummy_spanned};
+use source_map::{self, SourceMap, ExpnInfo, MacroAttribute, dummy_spanned};
use errors;
use config;
use entry::{self, EntryPointType};
@@ -38,8 +38,9 @@
use print::pprust;
use ast::{self, Ident};
use ptr::P;
+use OneVector;
use symbol::{self, Symbol, keywords};
-use util::small_vector::SmallVector;
+use ThinVec;
enum ShouldPanic {
No,
@@ -115,7 +116,7 @@
folded
}
- fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_item(&mut self, i: P<ast::Item>) -> OneVector<P<ast::Item>> {
let ident = i.ident;
if ident.name != keywords::Invalid.name() {
self.cx.path.push(ident);
@@ -182,7 +183,7 @@
if ident.name != keywords::Invalid.name() {
self.cx.path.pop();
}
- SmallVector::one(P(item))
+ OneVector::one(P(item))
}
fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { mac }
@@ -194,7 +195,7 @@
}
impl fold::Folder for EntryPointCleaner {
- fn fold_item(&mut self, i: P<ast::Item>) -> SmallVector<P<ast::Item>> {
+ fn fold_item(&mut self, i: P<ast::Item>) -> OneVector<P<ast::Item>> {
self.depth += 1;
let folded = fold::noop_fold_item(i, self).expect_one("noop did something");
self.depth -= 1;
@@ -234,7 +235,7 @@
EntryPointType::OtherMain => folded,
};
- SmallVector::one(folded)
+ OneVector::one(folded)
}
fn fold_mac(&mut self, mac: ast::Mac) -> ast::Mac { mac }
@@ -323,7 +324,7 @@
}
/// Craft a span that will be ignored by the stability lint's
-/// call to codemap's `is_internal` check.
+/// call to source_map's `is_internal` check.
/// The expanded code calls some unstable functions in the test crate.
fn ignored_span(cx: &TestCtxt, sp: Span) -> Span {
sp.with_ctxt(cx.ctxt)
@@ -615,8 +616,8 @@
(item, reexport)
}
-fn nospan<T>(t: T) -> codemap::Spanned<T> {
- codemap::Spanned { node: t, span: DUMMY_SP }
+fn nospan<T>(t: T) -> source_map::Spanned<T> {
+ source_map::Spanned { node: t, span: DUMMY_SP }
}
fn path_node(ids: Vec<Ident>) -> ast::Path {
@@ -631,7 +632,7 @@
let mut idents_iter = idents.iter().peekable();
while let Some(ident) = idents_iter.next() {
path_name.push_str(&ident.as_str());
- if let Some(_) = idents_iter.peek() {
+ if idents_iter.peek().is_some() {
path_name.push_str("::")
}
}
@@ -675,10 +676,10 @@
mk_test_desc_and_fn_rec(cx, test)
}).collect()),
span: DUMMY_SP,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
})),
span: DUMMY_SP,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
})
}
diff --git a/src/libsyntax/test_snippet.rs b/src/libsyntax/test_snippet.rs
index c7e4fbd..d49965f 100644
--- a/src/libsyntax/test_snippet.rs
+++ b/src/libsyntax/test_snippet.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use codemap::{CodeMap, FilePathMapping};
+use source_map::{SourceMap, FilePathMapping};
use errors::Handler;
use errors::emitter::EmitterWriter;
use std::io;
@@ -50,8 +50,8 @@
with_globals(|| {
let output = Arc::new(Mutex::new(Vec::new()));
- let code_map = Lrc::new(CodeMap::new(FilePathMapping::empty()));
- code_map.new_filemap(Path::new("test.rs").to_owned().into(), file_text.to_owned());
+ let code_map = Lrc::new(SourceMap::new(FilePathMapping::empty()));
+ code_map.new_source_file(Path::new("test.rs").to_owned().into(), file_text.to_owned());
let primary_span = make_span(&file_text, &span_labels[0].start, &span_labels[0].end);
let mut msp = MultiSpan::from_span(primary_span);
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs
index f84b530..840ee29 100644
--- a/src/libsyntax/tokenstream.rs
+++ b/src/libsyntax/tokenstream.rs
@@ -29,7 +29,7 @@
use parse::token::{self, Token};
use print::pprust;
use serialize::{Decoder, Decodable, Encoder, Encodable};
-use util::RcSlice;
+use util::RcVec;
use std::borrow::Cow;
use std::{fmt, iter, mem};
@@ -186,21 +186,43 @@
/// Given a `TokenStream` with a `Stream` of only two arguments, return a new `TokenStream`
/// separating the two arguments with a comma for diagnostic suggestions.
pub(crate) fn add_comma(&self) -> Option<(TokenStream, Span)> {
- // Used to suggest if a user writes `println!("{}" a);`
+ // Used to suggest if a user writes `foo!(a b);`
if let TokenStreamKind::Stream(ref slice) = self.kind {
- if slice.len() == 2 {
- let comma_span = match slice[0] {
- TokenStream { kind: TokenStreamKind::Tree(TokenTree::Token(sp, _)) } |
- TokenStream { kind: TokenStreamKind::Tree(TokenTree::Delimited(sp, _)) } => {
- sp.shrink_to_hi()
+ let mut suggestion = None;
+ let mut iter = slice.iter().enumerate().peekable();
+ while let Some((pos, ts)) = iter.next() {
+ if let Some((_, next)) = iter.peek() {
+ match (ts, next) {
+ (TokenStream {
+ kind: TokenStreamKind::Tree(TokenTree::Token(_, token::Token::Comma))
+ }, _) |
+ (_, TokenStream {
+ kind: TokenStreamKind::Tree(TokenTree::Token(_, token::Token::Comma))
+ }) => {}
+ (TokenStream {
+ kind: TokenStreamKind::Tree(TokenTree::Token(sp, _))
+ }, _) |
+ (TokenStream {
+ kind: TokenStreamKind::Tree(TokenTree::Delimited(sp, _))
+ }, _) => {
+ let sp = sp.shrink_to_hi();
+ let comma = TokenStream {
+ kind: TokenStreamKind::Tree(TokenTree::Token(sp, token::Comma)),
+ };
+ suggestion = Some((pos, comma, sp));
+ }
+ _ => {}
}
- _ => DUMMY_SP,
- };
- let comma = TokenStream {
- kind: TokenStreamKind::Tree(TokenTree::Token(comma_span, token::Comma)),
- };
- let slice = RcSlice::new(vec![slice[0].clone(), comma, slice[1].clone()]);
- return Some((TokenStream { kind: TokenStreamKind::Stream(slice) }, comma_span));
+ }
+ }
+ if let Some((pos, comma, sp)) = suggestion {
+ let mut new_slice = vec![];
+ let parts = slice.split_at(pos + 1);
+ new_slice.extend_from_slice(parts.0);
+ new_slice.push(comma);
+ new_slice.extend_from_slice(parts.1);
+ let slice = RcVec::new(new_slice);
+ return Some((TokenStream { kind: TokenStreamKind::Stream(slice) }, sp));
}
}
None
@@ -212,7 +234,7 @@
Empty,
Tree(TokenTree),
JointTree(TokenTree),
- Stream(RcSlice<TokenStream>),
+ Stream(RcVec<TokenStream>),
}
impl From<TokenTree> for TokenStream {
@@ -233,6 +255,60 @@
}
}
+impl Extend<TokenStream> for TokenStream {
+ fn extend<I: IntoIterator<Item = TokenStream>>(&mut self, iter: I) {
+ let iter = iter.into_iter();
+ let kind = mem::replace(&mut self.kind, TokenStreamKind::Empty);
+
+ // Vector of token streams originally in self.
+ let tts: Vec<TokenStream> = match kind {
+ TokenStreamKind::Empty => {
+ let mut vec = Vec::new();
+ vec.reserve(iter.size_hint().0);
+ vec
+ }
+ TokenStreamKind::Tree(_) | TokenStreamKind::JointTree(_) => {
+ let mut vec = Vec::new();
+ vec.reserve(1 + iter.size_hint().0);
+ vec.push(TokenStream { kind });
+ vec
+ }
+ TokenStreamKind::Stream(rc_vec) => match RcVec::try_unwrap(rc_vec) {
+ Ok(mut vec) => {
+ // Extend in place using the existing capacity if possible.
+ // This is the fast path for libraries like `quote` that
+ // build a token stream.
+ vec.reserve(iter.size_hint().0);
+ vec
+ }
+ Err(rc_vec) => {
+ // Self is shared so we need to copy and extend that.
+ let mut vec = Vec::new();
+ vec.reserve(rc_vec.len() + iter.size_hint().0);
+ vec.extend_from_slice(&rc_vec);
+ vec
+ }
+ }
+ };
+
+ // Perform the extend, joining tokens as needed along the way.
+ let mut builder = TokenStreamBuilder(tts);
+ for stream in iter {
+ builder.push(stream);
+ }
+
+ // Build the resulting token stream. If it contains more than one token,
+ // preserve capacity in the vector in anticipation of the caller
+ // performing additional calls to extend.
+ let mut tts = builder.0;
+ *self = match tts.len() {
+ 0 => TokenStream::empty(),
+ 1 => tts.pop().unwrap(),
+ _ => TokenStream::concat_rc_vec(RcVec::new_preserving_capacity(tts)),
+ };
+ }
+}
+
impl Eq for TokenStream {}
impl PartialEq<TokenStream> for TokenStream {
@@ -265,11 +341,11 @@
match streams.len() {
0 => TokenStream::empty(),
1 => streams.pop().unwrap(),
- _ => TokenStream::concat_rc_slice(RcSlice::new(streams)),
+ _ => TokenStream::concat_rc_vec(RcVec::new(streams)),
}
}
- fn concat_rc_slice(streams: RcSlice<TokenStream>) -> TokenStream {
+ fn concat_rc_vec(streams: RcVec<TokenStream>) -> TokenStream {
TokenStream { kind: TokenStreamKind::Stream(streams) }
}
@@ -412,7 +488,7 @@
match len {
1 => {}
2 => self.0.push(streams[0].clone().into()),
- _ => self.0.push(TokenStream::concat_rc_slice(streams.sub_slice(0 .. len - 1))),
+ _ => self.0.push(TokenStream::concat_rc_vec(streams.sub_slice(0 .. len - 1))),
}
self.push_all_but_last_tree(&streams[len - 1])
}
@@ -424,7 +500,7 @@
match len {
1 => {}
2 => self.0.push(streams[1].clone().into()),
- _ => self.0.push(TokenStream::concat_rc_slice(streams.sub_slice(1 .. len))),
+ _ => self.0.push(TokenStream::concat_rc_vec(streams.sub_slice(1 .. len))),
}
self.push_all_but_first_tree(&streams[0])
}
@@ -444,13 +520,13 @@
#[derive(Clone)]
struct StreamCursor {
- stream: RcSlice<TokenStream>,
+ stream: RcVec<TokenStream>,
index: usize,
- stack: Vec<(RcSlice<TokenStream>, usize)>,
+ stack: Vec<(RcVec<TokenStream>, usize)>,
}
impl StreamCursor {
- fn new(stream: RcSlice<TokenStream>) -> Self {
+ fn new(stream: RcVec<TokenStream>) -> Self {
StreamCursor { stream: stream, index: 0, stack: Vec::new() }
}
@@ -473,7 +549,7 @@
}
}
- fn insert(&mut self, stream: RcSlice<TokenStream>) {
+ fn insert(&mut self, stream: RcVec<TokenStream>) {
self.stack.push((mem::replace(&mut self.stream, stream),
mem::replace(&mut self.index, 0)));
}
@@ -535,7 +611,7 @@
CursorKind::Empty => TokenStream::empty(),
CursorKind::Tree(ref tree, _) => tree.clone().into(),
CursorKind::JointTree(ref tree, _) => tree.clone().joint(),
- CursorKind::Stream(ref cursor) => TokenStream::concat_rc_slice({
+ CursorKind::Stream(ref cursor) => TokenStream::concat_rc_vec({
cursor.stack.get(0).cloned().map(|(stream, _)| stream)
.unwrap_or(cursor.stream.clone())
}),
@@ -585,14 +661,14 @@
/// `ThinTokenStream` is smaller, but needs to allocate to represent a single `TokenTree`.
/// We must use `ThinTokenStream` in `TokenTree::Delimited` to avoid infinite size due to recursion.
#[derive(Debug, Clone)]
-pub struct ThinTokenStream(Option<RcSlice<TokenStream>>);
+pub struct ThinTokenStream(Option<RcVec<TokenStream>>);
impl From<TokenStream> for ThinTokenStream {
fn from(stream: TokenStream) -> ThinTokenStream {
ThinTokenStream(match stream.kind {
TokenStreamKind::Empty => None,
- TokenStreamKind::Tree(tree) => Some(RcSlice::new(vec![tree.into()])),
- TokenStreamKind::JointTree(tree) => Some(RcSlice::new(vec![tree.joint()])),
+ TokenStreamKind::Tree(tree) => Some(RcVec::new(vec![tree.into()])),
+ TokenStreamKind::JointTree(tree) => Some(RcVec::new(vec![tree.joint()])),
TokenStreamKind::Stream(stream) => Some(stream),
})
}
@@ -600,7 +676,7 @@
impl From<ThinTokenStream> for TokenStream {
fn from(stream: ThinTokenStream) -> TokenStream {
- stream.0.map(TokenStream::concat_rc_slice).unwrap_or_else(TokenStream::empty)
+ stream.0.map(TokenStream::concat_rc_vec).unwrap_or_else(TokenStream::empty)
}
}
@@ -751,4 +827,106 @@
assert_eq!(stream.trees().count(), 1);
}
+ #[test]
+ fn test_extend_empty() {
+ with_globals(|| {
+ // Append a token onto an empty token stream.
+ let mut stream = TokenStream::empty();
+ stream.extend(vec![string_to_ts("t")]);
+
+ let expected = string_to_ts("t");
+ assert!(stream.eq_unspanned(&expected));
+ });
+ }
+
+ #[test]
+ fn test_extend_nothing() {
+ with_globals(|| {
+ // Append nothing onto a token stream containing one token.
+ let mut stream = string_to_ts("t");
+ stream.extend(vec![]);
+
+ let expected = string_to_ts("t");
+ assert!(stream.eq_unspanned(&expected));
+ });
+ }
+
+ #[test]
+ fn test_extend_single() {
+ with_globals(|| {
+ // Append a token onto token stream containing a single token.
+ let mut stream = string_to_ts("t1");
+ stream.extend(vec![string_to_ts("t2")]);
+
+ let expected = string_to_ts("t1 t2");
+ assert!(stream.eq_unspanned(&expected));
+ });
+ }
+
+ #[test]
+ fn test_extend_in_place() {
+ with_globals(|| {
+ // Append a token onto token stream containing a reference counted
+ // vec of tokens. The token stream has a reference count of 1 so
+ // this can happen in place.
+ let mut stream = string_to_ts("t1 t2");
+ stream.extend(vec![string_to_ts("t3")]);
+
+ let expected = string_to_ts("t1 t2 t3");
+ assert!(stream.eq_unspanned(&expected));
+ });
+ }
+
+ #[test]
+ fn test_extend_copy() {
+ with_globals(|| {
+ // Append a token onto token stream containing a reference counted
+ // vec of tokens. The token stream is shared so the extend takes
+ // place on a copy.
+ let mut stream = string_to_ts("t1 t2");
+ let _incref = stream.clone();
+ stream.extend(vec![string_to_ts("t3")]);
+
+ let expected = string_to_ts("t1 t2 t3");
+ assert!(stream.eq_unspanned(&expected));
+ });
+ }
+
+ #[test]
+ fn test_extend_no_join() {
+ with_globals(|| {
+ let first = TokenTree::Token(DUMMY_SP, Token::Dot);
+ let second = TokenTree::Token(DUMMY_SP, Token::Dot);
+
+ // Append a dot onto a token stream containing a dot, but do not
+ // join them.
+ let mut stream = TokenStream::from(first);
+ stream.extend(vec![TokenStream::from(second)]);
+
+ let expected = string_to_ts(". .");
+ assert!(stream.eq_unspanned(&expected));
+
+ let unexpected = string_to_ts("..");
+ assert!(!stream.eq_unspanned(&unexpected));
+ });
+ }
+
+ #[test]
+ fn test_extend_join() {
+ with_globals(|| {
+ let first = TokenTree::Token(DUMMY_SP, Token::Dot).joint();
+ let second = TokenTree::Token(DUMMY_SP, Token::Dot);
+
+ // Append a dot onto a token stream containing a dot, forming a
+ // dotdot.
+ let mut stream = first;
+ stream.extend(vec![TokenStream::from(second)]);
+
+ let expected = string_to_ts("..");
+ assert!(stream.eq_unspanned(&expected));
+
+ let unexpected = string_to_ts(". .");
+ assert!(!stream.eq_unspanned(&unexpected));
+ });
+ }
}
diff --git a/src/libsyntax/util/move_map.rs b/src/libsyntax/util/move_map.rs
index 8cc37af..eb2c5a2 100644
--- a/src/libsyntax/util/move_map.rs
+++ b/src/libsyntax/util/move_map.rs
@@ -9,8 +9,7 @@
// except according to those terms.
use std::ptr;
-
-use util::small_vector::SmallVector;
+use OneVector;
pub trait MoveMap<T>: Sized {
fn move_map<F>(self, mut f: F) -> Self where F: FnMut(T) -> T {
@@ -78,7 +77,7 @@
}
}
-impl<T> MoveMap<T> for SmallVector<T> {
+impl<T> MoveMap<T> for OneVector<T> {
fn move_flat_map<F, I>(mut self, mut f: F) -> Self
where F: FnMut(T) -> I,
I: IntoIterator<Item=T>
diff --git a/src/libsyntax/util/parser_testing.rs b/src/libsyntax/util/parser_testing.rs
index 46b7f2d..374154e 100644
--- a/src/libsyntax/util/parser_testing.rs
+++ b/src/libsyntax/util/parser_testing.rs
@@ -9,8 +9,8 @@
// except according to those terms.
use ast::{self, Ident};
-use codemap::FilePathMapping;
-use parse::{ParseSess, PResult, filemap_to_stream};
+use source_map::FilePathMapping;
+use parse::{ParseSess, PResult, source_file_to_stream};
use parse::{lexer, new_parser_from_source_str};
use parse::parser::Parser;
use ptr::P;
@@ -21,8 +21,8 @@
/// Map a string to tts, using a made-up filename:
pub fn string_to_stream(source_str: String) -> TokenStream {
let ps = ParseSess::new(FilePathMapping::empty());
- filemap_to_stream(&ps, ps.codemap()
- .new_filemap(PathBuf::from("bogofile").into(), source_str), None)
+ source_file_to_stream(&ps, ps.source_map()
+ .new_source_file(PathBuf::from("bogofile").into(), source_str), None)
}
/// Map string to parser (via tts)
diff --git a/src/libsyntax/util/rc_vec.rs b/src/libsyntax/util/rc_vec.rs
new file mode 100644
index 0000000..99fbce1
--- /dev/null
+++ b/src/libsyntax/util/rc_vec.rs
@@ -0,0 +1,90 @@
+// 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.
+
+use std::fmt;
+use std::ops::{Deref, Range};
+
+use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
+use rustc_data_structures::sync::Lrc;
+
+#[derive(Clone)]
+pub struct RcVec<T> {
+ data: Lrc<Vec<T>>,
+ offset: u32,
+ len: u32,
+}
+
+impl<T> RcVec<T> {
+ pub fn new(mut vec: Vec<T>) -> Self {
+ // By default, constructing RcVec from Vec gives it just enough capacity
+ // to hold the initial elements. Callers that anticipate needing to
+ // extend the vector may prefer RcVec::new_preserving_capacity.
+ vec.shrink_to_fit();
+ Self::new_preserving_capacity(vec)
+ }
+
+ pub fn new_preserving_capacity(vec: Vec<T>) -> Self {
+ RcVec {
+ offset: 0,
+ len: vec.len() as u32,
+ data: Lrc::new(vec),
+ }
+ }
+
+ pub fn sub_slice(&self, range: Range<usize>) -> Self {
+ RcVec {
+ data: self.data.clone(),
+ offset: self.offset + range.start as u32,
+ len: (range.end - range.start) as u32,
+ }
+ }
+
+ /// If this RcVec has exactly one strong reference, returns ownership of the
+ /// underlying vector. Otherwise returns self unmodified.
+ pub fn try_unwrap(self) -> Result<Vec<T>, Self> {
+ match Lrc::try_unwrap(self.data) {
+ // If no other RcVec shares ownership of this data.
+ Ok(mut vec) => {
+ // Drop any elements after our view of the data.
+ vec.truncate(self.offset as usize + self.len as usize);
+ // Drop any elements before our view of the data. Do this after
+ // the `truncate` so that elements past the end of our view do
+ // not need to be copied around.
+ vec.drain(..self.offset as usize);
+ Ok(vec)
+ }
+
+ // If the data is shared.
+ Err(data) => Err(RcVec { data, ..self }),
+ }
+ }
+}
+
+impl<T> Deref for RcVec<T> {
+ type Target = [T];
+ fn deref(&self) -> &[T] {
+ &self.data[self.offset as usize..(self.offset + self.len) as usize]
+ }
+}
+
+impl<T: fmt::Debug> fmt::Debug for RcVec<T> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fmt::Debug::fmt(self.deref(), f)
+ }
+}
+
+impl<CTX, T> HashStable<CTX> for RcVec<T>
+where
+ T: HashStable<CTX>,
+{
+ fn hash_stable<W: StableHasherResult>(&self, hcx: &mut CTX, hasher: &mut StableHasher<W>) {
+ (**self).hash_stable(hcx, hasher);
+ }
+}
diff --git a/src/libsyntax/util/small_vector.rs b/src/libsyntax/util/small_vector.rs
deleted file mode 100644
index 31e6758..0000000
--- a/src/libsyntax/util/small_vector.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use rustc_data_structures::small_vec::SmallVec;
-
-pub type SmallVector<T> = SmallVec<[T; 1]>;
-
-#[cfg(test)]
-mod tests {
- use super::*;
-
- #[test]
- fn test_len() {
- let v: SmallVector<isize> = SmallVector::new();
- assert_eq!(0, v.len());
-
- assert_eq!(1, SmallVector::one(1).len());
- assert_eq!(5, SmallVector::many(vec![1, 2, 3, 4, 5]).len());
- }
-
- #[test]
- fn test_push_get() {
- let mut v = SmallVector::new();
- v.push(1);
- assert_eq!(1, v.len());
- assert_eq!(1, v[0]);
- v.push(2);
- assert_eq!(2, v.len());
- assert_eq!(2, v[1]);
- v.push(3);
- assert_eq!(3, v.len());
- assert_eq!(3, v[2]);
- }
-
- #[test]
- fn test_from_iter() {
- let v: SmallVector<isize> = (vec![1, 2, 3]).into_iter().collect();
- assert_eq!(3, v.len());
- assert_eq!(1, v[0]);
- assert_eq!(2, v[1]);
- assert_eq!(3, v[2]);
- }
-
- #[test]
- fn test_move_iter() {
- let v = SmallVector::new();
- let v: Vec<isize> = v.into_iter().collect();
- assert_eq!(v, Vec::new());
-
- let v = SmallVector::one(1);
- assert_eq!(v.into_iter().collect::<Vec<_>>(), [1]);
-
- let v = SmallVector::many(vec![1, 2, 3]);
- assert_eq!(v.into_iter().collect::<Vec<_>>(), [1, 2, 3]);
- }
-
- #[test]
- #[should_panic]
- fn test_expect_one_zero() {
- let _: isize = SmallVector::new().expect_one("");
- }
-
- #[test]
- #[should_panic]
- fn test_expect_one_many() {
- SmallVector::many(vec![1, 2]).expect_one("");
- }
-
- #[test]
- fn test_expect_one_one() {
- assert_eq!(1, SmallVector::one(1).expect_one(""));
- assert_eq!(1, SmallVector::many(vec![1]).expect_one(""));
- }
-}
diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs
index 4ebb1fc..026ddcc 100644
--- a/src/libsyntax_ext/asm.rs
+++ b/src/libsyntax_ext/asm.rs
@@ -12,6 +12,8 @@
//
use self::State::*;
+use rustc_data_structures::thin_vec::ThinVec;
+
use syntax::ast;
use syntax::ext::base;
use syntax::ext::base::*;
@@ -263,6 +265,6 @@
ctxt: cx.backtrace(),
})),
span: sp,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
}))
}
diff --git a/src/libsyntax_ext/assert.rs b/src/libsyntax_ext/assert.rs
index 8d0a048..e3bd2ca 100644
--- a/src/libsyntax_ext/assert.rs
+++ b/src/libsyntax_ext/assert.rs
@@ -9,7 +9,7 @@
// except according to those terms.
use syntax::ast::*;
-use syntax::codemap::Spanned;
+use syntax::source_map::Spanned;
use syntax::ext::base::*;
use syntax::ext::build::AstBuilder;
use syntax::parse::token;
diff --git a/src/libsyntax_ext/concat_idents.rs b/src/libsyntax_ext/concat_idents.rs
index a3c5c3d..c8cc11e 100644
--- a/src/libsyntax_ext/concat_idents.rs
+++ b/src/libsyntax_ext/concat_idents.rs
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+use rustc_data_structures::thin_vec::ThinVec;
+
use syntax::ast;
use syntax::ext::base::*;
use syntax::ext::base;
@@ -68,7 +70,7 @@
id: ast::DUMMY_NODE_ID,
node: ast::ExprKind::Path(None, ast::Path::from_ident(self.ident)),
span: self.ident.span,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
}))
}
diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs
index c3958bb..973ad63 100644
--- a/src/libsyntax_ext/deriving/custom.rs
+++ b/src/libsyntax_ext/deriving/custom.rs
@@ -14,7 +14,7 @@
use proc_macro::{TokenStream, __internal};
use syntax::ast::{self, ItemKind, Attribute, Mac};
use syntax::attr::{mark_used, mark_known};
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use syntax::ext::base::*;
use syntax::visit::Visitor;
diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs
index c2a7dea..df9c351 100644
--- a/src/libsyntax_ext/deriving/debug.rs
+++ b/src/libsyntax_ext/deriving/debug.rs
@@ -12,6 +12,8 @@
use deriving::generic::*;
use deriving::generic::ty::*;
+use rustc_data_structures::thin_vec::ThinVec;
+
use syntax::ast::{self, Ident};
use syntax::ast::{Expr, MetaItem};
use syntax::ext::base::{Annotatable, ExtCtxt};
@@ -139,7 +141,7 @@
init: Some(expr),
id: ast::DUMMY_NODE_ID,
span: sp,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
});
ast::Stmt {
id: ast::DUMMY_NODE_ID,
diff --git a/src/libsyntax_ext/deriving/default.rs b/src/libsyntax_ext/deriving/default.rs
index 958116f..adbc582 100644
--- a/src/libsyntax_ext/deriving/default.rs
+++ b/src/libsyntax_ext/deriving/default.rs
@@ -76,8 +76,8 @@
}
}
StaticEnum(..) => {
- span_err_if_not_stage0!(cx, trait_span, E0665,
- "`Default` cannot be derived for enums, only structs");
+ span_err!(cx, trait_span, E0665,
+ "`Default` cannot be derived for enums, only structs");
// let compilation continue
cx.expr_usize(trait_span, 0)
}
diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs
index e0f985c..28a2c11 100644
--- a/src/libsyntax_ext/deriving/generic/mod.rs
+++ b/src/libsyntax_ext/deriving/generic/mod.rs
@@ -191,13 +191,14 @@
use std::iter;
use std::vec;
+use rustc_data_structures::thin_vec::ThinVec;
use rustc_target::spec::abi::Abi;
use syntax::ast::{self, BinOpKind, EnumDef, Expr, Generics, Ident, PatKind};
use syntax::ast::{VariantData, GenericParamKind, GenericArg};
use syntax::attr;
use syntax::ext::base::{Annotatable, ExtCtxt};
use syntax::ext::build::AstBuilder;
-use syntax::codemap::{self, respan};
+use syntax::source_map::{self, respan};
use syntax::util::move_map::MoveMap;
use syntax::ptr::P;
use syntax::symbol::{Symbol, keywords};
@@ -554,7 +555,7 @@
GenericParamKind::Type { .. } => {
// I don't think this can be moved out of the loop, since
// a GenericBound requires an ast id
- let mut bounds: Vec<_> =
+ let bounds: Vec<_> =
// extra restrictions on the generics parameters to the
// type being derived upon
self.additional_bounds.iter().map(|p| {
@@ -1618,13 +1619,13 @@
if ident.is_none() {
cx.span_bug(sp, "a braced struct with unnamed fields in `derive`");
}
- codemap::Spanned {
+ source_map::Spanned {
span: pat.span.with_ctxt(self.span.ctxt()),
node: ast::FieldPat {
ident: ident.unwrap(),
pat,
is_shorthand: false,
- attrs: ast::ThinVec::new(),
+ attrs: ThinVec::new(),
},
}
})
diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs
index a0845e0..fa284f4 100644
--- a/src/libsyntax_ext/deriving/generic/ty.rs
+++ b/src/libsyntax_ext/deriving/generic/ty.rs
@@ -18,7 +18,7 @@
use syntax::ast::{Expr, GenericParamKind, Generics, Ident, SelfKind, GenericArg};
use syntax::ext::base::ExtCtxt;
use syntax::ext::build::AstBuilder;
-use syntax::codemap::{respan, DUMMY_SP};
+use syntax::source_map::{respan, DUMMY_SP};
use syntax::ptr::P;
use syntax_pos::Span;
use syntax_pos::symbol::keywords;
diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs
index 2f5e42d..ae47a02 100644
--- a/src/libsyntax_ext/deriving/mod.rs
+++ b/src/libsyntax_ext/deriving/mod.rs
@@ -19,17 +19,6 @@
use syntax::symbol::Symbol;
use syntax_pos::Span;
-macro_rules! span_err_if_not_stage0 {
- ($cx:expr, $sp:expr, $code:ident, $text:tt) => {
- #[cfg(not(stage0))] {
- span_err!($cx, $sp, $code, $text)
- }
- #[cfg(stage0)] {
- $cx.span_err($sp, $text)
- }
- }
-}
-
macro path_local($x:ident) {
generic::ty::Path::new_local(stringify!($x))
}
diff --git a/src/libsyntax_ext/env.rs b/src/libsyntax_ext/env.rs
index 3c34bf4..8f26b24 100644
--- a/src/libsyntax_ext/env.rs
+++ b/src/libsyntax_ext/env.rs
@@ -81,7 +81,7 @@
}
};
- if let Some(_) = exprs.next() {
+ if exprs.next().is_some() {
cx.span_err(sp, "env! takes 1 or 2 arguments");
return DummyResult::expr(sp);
}
diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs
index 53f8fe2..d97c0b14 100644
--- a/src/libsyntax_ext/format.rs
+++ b/src/libsyntax_ext/format.rs
@@ -14,8 +14,7 @@
use fmt_macros as parse;
use syntax::ast;
-use syntax::ext::base;
-use syntax::ext::base::*;
+use syntax::ext::base::{self, *};
use syntax::ext::build::AstBuilder;
use syntax::feature_gate;
use syntax::parse::token;
@@ -24,6 +23,7 @@
use syntax::tokenstream;
use syntax_pos::{MultiSpan, Span, DUMMY_SP};
+use std::borrow::Cow;
use std::collections::hash_map::Entry;
use std::collections::{HashMap, HashSet};
@@ -143,8 +143,10 @@
ecx.span_err(sp, "requires at least a format string argument");
return None;
}
+
let fmtstr = panictry!(p.parse_expr());
let mut named = false;
+
while p.token != token::Eof {
if !p.eat(&token::Comma) {
ecx.span_err(p.span, "expected token: `,`");
@@ -264,11 +266,11 @@
}
}
- fn describe_num_args(&self) -> String {
+ fn describe_num_args(&self) -> Cow<str> {
match self.args.len() {
- 0 => "no arguments were given".to_string(),
- 1 => "there is 1 argument".to_string(),
- x => format!("there are {} arguments", x),
+ 0 => "no arguments were given".into(),
+ 1 => "there is 1 argument".into(),
+ x => format!("there are {} arguments", x).into(),
}
}
@@ -772,8 +774,10 @@
// `ArgumentType` does not derive `Clone`.
let arg_types: Vec<_> = (0..args.len()).map(|_| Vec::new()).collect();
let arg_unique_types: Vec<_> = (0..args.len()).map(|_| Vec::new()).collect();
+
let mut macsp = ecx.call_site();
macsp = macsp.apply_mark(ecx.current_expansion.mark);
+
let msg = "format argument must be a string literal";
let fmt_sp = efmt.span;
let fmt = match expr_to_spanned_string(ecx, efmt, msg) {
@@ -796,11 +800,46 @@
return DummyResult::raw_expr(sp);
}
};
- let is_literal = match ecx.codemap().span_to_snippet(fmt_sp) {
+
+ let is_literal = match ecx.source_map().span_to_snippet(fmt_sp) {
Ok(ref s) if s.starts_with("\"") || s.starts_with("r#") => true,
_ => false,
};
+ let fmt_str = &*fmt.node.0.as_str();
+ let str_style = match fmt.node.1 {
+ ast::StrStyle::Cooked => None,
+ ast::StrStyle::Raw(raw) => Some(raw as usize),
+ };
+
+ let mut parser = parse::Parser::new(fmt_str, str_style);
+
+ let mut unverified_pieces = Vec::new();
+ while let Some(piece) = parser.next() {
+ if !parser.errors.is_empty() {
+ break;
+ } else {
+ unverified_pieces.push(piece);
+ }
+ }
+
+ if !parser.errors.is_empty() {
+ let err = parser.errors.remove(0);
+ let sp = fmt.span.from_inner_byte_pos(err.start, err.end);
+ let mut e = ecx.struct_span_err(sp, &format!("invalid format string: {}",
+ err.description));
+ e.span_label(sp, err.label + " in format string");
+ if let Some(note) = err.note {
+ e.note(¬e);
+ }
+ e.emit();
+ return DummyResult::raw_expr(sp);
+ }
+
+ let arg_spans = parser.arg_places.iter()
+ .map(|&(start, end)| fmt.span.from_inner_byte_pos(start, end))
+ .collect();
+
let mut cx = Context {
ecx,
args,
@@ -815,42 +854,22 @@
count_positions_count: 0,
count_args_index_offset: 0,
literal: String::new(),
- pieces: Vec::new(),
- str_pieces: Vec::new(),
+ pieces: Vec::with_capacity(unverified_pieces.len()),
+ str_pieces: Vec::with_capacity(unverified_pieces.len()),
all_pieces_simple: true,
macsp,
fmtsp: fmt.span,
invalid_refs: Vec::new(),
- arg_spans: Vec::new(),
+ arg_spans,
is_literal,
};
- let fmt_str = &*fmt.node.0.as_str();
- let str_style = match fmt.node.1 {
- ast::StrStyle::Cooked => None,
- ast::StrStyle::Raw(raw) => Some(raw as usize),
- };
- let mut parser = parse::Parser::new(fmt_str, str_style);
- let mut unverified_pieces = vec![];
- let mut pieces = vec![];
-
- while let Some(piece) = parser.next() {
- if !parser.errors.is_empty() {
- break;
- }
- unverified_pieces.push(piece);
- }
-
- cx.arg_spans = parser.arg_places.iter()
- .map(|&(start, end)| fmt.span.from_inner_byte_pos(start, end))
- .collect();
-
// This needs to happen *after* the Parser has consumed all pieces to create all the spans
- for mut piece in unverified_pieces {
+ let pieces = unverified_pieces.into_iter().map(|mut piece| {
cx.verify_piece(&piece);
cx.resolve_name_inplace(&mut piece);
- pieces.push(piece);
- }
+ piece
+ }).collect::<Vec<_>>();
let numbered_position_args = pieces.iter().any(|arg: &parse::Piece| {
match *arg {
@@ -867,6 +886,7 @@
cx.build_index_map();
let mut arg_index_consumed = vec![0usize; cx.arg_index_map.len()];
+
for piece in pieces {
if let Some(piece) = cx.build_piece(&piece, &mut arg_index_consumed) {
let s = cx.build_literal_string();
@@ -875,18 +895,6 @@
}
}
- if !parser.errors.is_empty() {
- let err = parser.errors.remove(0);
- let sp = cx.fmtsp.from_inner_byte_pos(err.start, err.end);
- let mut e = cx.ecx.struct_span_err(sp, &format!("invalid format string: {}",
- err.description));
- e.span_label(sp, err.label + " in format string");
- if let Some(note) = err.note {
- e.note(¬e);
- }
- e.emit();
- return DummyResult::raw_expr(sp);
- }
if !cx.literal.is_empty() {
let s = cx.build_literal_string();
cx.str_pieces.push(s);
@@ -898,24 +906,25 @@
// Make sure that all arguments were used and all arguments have types.
let num_pos_args = cx.args.len() - cx.names.len();
- let mut errs = vec![];
- for (i, ty) in cx.arg_types.iter().enumerate() {
- if ty.len() == 0 {
- if cx.count_positions.contains_key(&i) {
- continue;
- }
- let msg = if i >= num_pos_args {
- // named argument
- "named argument never used"
- } else {
- // positional argument
- "argument never used"
- };
- errs.push((cx.args[i].span, msg));
- }
- }
+
+ let errs = cx.arg_types
+ .iter()
+ .enumerate()
+ .filter(|(i, ty)| ty.is_empty() && !cx.count_positions.contains_key(&i))
+ .map(|(i, _)| {
+ let msg = if i >= num_pos_args {
+ // named argument
+ "named argument never used"
+ } else {
+ // positional argument
+ "argument never used"
+ };
+ (cx.args[i].span, msg)
+ })
+ .collect::<Vec<_>>();
+
let errs_len = errs.len();
- if errs_len > 0 {
+ if !errs.is_empty() {
let args_used = cx.arg_types.len() - errs_len;
let args_unused = errs_len;
diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs
index 40ecd6e..56f28d0 100644
--- a/src/libsyntax_ext/global_asm.rs
+++ b/src/libsyntax_ext/global_asm.rs
@@ -18,8 +18,10 @@
/// LLVM's `module asm "some assembly here"`. All of LLVM's caveats
/// therefore apply.
+use rustc_data_structures::small_vec::OneVector;
+
use syntax::ast;
-use syntax::codemap::respan;
+use syntax::source_map::respan;
use syntax::ext::base;
use syntax::ext::base::*;
use syntax::feature_gate;
@@ -28,8 +30,6 @@
use syntax_pos::Span;
use syntax::tokenstream;
-use syntax::util::small_vector::SmallVector;
-
pub const MACRO: &'static str = "global_asm";
pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt,
@@ -52,7 +52,7 @@
None => return DummyResult::any(sp),
};
- MacEager::items(SmallVector::one(P(ast::Item {
+ MacEager::items(OneVector::one(P(ast::Item {
ident: ast::Ident::with_empty_ctxt(Symbol::intern("")),
attrs: Vec::new(),
id: ast::DUMMY_NODE_ID,
diff --git a/src/libsyntax_ext/lib.rs b/src/libsyntax_ext/lib.rs
index f0d3383..1ba4ab4 100644
--- a/src/libsyntax_ext/lib.rs
+++ b/src/libsyntax_ext/lib.rs
@@ -16,6 +16,7 @@
#![feature(proc_macro_internals)]
#![feature(decl_macro)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(str_escape)]
#![feature(rustc_diagnostic_macros)]
diff --git a/src/libsyntax_ext/proc_macro_impl.rs b/src/libsyntax_ext/proc_macro_impl.rs
index 12400e3..ff60262 100644
--- a/src/libsyntax_ext/proc_macro_impl.rs
+++ b/src/libsyntax_ext/proc_macro_impl.rs
@@ -12,7 +12,7 @@
use errors::FatalError;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use syntax::ext::base::*;
use syntax::tokenstream::TokenStream;
use syntax::ext::base;
diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs
index 5031182..65e175f 100644
--- a/src/libsyntax_ext/proc_macro_registrar.rs
+++ b/src/libsyntax_ext/proc_macro_registrar.rs
@@ -14,7 +14,7 @@
use syntax::ast::{self, Ident};
use syntax::attr;
-use syntax::codemap::{ExpnInfo, MacroAttribute, hygiene, respan};
+use syntax::source_map::{ExpnInfo, MacroAttribute, hygiene, respan};
use syntax::ext::base::ExtCtxt;
use syntax::ext::build::AstBuilder;
use syntax::ext::expand::ExpansionConfig;
diff --git a/src/libsyntax_pos/analyze_filemap.rs b/src/libsyntax_pos/analyze_filemap.rs
deleted file mode 100644
index c7c0263..0000000
--- a/src/libsyntax_pos/analyze_filemap.rs
+++ /dev/null
@@ -1,436 +0,0 @@
-// 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.
-
-use unicode_width::UnicodeWidthChar;
-use super::*;
-
-/// Find all newlines, multi-byte characters, and non-narrow characters in a
-/// FileMap.
-///
-/// This function will use an SSE2 enhanced implementation if hardware support
-/// is detected at runtime.
-pub fn analyze_filemap(
- src: &str,
- filemap_start_pos: BytePos)
- -> (Vec<BytePos>, Vec<MultiByteChar>, Vec<NonNarrowChar>)
-{
- let mut lines = vec![filemap_start_pos];
- let mut multi_byte_chars = vec![];
- let mut non_narrow_chars = vec![];
-
- // Calls the right implementation, depending on hardware support available.
- analyze_filemap_dispatch(src,
- filemap_start_pos,
- &mut lines,
- &mut multi_byte_chars,
- &mut non_narrow_chars);
-
- // The code above optimistically registers a new line *after* each \n
- // it encounters. If that point is already outside the filemap, remove
- // it again.
- if let Some(&last_line_start) = lines.last() {
- let file_map_end = filemap_start_pos + BytePos::from_usize(src.len());
- assert!(file_map_end >= last_line_start);
- if last_line_start == file_map_end {
- lines.pop();
- }
- }
-
- (lines, multi_byte_chars, non_narrow_chars)
-}
-
-cfg_if! {
- if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"),
- not(stage0)))] {
- fn analyze_filemap_dispatch(src: &str,
- filemap_start_pos: BytePos,
- lines: &mut Vec<BytePos>,
- multi_byte_chars: &mut Vec<MultiByteChar>,
- non_narrow_chars: &mut Vec<NonNarrowChar>) {
- if is_x86_feature_detected!("sse2") {
- unsafe {
- analyze_filemap_sse2(src,
- filemap_start_pos,
- lines,
- multi_byte_chars,
- non_narrow_chars);
- }
- } else {
- analyze_filemap_generic(src,
- src.len(),
- filemap_start_pos,
- lines,
- multi_byte_chars,
- non_narrow_chars);
-
- }
- }
-
- /// Check 16 byte chunks of text at a time. If the chunk contains
- /// something other than printable ASCII characters and newlines, the
- /// function falls back to the generic implementation. Otherwise it uses
- /// SSE2 intrinsics to quickly find all newlines.
- #[target_feature(enable = "sse2")]
- unsafe fn analyze_filemap_sse2(src: &str,
- output_offset: BytePos,
- lines: &mut Vec<BytePos>,
- multi_byte_chars: &mut Vec<MultiByteChar>,
- non_narrow_chars: &mut Vec<NonNarrowChar>) {
- #[cfg(target_arch = "x86")]
- use std::arch::x86::*;
- #[cfg(target_arch = "x86_64")]
- use std::arch::x86_64::*;
-
- const CHUNK_SIZE: usize = 16;
-
- let src_bytes = src.as_bytes();
-
- let chunk_count = src.len() / CHUNK_SIZE;
-
- // This variable keeps track of where we should start decoding a
- // chunk. If a multi-byte character spans across chunk boundaries,
- // we need to skip that part in the next chunk because we already
- // handled it.
- let mut intra_chunk_offset = 0;
-
- for chunk_index in 0 .. chunk_count {
- let ptr = src_bytes.as_ptr() as *const __m128i;
- // We don't know if the pointer is aligned to 16 bytes, so we
- // use `loadu`, which supports unaligned loading.
- let chunk = _mm_loadu_si128(ptr.offset(chunk_index as isize));
-
- // For character in the chunk, see if its byte value is < 0, which
- // indicates that it's part of a UTF-8 char.
- let multibyte_test = _mm_cmplt_epi8(chunk, _mm_set1_epi8(0));
- // Create a bit mask from the comparison results.
- let multibyte_mask = _mm_movemask_epi8(multibyte_test);
-
- // If the bit mask is all zero, we only have ASCII chars here:
- if multibyte_mask == 0 {
- assert!(intra_chunk_offset == 0);
-
- // Check if there are any control characters in the chunk. All
- // control characters that we can encounter at this point have a
- // byte value less than 32 or ...
- let control_char_test0 = _mm_cmplt_epi8(chunk, _mm_set1_epi8(32));
- let control_char_mask0 = _mm_movemask_epi8(control_char_test0);
-
- // ... it's the ASCII 'DEL' character with a value of 127.
- let control_char_test1 = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(127));
- let control_char_mask1 = _mm_movemask_epi8(control_char_test1);
-
- let control_char_mask = control_char_mask0 | control_char_mask1;
-
- if control_char_mask != 0 {
- // Check for newlines in the chunk
- let newlines_test = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8));
- let newlines_mask = _mm_movemask_epi8(newlines_test);
-
- if control_char_mask == newlines_mask {
- // All control characters are newlines, record them
- let mut newlines_mask = 0xFFFF0000 | newlines_mask as u32;
- let output_offset = output_offset +
- BytePos::from_usize(chunk_index * CHUNK_SIZE + 1);
-
- loop {
- let index = newlines_mask.trailing_zeros();
-
- if index >= CHUNK_SIZE as u32 {
- // We have arrived at the end of the chunk.
- break
- }
-
- lines.push(BytePos(index) + output_offset);
-
- // Clear the bit, so we can find the next one.
- newlines_mask &= (!1) << index;
- }
-
- // We are done for this chunk. All control characters were
- // newlines and we took care of those.
- continue
- } else {
- // Some of the control characters are not newlines,
- // fall through to the slow path below.
- }
- } else {
- // No control characters, nothing to record for this chunk
- continue
- }
- }
-
- // The slow path.
- // There are control chars in here, fallback to generic decoding.
- let scan_start = chunk_index * CHUNK_SIZE + intra_chunk_offset;
- intra_chunk_offset = analyze_filemap_generic(
- &src[scan_start .. ],
- CHUNK_SIZE - intra_chunk_offset,
- BytePos::from_usize(scan_start) + output_offset,
- lines,
- multi_byte_chars,
- non_narrow_chars
- );
- }
-
- // There might still be a tail left to analyze
- let tail_start = chunk_count * CHUNK_SIZE + intra_chunk_offset;
- if tail_start < src.len() {
- analyze_filemap_generic(&src[tail_start as usize ..],
- src.len() - tail_start,
- output_offset + BytePos::from_usize(tail_start),
- lines,
- multi_byte_chars,
- non_narrow_chars);
- }
- }
- } else {
-
- // The target (or compiler version) does not support SSE2 ...
- fn analyze_filemap_dispatch(src: &str,
- filemap_start_pos: BytePos,
- lines: &mut Vec<BytePos>,
- multi_byte_chars: &mut Vec<MultiByteChar>,
- non_narrow_chars: &mut Vec<NonNarrowChar>) {
- analyze_filemap_generic(src,
- src.len(),
- filemap_start_pos,
- lines,
- multi_byte_chars,
- non_narrow_chars);
- }
- }
-}
-
-// `scan_len` determines the number of bytes in `src` to scan. Note that the
-// function can read past `scan_len` if a multi-byte character start within the
-// range but extends past it. The overflow is returned by the function.
-fn analyze_filemap_generic(src: &str,
- scan_len: usize,
- output_offset: BytePos,
- lines: &mut Vec<BytePos>,
- multi_byte_chars: &mut Vec<MultiByteChar>,
- non_narrow_chars: &mut Vec<NonNarrowChar>)
- -> usize
-{
- assert!(src.len() >= scan_len);
- let mut i = 0;
- let src_bytes = src.as_bytes();
-
- while i < scan_len {
- let byte = unsafe {
- // We verified that i < scan_len <= src.len()
- *src_bytes.get_unchecked(i as usize)
- };
-
- // How much to advance in order to get to the next UTF-8 char in the
- // string.
- let mut char_len = 1;
-
- if byte < 32 {
- // This is an ASCII control character, it could be one of the cases
- // that are interesting to us.
-
- let pos = BytePos::from_usize(i) + output_offset;
-
- match byte {
- b'\n' => {
- lines.push(pos + BytePos(1));
- }
- b'\t' => {
- non_narrow_chars.push(NonNarrowChar::Tab(pos));
- }
- _ => {
- non_narrow_chars.push(NonNarrowChar::ZeroWidth(pos));
- }
- }
- } else if byte >= 127 {
- // The slow path:
- // This is either ASCII control character "DEL" or the beginning of
- // a multibyte char. Just decode to `char`.
- let c = (&src[i..]).chars().next().unwrap();
- char_len = c.len_utf8();
-
- let pos = BytePos::from_usize(i) + output_offset;
-
- if char_len > 1 {
- assert!(char_len >=2 && char_len <= 4);
- let mbc = MultiByteChar {
- pos,
- bytes: char_len as u8,
- };
- multi_byte_chars.push(mbc);
- }
-
- // Assume control characters are zero width.
- // FIXME: How can we decide between `width` and `width_cjk`?
- let char_width = UnicodeWidthChar::width(c).unwrap_or(0);
-
- if char_width != 1 {
- non_narrow_chars.push(NonNarrowChar::new(pos, char_width));
- }
- }
-
- i += char_len;
- }
-
- i - scan_len
-}
-
-
-
-macro_rules! test {
- (case: $test_name:ident,
- text: $text:expr,
- filemap_start_pos: $filemap_start_pos:expr,
- lines: $lines:expr,
- multi_byte_chars: $multi_byte_chars:expr,
- non_narrow_chars: $non_narrow_chars:expr,) => (
-
- #[test]
- fn $test_name() {
-
- let (lines, multi_byte_chars, non_narrow_chars) =
- analyze_filemap($text, BytePos($filemap_start_pos));
-
- let expected_lines: Vec<BytePos> = $lines
- .into_iter()
- .map(|pos| BytePos(pos))
- .collect();
-
- assert_eq!(lines, expected_lines);
-
- let expected_mbcs: Vec<MultiByteChar> = $multi_byte_chars
- .into_iter()
- .map(|(pos, bytes)| MultiByteChar {
- pos: BytePos(pos),
- bytes,
- })
- .collect();
-
- assert_eq!(multi_byte_chars, expected_mbcs);
-
- let expected_nncs: Vec<NonNarrowChar> = $non_narrow_chars
- .into_iter()
- .map(|(pos, width)| {
- NonNarrowChar::new(BytePos(pos), width)
- })
- .collect();
-
- assert_eq!(non_narrow_chars, expected_nncs);
- })
-}
-
-test!(
- case: empty_text,
- text: "",
- filemap_start_pos: 0,
- lines: vec![],
- multi_byte_chars: vec![],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: newlines_short,
- text: "a\nc",
- filemap_start_pos: 0,
- lines: vec![0, 2],
- multi_byte_chars: vec![],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: newlines_long,
- text: "012345678\nabcdef012345678\na",
- filemap_start_pos: 0,
- lines: vec![0, 10, 26],
- multi_byte_chars: vec![],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: newline_and_multi_byte_char_in_same_chunk,
- text: "01234β789\nbcdef0123456789abcdef",
- filemap_start_pos: 0,
- lines: vec![0, 11],
- multi_byte_chars: vec![(5, 2)],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: newline_and_control_char_in_same_chunk,
- text: "01234\u{07}6789\nbcdef0123456789abcdef",
- filemap_start_pos: 0,
- lines: vec![0, 11],
- multi_byte_chars: vec![],
- non_narrow_chars: vec![(5, 0)],
-);
-
-test!(
- case: multi_byte_char_short,
- text: "aβc",
- filemap_start_pos: 0,
- lines: vec![0],
- multi_byte_chars: vec![(1, 2)],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: multi_byte_char_long,
- text: "0123456789abcΔf012345β",
- filemap_start_pos: 0,
- lines: vec![0],
- multi_byte_chars: vec![(13, 2), (22, 2)],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: multi_byte_char_across_chunk_boundary,
- text: "0123456789abcdeΔ123456789abcdef01234",
- filemap_start_pos: 0,
- lines: vec![0],
- multi_byte_chars: vec![(15, 2)],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: multi_byte_char_across_chunk_boundary_tail,
- text: "0123456789abcdeΔ....",
- filemap_start_pos: 0,
- lines: vec![0],
- multi_byte_chars: vec![(15, 2)],
- non_narrow_chars: vec![],
-);
-
-test!(
- case: non_narrow_short,
- text: "0\t2",
- filemap_start_pos: 0,
- lines: vec![0],
- multi_byte_chars: vec![],
- non_narrow_chars: vec![(1, 4)],
-);
-
-test!(
- case: non_narrow_long,
- text: "01\t3456789abcdef01234567\u{07}9",
- filemap_start_pos: 0,
- lines: vec![0],
- multi_byte_chars: vec![],
- non_narrow_chars: vec![(2, 4), (24, 0)],
-);
-
-test!(
- case: output_offset_all,
- text: "01\t345\n789abcΔf01234567\u{07}9\nbcΔf",
- filemap_start_pos: 1000,
- lines: vec![0 + 1000, 7 + 1000, 27 + 1000],
- multi_byte_chars: vec![(13 + 1000, 2), (29 + 1000, 2)],
- non_narrow_chars: vec![(2 + 1000, 4), (24 + 1000, 0)],
-);
diff --git a/src/libsyntax_pos/analyze_source_file.rs b/src/libsyntax_pos/analyze_source_file.rs
new file mode 100644
index 0000000..e468aaa
--- /dev/null
+++ b/src/libsyntax_pos/analyze_source_file.rs
@@ -0,0 +1,436 @@
+// 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.
+
+use unicode_width::UnicodeWidthChar;
+use super::*;
+
+/// Find all newlines, multi-byte characters, and non-narrow characters in a
+/// SourceFile.
+///
+/// This function will use an SSE2 enhanced implementation if hardware support
+/// is detected at runtime.
+pub fn analyze_source_file(
+ src: &str,
+ source_file_start_pos: BytePos)
+ -> (Vec<BytePos>, Vec<MultiByteChar>, Vec<NonNarrowChar>)
+{
+ let mut lines = vec![source_file_start_pos];
+ let mut multi_byte_chars = vec![];
+ let mut non_narrow_chars = vec![];
+
+ // Calls the right implementation, depending on hardware support available.
+ analyze_source_file_dispatch(src,
+ source_file_start_pos,
+ &mut lines,
+ &mut multi_byte_chars,
+ &mut non_narrow_chars);
+
+ // The code above optimistically registers a new line *after* each \n
+ // it encounters. If that point is already outside the source_file, remove
+ // it again.
+ if let Some(&last_line_start) = lines.last() {
+ let file_map_end = source_file_start_pos + BytePos::from_usize(src.len());
+ assert!(file_map_end >= last_line_start);
+ if last_line_start == file_map_end {
+ lines.pop();
+ }
+ }
+
+ (lines, multi_byte_chars, non_narrow_chars)
+}
+
+cfg_if! {
+ if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"),
+ not(stage0)))] {
+ fn analyze_source_file_dispatch(src: &str,
+ source_file_start_pos: BytePos,
+ lines: &mut Vec<BytePos>,
+ multi_byte_chars: &mut Vec<MultiByteChar>,
+ non_narrow_chars: &mut Vec<NonNarrowChar>) {
+ if is_x86_feature_detected!("sse2") {
+ unsafe {
+ analyze_source_file_sse2(src,
+ source_file_start_pos,
+ lines,
+ multi_byte_chars,
+ non_narrow_chars);
+ }
+ } else {
+ analyze_source_file_generic(src,
+ src.len(),
+ source_file_start_pos,
+ lines,
+ multi_byte_chars,
+ non_narrow_chars);
+
+ }
+ }
+
+ /// Check 16 byte chunks of text at a time. If the chunk contains
+ /// something other than printable ASCII characters and newlines, the
+ /// function falls back to the generic implementation. Otherwise it uses
+ /// SSE2 intrinsics to quickly find all newlines.
+ #[target_feature(enable = "sse2")]
+ unsafe fn analyze_source_file_sse2(src: &str,
+ output_offset: BytePos,
+ lines: &mut Vec<BytePos>,
+ multi_byte_chars: &mut Vec<MultiByteChar>,
+ non_narrow_chars: &mut Vec<NonNarrowChar>) {
+ #[cfg(target_arch = "x86")]
+ use std::arch::x86::*;
+ #[cfg(target_arch = "x86_64")]
+ use std::arch::x86_64::*;
+
+ const CHUNK_SIZE: usize = 16;
+
+ let src_bytes = src.as_bytes();
+
+ let chunk_count = src.len() / CHUNK_SIZE;
+
+ // This variable keeps track of where we should start decoding a
+ // chunk. If a multi-byte character spans across chunk boundaries,
+ // we need to skip that part in the next chunk because we already
+ // handled it.
+ let mut intra_chunk_offset = 0;
+
+ for chunk_index in 0 .. chunk_count {
+ let ptr = src_bytes.as_ptr() as *const __m128i;
+ // We don't know if the pointer is aligned to 16 bytes, so we
+ // use `loadu`, which supports unaligned loading.
+ let chunk = _mm_loadu_si128(ptr.offset(chunk_index as isize));
+
+ // For character in the chunk, see if its byte value is < 0, which
+ // indicates that it's part of a UTF-8 char.
+ let multibyte_test = _mm_cmplt_epi8(chunk, _mm_set1_epi8(0));
+ // Create a bit mask from the comparison results.
+ let multibyte_mask = _mm_movemask_epi8(multibyte_test);
+
+ // If the bit mask is all zero, we only have ASCII chars here:
+ if multibyte_mask == 0 {
+ assert!(intra_chunk_offset == 0);
+
+ // Check if there are any control characters in the chunk. All
+ // control characters that we can encounter at this point have a
+ // byte value less than 32 or ...
+ let control_char_test0 = _mm_cmplt_epi8(chunk, _mm_set1_epi8(32));
+ let control_char_mask0 = _mm_movemask_epi8(control_char_test0);
+
+ // ... it's the ASCII 'DEL' character with a value of 127.
+ let control_char_test1 = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(127));
+ let control_char_mask1 = _mm_movemask_epi8(control_char_test1);
+
+ let control_char_mask = control_char_mask0 | control_char_mask1;
+
+ if control_char_mask != 0 {
+ // Check for newlines in the chunk
+ let newlines_test = _mm_cmpeq_epi8(chunk, _mm_set1_epi8(b'\n' as i8));
+ let newlines_mask = _mm_movemask_epi8(newlines_test);
+
+ if control_char_mask == newlines_mask {
+ // All control characters are newlines, record them
+ let mut newlines_mask = 0xFFFF0000 | newlines_mask as u32;
+ let output_offset = output_offset +
+ BytePos::from_usize(chunk_index * CHUNK_SIZE + 1);
+
+ loop {
+ let index = newlines_mask.trailing_zeros();
+
+ if index >= CHUNK_SIZE as u32 {
+ // We have arrived at the end of the chunk.
+ break
+ }
+
+ lines.push(BytePos(index) + output_offset);
+
+ // Clear the bit, so we can find the next one.
+ newlines_mask &= (!1) << index;
+ }
+
+ // We are done for this chunk. All control characters were
+ // newlines and we took care of those.
+ continue
+ } else {
+ // Some of the control characters are not newlines,
+ // fall through to the slow path below.
+ }
+ } else {
+ // No control characters, nothing to record for this chunk
+ continue
+ }
+ }
+
+ // The slow path.
+ // There are control chars in here, fallback to generic decoding.
+ let scan_start = chunk_index * CHUNK_SIZE + intra_chunk_offset;
+ intra_chunk_offset = analyze_source_file_generic(
+ &src[scan_start .. ],
+ CHUNK_SIZE - intra_chunk_offset,
+ BytePos::from_usize(scan_start) + output_offset,
+ lines,
+ multi_byte_chars,
+ non_narrow_chars
+ );
+ }
+
+ // There might still be a tail left to analyze
+ let tail_start = chunk_count * CHUNK_SIZE + intra_chunk_offset;
+ if tail_start < src.len() {
+ analyze_source_file_generic(&src[tail_start as usize ..],
+ src.len() - tail_start,
+ output_offset + BytePos::from_usize(tail_start),
+ lines,
+ multi_byte_chars,
+ non_narrow_chars);
+ }
+ }
+ } else {
+
+ // The target (or compiler version) does not support SSE2 ...
+ fn analyze_source_file_dispatch(src: &str,
+ source_file_start_pos: BytePos,
+ lines: &mut Vec<BytePos>,
+ multi_byte_chars: &mut Vec<MultiByteChar>,
+ non_narrow_chars: &mut Vec<NonNarrowChar>) {
+ analyze_source_file_generic(src,
+ src.len(),
+ source_file_start_pos,
+ lines,
+ multi_byte_chars,
+ non_narrow_chars);
+ }
+ }
+}
+
+// `scan_len` determines the number of bytes in `src` to scan. Note that the
+// function can read past `scan_len` if a multi-byte character start within the
+// range but extends past it. The overflow is returned by the function.
+fn analyze_source_file_generic(src: &str,
+ scan_len: usize,
+ output_offset: BytePos,
+ lines: &mut Vec<BytePos>,
+ multi_byte_chars: &mut Vec<MultiByteChar>,
+ non_narrow_chars: &mut Vec<NonNarrowChar>)
+ -> usize
+{
+ assert!(src.len() >= scan_len);
+ let mut i = 0;
+ let src_bytes = src.as_bytes();
+
+ while i < scan_len {
+ let byte = unsafe {
+ // We verified that i < scan_len <= src.len()
+ *src_bytes.get_unchecked(i as usize)
+ };
+
+ // How much to advance in order to get to the next UTF-8 char in the
+ // string.
+ let mut char_len = 1;
+
+ if byte < 32 {
+ // This is an ASCII control character, it could be one of the cases
+ // that are interesting to us.
+
+ let pos = BytePos::from_usize(i) + output_offset;
+
+ match byte {
+ b'\n' => {
+ lines.push(pos + BytePos(1));
+ }
+ b'\t' => {
+ non_narrow_chars.push(NonNarrowChar::Tab(pos));
+ }
+ _ => {
+ non_narrow_chars.push(NonNarrowChar::ZeroWidth(pos));
+ }
+ }
+ } else if byte >= 127 {
+ // The slow path:
+ // This is either ASCII control character "DEL" or the beginning of
+ // a multibyte char. Just decode to `char`.
+ let c = (&src[i..]).chars().next().unwrap();
+ char_len = c.len_utf8();
+
+ let pos = BytePos::from_usize(i) + output_offset;
+
+ if char_len > 1 {
+ assert!(char_len >=2 && char_len <= 4);
+ let mbc = MultiByteChar {
+ pos,
+ bytes: char_len as u8,
+ };
+ multi_byte_chars.push(mbc);
+ }
+
+ // Assume control characters are zero width.
+ // FIXME: How can we decide between `width` and `width_cjk`?
+ let char_width = UnicodeWidthChar::width(c).unwrap_or(0);
+
+ if char_width != 1 {
+ non_narrow_chars.push(NonNarrowChar::new(pos, char_width));
+ }
+ }
+
+ i += char_len;
+ }
+
+ i - scan_len
+}
+
+
+
+macro_rules! test {
+ (case: $test_name:ident,
+ text: $text:expr,
+ source_file_start_pos: $source_file_start_pos:expr,
+ lines: $lines:expr,
+ multi_byte_chars: $multi_byte_chars:expr,
+ non_narrow_chars: $non_narrow_chars:expr,) => (
+
+ #[test]
+ fn $test_name() {
+
+ let (lines, multi_byte_chars, non_narrow_chars) =
+ analyze_source_file($text, BytePos($source_file_start_pos));
+
+ let expected_lines: Vec<BytePos> = $lines
+ .into_iter()
+ .map(|pos| BytePos(pos))
+ .collect();
+
+ assert_eq!(lines, expected_lines);
+
+ let expected_mbcs: Vec<MultiByteChar> = $multi_byte_chars
+ .into_iter()
+ .map(|(pos, bytes)| MultiByteChar {
+ pos: BytePos(pos),
+ bytes,
+ })
+ .collect();
+
+ assert_eq!(multi_byte_chars, expected_mbcs);
+
+ let expected_nncs: Vec<NonNarrowChar> = $non_narrow_chars
+ .into_iter()
+ .map(|(pos, width)| {
+ NonNarrowChar::new(BytePos(pos), width)
+ })
+ .collect();
+
+ assert_eq!(non_narrow_chars, expected_nncs);
+ })
+}
+
+test!(
+ case: empty_text,
+ text: "",
+ source_file_start_pos: 0,
+ lines: vec![],
+ multi_byte_chars: vec![],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: newlines_short,
+ text: "a\nc",
+ source_file_start_pos: 0,
+ lines: vec![0, 2],
+ multi_byte_chars: vec![],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: newlines_long,
+ text: "012345678\nabcdef012345678\na",
+ source_file_start_pos: 0,
+ lines: vec![0, 10, 26],
+ multi_byte_chars: vec![],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: newline_and_multi_byte_char_in_same_chunk,
+ text: "01234β789\nbcdef0123456789abcdef",
+ source_file_start_pos: 0,
+ lines: vec![0, 11],
+ multi_byte_chars: vec![(5, 2)],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: newline_and_control_char_in_same_chunk,
+ text: "01234\u{07}6789\nbcdef0123456789abcdef",
+ source_file_start_pos: 0,
+ lines: vec![0, 11],
+ multi_byte_chars: vec![],
+ non_narrow_chars: vec![(5, 0)],
+);
+
+test!(
+ case: multi_byte_char_short,
+ text: "aβc",
+ source_file_start_pos: 0,
+ lines: vec![0],
+ multi_byte_chars: vec![(1, 2)],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: multi_byte_char_long,
+ text: "0123456789abcΔf012345β",
+ source_file_start_pos: 0,
+ lines: vec![0],
+ multi_byte_chars: vec![(13, 2), (22, 2)],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: multi_byte_char_across_chunk_boundary,
+ text: "0123456789abcdeΔ123456789abcdef01234",
+ source_file_start_pos: 0,
+ lines: vec![0],
+ multi_byte_chars: vec![(15, 2)],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: multi_byte_char_across_chunk_boundary_tail,
+ text: "0123456789abcdeΔ....",
+ source_file_start_pos: 0,
+ lines: vec![0],
+ multi_byte_chars: vec![(15, 2)],
+ non_narrow_chars: vec![],
+);
+
+test!(
+ case: non_narrow_short,
+ text: "0\t2",
+ source_file_start_pos: 0,
+ lines: vec![0],
+ multi_byte_chars: vec![],
+ non_narrow_chars: vec![(1, 4)],
+);
+
+test!(
+ case: non_narrow_long,
+ text: "01\t3456789abcdef01234567\u{07}9",
+ source_file_start_pos: 0,
+ lines: vec![0],
+ multi_byte_chars: vec![],
+ non_narrow_chars: vec![(2, 4), (24, 0)],
+);
+
+test!(
+ case: output_offset_all,
+ text: "01\t345\n789abcΔf01234567\u{07}9\nbcΔf",
+ source_file_start_pos: 1000,
+ lines: vec![0 + 1000, 7 + 1000, 27 + 1000],
+ multi_byte_chars: vec![(13 + 1000, 2), (29 + 1000, 2)],
+ non_narrow_chars: vec![(2 + 1000, 4), (24 + 1000, 0)],
+);
diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs
index 44cd532..bd70344 100644
--- a/src/libsyntax_pos/lib.rs
+++ b/src/libsyntax_pos/lib.rs
@@ -21,6 +21,7 @@
#![feature(const_fn)]
#![feature(crate_visibility_modifier)]
#![feature(custom_attribute)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(non_exhaustive)]
#![feature(optin_builtin_traits)]
#![feature(specialization)]
@@ -62,7 +63,7 @@
pub mod symbol;
-mod analyze_filemap;
+mod analyze_source_file;
pub struct Globals {
symbol_interner: Lock<symbol::Interner>,
@@ -161,11 +162,11 @@
}
/// Spans represent a region of code, used for error reporting. Positions in spans
-/// are *absolute* positions from the beginning of the codemap, not positions
-/// relative to FileMaps. Methods on the CodeMap can be used to relate spans back
+/// are *absolute* positions from the beginning of the source_map, not positions
+/// relative to SourceFiles. Methods on the SourceMap can be used to relate spans back
/// to the original source.
/// You must be careful if the span crosses more than one file - you will not be
-/// able to use many of the functions on spans in codemap and you cannot assume
+/// able to use many of the functions on spans in source_map and you cannot assume
/// that the length of the span = hi - lo; there may be space in the BytePos
/// range between files.
///
@@ -674,16 +675,16 @@
pub const NO_EXPANSION: SyntaxContext = SyntaxContext::empty();
-/// Identifies an offset of a multi-byte character in a FileMap
+/// Identifies an offset of a multi-byte character in a SourceFile
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)]
pub struct MultiByteChar {
- /// The absolute offset of the character in the CodeMap
+ /// The absolute offset of the character in the SourceMap
pub pos: BytePos,
/// The number of bytes, >=2
pub bytes: u8,
}
-/// Identifies an offset of a non-narrow character in a FileMap
+/// Identifies an offset of a non-narrow character in a SourceFile
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Eq, PartialEq, Debug)]
pub enum NonNarrowChar {
/// Represents a zero-width character
@@ -704,7 +705,7 @@
}
}
- /// Returns the absolute offset of the character in the CodeMap
+ /// Returns the absolute offset of the character in the SourceMap
pub fn pos(&self) -> BytePos {
match *self {
NonNarrowChar::ZeroWidth(p) |
@@ -747,7 +748,7 @@
}
}
-/// The state of the lazy external source loading mechanism of a FileMap.
+/// The state of the lazy external source loading mechanism of a SourceFile.
#[derive(PartialEq, Eq, Clone)]
pub enum ExternalSource {
/// The external source has been loaded already.
@@ -756,7 +757,7 @@
AbsentOk,
/// A failed attempt has been made to load the external source.
AbsentErr,
- /// No external source has to be loaded, since the FileMap represents a local crate.
+ /// No external source has to be loaded, since the SourceFile represents a local crate.
Unneeded,
}
@@ -776,9 +777,9 @@
}
}
-/// A single source in the CodeMap.
+/// A single source in the SourceMap.
#[derive(Clone)]
-pub struct FileMap {
+pub struct SourceFile {
/// The name of the file that the source came from, source that doesn't
/// originate from files has names between angle brackets by convention,
/// e.g. `<anon>`
@@ -786,9 +787,9 @@
/// True if the `name` field above has been modified by --remap-path-prefix
pub name_was_remapped: bool,
/// The unmapped path of the file that the source came from.
- /// Set to `None` if the FileMap was imported from an external crate.
+ /// Set to `None` if the SourceFile was imported from an external crate.
pub unmapped_path: Option<FileName>,
- /// Indicates which crate this FileMap was imported from.
+ /// Indicates which crate this SourceFile was imported from.
pub crate_of_origin: u32,
/// The complete source code
pub src: Option<Lrc<String>>,
@@ -797,9 +798,9 @@
/// The external source code (used for external crates, which will have a `None`
/// value as `self.src`.
pub external_src: Lock<ExternalSource>,
- /// The start position of this source in the CodeMap
+ /// The start position of this source in the SourceMap
pub start_pos: BytePos,
- /// The end position of this source in the CodeMap
+ /// The end position of this source in the SourceMap
pub end_pos: BytePos,
/// Locations of lines beginnings in the source code
pub lines: Vec<BytePos>,
@@ -811,9 +812,9 @@
pub name_hash: u128,
}
-impl Encodable for FileMap {
+impl Encodable for SourceFile {
fn encode<S: Encoder>(&self, s: &mut S) -> Result<(), S::Error> {
- s.emit_struct("FileMap", 8, |s| {
+ s.emit_struct("SourceFile", 8, |s| {
s.emit_struct_field("name", 0, |s| self.name.encode(s))?;
s.emit_struct_field("name_was_remapped", 1, |s| self.name_was_remapped.encode(s))?;
s.emit_struct_field("src_hash", 2, |s| self.src_hash.encode(s))?;
@@ -878,10 +879,10 @@
}
}
-impl Decodable for FileMap {
- fn decode<D: Decoder>(d: &mut D) -> Result<FileMap, D::Error> {
+impl Decodable for SourceFile {
+ fn decode<D: Decoder>(d: &mut D) -> Result<SourceFile, D::Error> {
- d.read_struct("FileMap", 8, |d| {
+ d.read_struct("SourceFile", 8, |d| {
let name: FileName = d.read_struct_field("name", 0, |d| Decodable::decode(d))?;
let name_was_remapped: bool =
d.read_struct_field("name_was_remapped", 1, |d| Decodable::decode(d))?;
@@ -924,7 +925,7 @@
d.read_struct_field("non_narrow_chars", 8, |d| Decodable::decode(d))?;
let name_hash: u128 =
d.read_struct_field("name_hash", 9, |d| Decodable::decode(d))?;
- Ok(FileMap {
+ Ok(SourceFile {
name,
name_was_remapped,
unmapped_path: None,
@@ -946,18 +947,18 @@
}
}
-impl fmt::Debug for FileMap {
+impl fmt::Debug for SourceFile {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
- write!(fmt, "FileMap({})", self.name)
+ write!(fmt, "SourceFile({})", self.name)
}
}
-impl FileMap {
+impl SourceFile {
pub fn new(name: FileName,
name_was_remapped: bool,
unmapped_path: FileName,
mut src: String,
- start_pos: BytePos) -> FileMap {
+ start_pos: BytePos) -> SourceFile {
remove_bom(&mut src);
let src_hash = {
@@ -973,9 +974,9 @@
let end_pos = start_pos.to_usize() + src.len();
let (lines, multibyte_chars, non_narrow_chars) =
- analyze_filemap::analyze_filemap(&src[..], start_pos);
+ analyze_source_file::analyze_source_file(&src[..], start_pos);
- FileMap {
+ SourceFile {
name,
name_was_remapped,
unmapped_path: Some(unmapped_path),
@@ -1080,8 +1081,8 @@
}
/// Find the line containing the given position. The return value is the
- /// index into the `lines` array of this FileMap, not the 1-based line
- /// number. If the filemap is empty or the position is located before the
+ /// index into the `lines` array of this SourceFile, not the 1-based line
+ /// number. If the source_file is empty or the position is located before the
/// first line, None is returned.
pub fn lookup_line(&self, pos: BytePos) -> Option<usize> {
if self.lines.len() == 0 {
@@ -1140,7 +1141,7 @@
pub struct BytePos(pub u32);
/// A character offset. Because of multibyte utf8 characters, a byte offset
-/// is not equivalent to a character offset. The CodeMap will convert BytePos
+/// is not equivalent to a character offset. The SourceMap will convert BytePos
/// values to CharPos values as necessary.
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
pub struct CharPos(pub usize);
@@ -1225,14 +1226,14 @@
}
// _____________________________________________________________________________
-// Loc, LocWithOpt, FileMapAndLine, FileMapAndBytePos
+// Loc, LocWithOpt, SourceFileAndLine, SourceFileAndBytePos
//
/// A source code location used for error reporting
#[derive(Debug, Clone)]
pub struct Loc {
/// Information about the original source
- pub file: Lrc<FileMap>,
+ pub file: Lrc<SourceFile>,
/// The (1-based) line number
pub line: usize,
/// The (0-based) column offset
@@ -1249,14 +1250,14 @@
pub filename: FileName,
pub line: usize,
pub col: CharPos,
- pub file: Option<Lrc<FileMap>>,
+ pub file: Option<Lrc<SourceFile>>,
}
// used to be structural records. Better names, anyone?
#[derive(Debug)]
-pub struct FileMapAndLine { pub fm: Lrc<FileMap>, pub line: usize }
+pub struct SourceFileAndLine { pub fm: Lrc<SourceFile>, pub line: usize }
#[derive(Debug)]
-pub struct FileMapAndBytePos { pub fm: Lrc<FileMap>, pub pos: BytePos }
+pub struct SourceFileAndBytePos { pub fm: Lrc<SourceFile>, pub pos: BytePos }
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct LineInfo {
@@ -1271,7 +1272,7 @@
}
pub struct FileLines {
- pub file: Lrc<FileMap>,
+ pub file: Lrc<SourceFile>,
pub lines: Vec<LineInfo>
}
diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs
index cf92ce2..a49fd67 100644
--- a/src/libterm/lib.rs
+++ b/src/libterm/lib.rs
@@ -50,6 +50,7 @@
#![cfg_attr(windows, feature(libc))]
// Handle rustfmt skips
#![feature(custom_attribute)]
+#![cfg_attr(not(stage0), feature(nll))]
#![allow(unused_attributes)]
use std::io::prelude::*;
diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs
index 51e0fa3..adfc707 100644
--- a/src/libterm/terminfo/mod.rs
+++ b/src/libterm/terminfo/mod.rs
@@ -60,8 +60,8 @@
fn cause(&self) -> Option<&dyn error::Error> {
use self::Error::*;
- match self {
- &IoError(ref e) => Some(e),
+ match *self {
+ IoError(ref e) => Some(e),
_ => None,
}
}
@@ -70,10 +70,10 @@
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::Error::*;
- match self {
- &TermUnset => Ok(()),
- &MalformedTerminfo(ref e) => e.fmt(f),
- &IoError(ref e) => e.fmt(f),
+ match *self {
+ TermUnset => Ok(()),
+ MalformedTerminfo(ref e) => e.fmt(f),
+ IoError(ref e) => e.fmt(f),
}
}
}
@@ -109,9 +109,9 @@
}
// Keep the metadata small
fn _from_path(path: &Path) -> Result<TermInfo, Error> {
- let file = File::open(path).map_err(|e| Error::IoError(e))?;
+ let file = File::open(path).map_err(Error::IoError)?;
let mut reader = BufReader::new(file);
- parse(&mut reader, false).map_err(|e| Error::MalformedTerminfo(e))
+ parse(&mut reader, false).map_err(Error::MalformedTerminfo)
}
}
diff --git a/src/libterm/terminfo/parm.rs b/src/libterm/terminfo/parm.rs
index b720d55..31e1b18 100644
--- a/src/libterm/terminfo/parm.rs
+++ b/src/libterm/terminfo/parm.rs
@@ -12,8 +12,6 @@
use self::Param::*;
use self::States::*;
-use self::FormatState::*;
-use self::FormatOp::*;
use std::iter::repeat;
@@ -36,9 +34,9 @@
#[derive(Copy, PartialEq, Clone)]
enum FormatState {
- FormatStateFlags,
- FormatStateWidth,
- FormatStatePrecision,
+ Flags,
+ Width,
+ Precision,
}
/// Types of parameters a capability can use
@@ -210,22 +208,22 @@
if let Some(arg) = stack.pop() {
let flags = Flags::new();
let res = format(arg, FormatOp::from_char(cur), flags)?;
- output.extend(res.iter().map(|x| *x));
+ output.extend(res.iter().cloned());
} else {
return Err("stack is empty".to_string());
}
}
':' | '#' | ' ' | '.' | '0'..='9' => {
let mut flags = Flags::new();
- let mut fstate = FormatStateFlags;
+ let mut fstate = FormatState::Flags;
match cur {
':' => (),
'#' => flags.alternate = true,
' ' => flags.space = true,
- '.' => fstate = FormatStatePrecision,
+ '.' => fstate = FormatState::Precision,
'0'..='9' => {
flags.width = cur as usize - '0' as usize;
- fstate = FormatStateWidth;
+ fstate = FormatState::Width;
}
_ => unreachable!(),
}
@@ -318,43 +316,43 @@
(_, 'd') | (_, 'o') | (_, 'x') | (_, 'X') | (_, 's') => {
if let Some(arg) = stack.pop() {
let res = format(arg, FormatOp::from_char(cur), *flags)?;
- output.extend(res.iter().map(|x| *x));
+ output.extend(res.iter().cloned());
// will cause state to go to Nothing
old_state = FormatPattern(*flags, *fstate);
} else {
return Err("stack is empty".to_string());
}
}
- (FormatStateFlags, '#') => {
+ (FormatState::Flags, '#') => {
flags.alternate = true;
}
- (FormatStateFlags, '-') => {
+ (FormatState::Flags, '-') => {
flags.left = true;
}
- (FormatStateFlags, '+') => {
+ (FormatState::Flags, '+') => {
flags.sign = true;
}
- (FormatStateFlags, ' ') => {
+ (FormatState::Flags, ' ') => {
flags.space = true;
}
- (FormatStateFlags, '0'..='9') => {
+ (FormatState::Flags, '0'..='9') => {
flags.width = cur as usize - '0' as usize;
- *fstate = FormatStateWidth;
+ *fstate = FormatState::Width;
}
- (FormatStateFlags, '.') => {
- *fstate = FormatStatePrecision;
+ (FormatState::Flags, '.') => {
+ *fstate = FormatState::Precision;
}
- (FormatStateWidth, '0'..='9') => {
+ (FormatState::Width, '0'..='9') => {
let old = flags.width;
flags.width = flags.width * 10 + (cur as usize - '0' as usize);
if flags.width < old {
return Err("format width overflow".to_string());
}
}
- (FormatStateWidth, '.') => {
- *fstate = FormatStatePrecision;
+ (FormatState::Width, '.') => {
+ *fstate = FormatState::Precision;
}
- (FormatStatePrecision, '0'..='9') => {
+ (FormatState::Precision, '0'..='9') => {
let old = flags.precision;
flags.precision = flags.precision * 10 + (cur as usize - '0' as usize);
if flags.precision < old {
@@ -437,31 +435,31 @@
#[derive(Copy, Clone)]
enum FormatOp {
- FormatDigit,
- FormatOctal,
- FormatHex,
- FormatHEX,
- FormatString,
+ Digit,
+ Octal,
+ LowerHex,
+ UpperHex,
+ String,
}
impl FormatOp {
fn from_char(c: char) -> FormatOp {
match c {
- 'd' => FormatDigit,
- 'o' => FormatOctal,
- 'x' => FormatHex,
- 'X' => FormatHEX,
- 's' => FormatString,
+ 'd' => FormatOp::Digit,
+ 'o' => FormatOp::Octal,
+ 'x' => FormatOp::LowerHex,
+ 'X' => FormatOp::UpperHex,
+ 's' => FormatOp::String,
_ => panic!("bad FormatOp char"),
}
}
fn to_char(self) -> char {
match self {
- FormatDigit => 'd',
- FormatOctal => 'o',
- FormatHex => 'x',
- FormatHEX => 'X',
- FormatString => 's',
+ FormatOp::Digit => 'd',
+ FormatOp::Octal => 'o',
+ FormatOp::LowerHex => 'x',
+ FormatOp::UpperHex => 'X',
+ FormatOp::String => 's',
}
}
}
@@ -470,7 +468,7 @@
let mut s = match val {
Number(d) => {
match op {
- FormatDigit => {
+ FormatOp::Digit => {
if flags.sign {
format!("{:+01$}", d, flags.precision)
} else if d < 0 {
@@ -482,7 +480,7 @@
format!("{:01$}", d, flags.precision)
}
}
- FormatOctal => {
+ FormatOp::Octal => {
if flags.alternate {
// Leading octal zero counts against precision.
format!("0{:01$o}", d, flags.precision.saturating_sub(1))
@@ -490,27 +488,27 @@
format!("{:01$o}", d, flags.precision)
}
}
- FormatHex => {
+ FormatOp::LowerHex => {
if flags.alternate && d != 0 {
format!("0x{:01$x}", d, flags.precision)
} else {
format!("{:01$x}", d, flags.precision)
}
}
- FormatHEX => {
+ FormatOp::UpperHex => {
if flags.alternate && d != 0 {
format!("0X{:01$X}", d, flags.precision)
} else {
format!("{:01$X}", d, flags.precision)
}
}
- FormatString => return Err("non-number on stack with %s".to_string()),
+ FormatOp::String => return Err("non-number on stack with %s".to_string()),
}
.into_bytes()
}
Words(s) => {
match op {
- FormatString => {
+ FormatOp::String => {
let mut s = s.into_bytes();
if flags.precision > 0 && flags.precision < s.len() {
s.truncate(flags.precision);
diff --git a/src/libterm/win.rs b/src/libterm/win.rs
index d36b182..e0b60ee 100644
--- a/src/libterm/win.rs
+++ b/src/libterm/win.rs
@@ -198,11 +198,11 @@
Ok(true)
}
- fn get_ref<'a>(&'a self) -> &'a T {
+ fn get_ref(&self) -> &T {
&self.buf
}
- fn get_mut<'a>(&'a mut self) -> &'a mut T {
+ fn get_mut(&mut self) -> &mut T {
&mut self.buf
}
diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs
index 3f8be97..060ea1e 100644
--- a/src/libtest/lib.rs
+++ b/src/libtest/lib.rs
@@ -35,6 +35,7 @@
#![feature(asm)]
#![feature(fnbox)]
#![cfg_attr(any(unix, target_os = "cloudabi"), feature(libc))]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(set_stdio)]
#![feature(panic_unwind)]
#![feature(staged_api)]
@@ -323,7 +324,14 @@
/// test is considered a failure. By default, invokes `report()`
/// and checks for a `0` result.
pub fn assert_test_result<T: Termination>(result: T) {
- assert_eq!(result.report(), 0);
+ let code = result.report();
+ assert_eq!(
+ code,
+ 0,
+ "the test returned a termination value with a non-zero status code ({}) \
+ which indicates a failure",
+ code
+ );
}
#[derive(Copy, Clone, Debug)]
diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
index 2b3c19c..424a7e3 100644
--- a/src/libunwind/lib.rs
+++ b/src/libunwind/lib.rs
@@ -13,6 +13,7 @@
#![feature(cfg_target_vendor)]
#![feature(link_cfg)]
+#![cfg_attr(not(stage0), feature(nll))]
#![feature(staged_api)]
#![feature(unwind_attributes)]
#![feature(static_nobundle)]
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 7305dc7..d9fbd49 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -366,7 +366,8 @@
bool PositionIndependentExecutable, bool FunctionSections,
bool DataSections,
bool TrapUnreachable,
- bool Singlethread) {
+ bool Singlethread,
+ bool AsmComments) {
auto OptLevel = fromRust(RustOptLevel);
auto RM = fromRust(RustReloc);
@@ -393,6 +394,8 @@
}
Options.DataSections = DataSections;
Options.FunctionSections = FunctionSections;
+ Options.MCOptions.AsmVerbose = AsmComments;
+ Options.MCOptions.PreserveAsmComments = AsmComments;
if (TrapUnreachable) {
// Tell LLVM to codegen `unreachable` into an explicit trap instruction.
diff --git a/src/test/COMPILER_TESTS.md b/src/test/COMPILER_TESTS.md
index 7dabb1b..81a46ea 100644
--- a/src/test/COMPILER_TESTS.md
+++ b/src/test/COMPILER_TESTS.md
@@ -1,186 +1,4 @@
# Compiler Test Documentation
-In the Rust project, we use a special set of commands embedded in
-comments to test the Rust compiler. There are two groups of commands:
-
-1. Header commands
-2. Error info commands
-
-Both types of commands are inside comments, but header commands should
-be in a comment before any code.
-
-## Summary of Error Info Commands
-
-Error commands specify something about certain lines of the
-program. They tell the test what kind of error and what message you
-are expecting.
-
-* `~`: Associates the following error level and message with the
- current line
-* `~|`: Associates the following error level and message with the same
- line as the previous comment
-* `~^`: Associates the following error level and message with the
- previous line. Each caret (`^`) that you add adds a line to this, so
- `~^^^^^^^` is seven lines up.
-
-The error levels that you can have are:
-
-1. `ERROR`
-2. `WARNING`
-3. `NOTE`
-4. `HELP` and `SUGGESTION`*
-
-\* **Note**: `SUGGESTION` must follow immediately after `HELP`.
-
-## Summary of Header Commands
-
-Header commands specify something about the entire test file as a
-whole. They are normally put right after the copyright comment, e.g.:
-
-```Rust
-// Copyright blah blah blah
-// except according to those terms.
-
-// ignore-test This doesn't actually work
-```
-
-### Ignoring tests
-
-These are used to ignore the test in some situations, which means the test won't
-be compiled or run.
-
-* `ignore-X` where `X` is a target detail or stage will ignore the test accordingly (see below)
-* `ignore-pretty` will not compile the pretty-printed test (this is done to test the pretty-printer, but might not always work)
-* `ignore-test` always ignores the test
-* `ignore-lldb` and `ignore-gdb` will skip a debuginfo test on that debugger.
-
-`only-X` is the opposite. The test will run only when `X` matches.
-
-Some examples of `X` in `ignore-X`:
-
-* Architecture: `aarch64`, `arm`, `asmjs`, `mips`, `wasm32`, `x86_64`, `x86`, ...
-* OS: `android`, `emscripten`, `freebsd`, `ios`, `linux`, `macos`, `windows`, ...
-* Environment (fourth word of the target triple): `gnu`, `msvc`, `musl`.
-* Pointer width: `32bit`, `64bit`.
-* Stage: `stage0`, `stage1`, `stage2`.
-
-### Other Header Commands
-
-* `min-{gdb,lldb}-version`
-* `min-llvm-version`
-* `compile-pass` for UI tests, indicates that the test is supposed
- to compile, as opposed to the default where the test is supposed to error out.
-* `compile-flags` passes extra command-line args to the compiler,
- e.g. `compile-flags -g` which forces debuginfo to be enabled.
-* `should-fail` indicates that the test should fail; used for "meta testing",
- where we test the compiletest program itself to check that it will generate
- errors in appropriate scenarios. This header is ignored for pretty-printer tests.
-* `gate-test-X` where `X` is a feature marks the test as "gate test" for feature X.
- Such tests are supposed to ensure that the compiler errors when usage of a gated
- feature is attempted without the proper `#![feature(X)]` tag.
- Each unstable lang feature is required to have a gate test.
-
-## Revisions
-
-Certain classes of tests support "revisions" (as of the time of this
-writing, this includes run-pass, compile-fail, run-fail, and
-incremental, though incremental tests are somewhat
-different). Revisions allow a single test file to be used for multiple
-tests. This is done by adding a special header at the top of the file:
-
-```
-// revisions: foo bar baz
-```
-
-This will result in the test being compiled (and tested) three times,
-once with `--cfg foo`, once with `--cfg bar`, and once with `--cfg
-baz`. You can therefore use `#[cfg(foo)]` etc within the test to tweak
-each of these results.
-
-You can also customize headers and expected error messages to a particular
-revision. To do this, add `[foo]` (or `bar`, `baz`, etc) after the `//`
-comment, like so:
-
-```
-// A flag to pass in only for cfg `foo`:
-//[foo]compile-flags: -Z verbose
-
-#[cfg(foo)]
-fn test_foo() {
- let x: usize = 32_u32; //[foo]~ ERROR mismatched types
-}
-```
-
-Note that not all headers have meaning when customized to a revision.
-For example, the `ignore-test` header (and all "ignore" headers)
-currently only apply to the test as a whole, not to particular
-revisions. The only headers that are intended to really work when
-customized to a revision are error patterns and compiler flags.
-
-## Guide to the UI Tests
-
-The UI tests are intended to capture the compiler's complete output,
-so that we can test all aspects of the presentation. They work by
-compiling a file (e.g., `ui/hello_world/main.rs`), capturing the output,
-and then applying some normalization (see below). This normalized
-result is then compared against reference files named
-`ui/hello_world/main.stderr` and `ui/hello_world/main.stdout`. If either of
-those files doesn't exist, the output must be empty. If the test run
-fails, we will print out the current output, but it is also saved in
-`build/<target-triple>/test/ui/hello_world/main.stdout` (this path is
-printed as part of the test failure message), so you can run `diff` and
-so forth.
-
-Normally, the test-runner checks that UI tests fail compilation. If you want
-to do a UI test for code that *compiles* (e.g. to test warnings, or if you
-have a collection of tests, only some of which error out), you can use the
-`// compile-pass` header command to have the test runner instead
-check that the test compiles successfully.
-
-### Editing and updating the reference files
-
-If you have changed the compiler's output intentionally, or you are
-making a new test, you can pass `--bless` to the command you used to
-run the tests. This will then copy over the files
-from the build directory and use them as the new reference.
-
-### Normalization
-
-The normalization applied is aimed at eliminating output difference
-between platforms, mainly about filenames:
-
-- the test directory is replaced with `$DIR`
-- all backslashes (`\`) are converted to forward slashes (`/`) (for Windows)
-- all CR LF newlines are converted to LF
-
-Sometimes these built-in normalizations are not enough. In such cases, you
-may provide custom normalization rules using the header commands, e.g.
-
-```
-// normalize-stdout-test: "foo" -> "bar"
-// normalize-stderr-32bit: "fn\(\) \(32 bits\)" -> "fn\(\) \($$PTR bits\)"
-// normalize-stderr-64bit: "fn\(\) \(64 bits\)" -> "fn\(\) \($$PTR bits\)"
-```
-
-This tells the test, on 32-bit platforms, whenever the compiler writes
-`fn() (32 bits)` to stderr, it should be normalized to read `fn() ($PTR bits)`
-instead. Similar for 64-bit. The replacement is performed by regexes using
-default regex flavor provided by `regex` crate.
-
-The corresponding reference file will use the normalized output to test both
-32-bit and 64-bit platforms:
-
-```
-...
- |
- = note: source type: fn() ($PTR bits)
- = note: target type: u16 (16 bits)
-...
-```
-
-Please see `ui/transmute/main.rs` and `.stderr` for a concrete usage example.
-
-Besides `normalize-stderr-32bit` and `-64bit`, one may use any target
-information or stage supported by `ignore-X` here as well (e.g.
-`normalize-stderr-windows` or simply `normalize-stderr-test` for unconditional
-replacement).
+Documentation the compiler testing framework has moved to
+[the rustc guide](https://rust-lang-nursery.github.io/rustc-guide/tests/intro.html).
diff --git a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs
index 49e4b8d..cec88f1 100644
--- a/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs
+++ b/src/test/codegen-units/item-collection/drop_in_place_intrinsic.rs
@@ -14,7 +14,7 @@
#![feature(start)]
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<drop_in_place_intrinsic::StructWithDtor[0]> @@ drop_in_place_intrinsic-cgu.0[Internal]
struct StructWithDtor(u32);
impl Drop for StructWithDtor {
@@ -26,7 +26,7 @@
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]; 2]> @@ drop_in_place_intrinsic-cgu.0[Internal]
let x = [StructWithDtor(0), StructWithDtor(1)];
drop_slice_in_place(&x);
@@ -40,7 +40,7 @@
// This is the interesting thing in this test case: Normally we would
// not have drop-glue for the unsized [StructWithDtor]. This has to be
// generated though when the drop_in_place() intrinsic is used.
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<[drop_in_place_intrinsic::StructWithDtor[0]]> @@ drop_in_place_intrinsic-cgu.0[Internal]
::std::ptr::drop_in_place(x as *const _ as *mut [StructWithDtor]);
}
}
diff --git a/src/test/codegen-units/item-collection/generic-drop-glue.rs b/src/test/codegen-units/item-collection/generic-drop-glue.rs
index aad32d1..5afa519 100644
--- a/src/test/codegen-units/item-collection/generic-drop-glue.rs
+++ b/src/test/codegen-units/item-collection/generic-drop-glue.rs
@@ -47,7 +47,7 @@
struct NonGenericNoDrop(i32);
struct NonGenericWithDrop(i32);
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::NonGenericWithDrop[0]> @@ generic_drop_glue-cgu.0[Internal]
impl Drop for NonGenericWithDrop {
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[2]::drop[0]
@@ -57,11 +57,11 @@
//~ MONO_ITEM fn generic_drop_glue::start[0]
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<i8, char>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<i8, char>
let _ = StructWithDrop { x: 0i8, y: 'a' }.x;
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructWithDrop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[0]::drop[0]<&str, generic_drop_glue::NonGenericNoDrop[0]>
let _ = StructWithDrop { x: "&str", y: NonGenericNoDrop(0) }.y;
@@ -70,17 +70,17 @@
// This is supposed to generate drop-glue because it contains a field that
// needs to be dropped.
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::StructNoDrop[0]<generic_drop_glue::NonGenericWithDrop[0], f64>> @@ generic_drop_glue-cgu.0[Internal]
let _ = StructNoDrop { x: NonGenericWithDrop(0), y: 0f64 }.y;
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<i32, i64>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<i32, i64>
let _ = match EnumWithDrop::A::<i32, i64>(0) {
EnumWithDrop::A(x) => x,
EnumWithDrop::B(x) => x as i32
};
- //~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue0[Internal]
+ //~MONO_ITEM fn core::ptr[0]::drop_in_place[0]<generic_drop_glue::EnumWithDrop[0]<f64, f32>> @@ generic_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn generic_drop_glue::{{impl}}[1]::drop[0]<f64, f32>
let _ = match EnumWithDrop::B::<f64, f32>(1.0) {
EnumWithDrop::A(x) => x,
diff --git a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs
index 5c6201d..d09d343 100644
--- a/src/test/codegen-units/item-collection/instantiation-through-vtable.rs
+++ b/src/test/codegen-units/item-collection/instantiation-through-vtable.rs
@@ -34,13 +34,13 @@
fn start(_: isize, _: *const *const u8) -> isize {
let s1 = Struct { _a: 0u32 };
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u32>> @@ instantiation_through_vtable-cgu.0[Internal]
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u32>
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u32>
let _ = &s1 as &Trait;
let s1 = Struct { _a: 0u64 };
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<instantiation_through_vtable::Struct[0]<u64>> @@ instantiation_through_vtable-cgu.0[Internal]
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::foo[0]<u64>
//~ MONO_ITEM fn instantiation_through_vtable::{{impl}}[0]::bar[0]<u64>
let _ = &s1 as &Trait;
diff --git a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs
index 6ca24aa..a939dd5 100644
--- a/src/test/codegen-units/item-collection/non-generic-drop-glue.rs
+++ b/src/test/codegen-units/item-collection/non-generic-drop-glue.rs
@@ -15,7 +15,7 @@
#![deny(dead_code)]
#![feature(start)]
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::StructWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
struct StructWithDrop {
x: i32
}
@@ -29,7 +29,7 @@
x: i32
}
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<non_generic_drop_glue::EnumWithDrop[0]> @@ non_generic_drop_glue-cgu.0[Internal]
enum EnumWithDrop {
A(i32)
}
diff --git a/src/test/codegen-units/item-collection/transitive-drop-glue.rs b/src/test/codegen-units/item-collection/transitive-drop-glue.rs
index d20213c..7bbc9b6 100644
--- a/src/test/codegen-units/item-collection/transitive-drop-glue.rs
+++ b/src/test/codegen-units/item-collection/transitive-drop-glue.rs
@@ -15,11 +15,11 @@
#![deny(dead_code)]
#![feature(start)]
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Root[0]> @@ transitive_drop_glue-cgu.0[Internal]
struct Root(Intermediate);
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Intermediate[0]> @@ transitive_drop_glue-cgu.0[Internal]
struct Intermediate(Leaf);
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::Leaf[0]> @@ transitive_drop_glue-cgu.0[Internal]
struct Leaf;
impl Drop for Leaf {
@@ -40,15 +40,15 @@
fn start(_: isize, _: *const *const u8) -> isize {
let _ = Root(Intermediate(Leaf));
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue0[Internal]
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue0[Internal]
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<u32>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<u32>
let _ = RootGen(IntermediateGen(LeafGen(0u32)));
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue0[Internal]
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue0[Internal]
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::RootGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::IntermediateGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<transitive_drop_glue::LeafGen[0]<i16>> @@ transitive_drop_glue-cgu.0[Internal]
//~ MONO_ITEM fn transitive_drop_glue::{{impl}}[1]::drop[0]<i16>
let _ = RootGen(IntermediateGen(LeafGen(0i16)));
diff --git a/src/test/codegen-units/item-collection/tuple-drop-glue.rs b/src/test/codegen-units/item-collection/tuple-drop-glue.rs
index 9e4cc6e..865570c 100644
--- a/src/test/codegen-units/item-collection/tuple-drop-glue.rs
+++ b/src/test/codegen-units/item-collection/tuple-drop-glue.rs
@@ -15,7 +15,7 @@
#![deny(dead_code)]
#![feature(start)]
-//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue0[Internal]
+//~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<tuple_drop_glue::Dropped[0]> @@ tuple_drop_glue-cgu.0[Internal]
struct Dropped;
impl Drop for Dropped {
@@ -26,11 +26,11 @@
//~ MONO_ITEM fn tuple_drop_glue::start[0]
#[start]
fn start(_: isize, _: *const *const u8) -> isize {
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(u32, tuple_drop_glue::Dropped[0])> @@ tuple_drop_glue-cgu.0[Internal]
let x = (0u32, Dropped);
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue0[Internal]
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(i16, (tuple_drop_glue::Dropped[0], bool))> @@ tuple_drop_glue-cgu.0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<(tuple_drop_glue::Dropped[0], bool)> @@ tuple_drop_glue-cgu.0[Internal]
let x = (0i16, (Dropped, true));
0
diff --git a/src/test/codegen-units/item-collection/unsizing.rs b/src/test/codegen-units/item-collection/unsizing.rs
index adc0eb6..5e9a325 100644
--- a/src/test/codegen-units/item-collection/unsizing.rs
+++ b/src/test/codegen-units/item-collection/unsizing.rs
@@ -59,13 +59,13 @@
fn start(_: isize, _: *const *const u8) -> isize {
// simple case
let bool_sized = &true;
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<bool> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[0]::foo[0]
let _bool_unsized = bool_sized as &Trait;
let char_sized = &'a';
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<char> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[1]::foo[0]
let _char_unsized = char_sized as &Trait;
@@ -75,13 +75,13 @@
_b: 2,
_c: 3.0f64
};
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<f64> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[2]::foo[0]
let _struct_unsized = struct_sized as &Struct<Trait>;
// custom coercion
let wrapper_sized = Wrapper(&0u32);
- //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing0[Internal]
+ //~ MONO_ITEM fn core::ptr[0]::drop_in_place[0]<u32> @@ unsizing-cgu.0[Internal]
//~ MONO_ITEM fn unsizing::{{impl}}[3]::foo[0]
let _wrapper_sized = wrapper_sized as Wrapper<Trait>;
diff --git a/src/test/codegen/no-assumes-on-casts.rs b/src/test/codegen/no-assumes-on-casts.rs
new file mode 100644
index 0000000..a5a7d94
--- /dev/null
+++ b/src/test/codegen/no-assumes-on-casts.rs
@@ -0,0 +1,29 @@
+// 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.
+
+#![crate_type = "lib"]
+
+// compile-flags: -Cno-prepopulate-passes
+
+// CHECK-LABEL: fna
+#[no_mangle]
+pub fn fna(a: i16) -> i32 {
+ a as i32
+// CHECK-NOT: assume
+// CHECK: sext
+}
+
+// CHECK-LABEL: fnb
+#[no_mangle]
+pub fn fnb(a: u16) -> u32 {
+ a as u32
+// CHECK-NOT: assume
+// CHECK: zext
+}
diff --git a/src/test/codegen/vec-clear.rs b/src/test/codegen/vec-clear.rs
index a73dd07..c446373 100644
--- a/src/test/codegen/vec-clear.rs
+++ b/src/test/codegen/vec-clear.rs
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-debug: the debug assertions get in the way
// compile-flags: -O
#![crate_type = "lib"]
diff --git a/src/test/codegen/vec-iter-collect-len.rs b/src/test/codegen/vec-iter-collect-len.rs
index efb384d..05cbf05 100644
--- a/src/test/codegen/vec-iter-collect-len.rs
+++ b/src/test/codegen/vec-iter-collect-len.rs
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-debug: the debug assertions get in the way
// no-system-llvm
// compile-flags: -O
#![crate_type="lib"]
diff --git a/src/test/codegen/vec-optimizes-away.rs b/src/test/codegen/vec-optimizes-away.rs
index 261564e..6bef01f 100644
--- a/src/test/codegen/vec-optimizes-away.rs
+++ b/src/test/codegen/vec-optimizes-away.rs
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
+// ignore-debug: the debug assertions get in the way
// no-system-llvm
// compile-flags: -O
#![crate_type="lib"]
diff --git a/src/test/compile-fail-fulldeps/issue-48941.rs b/src/test/compile-fail-fulldeps/issue-48941.rs
index 4be2874..baeb019 100644
--- a/src/test/compile-fail-fulldeps/issue-48941.rs
+++ b/src/test/compile-fail-fulldeps/issue-48941.rs
@@ -17,10 +17,7 @@
#![feature(plugin)]
#![plugin(macro_crate_test)]
-#[noop_attribute"x"] //~ ERROR expected one of
-fn night() { }
-
-#[noop_attribute("hi"), rank = 2] //~ ERROR unexpected token
+#[noop_attribute("hi", rank = a)] //~ ERROR expected unsuffixed literal or identifier, found a
fn knight() { }
#[noop_attribute("/user", data= = "<user")] //~ ERROR literal or identifier
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs b/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs
index 9e7bbb2..3cb565c 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/attribute-with-error.rs
@@ -11,8 +11,6 @@
// aux-build:attribute-with-error.rs
// ignore-stage1
-#![feature(use_extern_macros)]
-
extern crate attribute_with_error;
use attribute_with_error::foo;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs
index ea66d3c..e941367 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/attributes-included.rs
@@ -12,7 +12,6 @@
// ignore-stage1
// compile-pass
-#![feature(use_extern_macros)]
#![warn(unused)]
extern crate attributes_included;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs
index f71d4b8..52d7afb 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs
@@ -13,7 +13,6 @@
// FIXME: https://github.com/rust-lang/rust/issues/41430
// This is a temporary regression test for the ICE reported in #41211
-#![feature(use_extern_macros)]
#![emit_unchanged]
//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler
extern crate issue_41211;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/macro-use-attr.rs b/src/test/compile-fail-fulldeps/proc-macro/macro-use-attr.rs
index bb7f341..0fcb9ef 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/macro-use-attr.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/macro-use-attr.rs
@@ -9,7 +9,6 @@
// except according to those terms.
// aux-build:attr_proc_macro.rs
-#![feature(use_extern_macros)]
#[macro_use] extern crate attr_proc_macro;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs b/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs
index e418ecc..f280e74 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/macros-in-extern.rs
@@ -12,8 +12,6 @@
// ignore-stage1
// ignore-wasm32
-#![feature(use_extern_macros)]
-
extern crate test_macros;
use test_macros::{nop_attr, no_output, emit_input};
diff --git a/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs
index ff9f170..b7ab978 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/more-gates.rs
@@ -10,8 +10,6 @@
// aux-build:more-gates.rs
-#![feature(use_extern_macros)]
-
extern crate more_gates as foo;
use foo::*;
diff --git a/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs b/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs
index e47a4ae..ab05ca2 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/no-macro-use-attr.rs
@@ -11,9 +11,10 @@
// aux-build:derive-a.rs
#![feature(rustc_attrs)]
+#![warn(unused_extern_crates)]
extern crate derive_a;
-//~^ WARN proc macro crates and `#[no_link]` crates have no effect without `#[macro_use]`
+//~^ WARN unused extern crate
#[rustc_error]
fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs
index 153e4dd..215d51c 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-attributes.rs
@@ -17,11 +17,11 @@
extern crate derive_b;
#[derive(B)]
-#[B]
-#[C] //~ ERROR: The attribute `C` is currently unknown to the compiler
+#[B] //~ ERROR `B` is a derive mode
+#[C]
#[B(D)]
#[B(E = "foo")]
-#[B arbitrary tokens] //~ expected one of `(` or `=`, found `arbitrary`
+#[B(arbitrary tokens)]
struct B;
fn main() {}
diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs
index 9a0171c..0798aa5 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates.rs
@@ -41,12 +41,6 @@
#[a = y] //~ ERROR: must only be followed by a delimiter token
fn _test3() {}
-#[a = ] //~ ERROR: must only be followed by a delimiter token
-fn _test4() {}
-
-#[a () = ] //~ ERROR: must only be followed by a delimiter token
-fn _test5() {}
-
fn attrs() {
// Statement, item
#[a] // OK
diff --git a/src/test/compile-fail-fulldeps/qquote.rs b/src/test/compile-fail-fulldeps/qquote.rs
index 3e2829a..4b0bc8f 100644
--- a/src/test/compile-fail-fulldeps/qquote.rs
+++ b/src/test/compile-fail-fulldeps/qquote.rs
@@ -16,7 +16,7 @@
extern crate syntax_pos;
use syntax::ast;
-use syntax::codemap::FilePathMapping;
+use syntax::source_map::FilePathMapping;
use syntax::print::pprust;
use syntax::symbol::Symbol;
use syntax_pos::DUMMY_SP;
diff --git a/src/test/compile-fail/associated-types-subtyping-1.rs b/src/test/compile-fail/associated-types-subtyping-1.rs
deleted file mode 100644
index 64dcdd3..0000000
--- a/src/test/compile-fail/associated-types-subtyping-1.rs
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(unused_variables)]
-
-trait Trait<'a> {
- type Type;
-
- fn method(&'a self) { }
-}
-
-fn method1<'a,'b,T>(x: &'a T, y: &'b T)
- where T : for<'z> Trait<'z>, 'a : 'b
-{
- // Note that &'static T <: &'a T.
- let a: <T as Trait<'a>>::Type = loop { };
- let b: <T as Trait<'b>>::Type = loop { };
- let _: <T as Trait<'a>>::Type = a;
-}
-
-fn method2<'a,'b,T>(x: &'a T, y: &'b T)
- where T : for<'z> Trait<'z>, 'a : 'b
-{
- // Note that &'static T <: &'a T.
- let a: <T as Trait<'a>>::Type = loop { };
- let b: <T as Trait<'b>>::Type = loop { };
- let _: <T as Trait<'b>>::Type = a; //~ ERROR E0623
-}
-
-fn method3<'a,'b,T>(x: &'a T, y: &'b T)
- where T : for<'z> Trait<'z>, 'a : 'b
-{
- // Note that &'static T <: &'a T.
- let a: <T as Trait<'a>>::Type = loop { };
- let b: <T as Trait<'b>>::Type = loop { };
- let _: <T as Trait<'a>>::Type = b; //~ ERROR E0623
-}
-
-fn method4<'a,'b,T>(x: &'a T, y: &'b T)
- where T : for<'z> Trait<'z>, 'a : 'b
-{
- // Note that &'static T <: &'a T.
- let a: <T as Trait<'a>>::Type = loop { };
- let b: <T as Trait<'b>>::Type = loop { };
- let _: <T as Trait<'b>>::Type = b;
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/auxiliary/coherence_lib.rs b/src/test/compile-fail/auxiliary/coherence_lib.rs
deleted file mode 100644
index daa1238..0000000
--- a/src/test/compile-fail/auxiliary/coherence_lib.rs
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2012 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.
-
-#![crate_type="lib"]
-
-pub trait Remote {
- fn foo(&self) { }
-}
-
-pub trait Remote1<T> {
- fn foo(&self, t: T) { }
-}
-
-pub trait Remote2<T, U> {
- fn foo(&self, t: T, u: U) { }
-}
-
-pub struct Pair<T,U>(T,U);
diff --git a/src/test/compile-fail/auxiliary/lint_output_format.rs b/src/test/compile-fail/auxiliary/lint_output_format.rs
deleted file mode 100644
index 6ba66f3..0000000
--- a/src/test/compile-fail/auxiliary/lint_output_format.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![crate_name="lint_output_format"]
-#![crate_type = "lib"]
-#![feature(staged_api)]
-#![unstable(feature = "unstable_test_feature", issue = "0")]
-
-#[stable(feature = "stable_test_feature", since = "1.0.0")]
-#[rustc_deprecated(since = "1.0.0", reason = "text")]
-pub fn foo() -> usize {
- 20
-}
-
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub fn bar() -> usize {
- 40
-}
-
-#[unstable(feature = "unstable_test_feature", issue = "0")]
-pub fn baz() -> usize {
- 30
-}
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-lang-items.rs b/src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs
similarity index 100%
copy from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-lang-items.rs
copy to src/test/compile-fail/auxiliary/panic-runtime-lang-items.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind.rs b/src/test/compile-fail/auxiliary/panic-runtime-unwind.rs
similarity index 100%
copy from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind.rs
copy to src/test/compile-fail/auxiliary/panic-runtime-unwind.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind2.rs b/src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs
similarity index 100%
copy from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind2.rs
copy to src/test/compile-fail/auxiliary/panic-runtime-unwind2.rs
diff --git a/src/test/compile-fail/auxiliary/struct_field_privacy.rs b/src/test/compile-fail/auxiliary/struct_field_privacy.rs
deleted file mode 100644
index 5fea97d..0000000
--- a/src/test/compile-fail/auxiliary/struct_field_privacy.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-pub struct A {
- a: isize,
- pub b: isize,
-}
-
-pub struct B {
- pub a: isize,
- b: isize,
-}
diff --git a/src/test/compile-fail/auxiliary/two_macros.rs b/src/test/compile-fail/auxiliary/two_macros.rs
deleted file mode 100644
index 060960f..0000000
--- a/src/test/compile-fail/auxiliary/two_macros.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2015 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.
-
-#[macro_export]
-macro_rules! macro_one { () => ("one") }
-
-#[macro_export]
-macro_rules! macro_two { () => ("two") }
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs b/src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs
similarity index 100%
copy from src/test/compile-fail/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs
copy to src/test/compile-fail/auxiliary/wants-panic-runtime-unwind.rs
diff --git a/src/test/compile-fail/borrow-tuple-fields.rs b/src/test/compile-fail/borrow-tuple-fields.rs
deleted file mode 100644
index f3417fa..0000000
--- a/src/test/compile-fail/borrow-tuple-fields.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(box_syntax)]
-
-struct Foo(Box<isize>, isize);
-
-struct Bar(isize, isize);
-
-fn main() {
- let x: (Box<_>, _) = (box 1, 2);
- let r = &x.0;
- let y = x; //~ ERROR cannot move out of `x` because it is borrowed
-
- let mut x = (1, 2);
- let a = &x.0;
- let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
-
- let mut x = (1, 2);
- let a = &mut x.0;
- let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
-
-
- let x = Foo(box 1, 2);
- let r = &x.0;
- let y = x; //~ ERROR cannot move out of `x` because it is borrowed
-
- let mut x = Bar(1, 2);
- let a = &x.0;
- let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
-
- let mut x = Bar(1, 2);
- let a = &mut x.0;
- let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-mut-object-twice.rs b/src/test/compile-fail/borrowck/borrowck-borrow-mut-object-twice.rs
deleted file mode 100644
index 7175194..0000000
--- a/src/test/compile-fail/borrowck/borrowck-borrow-mut-object-twice.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2012 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 `&mut` objects cannot be borrowed twice, just like
-// other `&mut` pointers.
-
-trait Foo {
- fn f1(&mut self) -> &();
- fn f2(&mut self);
-}
-
-fn test(x: &mut Foo) {
- let _y = x.f1();
- x.f2(); //~ ERROR cannot borrow `*x` as mutable
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-two-mut.rs b/src/test/compile-fail/borrowck/borrowck-closures-two-mut.rs
deleted file mode 100644
index 29546ab..0000000
--- a/src/test/compile-fail/borrowck/borrowck-closures-two-mut.rs
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Tests that two closures cannot simultaneously have mutable
-// access to the variable, whether that mutable access be used
-// for direct assignment or for taking mutable ref. Issue #6801.
-
-#![feature(box_syntax)]
-
-fn to_fn_mut<F: FnMut()>(f: F) -> F { f }
-
-fn a() {
- let mut x = 3;
- let c1 = to_fn_mut(|| x = 4);
- let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
-}
-
-fn set(x: &mut isize) {
- *x = 4;
-}
-
-fn b() {
- let mut x = 3;
- let c1 = to_fn_mut(|| set(&mut x));
- let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
-}
-
-fn c() {
- let mut x = 3;
- let c1 = to_fn_mut(|| x = 5);
- let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
-}
-
-fn d() {
- let mut x = 3;
- let c1 = to_fn_mut(|| x = 5);
- let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
- //~^ ERROR cannot borrow `x` as mutable more than once
-}
-
-fn g() {
- struct Foo {
- f: Box<isize>
- }
-
- let mut x: Box<_> = box Foo { f: box 3 };
- let c1 = to_fn_mut(|| set(&mut *x.f));
- let c2 = to_fn_mut(|| set(&mut *x.f));
- //~^ ERROR cannot borrow `x` as mutable more than once
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-unique-imm.rs b/src/test/compile-fail/borrowck/borrowck-closures-unique-imm.rs
deleted file mode 100644
index 247a4fe..0000000
--- a/src/test/compile-fail/borrowck/borrowck-closures-unique-imm.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Foo {
- x: isize,
-}
-
-pub fn main() {
- let mut this = &mut Foo {
- x: 1,
- };
- let mut r = || {
- let p = &this.x;
- &mut this.x; //~ ERROR cannot borrow
- };
- r()
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-unique.rs b/src/test/compile-fail/borrowck/borrowck-closures-unique.rs
deleted file mode 100644
index 1b22dc4..0000000
--- a/src/test/compile-fail/borrowck/borrowck-closures-unique.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Tests that a closure which requires mutable access to the referent
-// of an `&mut` requires a "unique" borrow -- that is, the variable to
-// be borrowed (here, `x`) will not be borrowed *mutably*, but
-// may be *immutable*, but we cannot allow
-// multiple borrows.
-
-fn get(x: &isize) -> isize {
- *x
-}
-
-fn set(x: &mut isize) -> isize {
- *x
-}
-
-fn a(x: &mut isize) {
- let c1 = || get(x);
- let c2 = || get(x);
-}
-
-fn b(x: &mut isize) {
- let c1 = || get(x);
- let c2 = || set(x); //~ ERROR closure requires unique access to `x`
-}
-
-fn c(x: &mut isize) {
- let c1 = || get(x);
- let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
-}
-
-fn d(x: &mut isize) {
- let c1 = || set(x);
- let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
-}
-
-fn e(x: &mut isize) {
- let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-issue-2657-1.rs b/src/test/compile-fail/borrowck/borrowck-issue-2657-1.rs
deleted file mode 100644
index 0e17121..0000000
--- a/src/test/compile-fail/borrowck/borrowck-issue-2657-1.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2012 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.
-
-#![feature(box_syntax)]
-
-fn main() {
- let x: Option<Box<_>> = Some(box 1);
- match x {
- Some(ref _y) => {
- let _a = x; //~ ERROR cannot move
- }
- _ => {}
- }
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-lend-flow-if.rs b/src/test/compile-fail/borrowck/borrowck-lend-flow-if.rs
deleted file mode 100644
index a6ce36a..0000000
--- a/src/test/compile-fail/borrowck/borrowck-lend-flow-if.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2012 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.
-
-// Note: the borrowck analysis is currently flow-insensitive.
-// Therefore, some of these errors are marked as spurious and could be
-// corrected by a simple change to the analysis. The others are
-// either genuine or would require more advanced changes. The latter
-// cases are noted.
-
-#![feature(box_syntax)]
-
-fn borrow(_v: &isize) {}
-fn borrow_mut(_v: &mut isize) {}
-fn cond() -> bool { panic!() }
-fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
-fn produce<T>() -> T { panic!(); }
-
-fn inc(v: &mut Box<isize>) {
- *v = box (**v + 1);
-}
-
-fn pre_freeze_cond() {
- // In this instance, the freeze is conditional and starts before
- // the mut borrow.
-
- let mut v: Box<_> = box 3;
- let _w;
- if cond() {
- _w = &v;
- }
- borrow_mut(&mut *v); //~ ERROR cannot borrow
-}
-
-fn pre_freeze_else() {
- // In this instance, the freeze and mut borrow are on separate sides
- // of the if.
-
- let mut v: Box<_> = box 3;
- let _w;
- if cond() {
- _w = &v;
- } else {
- borrow_mut(&mut *v);
- }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/borrowck/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck/borrowck-lend-flow.rs
deleted file mode 100644
index 1ed779c..0000000
--- a/src/test/compile-fail/borrowck/borrowck-lend-flow.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2012 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.
-
-// Note: the borrowck analysis is currently flow-insensitive.
-// Therefore, some of these errors are marked as spurious and could be
-// corrected by a simple change to the analysis. The others are
-// either genuine or would require more advanced changes. The latter
-// cases are noted.
-
-#![feature(box_syntax)]
-
-fn borrow(_v: &isize) {}
-fn borrow_mut(_v: &mut isize) {}
-fn cond() -> bool { panic!() }
-fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
-fn produce<T>() -> T { panic!(); }
-
-fn inc(v: &mut Box<isize>) {
- *v = box (**v + 1);
-}
-
-fn pre_freeze() {
- // In this instance, the freeze starts before the mut borrow.
-
- let mut v: Box<_> = box 3;
- let _w = &v;
- borrow_mut(&mut *v); //~ ERROR cannot borrow
-}
-
-fn post_freeze() {
- // In this instance, the const alias starts after the borrow.
-
- let mut v: Box<_> = box 3;
- borrow_mut(&mut *v);
- let _w = &v;
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck/borrowck-loan-blocks-move-cc.rs
deleted file mode 100644
index 57b584a..0000000
--- a/src/test/compile-fail/borrowck/borrowck-loan-blocks-move-cc.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2012 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.
-
-#![feature(box_syntax)]
-
-use std::thread;
-
-fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
- f(v);
-}
-
-fn box_imm() {
- let v: Box<_> = box 3;
- let _w = &v;
- thread::spawn(move|| {
- println!("v={}", *v);
- //~^ ERROR cannot move `v` into closure
- });
-}
-
-fn box_imm_explicit() {
- let v: Box<_> = box 3;
- let _w = &v;
- thread::spawn(move|| {
- println!("v={}", *v);
- //~^ ERROR cannot move
- });
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-blocks-move.rs b/src/test/compile-fail/borrowck/borrowck-loan-blocks-move.rs
deleted file mode 100644
index f3f1880..0000000
--- a/src/test/compile-fail/borrowck/borrowck-loan-blocks-move.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2012 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.
-
-#![feature(box_syntax)]
-
-fn take(_v: Box<isize>) {
-}
-
-fn box_imm() {
- let v = box 3;
- let _w = &v;
- take(v); //~ ERROR cannot move out of `v` because it is borrowed
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/compile-fail/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs
deleted file mode 100644
index c02c6a7..0000000
--- a/src/test/compile-fail/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// verify that an error is raised when trying to move out of a
-// borrowed path.
-
-#![feature(box_syntax)]
-
-fn main() {
- let a: Box<Box<_>> = box box 2;
- let b = &a;
-
- let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-move-mut-base-ptr.rs b/src/test/compile-fail/borrowck/borrowck-move-mut-base-ptr.rs
deleted file mode 100644
index 2fb89e6..0000000
--- a/src/test/compile-fail/borrowck/borrowck-move-mut-base-ptr.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that attempt to move `&mut` pointer while pointee is borrowed
-// yields an error.
-//
-// Example from src/librustc_borrowck/borrowck/README.md
-
-fn foo(t0: &mut isize) {
- let p: &isize = &*t0; // Freezes `*t0`
- let t1 = t0; //~ ERROR cannot move out of `t0`
- *t1 = 22;
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs b/src/test/compile-fail/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs
deleted file mode 100644
index bdeb7ea..0000000
--- a/src/test/compile-fail/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that attempt to mutably borrow `&mut` pointer while pointee is
-// borrowed yields an error.
-//
-// Example from src/librustc_borrowck/borrowck/README.md
-
-fn foo<'a>(mut t0: &'a mut isize,
- mut t1: &'a mut isize) {
- let p: &isize = &*t0; // Freezes `*t0`
- let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
- **t2 += 1; // Mutates `*t0`
-}
-
-fn bar<'a>(mut t0: &'a mut isize,
- mut t1: &'a mut isize) {
- let p: &mut isize = &mut *t0; // Claims `*t0`
- let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
- **t2 += 1; // Mutates `*t0` but not through `*p`
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-object-lifetime.rs b/src/test/compile-fail/borrowck/borrowck-object-lifetime.rs
deleted file mode 100644
index 021b3f3..0000000
--- a/src/test/compile-fail/borrowck/borrowck-object-lifetime.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that borrows that occur due to calls to object methods
-// properly "claim" the object path.
-
-trait Foo {
- fn borrowed(&self) -> &();
- fn mut_borrowed(&mut self) -> &();
-}
-
-fn borrowed_receiver(x: &Foo) {
- let _y = x.borrowed();
- let _z = x.borrowed();
-}
-
-fn mut_borrowed_receiver(x: &mut Foo) {
- let _y = x.borrowed();
- let _z = x.mut_borrowed(); //~ ERROR cannot borrow
-}
-
-fn mut_owned_receiver(mut x: Box<Foo>) {
- let _y = x.borrowed();
- let _z = &mut x; //~ ERROR cannot borrow
-}
-
-fn imm_owned_receiver(mut x: Box<Foo>) {
- let _y = x.borrowed();
- let _z = &x;
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-autoderef.rs b/src/test/compile-fail/borrowck/borrowck-overloaded-index-autoderef.rs
deleted file mode 100644
index b726c46..0000000
--- a/src/test/compile-fail/borrowck/borrowck-overloaded-index-autoderef.rs
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that we still see borrowck errors of various kinds when using
-// indexing and autoderef in combination.
-
-use std::ops::{Index, IndexMut};
-
-struct Foo {
- x: isize,
- y: isize,
-}
-
-impl<'a> Index<&'a String> for Foo {
- type Output = isize;
-
- fn index(&self, z: &String) -> &isize {
- if *z == "x" {
- &self.x
- } else {
- &self.y
- }
- }
-}
-
-impl<'a> IndexMut<&'a String> for Foo {
- fn index_mut(&mut self, z: &String) -> &mut isize {
- if *z == "x" {
- &mut self.x
- } else {
- &mut self.y
- }
- }
-}
-
-fn test1(mut f: Box<Foo>, s: String) {
- let _p = &mut f[&s];
- let _q = &f[&s]; //~ ERROR cannot borrow
-}
-
-fn test2(mut f: Box<Foo>, s: String) {
- let _p = &mut f[&s];
- let _q = &mut f[&s]; //~ ERROR cannot borrow
-}
-
-struct Bar {
- foo: Foo
-}
-
-fn test3(mut f: Box<Bar>, s: String) {
- let _p = &mut f.foo[&s];
- let _q = &mut f.foo[&s]; //~ ERROR cannot borrow
-}
-
-fn test4(mut f: Box<Bar>, s: String) {
- let _p = &f.foo[&s];
- let _q = &f.foo[&s];
-}
-
-fn test5(mut f: Box<Bar>, s: String) {
- let _p = &f.foo[&s];
- let _q = &mut f.foo[&s]; //~ ERROR cannot borrow
-}
-
-fn test6(mut f: Box<Bar>, g: Foo, s: String) {
- let _p = &f.foo[&s];
- f.foo = g; //~ ERROR cannot assign
-}
-
-fn test7(mut f: Box<Bar>, g: Bar, s: String) {
- let _p = &f.foo[&s];
- *f = g; //~ ERROR cannot assign
-}
-
-fn test8(mut f: Box<Bar>, g: Foo, s: String) {
- let _p = &mut f.foo[&s];
- f.foo = g; //~ ERROR cannot assign
-}
-
-fn test9(mut f: Box<Bar>, g: Bar, s: String) {
- let _p = &mut f.foo[&s];
- *f = g; //~ ERROR cannot assign
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-swap-mut-base-ptr.rs b/src/test/compile-fail/borrowck/borrowck-swap-mut-base-ptr.rs
deleted file mode 100644
index 552fcec..0000000
--- a/src/test/compile-fail/borrowck/borrowck-swap-mut-base-ptr.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that attempt to swap `&mut` pointer while pointee is borrowed
-// yields an error.
-//
-// Example from src/librustc_borrowck/borrowck/README.md
-
-use std::mem::swap;
-
-fn foo<'a>(mut t0: &'a mut isize,
- mut t1: &'a mut isize) {
- let p: &isize = &*t0; // Freezes `*t0`
- swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0`
- *t1 = 22;
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs b/src/test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
deleted file mode 100644
index f2e6d51..0000000
--- a/src/test/compile-fail/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-#![feature(thread_local)]
-
-#[thread_local]
-static FOO: u8 = 3;
-
-fn assert_static(_t: &'static u8) {}
-fn main() {
- assert_static(&FOO); //[ast]~ ERROR [E0597]
- //[mir]~^ ERROR [E0597]
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-union-borrow-nested.rs b/src/test/compile-fail/borrowck/borrowck-union-borrow-nested.rs
deleted file mode 100644
index 6298c87..0000000
--- a/src/test/compile-fail/borrowck/borrowck-union-borrow-nested.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[derive(Clone, Copy)]
-struct S {
- a: u8,
- b: u16,
-}
-
-#[derive(Clone, Copy)]
-union U {
- s: S,
- c: u32,
-}
-
-fn main() {
- unsafe {
- {
- let mut u = U { s: S { a: 0, b: 1 } };
- let ra = &mut u.s.a;
- let b = u.s.b; // OK
- }
- {
- let mut u = U { s: S { a: 0, b: 1 } };
- let ra = &mut u.s.a;
- let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed
- }
- }
-}
diff --git a/src/test/compile-fail/borrowck/borrowck-uniq-via-lend.rs b/src/test/compile-fail/borrowck/borrowck-uniq-via-lend.rs
deleted file mode 100644
index f36dc0c..0000000
--- a/src/test/compile-fail/borrowck/borrowck-uniq-via-lend.rs
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright 2012 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.
-
-#![feature(box_syntax)]
-
-fn borrow(_v: &isize) {}
-
-fn local() {
- let mut v: Box<_> = box 3;
- borrow(&*v);
-}
-
-fn local_rec() {
- struct F { f: Box<isize> }
- let mut v = F {f: box 3};
- borrow(&*v.f);
-}
-
-fn local_recs() {
- struct F { f: G }
- struct G { g: H }
- struct H { h: Box<isize> }
- let mut v = F {f: G {g: H {h: box 3}}};
- borrow(&*v.f.g.h);
-}
-
-fn aliased_imm() {
- let mut v: Box<_> = box 3;
- let _w = &v;
- borrow(&*v);
-}
-
-fn aliased_mut() {
- let mut v: Box<_> = box 3;
- let _w = &mut v;
- borrow(&*v); //~ ERROR cannot borrow `*v`
-}
-
-fn aliased_other() {
- let mut v: Box<_> = box 3;
- let mut w: Box<_> = box 4;
- let _x = &mut w;
- borrow(&*v);
-}
-
-fn aliased_other_reassign() {
- let mut v: Box<_> = box 3;
- let mut w: Box<_> = box 4;
- let mut _x = &mut w;
- _x = &mut v;
- borrow(&*v); //~ ERROR cannot borrow `*v`
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/cfg-empty-codemap.rs b/src/test/compile-fail/cfg-empty-codemap.rs
deleted file mode 100644
index 8868a5a..0000000
--- a/src/test/compile-fail/cfg-empty-codemap.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2015 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.
-
-// Tests that empty codemaps don't ICE (#23301)
-
-// compile-flags: --cfg ""
-
-// error-pattern: expected identifier, found
-
-pub fn main() {
-}
diff --git a/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs b/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs
deleted file mode 100644
index dcbb25b..0000000
--- a/src/test/compile-fail/cleanup-rvalue-scopes-cf.rs
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that the borrow checker prevents pointers to temporaries
-// with statement lifetimes from escaping.
-
-use std::ops::Drop;
-
-static mut FLAGS: u64 = 0;
-
-struct Box<T> { f: T }
-struct AddFlags { bits: u64 }
-
-fn AddFlags(bits: u64) -> AddFlags {
- AddFlags { bits: bits }
-}
-
-fn arg(x: &AddFlags) -> &AddFlags {
- x
-}
-
-impl AddFlags {
- fn get(&self) -> &AddFlags {
- self
- }
-}
-
-pub fn main() {
- let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
- let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
- let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
- let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough
-}
diff --git a/src/test/compile-fail/closure_promotion.rs b/src/test/compile-fail/closure_promotion.rs
deleted file mode 100644
index ddc995a..0000000
--- a/src/test/compile-fail/closure_promotion.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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.
-
-#![allow(const_err)]
-
-// nll successfully compiles this. It is a bug.
-// See https://github.com/rust-lang/rust/issues/52384
-fn main() {
- let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough
-}
diff --git a/src/test/compile-fail/dollar-crate-is-keyword.rs b/src/test/compile-fail/dollar-crate-is-keyword.rs
deleted file mode 100644
index 70597a2..0000000
--- a/src/test/compile-fail/dollar-crate-is-keyword.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-macro_rules! m {
- () => {
- struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate`
-
- use $crate; // OK
- //~^ WARN `$crate` may not be imported
- use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate`
- //~^ WARN `$crate` may not be imported
- }
-}
-
-m!();
-
-fn main() {}
diff --git a/src/test/compile-fail/edition-extern-crate-allowed.rs b/src/test/compile-fail/edition-extern-crate-allowed.rs
deleted file mode 100644
index 7368564..0000000
--- a/src/test/compile-fail/edition-extern-crate-allowed.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-// aux-build:edition-extern-crate-allowed.rs
-// compile-flags: --edition 2015
-// compile-pass
-
-#![warn(rust_2018_idioms)]
-
-extern crate edition_extern_crate_allowed;
-//~^ WARNING unused extern crate
-
-fn main() {}
diff --git a/src/test/compile-fail/edition-feature-ok.rs b/src/test/compile-fail/edition-feature-ok.rs
deleted file mode 100644
index 3a3a6ff..0000000
--- a/src/test/compile-fail/edition-feature-ok.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// 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.
-
-// compile-flags:--edition 2018
-// compile-pass
-
-#![feature(rust_2018_preview)]
-
-fn main() {}
diff --git a/src/test/compile-fail/extern-macro.rs b/src/test/compile-fail/extern-macro.rs
deleted file mode 100644
index 4267103a..0000000
--- a/src/test/compile-fail/extern-macro.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-// #41719
-
-#![feature(use_extern_macros)]
-
-fn main() {
- enum Foo {}
- let _ = Foo::bar!(); //~ ERROR fail to resolve non-ident macro path
-}
diff --git a/src/test/compile-fail/external-doc-error.rs b/src/test/compile-fail/external-doc-error.rs
deleted file mode 100644
index 1ae0d0b..0000000
--- a/src/test/compile-fail/external-doc-error.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright 2012-2015 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.
-
-#![feature(external_doc)]
-
-#[doc(include = "not-a-file.md")] //~ ERROR: couldn't read
-pub struct SomeStruct;
-
-fn main() {}
diff --git a/src/test/compile-fail/gated-attr-literals.rs b/src/test/compile-fail/gated-attr-literals.rs
deleted file mode 100644
index b500bfc..0000000
--- a/src/test/compile-fail/gated-attr-literals.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2015 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 literals in attributes don't parse without the feature gate.
-
-// gate-test-attr_literals
-// gate-test-custom_attribute
-
-#![feature(rustc_attrs)]
-#![allow(dead_code)]
-#![allow(unused_variables)]
-
-#[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown
-#[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes
-#[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes
-#[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR string literals in top-level positions, are experimental
-#[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown
-#[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes, or string literals in top-level positions
-#[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes
-#[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes, or string literals in top-level positions
-#[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes
-#[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes
-#[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR non-string literals in attributes
-#[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown
- //~^ ERROR string literals in top-level positions, are experimental
-#[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown
- //~^ ERROR string literals in top-level positions, are experimental
-struct Q { }
-
-#[rustc_error]
-fn main() { }
diff --git a/src/test/compile-fail/hashmap-lifetimes.rs b/src/test/compile-fail/hashmap-lifetimes.rs
deleted file mode 100644
index 6858599..0000000
--- a/src/test/compile-fail/hashmap-lifetimes.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- let mut my_stuff = std::collections::HashMap::new();
- my_stuff.insert(0, 42);
-
- let mut it = my_stuff.iter();
- my_stuff.insert(1, 43); //~ ERROR cannot borrow
-}
diff --git a/src/test/compile-fail/huge-enum.rs b/src/test/compile-fail/huge-enum.rs
deleted file mode 100644
index 6e7c053..0000000
--- a/src/test/compile-fail/huge-enum.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: Option
-
-// FIXME: work properly with higher limits
-
-#[cfg(target_pointer_width = "32")]
-fn main() {
- let big: Option<[u32; (1<<29)-1]> = None;
-}
-
-#[cfg(target_pointer_width = "64")]
-fn main() {
- let big: Option<[u32; (1<<45)-1]> = None;
-}
diff --git a/src/test/compile-fail/huge-struct.rs b/src/test/compile-fail/huge-struct.rs
deleted file mode 100644
index a10c61d..0000000
--- a/src/test/compile-fail/huge-struct.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: too big for the current
-
-struct S32<T> {
- v0: T,
- v1: T,
- v2: T,
- v3: T,
- v4: T,
- v5: T,
- v6: T,
- v7: T,
- v8: T,
- u9: T,
- v10: T,
- v11: T,
- v12: T,
- v13: T,
- v14: T,
- v15: T,
- v16: T,
- v17: T,
- v18: T,
- v19: T,
- v20: T,
- v21: T,
- v22: T,
- v23: T,
- v24: T,
- u25: T,
- v26: T,
- v27: T,
- v28: T,
- v29: T,
- v30: T,
- v31: T,
-}
-
-struct S1k<T> { val: S32<S32<T>> }
-
-struct S1M<T> { val: S1k<S1k<T>> }
-
-fn main() {
- let fat: Option<S1M<S1M<S1M<u32>>>> = None;
-}
diff --git a/src/test/compile-fail/import-crate-var.rs b/src/test/compile-fail/import-crate-var.rs
deleted file mode 100644
index e58ba2c..0000000
--- a/src/test/compile-fail/import-crate-var.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// aux-build:import_crate_var.rs
-// error-pattern: `$crate` may not be imported
-// error-pattern: `use $crate;` was erroneously allowed and will become a hard error
-// error-pattern: compilation successful
-
-#![feature(rustc_attrs)]
-
-#[macro_use] extern crate import_crate_var;
-
-#[rustc_error]
-fn main() {
- m!();
-}
diff --git a/src/test/compile-fail/issue-15919.rs b/src/test/compile-fail/issue-15919.rs
deleted file mode 100644
index df7e7c1..0000000
--- a/src/test/compile-fail/issue-15919.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2015 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.
-
-// error-pattern: too big for the current architecture
-
-#[cfg(target_pointer_width = "32")]
-fn main() {
- let x = [0usize; 0xffff_ffff];
-}
-
-#[cfg(target_pointer_width = "64")]
-fn main() {
- let x = [0usize; 0xffff_ffff_ffff_ffff];
-}
diff --git a/src/test/compile-fail/issue-17913.rs b/src/test/compile-fail/issue-17913.rs
deleted file mode 100644
index 80e5f2b..0000000
--- a/src/test/compile-fail/issue-17913.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-
-// error-pattern: too big for the current architecture
-
-#![feature(box_syntax)]
-
-#[cfg(target_pointer_width = "64")]
-fn main() {
- let n = 0_usize;
- let a: Box<_> = box [&n; 0xF000000000000000_usize];
- println!("{}", a[0xFFFFFF_usize]);
-}
-
-#[cfg(target_pointer_width = "32")]
-fn main() {
- let n = 0_usize;
- let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
- println!("{}", a[0xFFFFFF_usize]);
-}
diff --git a/src/test/compile-fail/issue-22638.rs b/src/test/compile-fail/issue-22638.rs
deleted file mode 100644
index 1c534eb..0000000
--- a/src/test/compile-fail/issue-22638.rs
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(unused)]
-
-#![recursion_limit = "20"]
-#![type_length_limit = "20000000"]
-#![crate_type = "rlib"]
-
-#[derive(Clone)]
-struct A (B);
-
-impl A {
- pub fn matches<F: Fn()>(&self, f: &F) {
- let &A(ref term) = self;
- term.matches(f);
- }
-}
-
-#[derive(Clone)]
-enum B {
- Variant1,
- Variant2(C),
-}
-
-impl B {
- pub fn matches<F: Fn()>(&self, f: &F) {
- match self {
- &B::Variant2(ref factor) => {
- factor.matches(&|| ())
- }
- _ => unreachable!("")
- }
- }
-}
-
-#[derive(Clone)]
-struct C (D);
-
-impl C {
- pub fn matches<F: Fn()>(&self, f: &F) {
- let &C(ref base) = self;
- base.matches(&|| {
- C(base.clone()).matches(f)
- })
- }
-}
-
-#[derive(Clone)]
-struct D (Box<A>);
-
-impl D {
- pub fn matches<F: Fn()>(&self, f: &F) {
- //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure
- let &D(ref a) = self;
- a.matches(f)
- }
-}
-
-pub fn matches() {
- A(B::Variant1).matches(&(|| ()))
-}
diff --git a/src/test/compile-fail/issue-28625.rs b/src/test/compile-fail/issue-28625.rs
deleted file mode 100644
index dc9155e..0000000
--- a/src/test/compile-fail/issue-28625.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-trait Bar {
- type Bar;
-}
-
-struct ArrayPeano<T: Bar> {
- data: T::Bar,
-}
-
-fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
- unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
-}
-
-impl Bar for () {
- type Bar = ();
-}
-
-fn main() {
- let x: ArrayPeano<()> = ArrayPeano { data: () };
- foo(&x);
-}
diff --git a/src/test/compile-fail/issue-28848.rs b/src/test/compile-fail/issue-28848.rs
deleted file mode 100644
index 1a06d59..0000000
--- a/src/test/compile-fail/issue-28848.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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.
-
-struct Foo<'a, 'b: 'a>(&'a &'b ());
-
-impl<'a, 'b> Foo<'a, 'b> {
- fn xmute(a: &'b ()) -> &'a () {
- unreachable!()
- }
-}
-
-pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
- Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/issue-32377.rs b/src/test/compile-fail/issue-32377.rs
deleted file mode 100644
index 5091ba4..0000000
--- a/src/test/compile-fail/issue-32377.rs
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::mem;
-use std::marker::PhantomData;
-
-trait Foo {
- type Error;
-}
-
-struct Bar<U: Foo> {
- stream: PhantomData<U::Error>,
-}
-
-fn foo<U: Foo>(x: [usize; 2]) -> Bar<U> {
- unsafe { mem::transmute(x) }
- //~^ ERROR transmute called with types of different sizes
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/issue-5500-1.rs b/src/test/compile-fail/issue-5500-1.rs
deleted file mode 100644
index 4bd147a..0000000
--- a/src/test/compile-fail/issue-5500-1.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=compare
-
-struct TrieMapIterator<'a> {
- node: &'a usize
-}
-
-fn main() {
- let a = 5;
- let _iter = TrieMapIterator{node: &a};
- _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
- //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
- // MIR doesn't generate an error because the code isn't reachable. This is OK
- // because the test is here to check that the compiler doesn't ICE (cf. #5500).
- panic!()
-}
diff --git a/src/test/compile-fail/keyword-extern-as-identifier.rs b/src/test/compile-fail/keyword-extern-as-identifier.rs
deleted file mode 100644
index e5927d0..0000000
--- a/src/test/compile-fail/keyword-extern-as-identifier.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(extern_in_paths)]
-
-fn main() {
- let extern = 0; //~ ERROR expected unit struct/variant or constant, found module `extern`
-}
diff --git a/src/test/compile-fail/macro-attribute.rs b/src/test/compile-fail/macro-attribute.rs
deleted file mode 100644
index 52f867f..0000000
--- a/src/test/compile-fail/macro-attribute.rs
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#[doc = $not_there] //~ error: unexpected token: `$`
-fn main() { }
diff --git a/src/test/compile-fail/macro-with-seps-err-msg.rs b/src/test/compile-fail/macro-with-seps-err-msg.rs
deleted file mode 100644
index 1281adc..0000000
--- a/src/test/compile-fail/macro-with-seps-err-msg.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2012 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.
-
-// gate-test-use_extern_macros
-
-fn main() {
- globnar::brotz!(); //~ ERROR non-ident macro paths are experimental
-}
diff --git a/src/test/compile-fail/macros-nonfatal-errors.rs b/src/test/compile-fail/macros-nonfatal-errors.rs
deleted file mode 100644
index 7046ee1..0000000
--- a/src/test/compile-fail/macros-nonfatal-errors.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// test that errors in a (selection) of macros don't kill compilation
-// immediately, so that we get more errors listed at a time.
-
-#![feature(asm)]
-#![feature(trace_macros, concat_idents)]
-
-#[derive(Default)] //~ ERROR
-enum OrDeriveThis {}
-
-fn main() {
- asm!(invalid); //~ ERROR
-
- concat_idents!("not", "idents"); //~ ERROR
-
- option_env!(invalid); //~ ERROR
- env!(invalid); //~ ERROR
- env!(foo, abr, baz); //~ ERROR
- env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR
-
- foo::blah!(); //~ ERROR
-
- format!(invalid); //~ ERROR
-
- include!(invalid); //~ ERROR
-
- include_str!(invalid); //~ ERROR
- include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR
- include_bytes!(invalid); //~ ERROR
- include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR
-
- trace_macros!(invalid); //~ ERROR
-}
diff --git a/src/test/compile-fail/meta-expected-error-wrong-rev.rs b/src/test/compile-fail/meta-expected-error-wrong-rev.rs
index 3c13050..8869e95 100644
--- a/src/test/compile-fail/meta-expected-error-wrong-rev.rs
+++ b/src/test/compile-fail/meta-expected-error-wrong-rev.rs
@@ -8,6 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-compare-mode-nll
+
// revisions: a
// should-fail
diff --git a/src/test/compile-fail/method-self-arg-2.rs b/src/test/compile-fail/method-self-arg-2.rs
deleted file mode 100644
index dd5b200..0000000
--- a/src/test/compile-fail/method-self-arg-2.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test method calls with self as an argument cannot subvert borrow checking.
-
-struct Foo;
-
-impl Foo {
- fn bar(&self) {}
- fn baz(&mut self) {}
-}
-
-fn main() {
- let mut x = Foo;
- let y = &mut x;
- Foo::bar(&x); //~ERROR cannot borrow `x`
-
- let mut x = Foo;
- let y = &mut x;
- Foo::baz(&mut x); //~ERROR cannot borrow `x`
-}
diff --git a/src/test/compile-fail/mod_file_correct_spans.rs b/src/test/compile-fail/mod_file_correct_spans.rs
deleted file mode 100644
index 5283747..0000000
--- a/src/test/compile-fail/mod_file_correct_spans.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2012 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.
-
-// Testing that the codemap is maintained correctly when parsing mods from external files
-
-mod mod_file_aux;
-
-fn main() {
- assert!(mod_file_aux::bar() == 10);
- //~^ ERROR cannot find function `bar` in module `mod_file_aux`
-}
diff --git a/src/test/compile-fail/mut-cant-alias.rs b/src/test/compile-fail/mut-cant-alias.rs
deleted file mode 100644
index 99d7258..0000000
--- a/src/test/compile-fail/mut-cant-alias.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-use std::cell::RefCell;
-
-fn main() {
- let m = RefCell::new(0);
- let mut b = m.borrow_mut();
- let b1 = &mut *b;
- let b2 = &mut *b; //~ ERROR cannot borrow
-}
diff --git a/src/test/compile-fail/no-link.rs b/src/test/compile-fail/no-link.rs
deleted file mode 100644
index f74ff55..0000000
--- a/src/test/compile-fail/no-link.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2015 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.
-
-// aux-build:empty-struct.rs
-
-#[no_link]
-extern crate empty_struct;
-//~^ WARN proc macro crates and `#[no_link]` crates have no effect without `#[macro_use]`
-
-fn main() {
- empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct`
-}
diff --git a/src/test/compile-fail/object-lifetime-default.rs b/src/test/compile-fail/object-lifetime-default.rs
deleted file mode 100644
index 104e10f..0000000
--- a/src/test/compile-fail/object-lifetime-default.rs
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright 2015 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.
-
-#![feature(rustc_attrs)]
-
-#[rustc_object_lifetime_default]
-struct A<T>(T); //~ ERROR BaseDefault
-
-#[rustc_object_lifetime_default]
-struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault
-
-#[rustc_object_lifetime_default]
-struct C<'a,T:'a>(&'a T); //~ ERROR 'a
-
-#[rustc_object_lifetime_default]
-struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous
-
-#[rustc_object_lifetime_default]
-struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b
-
-#[rustc_object_lifetime_default]
-struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b
-
-#[rustc_object_lifetime_default]
-struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous
-
-fn main() { }
diff --git a/src/test/compile-fail/packed-struct-transmute.rs b/src/test/compile-fail/packed-struct-transmute.rs
deleted file mode 100644
index abb02dd..0000000
--- a/src/test/compile-fail/packed-struct-transmute.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// This assumes the packed and non-packed structs are different sizes.
-
-// the error points to the start of the file, not the line with the
-// transmute
-
-// error-pattern: transmute called with types of different sizes
-
-use std::mem;
-
-#[repr(packed)]
-struct Foo {
- bar: u8,
- baz: usize
-}
-
-#[derive(Debug)]
-struct Oof {
- rab: u8,
- zab: usize
-}
-
-fn main() {
- let foo = Foo { bar: 1, baz: 10 };
- unsafe {
- let oof: Oof = mem::transmute(foo);
- println!("{:?}", oof);
- }
-}
diff --git a/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs
deleted file mode 100644
index f2ff877..0000000
--- a/src/test/compile-fail/regions-assoc-type-in-supertrait-outlives-container.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2015 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.
-
-// Test that we are imposing the requirement that every associated
-// type of a bound that appears in the where clause on a struct must
-// outlive the location in which the type appears, even when the
-// associted type is in a supertype. Issue #22246.
-
-#![allow(dead_code)]
-
-///////////////////////////////////////////////////////////////////////////
-
-pub trait TheTrait {
- type TheAssocType;
-}
-
-pub trait TheSubTrait : TheTrait {
-}
-
-pub struct TheType<'b> {
- m: [fn(&'b()); 0]
-}
-
-impl<'b> TheTrait for TheType<'b> {
- type TheAssocType = &'b ();
-}
-
-impl<'b> TheSubTrait for TheType<'b> {
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-pub struct WithAssoc<T:TheSubTrait> {
- m: [T; 0]
-}
-
-fn with_assoc<'a,'b>() {
- // For this type to be valid, the rules require that all
- // associated types of traits that appear in `WithAssoc` must
- // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
- // which is &'b (), must outlive 'a.
-
- let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs b/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs
deleted file mode 100644
index 19c50d5..0000000
--- a/src/test/compile-fail/regions-bounded-by-trait-requiring-static.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2012 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.
-
-// Test which of the builtin types are considered sendable. The tests
-// in this file all test region bound and lifetime violations that are
-// detected during type check.
-
-trait Dummy : 'static { }
-fn assert_send<T:'static>() { }
-
-// lifetime pointers with 'static lifetime are ok
-
-fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) {
- assert_send::<&'static isize>();
- assert_send::<&'static str>();
- assert_send::<&'static [isize]>();
-
- // whether or not they are mutable
- assert_send::<&'static mut isize>();
-}
-
-// otherwise lifetime pointers are not ok
-
-fn param_not_ok<'a>(x: &'a isize) {
- assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime
-}
-
-fn param_not_ok1<'a>(_: &'a isize) {
- assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime
-}
-
-fn param_not_ok2<'a>(_: &'a isize) {
- assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime
-}
-
-// boxes are ok
-
-fn box_ok() {
- assert_send::<Box<isize>>();
- assert_send::<String>();
- assert_send::<Vec<isize>>();
-}
-
-// but not if they own a bad thing
-
-fn box_with_region_not_ok<'a>() {
- assert_send::<Box<&'a isize>>(); //~ ERROR does not fulfill the required lifetime
-}
-
-// raw pointers are ok unless they point at unsendable things
-
-fn unsafe_ok1<'a>(_: &'a isize) {
- assert_send::<*const isize>();
- assert_send::<*mut isize>();
-}
-
-fn unsafe_ok2<'a>(_: &'a isize) {
- assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime
-}
-
-fn unsafe_ok3<'a>(_: &'a isize) {
- assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters.rs b/src/test/compile-fail/regions-bounded-method-type-parameters.rs
deleted file mode 100644
index da4e823..0000000
--- a/src/test/compile-fail/regions-bounded-method-type-parameters.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Check that explicit region bounds are allowed on the various
-// nominal types (but not on other types) and that they are type
-// checked.
-
-struct Foo;
-
-impl Foo {
- fn some_method<A:'static>(self) { }
-}
-
-fn caller<'a>(x: &isize) {
- Foo.some_method::<&'a isize>();
- //~^ ERROR does not fulfill the required lifetime
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/regions-free-region-ordering-caller.rs b/src/test/compile-fail/regions-free-region-ordering-caller.rs
deleted file mode 100644
index 66b1674..0000000
--- a/src/test/compile-fail/regions-free-region-ordering-caller.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2012 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.
-
-// Test various ways to construct a pointer with a longer lifetime
-// than the thing it points at and ensure that they result in
-// errors. See also regions-free-region-ordering-callee.rs
-
-struct Paramd<'a> { x: &'a usize }
-
-fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
- let z: Option<&'b &'a usize> = None;//~ ERROR E0623
-}
-
-fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
- let y: Paramd<'a> = Paramd { x: a };
- let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623
-}
-
-fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
- let z: Option<&'a &'b usize> = None;//~ ERROR E0623
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/regions-implied-bounds-projection-gap-1.rs b/src/test/compile-fail/regions-implied-bounds-projection-gap-1.rs
deleted file mode 100644
index 65594ab..0000000
--- a/src/test/compile-fail/regions-implied-bounds-projection-gap-1.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2012 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.
-
-// Illustrates the "projection gap": in this test, even though we know
-// that `T::Foo: 'x`, that does not tell us that `T: 'x`, because
-// there might be other ways for the caller of `func` to show that
-// `T::Foo: 'x` holds (e.g., where-clause).
-
-trait Trait1<'x> {
- type Foo;
-}
-
-// calling this fn should trigger a check that the type argument
-// supplied is well-formed.
-fn wf<T>() { }
-
-fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
-{
- wf::<&'x T>();
- //~^ ERROR the parameter type `T` may not live long enough
-}
-
-fn caller2<'x, T:Trait1<'x>>(t: &'x T)
-{
- wf::<&'x T::Foo>(); // OK
-}
-
-fn caller3<'x, T:Trait1<'x>>(t: &'x T::Foo)
-{
- wf::<&'x T::Foo>(); // OK
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs b/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs
deleted file mode 100644
index 6e1c765..0000000
--- a/src/test/compile-fail/regions-infer-contravariance-due-to-decl.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2012 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.
-
-// Test that a type which is contravariant with respect to its region
-// parameter yields an error when used in a covariant way.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-use std::marker;
-
-// This is contravariant with respect to 'a, meaning that
-// Contravariant<'foo> <: Contravariant<'static> because
-// 'foo <= 'static
-struct Contravariant<'a> {
- marker: marker::PhantomData<&'a()>
-}
-
-fn use_<'short,'long>(c: Contravariant<'short>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
-
- // Test whether Contravariant<'short> <: Contravariant<'long>. Since
- // 'short <= 'long, this would be true if the Contravariant type were
- // covariant with respect to its parameter 'a.
-
- let _: Contravariant<'long> = c; //~ ERROR E0623
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs b/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs
deleted file mode 100644
index 1ab8ba4..0000000
--- a/src/test/compile-fail/regions-infer-covariance-due-to-decl.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2012 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.
-
-// Test that a type which is covariant with respect to its region
-// parameter yields an error when used in a contravariant way.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-use std::marker;
-
-struct Covariant<'a> {
- marker: marker::PhantomData<fn(&'a ())>
-}
-
-fn use_<'short,'long>(c: Covariant<'long>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
-
- // Test whether Covariant<'long> <: Covariant<'short>. Since
- // 'short <= 'long, this would be true if the Covariant type were
- // contravariant with respect to its parameter 'a.
-
- let _: Covariant<'short> = c; //~ ERROR E0623
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/regions-outlives-projection-container-wc.rs b/src/test/compile-fail/regions-outlives-projection-container-wc.rs
deleted file mode 100644
index 71606ba..0000000
--- a/src/test/compile-fail/regions-outlives-projection-container-wc.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2015 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.
-
-// Test that we are imposing the requirement that every associated
-// type of a bound that appears in the where clause on a struct must
-// outlive the location in which the type appears, even when the
-// constraint is in a where clause not a bound. Issue #22246.
-
-#![allow(dead_code)]
-
-///////////////////////////////////////////////////////////////////////////
-
-pub trait TheTrait {
- type TheAssocType;
-}
-
-pub struct TheType<'b> {
- m: [fn(&'b()); 0]
-}
-
-impl<'b> TheTrait for TheType<'b> {
- type TheAssocType = &'b ();
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-pub struct WithAssoc<T> where T : TheTrait {
- m: [T; 0]
-}
-
-fn with_assoc<'a,'b>() {
- // For this type to be valid, the rules require that all
- // associated types of traits that appear in `WithAssoc` must
- // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
- // which is &'b (), must outlive 'a.
-
- let _: &'a WithAssoc<TheType<'b>> = loop { };
- //~^ ERROR reference has a longer lifetime
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/regions-outlives-projection-container.rs b/src/test/compile-fail/regions-outlives-projection-container.rs
deleted file mode 100644
index 957e56f..0000000
--- a/src/test/compile-fail/regions-outlives-projection-container.rs
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2015 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.
-
-// Test that we are imposing the requirement that every associated
-// type of a bound that appears in the where clause on a struct must
-// outlive the location in which the type appears. Issue #22246.
-
-#![allow(dead_code)]
-#![feature(rustc_attrs)]
-
-///////////////////////////////////////////////////////////////////////////
-
-pub trait TheTrait {
- type TheAssocType;
-}
-
-pub struct TheType<'b> {
- m: [fn(&'b()); 0]
-}
-
-impl<'b> TheTrait for TheType<'b> {
- type TheAssocType = &'b ();
-}
-
-///////////////////////////////////////////////////////////////////////////
-
-pub struct WithAssoc<T:TheTrait> {
- m: [T; 0]
-}
-
-pub struct WithoutAssoc<T> {
- m: [T; 0]
-}
-
-fn with_assoc<'a,'b>() {
- // For this type to be valid, the rules require that all
- // associated types of traits that appear in `WithAssoc` must
- // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
- // which is &'b (), must outlive 'a.
-
- let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
-}
-
-fn with_assoc1<'a,'b>() where 'b : 'a {
- // For this type to be valid, the rules require that all
- // associated types of traits that appear in `WithAssoc` must
- // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
- // which is &'b (), must outlive 'a, so 'b : 'a must hold, and
- // that is in the where clauses, so we're fine.
-
- let _: &'a WithAssoc<TheType<'b>> = loop { };
-}
-
-fn without_assoc<'a,'b>() {
- // Here there are no associated types but there is a requirement
- // that `'b:'a` holds because the `'b` appears in `TheType<'b>`.
-
- let _: &'a WithoutAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
-}
-
-fn call_with_assoc<'a,'b>() {
- // As `with_assoc`, but just checking that we impose the same rule
- // on the value supplied for the type argument, even when there is
- // no data.
-
- call::<&'a WithAssoc<TheType<'b>>>();
- //~^ ERROR reference has a longer lifetime
-}
-
-fn call_without_assoc<'a,'b>() {
- // As `without_assoc`, but in a distinct scenario.
-
- call::<&'a WithoutAssoc<TheType<'b>>>(); //~ ERROR reference has a longer lifetime
-}
-
-fn call<T>() { }
-
-fn main() {
-}
diff --git a/src/test/compile-fail/regions-variance-contravariant-use-covariant-in-second-position.rs b/src/test/compile-fail/regions-variance-contravariant-use-covariant-in-second-position.rs
deleted file mode 100644
index 1dfebd5..0000000
--- a/src/test/compile-fail/regions-variance-contravariant-use-covariant-in-second-position.rs
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2012 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.
-
-// Test that a type which is covariant with respect to its region
-// parameter yields an error when used in a contravariant way.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-// `S` is contravariant with respect to both parameters.
-struct S<'a, 'b> {
- f: &'a isize,
- g: &'b isize,
-}
-
-fn use_<'short,'long>(c: S<'long, 'short>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
-
- let _: S<'long, 'short> = c; // OK
- let _: S<'short, 'short> = c; // OK
-
- // Test whether S<_,'short> <: S<_,'long>. Since
- // 'short <= 'long, this would be true if the Contravariant type were
- // covariant with respect to its parameter 'a.
-
- let _: S<'long, 'long> = c; //~ ERROR E0623
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs b/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs
deleted file mode 100644
index caf6a86..0000000
--- a/src/test/compile-fail/regions-variance-contravariant-use-covariant.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 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.
-
-// Test that a type which is covariant with respect to its region
-// parameter yields an error when used in a contravariant way.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-// This is contravariant with respect to 'a, meaning that
-// Contravariant<'long> <: Contravariant<'short> iff
-// 'short <= 'long
-struct Contravariant<'a> {
- f: &'a isize
-}
-
-fn use_<'short,'long>(c: Contravariant<'short>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
-
- // Test whether Contravariant<'short> <: Contravariant<'long>. Since
- // 'short <= 'long, this would be true if the Contravariant type were
- // covariant with respect to its parameter 'a.
-
- let _: Contravariant<'long> = c; //~ ERROR E0623
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/regions-variance-covariant-use-contravariant.rs b/src/test/compile-fail/regions-variance-covariant-use-contravariant.rs
deleted file mode 100644
index 60dc3d9..0000000
--- a/src/test/compile-fail/regions-variance-covariant-use-contravariant.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 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.
-
-// Test that a type which is covariant with respect to its region
-// parameter yields an error when used in a contravariant way.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-// This is covariant with respect to 'a, meaning that
-// Covariant<'foo> <: Covariant<'static> because
-// 'foo <= 'static
-struct Covariant<'a> {
- f: extern "Rust" fn(&'a isize)
-}
-
-fn use_<'short,'long>(c: Covariant<'long>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
-
- // Test whether Covariant<'long> <: Covariant<'short>. Since
- // 'short <= 'long, this would be true if the Covariant type were
- // contravariant with respect to its parameter 'a.
-
- let _: Covariant<'short> = c; //~ ERROR E0623
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/regions-variance-invariant-use-contravariant.rs b/src/test/compile-fail/regions-variance-invariant-use-contravariant.rs
deleted file mode 100644
index 96478fa..0000000
--- a/src/test/compile-fail/regions-variance-invariant-use-contravariant.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2012 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.
-
-// Test that an invariant region parameter used in a contravariant way
-// yields an error.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-struct Invariant<'a> {
- f: &'a mut &'a isize
-}
-
-fn use_<'short,'long>(c: Invariant<'long>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
-
- // Test whether Invariant<'long> <: Invariant<'short>. Since
- // 'short <= 'long, this would be true if the Invariant type were
- // contravariant with respect to its parameter 'a.
-
- let _: Invariant<'short> = c; //~ ERROR E0623
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/regions-variance-invariant-use-covariant.rs b/src/test/compile-fail/regions-variance-invariant-use-covariant.rs
deleted file mode 100644
index bd944a8..0000000
--- a/src/test/compile-fail/regions-variance-invariant-use-covariant.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2012 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.
-
-// Test that a type which is invariant with respect to its region
-// parameter used in a covariant way yields an error.
-//
-// Note: see variance-regions-*.rs for the tests that check that the
-// variance inference works in the first place.
-
-struct Invariant<'a> {
- f: &'a mut &'a isize
-}
-
-fn use_<'b>(c: Invariant<'b>) {
-
- // For this assignment to be legal, Invariant<'b> <: Invariant<'static>.
- // Since 'b <= 'static, this would be true if Invariant were covariant
- // with respect to its parameter 'a.
-
- let _: Invariant<'static> = c; //~ ERROR mismatched types
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs b/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs
deleted file mode 100644
index 65f11c0..0000000
--- a/src/test/compile-fail/rfc-2126-crate-paths/crate-path-non-absolute.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.
-
-#![feature(crate_in_paths)]
-
-struct S;
-
-pub mod m {
- fn f() {
- let s = ::m::crate::S; //~ ERROR failed to resolve
- let s2 = crate::S; // no error
- }
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs b/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs
deleted file mode 100644
index bdd03be..0000000
--- a/src/test/compile-fail/rfc-2126-crate-paths/keyword-crate-as-identifier.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-#![feature(crate_in_paths)]
-
-fn main() {
- let crate = 0; //~ ERROR failed to resolve. `crate` in paths can only be used in start position
-}
diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs
deleted file mode 100644
index e9de0f0..0000000
--- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/single-segment.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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.
-
-// aux-build:xcrate.rs
-// edition:2018
-
-use crate; //~ ERROR unresolved import `crate`
- //~^ NOTE crate root imports need to be explicitly named: `use crate as name;`
-use *; //~ ERROR unresolved import `*`
- //~^ NOTE cannot glob-import all possible crates
-
-fn main() {
- let s = ::xcrate; //~ ERROR expected value, found module `xcrate`
- //~^ NOTE not a value
-}
diff --git a/src/test/compile-fail/rfc-2126-extern-in-paths/single-segment.rs b/src/test/compile-fail/rfc-2126-extern-in-paths/single-segment.rs
deleted file mode 100644
index ebc42aa..0000000
--- a/src/test/compile-fail/rfc-2126-extern-in-paths/single-segment.rs
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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.
-
-// aux-build:xcrate.rs
-
-#![feature(extern_in_paths)]
-
-use extern; //~ ERROR unresolved import `extern`
- //~^ NOTE no `extern` in the root
-use extern::*; //~ ERROR unresolved import `extern::*`
- //~^ NOTE cannot glob-import all possible crates
-
-fn main() {
- let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate`
- //~^ NOTE not a value
-}
diff --git a/src/test/compile-fail/transmute-different-sizes.rs b/src/test/compile-fail/transmute-different-sizes.rs
deleted file mode 100644
index 113e2ed..0000000
--- a/src/test/compile-fail/transmute-different-sizes.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2012 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.
-
-// Tests that `transmute` cannot be called on types of different size.
-
-#![allow(warnings)]
-#![feature(specialization)]
-
-use std::mem::transmute;
-
-unsafe fn f() {
- let _: i8 = transmute(16i16);
- //~^ ERROR transmute called with types of different sizes
-}
-
-unsafe fn g<T>(x: &T) {
- let _: i8 = transmute(x);
- //~^ ERROR transmute called with types of different sizes
-}
-
-trait Specializable { type Output; }
-
-impl<T> Specializable for T {
- default type Output = u16;
-}
-
-unsafe fn specializable<T>(x: u16) -> <T as Specializable>::Output {
- transmute(x)
- //~^ ERROR transmute called with types of different sizes
-}
-
-fn main() {}
diff --git a/src/test/compile-fail/transmute-fat-pointers.rs b/src/test/compile-fail/transmute-fat-pointers.rs
deleted file mode 100644
index 59027fc..0000000
--- a/src/test/compile-fail/transmute-fat-pointers.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2012 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.
-
-// Tests that are conservative around thin/fat pointer mismatches.
-
-#![allow(dead_code)]
-
-use std::mem::transmute;
-
-fn a<T, U: ?Sized>(x: &[T]) -> &U {
- unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
-}
-
-fn b<T: ?Sized, U: ?Sized>(x: &T) -> &U {
- unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
-}
-
-fn c<T, U>(x: &T) -> &U {
- unsafe { transmute(x) }
-}
-
-fn d<T, U>(x: &[T]) -> &[U] {
- unsafe { transmute(x) }
-}
-
-fn e<T: ?Sized, U>(x: &T) -> &U {
- unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
-}
-
-fn f<T, U: ?Sized>(x: &T) -> &U {
- unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/transmute-impl.rs b/src/test/compile-fail/transmute-impl.rs
deleted file mode 100644
index 2f8f9e4..0000000
--- a/src/test/compile-fail/transmute-impl.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Tests that are conservative around thin/fat pointer mismatches.
-
-#![allow(dead_code)]
-
-use std::mem::transmute;
-
-struct Foo<T: ?Sized> {
- t: Box<T>
-}
-
-impl<T: ?Sized> Foo<T> {
- fn m(x: &T) -> &isize where T : Sized {
- // OK here, because T : Sized is in scope.
- unsafe { transmute(x) }
- }
-
- fn n(x: &T) -> &isize {
- // Not OK here, because T : Sized is not in scope.
- unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
- }
-}
-
-fn main() { }
diff --git a/src/test/compile-fail/panic-runtime/two-panic-runtimes.rs b/src/test/compile-fail/two-panic-runtimes.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/two-panic-runtimes.rs
rename to src/test/compile-fail/two-panic-runtimes.rs
diff --git a/src/test/compile-fail/unboxed-closure-region.rs b/src/test/compile-fail/unboxed-closure-region.rs
deleted file mode 100644
index 1c86dda..0000000
--- a/src/test/compile-fail/unboxed-closure-region.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that an unboxed closure that captures a free variable by
-// reference cannot escape the region of that variable.
-fn main() {
- let _f = {
- let x = 0;
- || x //~ ERROR `x` does not live long enough
- };
-}
diff --git a/src/test/compile-fail/unboxed-closures-borrow-conflict.rs b/src/test/compile-fail/unboxed-closures-borrow-conflict.rs
deleted file mode 100644
index ad7e678..0000000
--- a/src/test/compile-fail/unboxed-closures-borrow-conflict.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// Test that an unboxed closure that mutates a free variable will
-// cause borrow conflicts.
-
-fn main() {
- let mut x = 0;
- let f = || x += 1;
- let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
-}
diff --git a/src/test/compile-fail/union-ub-fat-ptr.rs b/src/test/compile-fail/union-ub-fat-ptr.rs
deleted file mode 100644
index 935e69d..0000000
--- a/src/test/compile-fail/union-ub-fat-ptr.rs
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct SliceRepr {
- ptr: *const u8,
- len: usize,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct BadSliceRepr {
- ptr: *const u8,
- len: &'static u8,
-}
-
-union SliceTransmute {
- repr: SliceRepr,
- bad: BadSliceRepr,
- slice: &'static [u8],
- str: &'static str,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct DynRepr {
- ptr: *const u8,
- vtable: *const u8,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct DynRepr2 {
- ptr: *const u8,
- vtable: *const u64,
-}
-
-#[repr(C)]
-#[derive(Copy, Clone)]
-struct BadDynRepr {
- ptr: *const u8,
- vtable: usize,
-}
-
-union DynTransmute {
- repr: DynRepr,
- repr2: DynRepr2,
- bad: BadDynRepr,
- rust: &'static Trait,
-}
-
-trait Trait {}
-
-// OK
-const A: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 1 } }.str};
-// should lint
-const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str};
-// bad
-const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str};
-//~^ ERROR this constant likely exhibits undefined behavior
-
-// OK
-const A2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 1 } }.slice};
-// should lint
-const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice};
-// bad
-const C2: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice};
-//~^ ERROR this constant likely exhibits undefined behavior
-
-// bad
-const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust};
-//~^ ERROR this constant likely exhibits undefined behavior
-// bad
-const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust};
-//~^ ERROR this constant likely exhibits undefined behavior
-// bad
-const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust};
-//~^ ERROR this constant likely exhibits undefined behavior
-
-fn main() {
-}
diff --git a/src/test/compile-fail/unsized-locals/unsized-exprs.rs b/src/test/compile-fail/unsized-locals/unsized-exprs.rs
new file mode 100644
index 0000000..a09ccbb
--- /dev/null
+++ b/src/test/compile-fail/unsized-locals/unsized-exprs.rs
@@ -0,0 +1,36 @@
+// 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.
+
+#![feature(unsized_tuple_coercion, unsized_locals)]
+
+struct A<X: ?Sized>(X);
+
+fn udrop<T: ?Sized>(_x: T) {}
+fn foo() -> Box<[u8]> {
+ Box::new(*b"foo")
+}
+fn tfoo() -> Box<(i32, [u8])> {
+ Box::new((42, *b"foo"))
+}
+fn afoo() -> Box<A<[u8]>> {
+ Box::new(A(*b"foo"))
+}
+
+impl std::ops::Add<i32> for A<[u8]> {
+ type Output = ();
+ fn add(self, _rhs: i32) -> Self::Output {}
+}
+
+fn main() {
+ udrop::<(i32, [u8])>((42, *foo()));
+ //~^ERROR E0277
+ udrop::<A<[u8]>>(A { 0: *foo() });
+ //~^ERROR E0277
+}
diff --git a/src/test/compile-fail/unsized-locals/unsized-exprs2.rs b/src/test/compile-fail/unsized-locals/unsized-exprs2.rs
new file mode 100644
index 0000000..40d6e54
--- /dev/null
+++ b/src/test/compile-fail/unsized-locals/unsized-exprs2.rs
@@ -0,0 +1,36 @@
+// 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.
+
+#![feature(unsized_tuple_coercion, unsized_locals)]
+
+struct A<X: ?Sized>(X);
+
+fn udrop<T: ?Sized>(_x: T) {}
+fn foo() -> Box<[u8]> {
+ Box::new(*b"foo")
+}
+fn tfoo() -> Box<(i32, [u8])> {
+ Box::new((42, *b"foo"))
+}
+fn afoo() -> Box<A<[u8]>> {
+ Box::new(A(*b"foo"))
+}
+
+impl std::ops::Add<i32> for A<[u8]> {
+ type Output = ();
+ fn add(self, _rhs: i32) -> Self::Output {}
+}
+
+fn main() {
+ udrop::<[u8]>(foo()[..]);
+ //~^ERROR cannot move out of indexed content
+ // FIXME: should be error
+ udrop::<A<[u8]>>(A(*foo()));
+}
diff --git a/src/test/compile-fail/variance-cell-is-invariant.rs b/src/test/compile-fail/variance-cell-is-invariant.rs
deleted file mode 100644
index 1ddbcf4..0000000
--- a/src/test/compile-fail/variance-cell-is-invariant.rs
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2012 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.
-
-// Test that Cell is considered invariant with respect to its
-// type.
-
-use std::cell::Cell;
-
-struct Foo<'a> {
- x: Cell<Option<&'a isize>>,
-}
-
-fn use_<'short,'long>(c: Foo<'short>,
- s: &'short isize,
- l: &'long isize,
- _where:Option<&'short &'long ()>) {
- let _: Foo<'long> = c; //~ ERROR E0623
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/variance-contravariant-arg-trait-match.rs b/src/test/compile-fail/variance-contravariant-arg-trait-match.rs
deleted file mode 100644
index 9b6e3c9..0000000
--- a/src/test/compile-fail/variance-contravariant-arg-trait-match.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(dead_code)]
-
-// Test that even when `T` is only used in contravariant position, it
-// is treated as invariant.
-
-trait Get<T> {
- fn get(&self, t: T);
-}
-
-fn get_min_from_max<'min, 'max, G>()
- where 'max : 'min, G : Get<&'max i32>
-{
- impls_get::<G,&'min i32>() //~ ERROR mismatched types
-}
-
-fn get_max_from_min<'min, 'max, G>()
- where 'max : 'min, G : Get<&'min i32>
-{
- // Previously OK, but now an error because traits are invariant:
-
- impls_get::<G,&'max i32>() //~ ERROR mismatched types
-}
-
-fn impls_get<G,T>() where G : Get<T> { }
-
-fn main() { }
diff --git a/src/test/compile-fail/variance-contravariant-self-trait-match.rs b/src/test/compile-fail/variance-contravariant-self-trait-match.rs
deleted file mode 100644
index 6d9d1e6..0000000
--- a/src/test/compile-fail/variance-contravariant-self-trait-match.rs
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(dead_code)]
-
-// Test that even when `Self` is only used in contravariant position, it
-// is treated as invariant.
-
-trait Get {
- fn get(&self);
-}
-
-fn get_min_from_max<'min, 'max, G>()
- where 'max : 'min, G : 'max, &'max G : Get
-{
- impls_get::<&'min G>(); //~ ERROR mismatched types
-}
-
-fn get_max_from_min<'min, 'max, G>()
- where 'max : 'min, G : 'max, &'min G : Get
-{
- // Previously OK, but now error because traits are invariant with
- // respect to all inputs.
-
- impls_get::<&'max G>(); //~ ERROR mismatched types
-}
-
-fn impls_get<G>() where G : Get { }
-
-fn main() { }
diff --git a/src/test/compile-fail/variance-covariant-arg-trait-match.rs b/src/test/compile-fail/variance-covariant-arg-trait-match.rs
deleted file mode 100644
index c42a845..0000000
--- a/src/test/compile-fail/variance-covariant-arg-trait-match.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(dead_code)]
-
-// Test that even when `T` is only used in covariant position, it
-// is treated as invariant.
-
-trait Get<T> {
- fn get(&self) -> T;
-}
-
-fn get_min_from_max<'min, 'max, G>()
- where 'max : 'min, G : Get<&'max i32>
-{
- // Previously OK, now an error as traits are invariant.
- impls_get::<G,&'min i32>() //~ ERROR mismatched types
-}
-
-fn get_max_from_min<'min, 'max, G>()
- where 'max : 'min, G : Get<&'min i32>
-{
- impls_get::<G,&'max i32>() //~ ERROR mismatched types
-}
-
-fn impls_get<G,T>() where G : Get<T> { }
-
-fn main() { }
diff --git a/src/test/compile-fail/variance-covariant-self-trait-match.rs b/src/test/compile-fail/variance-covariant-self-trait-match.rs
deleted file mode 100644
index 25148df..0000000
--- a/src/test/compile-fail/variance-covariant-self-trait-match.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(dead_code)]
-
-// Test that even when `Self` is only used in covariant position, it
-// is treated as invariant.
-
-trait Get {
- fn get() -> Self;
-}
-
-fn get_min_from_max<'min, 'max, G>()
- where 'max : 'min, G : 'max, &'max G : Get
-{
- // Previously OK, now an error as traits are invariant.
- impls_get::<&'min G>(); //~ ERROR mismatched types
-}
-
-fn get_max_from_min<'min, 'max, G>()
- where 'max : 'min, G : 'max, &'min G : Get
-{
- impls_get::<&'max G>(); //~ ERROR mismatched types
-}
-
-fn impls_get<G>() where G : Get { }
-
-fn main() { }
diff --git a/src/test/compile-fail/variance-invariant-arg-trait-match.rs b/src/test/compile-fail/variance-invariant-arg-trait-match.rs
deleted file mode 100644
index 45fed0b..0000000
--- a/src/test/compile-fail/variance-invariant-arg-trait-match.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(dead_code)]
-
-trait Get<T> {
- fn get(&self, t: T) -> T;
-}
-
-fn get_min_from_max<'min, 'max, G>()
- where 'max : 'min, G : Get<&'max i32>
-{
- impls_get::<G,&'min i32>() //~ ERROR mismatched types
-}
-
-fn get_max_from_min<'min, 'max, G>()
- where 'max : 'min, G : Get<&'min i32>
-{
- impls_get::<G,&'max i32>() //~ ERROR mismatched types
-}
-
-fn impls_get<G,T>() where G : Get<T> { }
-
-fn main() { }
diff --git a/src/test/compile-fail/variance-invariant-self-trait-match.rs b/src/test/compile-fail/variance-invariant-self-trait-match.rs
deleted file mode 100644
index fe61dee..0000000
--- a/src/test/compile-fail/variance-invariant-self-trait-match.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2015 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.
-
-#![allow(dead_code)]
-
-trait Get {
- fn get(&self) -> Self;
-}
-
-fn get_min_from_max<'min, 'max, G>()
- where 'max : 'min, &'max G : Get, G : 'max
-{
- impls_get::<&'min G>(); //~ ERROR mismatched types
-}
-
-fn get_max_from_min<'min, 'max, G>()
- where 'max : 'min, &'min G : Get, G : 'min
-{
- impls_get::<&'max G>(); //~ ERROR mismatched types
-}
-
-fn impls_get<G>() where G : Get { }
-
-fn main() { }
diff --git a/src/test/compile-fail/panic-runtime/want-abort-got-unwind.rs b/src/test/compile-fail/want-abort-got-unwind.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/want-abort-got-unwind.rs
rename to src/test/compile-fail/want-abort-got-unwind.rs
diff --git a/src/test/compile-fail/panic-runtime/want-abort-got-unwind2.rs b/src/test/compile-fail/want-abort-got-unwind2.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/want-abort-got-unwind2.rs
rename to src/test/compile-fail/want-abort-got-unwind2.rs
diff --git a/src/test/debuginfo/pretty-std-collections.rs b/src/test/debuginfo/pretty-std-collections.rs
new file mode 100644
index 0000000..8e37a88
--- /dev/null
+++ b/src/test/debuginfo/pretty-std-collections.rs
@@ -0,0 +1,60 @@
+// 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.
+
+// ignore-windows failing on win32 bot
+// ignore-freebsd: gdb package too new
+// ignore-android: FIXME(#10381)
+// compile-flags:-g
+// min-gdb-version 7.7
+// min-lldb-version: 310
+
+// === GDB TESTS ===================================================================================
+
+// gdb-command: run
+
+// gdb-command: print btree_set
+// gdb-check:$1 = BTreeSet<i32>(len: 3) = {3, 5, 7}
+
+// gdb-command: print btree_map
+// gdb-check:$2 = BTreeMap<i32, i32>(len: 3) = {[3] = 3, [5] = 7, [7] = 4}
+
+// gdb-command: print vec_deque
+// gdb-check:$3 = VecDeque<i32>(len: 3, cap: 8) = {5, 3, 7}
+
+#![allow(unused_variables)]
+use std::collections::BTreeSet;
+use std::collections::BTreeMap;
+use std::collections::VecDeque;
+
+
+fn main() {
+
+ // BTreeSet
+ let mut btree_set = BTreeSet::new();
+ btree_set.insert(5);
+ btree_set.insert(3);
+ btree_set.insert(7);
+
+ // BTreeMap
+ let mut btree_map = BTreeMap::new();
+ btree_map.insert(5, 7);
+ btree_map.insert(3, 3);
+ btree_map.insert(7, 4);
+
+ // VecDeque
+ let mut vec_deque = VecDeque::new();
+ vec_deque.push_back(5);
+ vec_deque.push_back(3);
+ vec_deque.push_back(7);
+
+ zzz(); // #break
+}
+
+fn zzz() { () }
diff --git a/src/test/incremental/issue-39828/auxiliary/generic.rs b/src/test/incremental/issue-39828/auxiliary/generic.rs
index a562eab..5491827 100644
--- a/src/test/incremental/issue-39828/auxiliary/generic.rs
+++ b/src/test/incremental/issue-39828/auxiliary/generic.rs
@@ -11,7 +11,7 @@
// revisions:rpass1 rpass2
// compile-flags: -Z query-dep-graph
-#![rustc_partition_reused(module="__rustc_fallback_codegen_unit", cfg="rpass2")]
+#![rustc_partition_reused(module="generic-fallback.cgu", cfg="rpass2")]
#![feature(rustc_attrs)]
#![crate_type="rlib"]
diff --git a/src/test/incremental/remove_source_file/main.rs b/src/test/incremental/remove_source_file/main.rs
index a8c3f70..75fe6d9 100644
--- a/src/test/incremental/remove_source_file/main.rs
+++ b/src/test/incremental/remove_source_file/main.rs
@@ -13,7 +13,7 @@
// revisions:cfail1 cfail2
-// Note that we specify -g so that the FileMaps actually get referenced by the
+// Note that we specify -g so that the SourceFiles actually get referenced by the
// incr. comp. cache:
// compile-flags: -Z query-dep-graph -g
// compile-pass
diff --git a/src/test/incremental/span_hash_stable/main.rs b/src/test/incremental/span_hash_stable/main.rs
index 1512c5d..646a388 100644
--- a/src/test/incremental/span_hash_stable/main.rs
+++ b/src/test/incremental/span_hash_stable/main.rs
@@ -9,7 +9,7 @@
// except according to those terms.
// This test makes sure that it doesn't make a difference in which order we are
-// adding source files to the codemap. The order affects the BytePos values of
+// adding source files to the source_map. The order affects the BytePos values of
// the spans and this test makes sure that we handle them correctly by hashing
// file:line:column instead of raw byte offset.
diff --git a/src/test/parse-fail/attr-bad-meta-2.rs b/src/test/parse-fail/attr-bad-meta-2.rs
new file mode 100644
index 0000000..ce640a3
--- /dev/null
+++ b/src/test/parse-fail/attr-bad-meta-2.rs
@@ -0,0 +1,12 @@
+// 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.
+
+#[path =] //~ ERROR unexpected token: `]`
+mod m {}
diff --git a/src/test/parse-fail/attr-bad-meta-3.rs b/src/test/parse-fail/attr-bad-meta-3.rs
new file mode 100644
index 0000000..92e2a59
--- /dev/null
+++ b/src/test/parse-fail/attr-bad-meta-3.rs
@@ -0,0 +1,12 @@
+// 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.
+
+#[path() token] //~ ERROR expected `]`, found `token`
+mod m {}
diff --git a/src/test/parse-fail/attr-bad-meta.rs b/src/test/parse-fail/attr-bad-meta.rs
index d57a813..6f9d794 100644
--- a/src/test/parse-fail/attr-bad-meta.rs
+++ b/src/test/parse-fail/attr-bad-meta.rs
@@ -8,6 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// asterisk is bogus
-#[path*] //~ ERROR expected one of `(` or `=`
+#![feature(unrestricted_attribute_tokens)]
+
+#[path*] //~ ERROR expected one of `(`, `::`, `=`, `[`, `]`, or `{`, found `*`
mod m {}
diff --git a/src/test/parse-fail/issue-10636-1.rs b/src/test/parse-fail/issue-10636-1.rs
deleted file mode 100644
index 398fe8c..0000000
--- a/src/test/parse-fail/issue-10636-1.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags: -Z parse-only
-
-struct Obj { //~ NOTE: unclosed delimiter
- member: usize
-) //~ ERROR: incorrect close delimiter
diff --git a/src/test/pretty/cast-lt.pp b/src/test/pretty/cast-lt.pp
index f1b4b4f..b8d9207 100644
--- a/src/test/pretty/cast-lt.pp
+++ b/src/test/pretty/cast-lt.pp
@@ -1,7 +1,7 @@
#![feature(prelude_import)]
#![no_std]
#[prelude_import]
-use std::prelude::v1::*;
+use ::std::prelude::v1::*;
#[macro_use]
extern crate std;
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp
index a4380d9..5f42b86 100644
--- a/src/test/pretty/issue-4264.pp
+++ b/src/test/pretty/issue-4264.pp
@@ -1,5 +1,5 @@
#[prelude_import]
-use std::prelude::v1::*;
+use ::std::prelude::v1::*;
#[macro_use]
extern crate std;
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
diff --git a/src/test/run-fail-fulldeps/qquote.rs b/src/test/run-fail-fulldeps/qquote.rs
index c8c80b7..d757dd9 100644
--- a/src/test/run-fail-fulldeps/qquote.rs
+++ b/src/test/run-fail-fulldeps/qquote.rs
@@ -18,7 +18,7 @@
extern crate syntax_pos;
use syntax::ast;
-use syntax::codemap;
+use syntax::source_map;
use syntax::print::pprust;
use syntax::symbol::Symbol;
use syntax_pos::DUMMY_SP;
@@ -28,7 +28,7 @@
}
fn run() {
- let ps = syntax::parse::ParseSess::new(codemap::FilePathMapping::empty());
+ let ps = syntax::parse::ParseSess::new(source_map::FilePathMapping::empty());
let mut resolver = syntax::ext::base::DummyResolver;
let mut cx = syntax::ext::base::ExtCtxt::new(
&ps,
diff --git a/src/test/run-make-fulldeps/cross-lang-lto/Makefile b/src/test/run-make-fulldeps/cross-lang-lto/Makefile
index 6d06fad..1d072e0 100644
--- a/src/test/run-make-fulldeps/cross-lang-lto/Makefile
+++ b/src/test/run-make-fulldeps/cross-lang-lto/Makefile
@@ -16,22 +16,22 @@
staticlib: lib.rs
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib.a
$(call EXTRACT_OBJS, liblib.a)
- $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib.lib0.rcgu.o
+ for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
staticlib-fat-lto: lib.rs
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-fat-lto.a -Clto=fat
$(call EXTRACT_OBJS, liblib-fat-lto.a)
- $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib-fat-lto.lib0.rcgu.o
+ for file in $(TMPDIR)/liblib-fat-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
staticlib-thin-lto: lib.rs
$(BUILD_LIB) --crate-type=staticlib -o $(TMPDIR)/liblib-thin-lto.a -Clto=thin
$(call EXTRACT_OBJS, liblib-thin-lto.a)
- $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib-thin-lto.lib0.rcgu.o
+ for file in $(TMPDIR)/liblib-thin-lto.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
rlib: lib.rs
$(BUILD_LIB) --crate-type=rlib -o $(TMPDIR)/liblib.rlib
$(call EXTRACT_OBJS, liblib.rlib)
- $(ASSERT_IS_BITCODE_OBJ) $(TMPDIR)/liblib.lib0.rcgu.o
+ for file in $(TMPDIR)/liblib.*.rcgu.o; do $(ASSERT_IS_BITCODE_OBJ) $$file; done
cdylib: lib.rs
$(BUILD_LIB) --crate-type=cdylib --emit=obj -o $(TMPDIR)/cdylib.o
diff --git a/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile b/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile
index 6de4f97..e46390a 100644
--- a/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile
+++ b/src/test/run-make-fulldeps/extra-filename-with-temp-outputs/Makefile
@@ -2,5 +2,5 @@
all:
$(RUSTC) -C extra-filename=bar foo.rs -C save-temps
- rm $(TMPDIR)/foobar.foo0.rcgu.o
+ rm $(TMPDIR)/foobar.foo*0.rcgu.o
rm $(TMPDIR)/$(call BIN,foobar)
diff --git a/src/test/run-make-fulldeps/issue-19371/foo.rs b/src/test/run-make-fulldeps/issue-19371/foo.rs
index d83b21e..4dfecb3 100644
--- a/src/test/run-make-fulldeps/issue-19371/foo.rs
+++ b/src/test/run-make-fulldeps/issue-19371/foo.rs
@@ -24,7 +24,7 @@
use rustc_driver::driver::{self, compile_input, CompileController};
use rustc_metadata::cstore::CStore;
use rustc_errors::registry::Registry;
-use syntax::codemap::FileName;
+use syntax::source_map::FileName;
use rustc_codegen_utils::codegen_backend::CodegenBackend;
use std::path::PathBuf;
diff --git a/src/test/run-make/git_clone_sha1.sh b/src/test/run-make/git_clone_sha1.sh
new file mode 100644
index 0000000..efcc93c
--- /dev/null
+++ b/src/test/run-make/git_clone_sha1.sh
@@ -0,0 +1,33 @@
+#!/bin/bash -x
+
+# 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.
+
+# Usage: $0 project_name url sha1
+# Get the crate with the specified sha1.
+#
+# all arguments are required.
+#
+# See below link for git usage:
+# https://stackoverflow.com/questions/3489173#14091182
+
+# Mandatory arguments:
+PROJECT_NAME=$1
+URL=$2
+SHA1=$3
+
+function err_exit() {
+ echo "ERROR:" $*
+ exit 1
+}
+
+git clone $URL $PROJECT_NAME || err_exit
+cd $PROJECT_NAME || err_exit
+git reset --hard $SHA1 || err_exit
diff --git a/src/test/run-make/thumb-none-cortex-m/Makefile b/src/test/run-make/thumb-none-cortex-m/Makefile
new file mode 100644
index 0000000..a267016
--- /dev/null
+++ b/src/test/run-make/thumb-none-cortex-m/Makefile
@@ -0,0 +1,38 @@
+-include ../../run-make-fulldeps/tools.mk
+
+# How to run this
+# $ ./x.py clean
+# $ ./x.py test --target thumbv6m-none-eabi,thumbv7m-none-eabi src/test/run-make
+
+# Supported targets:
+# - thumbv6m-none-eabi (Bare Cortex-M0, M0+, M1)
+# - thumbv7em-none-eabi (Bare Cortex-M4, M7)
+# - thumbv7em-none-eabihf (Bare Cortex-M4F, M7F, FPU, hardfloat)
+# - thumbv7m-none-eabi (Bare Cortex-M3)
+
+# See https://stackoverflow.com/questions/7656425/makefile-ifeq-logical-or
+ifneq (,$(filter $(TARGET),thumbv6m-none-eabi thumbv7em-none-eabi thumbv7em-none-eabihf thumbv7m-none-eabi))
+
+# For cargo setting
+RUSTC := $(RUSTC_ORIGINAL)
+LD_LIBRARY_PATH := $(HOST_RPATH_DIR)
+# We need to be outside of 'src' dir in order to run cargo
+WORK_DIR := $(TMPDIR)
+
+HERE := $(shell pwd)
+
+CRATE := cortex-m
+CRATE_URL := https://github.com/rust-embedded/cortex-m
+CRATE_SHA1 := a448e9156e2cb1e556e5441fd65426952ef4b927 # 0.5.0
+
+all:
+ env
+ mkdir -p $(WORK_DIR)
+ -cd $(WORK_DIR) && rm -rf $(CRATE)
+ cd $(WORK_DIR) && bash -x $(HERE)/../git_clone_sha1.sh $(CRATE) $(CRATE_URL) $(CRATE_SHA1)
+ cd $(WORK_DIR) && cd $(CRATE) && $(CARGO) build --target $(TARGET) -v
+else
+
+all:
+
+endif
diff --git a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs
index 2ef7eba..6a706bd 100644
--- a/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs
+++ b/src/test/run-pass-fulldeps/ast_stmt_expr_attr.rs
@@ -17,7 +17,7 @@
use syntax::ast::*;
use syntax::attr::*;
use syntax::ast;
-use syntax::codemap::{FilePathMapping, FileName};
+use syntax::source_map::{FilePathMapping, FileName};
use syntax::parse;
use syntax::parse::{ParseSess, PResult};
use syntax::parse::new_parser_from_source_str;
diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs
index 6d5e82c..985f312 100644
--- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs
@@ -22,7 +22,7 @@
use rustc_plugin::Registry;
use syntax::ast::*;
-use syntax::codemap::Span;
+use syntax::source_map::Span;
use syntax::ext::base::*;
use syntax::ext::build::AstBuilder;
use syntax::symbol::Symbol;
diff --git a/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs b/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs
index 7f8a741..ff5d9a5 100644
--- a/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/issue-16723.rs
@@ -15,12 +15,12 @@
extern crate syntax;
extern crate rustc;
+extern crate rustc_data_structures;
extern crate rustc_plugin;
extern crate syntax_pos;
-use syntax::ast;
+use rustc_data_structures::small_vec::OneVector;
use syntax::ext::base::{ExtCtxt, MacResult, MacEager};
-use syntax::util::small_vector::SmallVector;
use syntax::tokenstream;
use rustc_plugin::Registry;
@@ -31,7 +31,7 @@
fn expand(cx: &mut ExtCtxt, _: syntax_pos::Span, _: &[tokenstream::TokenTree])
-> Box<MacResult+'static> {
- MacEager::items(SmallVector::many(vec![
+ MacEager::items(OneVector::many(vec![
quote_item!(cx, struct Struct1;).unwrap(),
quote_item!(cx, struct Struct2;).unwrap()
]))
diff --git a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
index 64fdd7f..14e9dbf 100644
--- a/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
+++ b/src/test/run-pass-fulldeps/auxiliary/macro_crate_test.rs
@@ -18,7 +18,7 @@
extern crate syntax_pos;
use syntax::ast::{self, Item, MetaItem, ItemKind};
-use syntax::codemap::DUMMY_SP;
+use syntax::source_map::DUMMY_SP;
use syntax::ext::base::*;
use syntax::ext::quote::rt::ToTokens;
use syntax::parse::{self, token};
diff --git a/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs b/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs
index 3bf5065..ee424b3 100644
--- a/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs
+++ b/src/test/run-pass-fulldeps/mod_dir_path_canonicalized.rs
@@ -16,7 +16,7 @@
extern crate syntax;
use std::path::Path;
-use syntax::codemap::FilePathMapping;
+use syntax::source_map::FilePathMapping;
use syntax::parse::{self, ParseSess};
#[path = "mod_dir_simple/test.rs"]
diff --git a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
index bbd81e79..e944ef2 100644
--- a/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
+++ b/src/test/run-pass-fulldeps/pprust-expr-roundtrip.rs
@@ -30,16 +30,17 @@
#![feature(rustc_private)]
+extern crate rustc_data_structures;
extern crate syntax;
+use rustc_data_structures::thin_vec::ThinVec;
use syntax::ast::*;
-use syntax::codemap::{Spanned, DUMMY_SP, FileName};
-use syntax::codemap::FilePathMapping;
+use syntax::source_map::{Spanned, DUMMY_SP, FileName};
+use syntax::source_map::FilePathMapping;
use syntax::fold::{self, Folder};
use syntax::parse::{self, ParseSess};
use syntax::print::pprust;
use syntax::ptr::P;
-use syntax::util::ThinVec;
fn parse_expr(ps: &ParseSess, src: &str) -> P<Expr> {
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs
index 2652239..effb3ad 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-args.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/attr-args.rs
@@ -12,7 +12,6 @@
// ignore-stage1
#![allow(warnings)]
-#![feature(use_extern_macros)]
extern crate attr_args;
use attr_args::{attr_with_args, identity};
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs b/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs
index 4ee30b8..1a9d9b9 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/attr-cfg.rs
@@ -12,8 +12,6 @@
// ignore-stage1
// revisions: foo bar
-#![feature(use_extern_macros)]
-
extern crate attr_cfg;
use attr_cfg::attr_cfg;
diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs
index 256096f..698a0ec 100644
--- a/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/attr-on-trait.rs
@@ -11,8 +11,6 @@
// aux-build:attr-on-trait.rs
// ignore-stage1
-#![feature(use_extern_macros)]
-
extern crate attr_on_trait;
use attr_on_trait::foo;
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs
index 7b521f2..e1aabad 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/derive-b.rs
@@ -19,7 +19,7 @@
#[proc_macro_derive(B, attributes(B, C))]
pub fn derive(input: TokenStream) -> TokenStream {
let input = input.to_string();
- assert!(input.contains("#[B arbitrary tokens]"));
+ assert!(input.contains("#[B [ arbitrary tokens ]]"));
assert!(input.contains("struct B {"));
assert!(input.contains("#[C]"));
"".parse().unwrap()
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs
index bac6524..ca88482 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(use_extern_macros)]
-
extern crate hygiene_example_codegen;
pub use hygiene_example_codegen::hello;
diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs
index 56c163b..7edb3e0 100644
--- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/issue-40001-plugin.rs
@@ -29,7 +29,7 @@
use rustc::hir::map as hir_map;
use rustc::lint::{LateContext, LintPass, LintArray, LateLintPass, LintContext};
use rustc::ty;
-use syntax::{ast, codemap};
+use syntax::{ast, source_map};
#[plugin_registrar]
pub fn plugin_registrar(reg: &mut Registry) {
@@ -54,7 +54,7 @@
_: intravisit::FnKind<'tcx>,
_: &'tcx hir::FnDecl,
_: &'tcx hir::Body,
- span: codemap::Span,
+ span: source_map::Span,
id: ast::NodeId) {
let item = match cx.tcx.hir.get(id) {
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs b/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs
index 6ef23bc..93023f8 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/derive-attr-cfg.rs
@@ -11,8 +11,6 @@
// aux-build:derive-attr-cfg.rs
// ignore-stage1
-#![feature(use_extern_macros)]
-
extern crate derive_attr_cfg;
use derive_attr_cfg::Foo;
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs
index 4a7c8f3..1de6496 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs
@@ -11,12 +11,12 @@
// aux-build:derive-b.rs
// ignore-stage1
-#![feature(proc_macro_path_invoc)]
+#![feature(proc_macro_path_invoc, unrestricted_attribute_tokens)]
extern crate derive_b;
#[derive(Debug, PartialEq, derive_b::B, Eq, Copy, Clone)]
-#[cfg_attr(all(), B arbitrary tokens)]
+#[cfg_attr(all(), B[arbitrary tokens])]
struct B {
#[C]
a: u64
diff --git a/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs b/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs
index 6a0a3b3..0df0288 100644
--- a/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/derive-two-attrs.rs
@@ -10,8 +10,6 @@
// aux-build:derive-two-attrs.rs
-#![feature(use_extern_macros)]
-
extern crate derive_two_attrs as foo;
use foo::A;
diff --git a/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs b/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs
index c8a9bea..ce2fed8 100644
--- a/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/gen-lifetime-token.rs
@@ -10,8 +10,6 @@
// aux-build:gen-lifetime-token.rs
-#![feature(use_extern_macros)]
-
extern crate gen_lifetime_token as bar;
bar::bar!();
diff --git a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs b/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs
index 5b7d8c2..3fc7446 100644
--- a/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/issue-39889.rs
@@ -11,9 +11,6 @@
// aux-build:issue-39889.rs
// ignore-stage1
-#![feature(use_extern_macros)]
-#![allow(unused)]
-
extern crate issue_39889;
use issue_39889::Issue39889;
diff --git a/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs b/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs
index cfe0ce1..c73441e 100644
--- a/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/lifetimes.rs
@@ -11,8 +11,6 @@
// aux-build:lifetimes.rs
// ignore-stage1
-#![feature(use_extern_macros)]
-
extern crate lifetimes;
use lifetimes::*;
diff --git a/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs b/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs
index 0b584fd..d6f7cc4 100644
--- a/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/modify-ast.rs
@@ -10,8 +10,6 @@
// aux-build:modify-ast.rs
-#![feature(use_extern_macros)]
-
extern crate modify_ast;
use modify_ast::*;
diff --git a/src/test/run-pass-fulldeps/proc-macro/not-joint.rs b/src/test/run-pass-fulldeps/proc-macro/not-joint.rs
index 8a59d57..7a53348 100644
--- a/src/test/run-pass-fulldeps/proc-macro/not-joint.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/not-joint.rs
@@ -10,8 +10,6 @@
// aux-build:not-joint.rs
-#![feature(use_extern_macros)]
-
extern crate not_joint as bar;
use bar::{tokens, nothing};
diff --git a/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs b/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs
index 735e088..415cada 100644
--- a/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs
+++ b/src/test/run-pass-fulldeps/proc-macro/span-api-tests.rs
@@ -13,8 +13,6 @@
// ignore-pretty
-#![feature(use_extern_macros)]
-
#[macro_use]
extern crate span_test_macros;
diff --git a/src/test/run-pass-fulldeps/qquote.rs b/src/test/run-pass-fulldeps/qquote.rs
index c597360..55fed86 100644
--- a/src/test/run-pass-fulldeps/qquote.rs
+++ b/src/test/run-pass-fulldeps/qquote.rs
@@ -15,7 +15,7 @@
extern crate syntax;
extern crate syntax_pos;
-use syntax::codemap::FilePathMapping;
+use syntax::source_map::FilePathMapping;
use syntax::print::pprust::*;
use syntax::symbol::Symbol;
use syntax_pos::DUMMY_SP;
diff --git a/src/test/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs b/src/test/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs
new file mode 100644
index 0000000..e1fda42
--- /dev/null
+++ b/src/test/run-pass-valgrind/unsized-locals/long-live-the-unsized-temporary.rs
@@ -0,0 +1,65 @@
+// 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.
+
+#![feature(unsized_locals)]
+
+use std::fmt;
+
+fn gen_foo() -> Box<fmt::Display> {
+ Box::new(Box::new("foo"))
+}
+
+fn foo(x: fmt::Display) {
+ assert_eq!(x.to_string(), "foo");
+}
+
+fn foo_indirect(x: fmt::Display) {
+ foo(x);
+}
+
+fn main() {
+ foo(*gen_foo());
+ foo_indirect(*gen_foo());
+
+ {
+ let x: fmt::Display = *gen_foo();
+ foo(x);
+ }
+
+ {
+ let x: fmt::Display = *gen_foo();
+ let y: fmt::Display = *gen_foo();
+ foo(x);
+ foo(y);
+ }
+
+ {
+ let mut cnt: usize = 3;
+ let x = loop {
+ let x: fmt::Display = *gen_foo();
+ if cnt == 0 {
+ break x;
+ } else {
+ cnt -= 1;
+ }
+ };
+ foo(x);
+ }
+
+ {
+ let x: fmt::Display = *gen_foo();
+ let x = if true {
+ x
+ } else {
+ *gen_foo()
+ };
+ foo(x);
+ }
+}
diff --git a/src/test/run-pass/auxiliary/issue_38715-modern.rs b/src/test/run-pass/auxiliary/issue_38715-modern.rs
index 68aced7..7f14b2c 100644
--- a/src/test/run-pass/auxiliary/issue_38715-modern.rs
+++ b/src/test/run-pass/auxiliary/issue_38715-modern.rs
@@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(use_extern_macros)]
#![allow(duplicate_macro_exports)]
#[macro_export]
diff --git a/src/test/run-pass/env-null-vars.rs b/src/test/run-pass/env-null-vars.rs
new file mode 100644
index 0000000..2967642
--- /dev/null
+++ b/src/test/run-pass/env-null-vars.rs
@@ -0,0 +1,29 @@
+// 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.
+
+// ignore-windows
+// ignore-wasm32-bare no libc to test ffi with
+
+// issue-53200
+
+#![feature(libc)]
+extern crate libc;
+
+use std::env;
+
+// FIXME: more platforms?
+#[cfg(target_os = "linux")]
+fn main() {
+ unsafe { libc::clearenv(); }
+ assert_eq!(env::vars().count(), 0);
+}
+
+#[cfg(not(target_os = "linux"))]
+fn main() {}
diff --git a/src/test/run-pass/generator/issue-52398.rs b/src/test/run-pass/generator/issue-52398.rs
new file mode 100644
index 0000000..0fb8f27
--- /dev/null
+++ b/src/test/run-pass/generator/issue-52398.rs
@@ -0,0 +1,35 @@
+// 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.
+
+#![feature(generators)]
+
+use std::cell::RefCell;
+
+struct A;
+
+impl A {
+ fn test(&self, a: ()) {}
+}
+
+fn main() {
+ // Test that the MIR local with type &A created for the auto-borrow adjustment
+ // is caught by typeck
+ move || {
+ A.test(yield);
+ };
+
+ // Test that the std::cell::Ref temporary returned from the `borrow` call
+ // is caught by typeck
+ let y = RefCell::new(true);
+ static move || {
+ yield *y.borrow();
+ return "Done";
+ };
+}
diff --git a/src/test/run-pass/issue-52140/auxiliary/some_crate.rs b/src/test/run-pass/issue-52140/auxiliary/some_crate.rs
new file mode 100644
index 0000000..bf8dee0
--- /dev/null
+++ b/src/test/run-pass/issue-52140/auxiliary/some_crate.rs
@@ -0,0 +1,15 @@
+// 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.
+
+#![crate_type = "lib"]
+
+pub fn hello() {
+ println!("Hello, world!");
+}
diff --git a/src/test/run-pass/issue-52140/main.rs b/src/test/run-pass/issue-52140/main.rs
new file mode 100644
index 0000000..6fae6ad
--- /dev/null
+++ b/src/test/run-pass/issue-52140/main.rs
@@ -0,0 +1,21 @@
+// 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.
+
+// aux-build:some_crate.rs
+// edition:2018
+
+mod foo {
+ pub use some_crate;
+}
+
+fn main() {
+ ::some_crate::hello();
+ foo::some_crate::hello();
+}
diff --git a/src/test/run-pass/issue-52141/auxiliary/some_crate.rs b/src/test/run-pass/issue-52141/auxiliary/some_crate.rs
new file mode 100644
index 0000000..bf8dee0
--- /dev/null
+++ b/src/test/run-pass/issue-52141/auxiliary/some_crate.rs
@@ -0,0 +1,15 @@
+// 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.
+
+#![crate_type = "lib"]
+
+pub fn hello() {
+ println!("Hello, world!");
+}
diff --git a/src/test/run-pass/issue-52141/main.rs b/src/test/run-pass/issue-52141/main.rs
new file mode 100644
index 0000000..8f3fc9f
--- /dev/null
+++ b/src/test/run-pass/issue-52141/main.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// aux-build:some_crate.rs
+// edition:2018
+
+use some_crate as some_name;
+
+mod foo {
+ pub use crate::some_name::*;
+}
+
+fn main() {
+ ::some_crate::hello();
+ some_name::hello();
+ foo::hello();
+}
diff --git a/src/test/run-pass/issue-52705/auxiliary/png.rs b/src/test/run-pass/issue-52705/auxiliary/png.rs
new file mode 100644
index 0000000..48d53a2
--- /dev/null
+++ b/src/test/run-pass/issue-52705/auxiliary/png.rs
@@ -0,0 +1,13 @@
+// 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.
+
+#![crate_type = "lib"]
+
+pub struct DecodingError;
diff --git a/src/test/run-pass/issue-52705/main.rs b/src/test/run-pass/issue-52705/main.rs
new file mode 100644
index 0000000..101f67e
--- /dev/null
+++ b/src/test/run-pass/issue-52705/main.rs
@@ -0,0 +1,22 @@
+// 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.
+
+// aux-build:png.rs
+// edition:2018
+
+mod png {
+ use png as png_ext;
+
+ fn foo() -> png_ext::DecodingError { unimplemented!() }
+}
+
+fn main() {
+ println!("Hello, world!");
+}
diff --git a/src/test/run-pass/issue-53333.rs b/src/test/run-pass/issue-53333.rs
new file mode 100644
index 0000000..51b90af
--- /dev/null
+++ b/src/test/run-pass/issue-53333.rs
@@ -0,0 +1,17 @@
+// 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.
+
+// edition:2018
+
+fn main() {
+ use std;
+ let std = "std";
+ println!("{}", std);
+}
diff --git a/src/test/run-pass/macro-at-most-once-rep.rs b/src/test/run-pass/macro-at-most-once-rep.rs
index dcf2222..61c3e78 100644
--- a/src/test/run-pass/macro-at-most-once-rep.rs
+++ b/src/test/run-pass/macro-at-most-once-rep.rs
@@ -18,7 +18,7 @@
//
// This test focuses on non-error cases and making sure the correct number of repetitions happen.
-// compile-flags: --edition=2018
+// edition:2018
#![feature(macro_at_most_once_rep)]
diff --git a/src/test/run-pass/macro-comma-support.rs b/src/test/run-pass/macro-comma-support.rs
index bfd9110..f645849 100644
--- a/src/test/run-pass/macro-comma-support.rs
+++ b/src/test/run-pass/macro-comma-support.rs
@@ -61,30 +61,30 @@
#[test]
fn cfg() {
- let _ = cfg!(pants);
- let _ = cfg!(pants,);
- let _ = cfg!(pants = "pants");
- let _ = cfg!(pants = "pants",);
- let _ = cfg!(all(pants));
- let _ = cfg!(all(pants),);
- let _ = cfg!(all(pants,));
- let _ = cfg!(all(pants,),);
+ cfg!(pants);
+ cfg!(pants,);
+ cfg!(pants = "pants");
+ cfg!(pants = "pants",);
+ cfg!(all(pants));
+ cfg!(all(pants),);
+ cfg!(all(pants,));
+ cfg!(all(pants,),);
}
#[test]
fn column() {
- let _ = column!();
+ column!();
}
// compile_error! is in a companion to this test in compile-fail
#[test]
fn concat() {
- let _ = concat!();
- let _ = concat!("hello");
- let _ = concat!("hello",);
- let _ = concat!("hello", " world");
- let _ = concat!("hello", " world",);
+ concat!();
+ concat!("hello");
+ concat!("hello",);
+ concat!("hello", " world");
+ concat!("hello", " world",);
}
#[test]
@@ -130,10 +130,10 @@
#[test]
fn env() {
- let _ = env!("PATH");
- let _ = env!("PATH",);
- let _ = env!("PATH", "not found");
- let _ = env!("PATH", "not found",);
+ env!("PATH");
+ env!("PATH",);
+ env!("PATH", "not found");
+ env!("PATH", "not found",);
}
#[cfg(std)]
@@ -157,58 +157,58 @@
#[test]
fn file() {
- let _ = file!();
+ file!();
}
#[cfg(std)]
#[test]
fn format() {
- let _ = format!("hello");
- let _ = format!("hello",);
- let _ = format!("hello {}", "world");
- let _ = format!("hello {}", "world",);
+ format!("hello");
+ format!("hello",);
+ format!("hello {}", "world");
+ format!("hello {}", "world",);
}
#[test]
fn format_args() {
- let _ = format_args!("hello");
- let _ = format_args!("hello",);
- let _ = format_args!("hello {}", "world");
- let _ = format_args!("hello {}", "world",);
+ format_args!("hello");
+ format_args!("hello",);
+ format_args!("hello {}", "world");
+ format_args!("hello {}", "world",);
}
#[test]
fn include() {
- let _ = include!("auxiliary/macro-comma-support.rs");
- let _ = include!("auxiliary/macro-comma-support.rs",);
+ include!("auxiliary/macro-comma-support.rs");
+ include!("auxiliary/macro-comma-support.rs",);
}
#[test]
fn include_bytes() {
- let _ = include_bytes!("auxiliary/macro-comma-support.rs");
- let _ = include_bytes!("auxiliary/macro-comma-support.rs",);
+ include_bytes!("auxiliary/macro-comma-support.rs");
+ include_bytes!("auxiliary/macro-comma-support.rs",);
}
#[test]
fn include_str() {
- let _ = include_str!("auxiliary/macro-comma-support.rs");
- let _ = include_str!("auxiliary/macro-comma-support.rs",);
+ include_str!("auxiliary/macro-comma-support.rs");
+ include_str!("auxiliary/macro-comma-support.rs",);
}
#[test]
fn line() {
- let _ = line!();
+ line!();
}
#[test]
fn module_path() {
- let _ = module_path!();
+ module_path!();
}
#[test]
fn option_env() {
- let _ = option_env!("PATH");
- let _ = option_env!("PATH",);
+ option_env!("PATH");
+ option_env!("PATH",);
}
#[test]
@@ -308,10 +308,10 @@
#[test]
fn vec() {
let _: Vec<()> = vec![];
- let _ = vec![0];
- let _ = vec![0,];
- let _ = vec![0, 1];
- let _ = vec![0, 1,];
+ vec![0];
+ vec![0,];
+ vec![0, 1];
+ vec![0, 1,];
}
// give a test body access to a fmt::Formatter, which seems
@@ -339,21 +339,21 @@
test_with_formatter! {
#[test]
fn write(f: &mut fmt::Formatter) {
- let _ = write!(f, "hello");
- let _ = write!(f, "hello",);
- let _ = write!(f, "hello {}", "world");
- let _ = write!(f, "hello {}", "world",);
+ write!(f, "hello");
+ write!(f, "hello",);
+ write!(f, "hello {}", "world");
+ write!(f, "hello {}", "world",);
}
}
test_with_formatter! {
#[test]
fn writeln(f: &mut fmt::Formatter) {
- let _ = writeln!(f);
- let _ = writeln!(f,);
- let _ = writeln!(f, "hello");
- let _ = writeln!(f, "hello",);
- let _ = writeln!(f, "hello {}", "world");
- let _ = writeln!(f, "hello {}", "world",);
+ writeln!(f);
+ writeln!(f,);
+ writeln!(f, "hello");
+ writeln!(f, "hello",);
+ writeln!(f, "hello {}", "world");
+ writeln!(f, "hello {}", "world",);
}
}
diff --git a/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs
new file mode 100644
index 0000000..7959f17
--- /dev/null
+++ b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs
@@ -0,0 +1,35 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(nll)]
+#![allow(unused_variables)]
+
+pub trait TryTransform {
+ fn try_transform<F>(self, f: F)
+ where
+ Self: Sized,
+ F: FnOnce(Self);
+}
+
+impl<'a, T> TryTransform for &'a mut T {
+ fn try_transform<F>(self, f: F)
+ where
+ // The bug was that `Self: Sized` caused the lifetime of `this` to "extend" for all
+ // of 'a instead of only lasting as long as the binding is used (for just that line).
+ Self: Sized,
+ F: FnOnce(Self),
+ {
+ let this: *mut T = self as *mut T;
+ f(self);
+ }
+}
+
+fn main() {
+}
diff --git a/src/test/run-pass/paths-in-macro-invocations.rs b/src/test/run-pass/paths-in-macro-invocations.rs
index 69f8906..e860f70 100644
--- a/src/test/run-pass/paths-in-macro-invocations.rs
+++ b/src/test/run-pass/paths-in-macro-invocations.rs
@@ -10,8 +10,6 @@
// aux-build:two_macros.rs
-#![feature(use_extern_macros)]
-
extern crate two_macros;
::two_macros::macro_one!();
diff --git a/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs b/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs
index 7003541..31f683a 100644
--- a/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs
+++ b/src/test/run-pass/rfc-2126-crate-paths/crate-path-absolute.rs
@@ -28,14 +28,14 @@
use crate as root;
pub fn check() {
assert_eq!(f(), 1);
- assert_eq!(::crate::m::g(), 2);
+ assert_eq!(crate::m::g(), 2);
assert_eq!(root::m::h(), 3);
}
}
fn main() {
assert_eq!(f(), 1);
- assert_eq!(::crate::m::g(), 2);
+ assert_eq!(crate::m::g(), 2);
assert_eq!(root::m::h(), 3);
n::check();
}
diff --git a/src/test/run-pass/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs b/src/test/run-pass/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs
index 1a8d2d8..4646d81 100644
--- a/src/test/run-pass/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs
+++ b/src/test/run-pass/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs
@@ -14,8 +14,9 @@
mod m {
pub struct Z;
pub struct S1(crate (::m::Z)); // OK
- pub struct S2(::crate ::m::Z); // OK
+ pub struct S2((crate ::m::Z)); // OK
pub struct S3(crate ::m::Z); // OK
+ pub struct S4(crate crate::m::Z); // OK
}
fn main() {
diff --git a/src/test/run-pass/self-in-typedefs.rs b/src/test/run-pass/self-in-typedefs.rs
new file mode 100644
index 0000000..d262e8c
--- /dev/null
+++ b/src/test/run-pass/self-in-typedefs.rs
@@ -0,0 +1,40 @@
+// 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.
+
+#![feature(self_in_typedefs)]
+#![feature(untagged_unions)]
+
+#![allow(dead_code)]
+
+enum A<'a, T: 'a>
+where
+ Self: Send, T: PartialEq<Self>
+{
+ Foo(&'a Self),
+ Bar(T),
+}
+
+struct B<'a, T: 'a>
+where
+ Self: Send, T: PartialEq<Self>
+{
+ foo: &'a Self,
+ bar: T,
+}
+
+union C<'a, T: 'a>
+where
+ Self: Send, T: PartialEq<Self>
+{
+ foo: &'a Self,
+ bar: T,
+}
+
+fn main() {}
diff --git a/src/test/run-pass/simd-intrinsic-float-minmax.rs b/src/test/run-pass/simd-intrinsic-float-minmax.rs
index 71c0139..d35123e 100644
--- a/src/test/run-pass/simd-intrinsic-float-minmax.rs
+++ b/src/test/run-pass/simd-intrinsic-float-minmax.rs
@@ -29,7 +29,14 @@
fn main() {
let x = f32x4(1.0, 2.0, 3.0, 4.0);
let y = f32x4(2.0, 1.0, 4.0, 3.0);
+
+ #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
let nan = ::std::f32::NAN;
+ // MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit.
+ // See https://github.com/rust-lang/rust/issues/52746.
+ #[cfg(any(target_arch = "mips", target_arch = "mips64"))]
+ let nan = f32::from_bits(::std::f32::NAN.to_bits() - 1);
+
let n = f32x4(nan, nan, nan, nan);
unsafe {
diff --git a/src/test/run-pass/uniform-paths/basic-nested.rs b/src/test/run-pass/uniform-paths/basic-nested.rs
new file mode 100644
index 0000000..954736d
--- /dev/null
+++ b/src/test/run-pass/uniform-paths/basic-nested.rs
@@ -0,0 +1,59 @@
+// 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.
+
+// edition:2018
+
+#![feature(decl_macro, uniform_paths)]
+
+// This test is similar to `basic.rs`, but nested in modules.
+
+mod foo {
+ // Test that ambiguity errors are not emitted between `self::test` and
+ // `::test`, assuming the latter (crate) is not in `extern_prelude`.
+ mod test {
+ pub struct Foo(pub ());
+ }
+ pub use test::Foo;
+
+ // Test that qualified paths can refer to both the external crate and local item.
+ mod std {
+ pub struct io(pub ());
+ }
+ pub use ::std::io as std_io;
+ pub use self::std::io as local_io;
+}
+
+// Test that we can refer to the external crate unqualified
+// (when there isn't a local item with the same name).
+use std::io;
+
+mod bar {
+ // Also test the unqualified external crate import in a nested module,
+ // to show that the above import doesn't resolve through a local `std`
+ // item, e.g. the automatically injected `extern crate std;`, which in
+ // the Rust 2018 should no longer be visible through `crate::std`.
+ pub use std::io;
+
+ // Also test that items named `std` in other namespaces don't
+ // cause ambiguity errors for the import from `std` above.
+ pub fn std() {}
+ pub macro std() {}
+}
+
+
+fn main() {
+ foo::Foo(());
+ foo::std_io::stdout();
+ foo::local_io(());
+ io::stdout();
+ bar::io::stdout();
+ bar::std();
+ bar::std!();
+}
diff --git a/src/test/run-pass/uniform-paths/basic.rs b/src/test/run-pass/uniform-paths/basic.rs
new file mode 100644
index 0000000..59a0404
--- /dev/null
+++ b/src/test/run-pass/uniform-paths/basic.rs
@@ -0,0 +1,33 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+// Test that ambiguity errors are not emitted between `self::test` and
+// `::test`, assuming the latter (crate) is not in `extern_prelude`.
+mod test {
+ pub struct Foo(pub ());
+}
+use test::Foo;
+
+// Test that qualified paths can refer to both the external crate and local item.
+mod std {
+ pub struct io(pub ());
+}
+use ::std::io as std_io;
+use self::std::io as local_io;
+
+fn main() {
+ Foo(());
+ std_io::stdout();
+ local_io(());
+}
diff --git a/src/test/run-pass/uniform-paths/macros-nested.rs b/src/test/run-pass/uniform-paths/macros-nested.rs
new file mode 100644
index 0000000..9cf05cd
--- /dev/null
+++ b/src/test/run-pass/uniform-paths/macros-nested.rs
@@ -0,0 +1,62 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+// This test is similar to `macros.rs`, but nested in modules.
+
+mod foo {
+ // Test that ambiguity errors are not emitted between `self::test` and
+ // `::test`, assuming the latter (crate) is not in `extern_prelude`.
+ macro_rules! m1 {
+ () => {
+ mod test {
+ pub struct Foo(pub ());
+ }
+ }
+ }
+ pub use test::Foo;
+ m1!();
+
+ // Test that qualified paths can refer to both the external crate and local item.
+ macro_rules! m2 {
+ () => {
+ mod std {
+ pub struct io(pub ());
+ }
+ }
+ }
+ pub use ::std::io as std_io;
+ pub use self::std::io as local_io;
+ m2!();
+}
+
+// Test that we can refer to the external crate unqualified
+// (when there isn't a local item with the same name).
+use std::io;
+
+mod bar {
+ // Also test the unqualified external crate import in a nested module,
+ // to show that the above import doesn't resolve through a local `std`
+ // item, e.g. the automatically injected `extern crate std;`, which in
+ // the Rust 2018 should no longer be visible through `crate::std`.
+ pub use std::io;
+}
+
+
+fn main() {
+ foo::Foo(());
+ foo::std_io::stdout();
+ foo::local_io(());
+ io::stdout();
+ bar::io::stdout();
+}
diff --git a/src/test/run-pass/uniform-paths/macros.rs b/src/test/run-pass/uniform-paths/macros.rs
new file mode 100644
index 0000000..ad74f5d
--- /dev/null
+++ b/src/test/run-pass/uniform-paths/macros.rs
@@ -0,0 +1,45 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+// This test is similar to `basic.rs`, but with macros defining local items.
+
+// Test that ambiguity errors are not emitted between `self::test` and
+// `::test`, assuming the latter (crate) is not in `extern_prelude`.
+macro_rules! m1 {
+ () => {
+ mod test {
+ pub struct Foo(pub ());
+ }
+ }
+}
+use test::Foo;
+m1!();
+
+// Test that qualified paths can refer to both the external crate and local item.
+macro_rules! m2 {
+ () => {
+ mod std {
+ pub struct io(pub ());
+ }
+ }
+}
+use ::std::io as std_io;
+use self::std::io as local_io;
+m2!();
+
+fn main() {
+ Foo(());
+ std_io::stdout();
+ local_io(());
+}
diff --git a/src/test/run-pass/uniform-paths/same-crate.rs b/src/test/run-pass/uniform-paths/same-crate.rs
new file mode 100644
index 0000000..a3eefa7
--- /dev/null
+++ b/src/test/run-pass/uniform-paths/same-crate.rs
@@ -0,0 +1,109 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+pub const A: usize = 0;
+
+pub mod foo {
+ pub const B: usize = 1;
+
+ pub mod bar {
+ pub const C: usize = 2;
+
+ pub enum E {
+ V1(usize),
+ V2(String),
+ }
+
+ pub fn test() -> String {
+ format!("{} {} {}", crate::A, crate::foo::B, C)
+ }
+
+ pub fn test_use() -> String {
+ use crate::A;
+ use crate::foo::B;
+
+ format!("{} {} {}", A, B, C)
+ }
+
+ pub fn test_enum() -> String {
+ use E::*;
+ match E::V1(10) {
+ V1(i) => { format!("V1: {}", i) }
+ V2(s) => { format!("V2: {}", s) }
+ }
+ }
+ }
+
+ pub fn test() -> String {
+ format!("{} {} {}", crate::A, B, bar::C)
+ }
+
+ pub fn test_use() -> String {
+ use crate::A;
+ use bar::C;
+
+ format!("{} {} {}", A, B, C)
+ }
+
+ pub fn test_enum() -> String {
+ use bar::E::*;
+ match bar::E::V1(10) {
+ V1(i) => { format!("V1: {}", i) }
+ V2(s) => { format!("V2: {}", s) }
+ }
+ }
+}
+
+pub fn test() -> String {
+ format!("{} {} {}", A, foo::B, foo::bar::C)
+}
+
+pub fn test_use() -> String {
+ use foo::B;
+ use foo::bar::C;
+
+ format!("{} {} {}", A, B, C)
+}
+
+pub fn test_enum() -> String {
+ use foo::bar::E::*;
+ match foo::bar::E::V1(10) {
+ V1(i) => { format!("V1: {}", i) }
+ V2(s) => { format!("V2: {}", s) }
+ }
+}
+
+fn main() {
+ let output = [
+ test(),
+ foo::test(),
+ foo::bar::test(),
+ test_use(),
+ foo::test_use(),
+ foo::bar::test_use(),
+ test_enum(),
+ foo::test_enum(),
+ foo::bar::test_enum(),
+ ].join("\n");
+ assert_eq!(output, "\
+0 1 2
+0 1 2
+0 1 2
+0 1 2
+0 1 2
+0 1 2
+V1: 10
+V1: 10
+V1: 10");
+}
diff --git a/src/test/run-pass/unsized-locals/reference-unsized-locals.rs b/src/test/run-pass/unsized-locals/reference-unsized-locals.rs
new file mode 100644
index 0000000..6ed39a7
--- /dev/null
+++ b/src/test/run-pass/unsized-locals/reference-unsized-locals.rs
@@ -0,0 +1,17 @@
+// 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.
+
+#![feature(unsized_locals)]
+
+fn main() {
+ let foo: Box<[u8]> = Box::new(*b"foo");
+ let foo: [u8] = *foo;
+ assert_eq!(&foo, b"foo" as &[u8]);
+}
diff --git a/src/test/run-pass/unsized-locals/simple-unsized-locals.rs b/src/test/run-pass/unsized-locals/simple-unsized-locals.rs
new file mode 100644
index 0000000..0b1aa62
--- /dev/null
+++ b/src/test/run-pass/unsized-locals/simple-unsized-locals.rs
@@ -0,0 +1,16 @@
+// 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.
+
+#![feature(unsized_locals)]
+
+fn main() {
+ let foo: Box<[u8]> = Box::new(*b"foo");
+ let _foo: [u8] = *foo;
+}
diff --git a/src/test/run-pass/unsized-locals/unsized-exprs.rs b/src/test/run-pass/unsized-locals/unsized-exprs.rs
new file mode 100644
index 0000000..9a5e534
--- /dev/null
+++ b/src/test/run-pass/unsized-locals/unsized-exprs.rs
@@ -0,0 +1,45 @@
+// 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.
+
+#![feature(unsized_tuple_coercion, unsized_locals)]
+
+struct A<X: ?Sized>(X);
+
+fn udrop<T: ?Sized>(_x: T) {}
+fn foo() -> Box<[u8]> {
+ Box::new(*b"foo")
+}
+fn tfoo() -> Box<(i32, [u8])> {
+ Box::new((42, *b"foo"))
+}
+fn afoo() -> Box<A<[u8]>> {
+ Box::new(A(*b"foo"))
+}
+
+impl std::ops::Add<i32> for A<[u8]> {
+ type Output = ();
+ fn add(self, _rhs: i32) -> Self::Output {}
+}
+
+fn main() {
+ udrop::<[u8]>(loop {
+ break *foo();
+ });
+ udrop::<[u8]>(if true {
+ *foo()
+ } else {
+ *foo()
+ });
+ udrop::<[u8]>({*foo()});
+ #[allow(unused_parens)]
+ udrop::<[u8]>((*foo()));
+ udrop::<[u8]>((*tfoo()).1);
+ *afoo() + 42;
+}
diff --git a/src/test/run-pass/unsized-locals/unsized-parameters.rs b/src/test/run-pass/unsized-locals/unsized-parameters.rs
new file mode 100644
index 0000000..0314fe1
--- /dev/null
+++ b/src/test/run-pass/unsized-locals/unsized-parameters.rs
@@ -0,0 +1,20 @@
+// 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.
+
+#![feature(unsized_locals)]
+
+pub fn f0(_f: dyn FnOnce()) {}
+pub fn f1(_s: str) {}
+pub fn f2((_x, _y): (i32, [i32])) {}
+
+fn main() {
+ let foo = "foo".to_string().into_boxed_str();
+ f1(*foo);
+}
diff --git a/src/test/run-pass/use-macro-self.rs b/src/test/run-pass/use-macro-self.rs
index 9162ad3..66ab00d 100644
--- a/src/test/run-pass/use-macro-self.rs
+++ b/src/test/run-pass/use-macro-self.rs
@@ -10,8 +10,6 @@
// aux-build:use-macro-self.rs
-#![feature(use_extern_macros)]
-
#[macro_use]
extern crate use_macro_self;
diff --git a/src/test/rustdoc/async-fn.rs b/src/test/rustdoc/async-fn.rs
new file mode 100644
index 0000000..f3d39de
--- /dev/null
+++ b/src/test/rustdoc/async-fn.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// edition:2018
+// compile-flags:-Z unstable-options
+
+// FIXME: once `--edition` is stable in rustdoc, remove that `compile-flags` directive
+
+#![feature(async_await, futures_api)]
+
+// @has async_fn/struct.S.html
+// @has - '//code' 'pub async fn f()'
+pub struct S;
+
+impl S {
+ pub async fn f() {}
+}
diff --git a/src/test/rustdoc/cross-crate-links.rs b/src/test/rustdoc/cross-crate-links.rs
index 15a774d..7ccfb3d 100644
--- a/src/test/rustdoc/cross-crate-links.rs
+++ b/src/test/rustdoc/cross-crate-links.rs
@@ -11,8 +11,6 @@
// aux-build:all-item-types.rs
// build-aux-docs
-#![feature(use_extern_macros)]
-
#![crate_name = "foo"]
#[macro_use]
diff --git a/src/test/rustdoc/inline_cross/macro-vis.rs b/src/test/rustdoc/inline_cross/macro-vis.rs
index 6de1333..5467a21 100644
--- a/src/test/rustdoc/inline_cross/macro-vis.rs
+++ b/src/test/rustdoc/inline_cross/macro-vis.rs
@@ -12,8 +12,6 @@
// build-aux-docs
// ignore-cross-compile
-#![feature(use_extern_macros)]
-
#[macro_use] extern crate qwop;
// @has macro_vis/macro.some_macro.html
diff --git a/src/test/rustdoc/inline_cross/macros.rs b/src/test/rustdoc/inline_cross/macros.rs
index 8d2f7d1..474a1da 100644
--- a/src/test/rustdoc/inline_cross/macros.rs
+++ b/src/test/rustdoc/inline_cross/macros.rs
@@ -12,7 +12,6 @@
// build-aux-docs
#![feature(macro_test)]
-#![feature(use_extern_macros)]
#![crate_name = "foo"]
diff --git a/src/test/rustdoc/pub-use-extern-macros.rs b/src/test/rustdoc/pub-use-extern-macros.rs
index 13957fd..48fb9bf 100644
--- a/src/test/rustdoc/pub-use-extern-macros.rs
+++ b/src/test/rustdoc/pub-use-extern-macros.rs
@@ -10,8 +10,6 @@
// aux-build:pub-use-extern-macros.rs
-#![feature(use_extern_macros)]
-
extern crate macros;
// @has pub_use_extern_macros/macro.bar.html
diff --git a/src/test/ui-fulldeps/invalid-punct-ident-4.stderr b/src/test/ui-fulldeps/invalid-punct-ident-4.stderr
index 4493e37..669a1eb 100644
--- a/src/test/ui-fulldeps/invalid-punct-ident-4.stderr
+++ b/src/test/ui-fulldeps/invalid-punct-ident-4.stderr
@@ -2,7 +2,7 @@
--> $DIR/invalid-punct-ident-4.rs:16:1
|
LL | lexer_failure!(); //~ ERROR proc macro panicked
- | ^^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^^^^^^^^ unexpected close delimiter
error: proc macro panicked
--> $DIR/invalid-punct-ident-4.rs:16:1
diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs
index e140165..af47dad 100644
--- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs
+++ b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.rs
@@ -10,13 +10,11 @@
// aux-build:attribute-spans-preserved.rs
-#![feature(use_extern_macros)]
-
extern crate attribute_spans_preserved as foo;
use foo::foo;
#[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types
-#[ bar let x: u32 = "y"; ] //~ ERROR: mismatched types
+#[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types
fn main() {
}
diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr
index fe62bd2..329e5be 100644
--- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr
+++ b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/attribute-spans-preserved.rs:19:23
+ --> $DIR/attribute-spans-preserved.rs:17:23
|
LL | #[ foo ( let y: u32 = "z"; ) ] //~ ERROR: mismatched types
| ^^^ expected u32, found reference
@@ -8,10 +8,10 @@
found type `&'static str`
error[E0308]: mismatched types
- --> $DIR/attribute-spans-preserved.rs:20:21
+ --> $DIR/attribute-spans-preserved.rs:18:23
|
-LL | #[ bar let x: u32 = "y"; ] //~ ERROR: mismatched types
- | ^^^ expected u32, found reference
+LL | #[ bar { let x: u32 = "y"; } ] //~ ERROR: mismatched types
+ | ^^^ expected u32, found reference
|
= note: expected type `u32`
found type `&'static str`
diff --git a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout
index 33dc064..b1487fc 100644
--- a/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout
+++ b/src/test/ui-fulldeps/proc-macro/attribute-spans-preserved.stdout
@@ -1 +1 @@
-fn main ( ) { let y : u32 = "z" ; let x : u32 = "y" ; }
+fn main ( ) { let y : u32 = "z" ; { let x : u32 = "y" ; } }
diff --git a/src/test/ui-fulldeps/proc-macro/macro-brackets.rs b/src/test/ui-fulldeps/proc-macro/macro-brackets.rs
index 1c16faa..b29f277 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-brackets.rs
+++ b/src/test/ui-fulldeps/proc-macro/macro-brackets.rs
@@ -10,8 +10,6 @@
// aux-build:macro-brackets.rs
-#![feature(use_extern_macros)]
-
extern crate macro_brackets as bar;
use bar::doit;
diff --git a/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr b/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr
index 1f31a03..7c263d3 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr
+++ b/src/test/ui-fulldeps/proc-macro/macro-brackets.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/macro-brackets.rs:23:21
+ --> $DIR/macro-brackets.rs:21:21
|
LL | id![static X: u32 = 'a';]; //~ ERROR: mismatched types
| ^^^ expected u32, found char
diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs
index 9cfd486..fa05ad2 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs
+++ b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.rs
@@ -10,7 +10,6 @@
// no-prefer-dynamic
-#![feature(use_extern_macros)]
#![crate_type = "proc-macro"]
extern crate proc_macro;
diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr
index 58a7f97..342d7dd 100644
--- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr
+++ b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved-2.stderr
@@ -1,53 +1,53 @@
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:35:5
+ --> $DIR/macro-namespace-reserved-2.rs:34:5
|
LL | my_macro!(); //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:38:5
+ --> $DIR/macro-namespace-reserved-2.rs:37:5
|
LL | my_macro_attr!(); //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:41:5
+ --> $DIR/macro-namespace-reserved-2.rs:40:5
|
LL | MyTrait!(); //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:44:1
+ --> $DIR/macro-namespace-reserved-2.rs:43:1
|
LL | #[my_macro] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:46:1
+ --> $DIR/macro-namespace-reserved-2.rs:45:1
|
LL | #[my_macro_attr] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:48:1
+ --> $DIR/macro-namespace-reserved-2.rs:47:1
|
LL | #[MyTrait] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:51:10
+ --> $DIR/macro-namespace-reserved-2.rs:50:10
|
LL | #[derive(my_macro)] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:53:10
+ --> $DIR/macro-namespace-reserved-2.rs:52:10
|
LL | #[derive(my_macro_attr)] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^^^^^^^
error: can't use a procedural macro from the same crate that defines it
- --> $DIR/macro-namespace-reserved-2.rs:55:10
+ --> $DIR/macro-namespace-reserved-2.rs:54:10
|
LL | #[derive(MyTrait)] //~ ERROR can't use a procedural macro from the same crate that defines it
| ^^^^^^^
diff --git a/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs b/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs
index bacab34..8f059d6 100644
--- a/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs
+++ b/src/test/ui-fulldeps/proc-macro/nested-item-spans.rs
@@ -10,8 +10,6 @@
// aux-build:nested-item-spans.rs
-#![feature(use_extern_macros)]
-
extern crate nested_item_spans;
use nested_item_spans::foo;
diff --git a/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr b/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr
index c02cc25..7514074 100644
--- a/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr
+++ b/src/test/ui-fulldeps/proc-macro/nested-item-spans.stderr
@@ -1,5 +1,5 @@
error[E0308]: mismatched types
- --> $DIR/nested-item-spans.rs:22:22
+ --> $DIR/nested-item-spans.rs:20:22
|
LL | let x: u32 = "x"; //~ ERROR: mismatched types
| ^^^ expected u32, found reference
@@ -8,7 +8,7 @@
found type `&'static str`
error[E0308]: mismatched types
- --> $DIR/nested-item-spans.rs:31:22
+ --> $DIR/nested-item-spans.rs:29:22
|
LL | let x: u32 = "x"; //~ ERROR: mismatched types
| ^^^ expected u32, found reference
diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed b/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed
index e5b47c7..b64ebed 100644
--- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed
+++ b/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.fixed
@@ -9,7 +9,7 @@
// except according to those terms.
// aux-build:suggestions-not-always-applicable.rs
-// compile-flags: --edition 2015
+// edition:2015
// run-rustfix
// rustfix-only-machine-applicable
// compile-pass
diff --git a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs b/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs
index e5b47c7..b64ebed 100644
--- a/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs
+++ b/src/test/ui-fulldeps/rust-2018/suggestions-not-always-applicable.rs
@@ -9,7 +9,7 @@
// except according to those terms.
// aux-build:suggestions-not-always-applicable.rs
-// compile-flags: --edition 2015
+// edition:2015
// run-rustfix
// rustfix-only-machine-applicable
// compile-pass
diff --git a/src/test/ui-fulldeps/unnecessary-extern-crate.rs b/src/test/ui-fulldeps/unnecessary-extern-crate.rs
index 0811c79..ea3e058 100644
--- a/src/test/ui-fulldeps/unnecessary-extern-crate.rs
+++ b/src/test/ui-fulldeps/unnecessary-extern-crate.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: --edition 2018
+// edition:2018
#![deny(unused_extern_crates)]
#![feature(alloc, test, libc)]
diff --git a/src/test/compile-fail/.gitattributes b/src/test/ui/.gitattributes
similarity index 100%
rename from src/test/compile-fail/.gitattributes
rename to src/test/ui/.gitattributes
diff --git a/src/test/ui/E0501.ast.nll.stderr b/src/test/ui/E0501.ast.nll.stderr
new file mode 100644
index 0000000..a9abc79
--- /dev/null
+++ b/src/test/ui/E0501.ast.nll.stderr
@@ -0,0 +1,31 @@
+error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
+ --> $DIR/E0501.rs:28:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - first borrow occurs due to use of `a` in closure
+LL | };
+LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
+ | ^ borrow occurs here
+...
+LL | drop(bar);
+ | --- borrow later used here
+
+error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
+ --> $DIR/E0501.rs:31:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - first borrow occurs due to use of `a` in closure
+...
+LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+ | ^ borrow occurs here
+...
+LL | drop(bar);
+ | --- borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/E0501.ast.stderr b/src/test/ui/E0501.ast.stderr
new file mode 100644
index 0000000..229b166
--- /dev/null
+++ b/src/test/ui/E0501.ast.stderr
@@ -0,0 +1,31 @@
+error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
+ --> $DIR/E0501.rs:28:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - previous borrow occurs due to use of `a` in closure
+LL | };
+LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
+ | ^ borrow occurs here
+...
+LL | }
+ | - borrow from closure ends here
+
+error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
+ --> $DIR/E0501.rs:31:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - previous borrow occurs due to use of `a` in closure
+...
+LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+ | ^ borrow occurs here
+...
+LL | }
+ | - borrow from closure ends here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/ui/E0501.mir.stderr b/src/test/ui/E0501.mir.stderr
new file mode 100644
index 0000000..a9abc79
--- /dev/null
+++ b/src/test/ui/E0501.mir.stderr
@@ -0,0 +1,31 @@
+error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
+ --> $DIR/E0501.rs:28:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - first borrow occurs due to use of `a` in closure
+LL | };
+LL | outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
+ | ^ borrow occurs here
+...
+LL | drop(bar);
+ | --- borrow later used here
+
+error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
+ --> $DIR/E0501.rs:31:23
+ |
+LL | let bar = || {
+ | -- closure construction occurs here
+LL | inside_closure(a)
+ | - first borrow occurs due to use of `a` in closure
+...
+LL | outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
+ | ^ borrow occurs here
+...
+LL | drop(bar);
+ | --- borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0501`.
diff --git a/src/test/compile-fail/E0501.rs b/src/test/ui/E0501.rs
similarity index 100%
rename from src/test/compile-fail/E0501.rs
rename to src/test/ui/E0501.rs
diff --git a/src/test/ui/E0506.ast.nll.stderr b/src/test/ui/E0506.ast.nll.stderr
new file mode 100644
index 0000000..cf6b8d9
--- /dev/null
+++ b/src/test/ui/E0506.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `fancy_num` because it is borrowed
+ --> $DIR/E0506.rs:21:5
+ |
+LL | let fancy_ref = &fancy_num;
+ | ---------- borrow of `fancy_num` occurs here
+LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+...
+LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
+ | ------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/E0506.ast.stderr b/src/test/ui/E0506.ast.stderr
new file mode 100644
index 0000000..54b4e16
--- /dev/null
+++ b/src/test/ui/E0506.ast.stderr
@@ -0,0 +1,11 @@
+error[E0506]: cannot assign to `fancy_num` because it is borrowed
+ --> $DIR/E0506.rs:21:5
+ |
+LL | let fancy_ref = &fancy_num;
+ | --------- borrow of `fancy_num` occurs here
+LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/E0506.mir.stderr b/src/test/ui/E0506.mir.stderr
new file mode 100644
index 0000000..cf6b8d9
--- /dev/null
+++ b/src/test/ui/E0506.mir.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `fancy_num` because it is borrowed
+ --> $DIR/E0506.rs:21:5
+ |
+LL | let fancy_ref = &fancy_num;
+ | ---------- borrow of `fancy_num` occurs here
+LL | fancy_num = FancyNum { num: 6 }; //[ast]~ ERROR E0506
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `fancy_num` occurs here
+...
+LL | println!("Num: {}, Ref: {}", fancy_num.num, fancy_ref.num);
+ | ------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/E0506.rs b/src/test/ui/E0506.rs
similarity index 100%
rename from src/test/compile-fail/E0506.rs
rename to src/test/ui/E0506.rs
diff --git a/src/test/ui/E0508-fail.ast.nll.stderr b/src/test/ui/E0508-fail.ast.nll.stderr
new file mode 100644
index 0000000..fda6c24
--- /dev/null
+++ b/src/test/ui/E0508-fail.ast.nll.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508-fail.rs:18:18
+ |
+LL | let _value = array[0]; //[ast]~ ERROR [E0508]
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508-fail.ast.stderr b/src/test/ui/E0508-fail.ast.stderr
new file mode 100644
index 0000000..faf7411
--- /dev/null
+++ b/src/test/ui/E0508-fail.ast.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508-fail.rs:18:18
+ |
+LL | let _value = array[0]; //[ast]~ ERROR [E0508]
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider using a reference instead: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508-fail.mir.stderr b/src/test/ui/E0508-fail.mir.stderr
new file mode 100644
index 0000000..fda6c24
--- /dev/null
+++ b/src/test/ui/E0508-fail.mir.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508-fail.rs:18:18
+ |
+LL | let _value = array[0]; //[ast]~ ERROR [E0508]
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/compile-fail/E0508.rs b/src/test/ui/E0508-fail.rs
similarity index 100%
rename from src/test/compile-fail/E0508.rs
rename to src/test/ui/E0508-fail.rs
diff --git a/src/test/ui/E0508.ast.stderr b/src/test/ui/E0508.ast.stderr
new file mode 100644
index 0000000..5878b79
--- /dev/null
+++ b/src/test/ui/E0508.ast.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508.rs:18:18
+ |
+LL | let _value = array[0]; //[ast]~ ERROR [E0508]
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider using a reference instead: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508.mir.stderr b/src/test/ui/E0508.mir.stderr
new file mode 100644
index 0000000..5878b79
--- /dev/null
+++ b/src/test/ui/E0508.mir.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508.rs:18:18
+ |
+LL | let _value = array[0]; //[ast]~ ERROR [E0508]
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider using a reference instead: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/E0508.nll.stderr b/src/test/ui/E0508.nll.stderr
new file mode 100644
index 0000000..025ff87
--- /dev/null
+++ b/src/test/ui/E0508.nll.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[NonCopy; 1]`, a non-copy array
+ --> $DIR/E0508.rs:15:18
+ |
+LL | let _value = array[0]; //~ ERROR [E0508]
+ | ^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&array[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/compile-fail/E0583.rs b/src/test/ui/E0583.rs
similarity index 100%
rename from src/test/compile-fail/E0583.rs
rename to src/test/ui/E0583.rs
diff --git a/src/test/ui/E0583.stderr b/src/test/ui/E0583.stderr
new file mode 100644
index 0000000..82e1ccc
--- /dev/null
+++ b/src/test/ui/E0583.stderr
@@ -0,0 +1,11 @@
+error[E0583]: file not found for module `module_that_doesnt_exist`
+ --> $DIR/E0583.rs:11:5
+ |
+LL | mod module_that_doesnt_exist; //~ ERROR E0583
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: name the file either module_that_doesnt_exist.rs or module_that_doesnt_exist/mod.rs inside the directory "$DIR"
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0583`.
diff --git a/src/test/ui/E0594.ast.nll.stderr b/src/test/ui/E0594.ast.nll.stderr
new file mode 100644
index 0000000..f96eb01a
--- /dev/null
+++ b/src/test/ui/E0594.ast.nll.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item `NUM`
+ --> $DIR/E0594.rs:17:5
+ |
+LL | NUM = 20; //[ast]~ ERROR E0594
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/E0594.ast.stderr b/src/test/ui/E0594.ast.stderr
new file mode 100644
index 0000000..f84c1f5
--- /dev/null
+++ b/src/test/ui/E0594.ast.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item
+ --> $DIR/E0594.rs:17:5
+ |
+LL | NUM = 20; //[ast]~ ERROR E0594
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/E0594.mir.stderr b/src/test/ui/E0594.mir.stderr
new file mode 100644
index 0000000..f96eb01a
--- /dev/null
+++ b/src/test/ui/E0594.mir.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item `NUM`
+ --> $DIR/E0594.rs:17:5
+ |
+LL | NUM = 20; //[ast]~ ERROR E0594
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/E0594.rs b/src/test/ui/E0594.rs
similarity index 100%
rename from src/test/compile-fail/E0594.rs
rename to src/test/ui/E0594.rs
diff --git a/src/test/ui/E0596.ast.nll.stderr b/src/test/ui/E0596.ast.nll.stderr
new file mode 100644
index 0000000..589db4a
--- /dev/null
+++ b/src/test/ui/E0596.ast.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/E0596.rs:16:13
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+LL | let y = &mut x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/E0596.ast.stderr b/src/test/ui/E0596.ast.stderr
new file mode 100644
index 0000000..d88530b
--- /dev/null
+++ b/src/test/ui/E0596.ast.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `x` as mutable
+ --> $DIR/E0596.rs:16:18
+ |
+LL | let x = 1;
+ | - consider changing this to `mut x`
+LL | let y = &mut x; //[ast]~ ERROR [E0596]
+ | ^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/E0596.mir.stderr b/src/test/ui/E0596.mir.stderr
new file mode 100644
index 0000000..589db4a
--- /dev/null
+++ b/src/test/ui/E0596.mir.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/E0596.rs:16:13
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+LL | let y = &mut x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/E0596.rs b/src/test/ui/E0596.rs
similarity index 100%
rename from src/test/compile-fail/E0596.rs
rename to src/test/ui/E0596.rs
diff --git a/src/test/ui/E0642.rs b/src/test/ui/E0642.rs
new file mode 100644
index 0000000..58ccfc5
--- /dev/null
+++ b/src/test/ui/E0642.rs
@@ -0,0 +1,24 @@
+// 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.
+
+#[derive(Clone, Copy)]
+struct S;
+
+trait T {
+ fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
+
+ fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
+
+ fn f(&ident: &S) {} // ok
+ fn g(&&ident: &&S) {} // ok
+ fn h(mut ident: S) {} // ok
+}
+
+fn main() {}
diff --git a/src/test/ui/E0642.stderr b/src/test/ui/E0642.stderr
new file mode 100644
index 0000000..34c163e
--- /dev/null
+++ b/src/test/ui/E0642.stderr
@@ -0,0 +1,23 @@
+error[E0642]: patterns aren't allowed in methods without bodies
+ --> $DIR/E0642.rs:15:12
+ |
+LL | fn foo((x, y): (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
+ | ^^^^^^
+help: give this argument a name or use an underscore to ignore it
+ |
+LL | fn foo(_: (i32, i32)); //~ ERROR patterns aren't allowed in methods without bodies
+ | ^
+
+error[E0642]: patterns aren't allowed in methods without bodies
+ --> $DIR/E0642.rs:17:12
+ |
+LL | fn bar((x, y): (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
+ | ^^^^^^
+help: give this argument a name or use an underscore to ignore it
+ |
+LL | fn bar(_: (i32, i32)) {} //~ ERROR patterns aren't allowed in methods without bodies
+ | ^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0642`.
diff --git a/src/test/ui/E0660.rs b/src/test/ui/E0660.rs
index 82ef38e..2981e4e 100644
--- a/src/test/ui/E0660.rs
+++ b/src/test/ui/E0660.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-stage1
-
#![feature(asm)]
fn main() {
diff --git a/src/test/ui/E0660.stderr b/src/test/ui/E0660.stderr
index fcf3e9a..e8acb28 100644
--- a/src/test/ui/E0660.stderr
+++ b/src/test/ui/E0660.stderr
@@ -1,11 +1,11 @@
error[E0660]: malformed inline assembly
- --> $DIR/E0660.rs:17:5
+ --> $DIR/E0660.rs:15:5
|
LL | asm!("nop" "nop");
| ^^^^^^^^^^^^^^^^^^
error[E0660]: malformed inline assembly
- --> $DIR/E0660.rs:19:5
+ --> $DIR/E0660.rs:17:5
|
LL | asm!("nop" "nop" : "=r"(a));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/E0661.rs b/src/test/ui/E0661.rs
index 7f8a0d8..2410eba 100644
--- a/src/test/ui/E0661.rs
+++ b/src/test/ui/E0661.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-stage1
-
#![feature(asm)]
fn main() {
diff --git a/src/test/ui/E0661.stderr b/src/test/ui/E0661.stderr
index d8b974d..90aeca5 100644
--- a/src/test/ui/E0661.stderr
+++ b/src/test/ui/E0661.stderr
@@ -1,5 +1,5 @@
error[E0661]: output operand constraint lacks '=' or '+'
- --> $DIR/E0661.rs:17:18
+ --> $DIR/E0661.rs:15:18
|
LL | asm!("nop" : "r"(a));
| ^^^
diff --git a/src/test/ui/E0662.rs b/src/test/ui/E0662.rs
index 6adb11c..700540f 100644
--- a/src/test/ui/E0662.rs
+++ b/src/test/ui/E0662.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-stage1
-
#![feature(asm)]
fn main() {
diff --git a/src/test/ui/E0662.stderr b/src/test/ui/E0662.stderr
index 215e3a6..31655ca 100644
--- a/src/test/ui/E0662.stderr
+++ b/src/test/ui/E0662.stderr
@@ -1,5 +1,5 @@
error[E0662]: input operand constraint contains '='
- --> $DIR/E0662.rs:18:12
+ --> $DIR/E0662.rs:16:12
|
LL | : "=test"("a") //~ ERROR E0662
| ^^^^^^^
diff --git a/src/test/ui/E0663.rs b/src/test/ui/E0663.rs
index 9eb05ad..dea2b91 100644
--- a/src/test/ui/E0663.rs
+++ b/src/test/ui/E0663.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-stage1
-
#![feature(asm)]
fn main() {
diff --git a/src/test/ui/E0663.stderr b/src/test/ui/E0663.stderr
index 123aa73..0a28762 100644
--- a/src/test/ui/E0663.stderr
+++ b/src/test/ui/E0663.stderr
@@ -1,5 +1,5 @@
error[E0663]: input operand constraint contains '+'
- --> $DIR/E0663.rs:18:12
+ --> $DIR/E0663.rs:16:12
|
LL | : "+test"("a") //~ ERROR E0663
| ^^^^^^^
diff --git a/src/test/ui/E0664.rs b/src/test/ui/E0664.rs
index 738ffc1..9773f60 100644
--- a/src/test/ui/E0664.rs
+++ b/src/test/ui/E0664.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-stage1
-
#![feature(asm)]
fn main() {
diff --git a/src/test/ui/E0664.stderr b/src/test/ui/E0664.stderr
index 5708117..1e79c84 100644
--- a/src/test/ui/E0664.stderr
+++ b/src/test/ui/E0664.stderr
@@ -1,5 +1,5 @@
error[E0664]: clobber should not be surrounded by braces
- --> $DIR/E0664.rs:19:12
+ --> $DIR/E0664.rs:17:12
|
LL | : "{eax}" //~ ERROR E0664
| ^^^^^^^
diff --git a/src/test/ui/E0665.rs b/src/test/ui/E0665.rs
index 8888bed..0a0bd3f 100644
--- a/src/test/ui/E0665.rs
+++ b/src/test/ui/E0665.rs
@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// ignore-stage1
-
#[derive(Default)] //~ ERROR E0665
enum Food {
Sweet,
diff --git a/src/test/ui/E0665.stderr b/src/test/ui/E0665.stderr
index c97e9e5..268224c 100644
--- a/src/test/ui/E0665.stderr
+++ b/src/test/ui/E0665.stderr
@@ -1,5 +1,5 @@
error[E0665]: `Default` cannot be derived for enums, only structs
- --> $DIR/E0665.rs:13:10
+ --> $DIR/E0665.rs:11:10
|
LL | #[derive(Default)] //~ ERROR E0665
| ^^^^^^^
diff --git a/src/test/ui/E0705.rs b/src/test/ui/E0705.rs
index a0ce95e..b5fd3cf 100644
--- a/src/test/ui/E0705.rs
+++ b/src/test/ui/E0705.rs
@@ -10,9 +10,9 @@
// compile-pass
-#![feature(rust_2018_preview)]
#![feature(raw_identifiers)]
//~^ WARN the feature `raw_identifiers` is included in the Rust 2018 edition
+#![feature(rust_2018_preview)]
fn main() {
let foo = 0;
diff --git a/src/test/ui/E0705.stderr b/src/test/ui/E0705.stderr
index ebb8dd4..2aa3077 100644
--- a/src/test/ui/E0705.stderr
+++ b/src/test/ui/E0705.stderr
@@ -1,5 +1,5 @@
warning[E0705]: the feature `raw_identifiers` is included in the Rust 2018 edition
- --> $DIR/E0705.rs:14:12
+ --> $DIR/E0705.rs:13:12
|
LL | #![feature(raw_identifiers)]
| ^^^^^^^^^^^^^^^
diff --git a/src/test/compile-fail/absolute-paths-in-nested-use-groups.rs b/src/test/ui/absolute-paths-in-nested-use-groups.rs
similarity index 100%
rename from src/test/compile-fail/absolute-paths-in-nested-use-groups.rs
rename to src/test/ui/absolute-paths-in-nested-use-groups.rs
diff --git a/src/test/ui/absolute-paths-in-nested-use-groups.stderr b/src/test/ui/absolute-paths-in-nested-use-groups.stderr
new file mode 100644
index 0000000..e88d267
--- /dev/null
+++ b/src/test/ui/absolute-paths-in-nested-use-groups.stderr
@@ -0,0 +1,21 @@
+error[E0433]: failed to resolve. crate root in paths can only be used in start position
+ --> $DIR/absolute-paths-in-nested-use-groups.rs:16:5
+ |
+LL | ::bar, //~ ERROR crate root in paths can only be used in start position
+ | ^ crate root in paths can only be used in start position
+
+error[E0433]: failed to resolve. `super` in paths can only be used in start position
+ --> $DIR/absolute-paths-in-nested-use-groups.rs:17:5
+ |
+LL | super::bar, //~ ERROR `super` in paths can only be used in start position
+ | ^^^^^ `super` in paths can only be used in start position
+
+error[E0433]: failed to resolve. `self` in paths can only be used in start position
+ --> $DIR/absolute-paths-in-nested-use-groups.rs:18:5
+ |
+LL | self::bar, //~ ERROR `self` in paths can only be used in start position
+ | ^^^^ `self` in paths can only be used in start position
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr
new file mode 100644
index 0000000..b9de60f
--- /dev/null
+++ b/src/test/ui/access-mode-in-closures.nll.stderr
@@ -0,0 +1,18 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/access-mode-in-closures.rs:19:15
+ |
+LL | match *s { sty(v) => v } //~ ERROR cannot move out
+ | ^^ - data moved here
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `s`
+ |
+note: move occurs because `v` has type `std::vec::Vec<isize>`, which does not implement the `Copy` trait
+ --> $DIR/access-mode-in-closures.rs:19:24
+ |
+LL | match *s { sty(v) => v } //~ ERROR cannot move out
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/access-mode-in-closures.rs b/src/test/ui/access-mode-in-closures.rs
similarity index 100%
rename from src/test/compile-fail/access-mode-in-closures.rs
rename to src/test/ui/access-mode-in-closures.rs
diff --git a/src/test/ui/access-mode-in-closures.stderr b/src/test/ui/access-mode-in-closures.stderr
new file mode 100644
index 0000000..daecbb6
--- /dev/null
+++ b/src/test/ui/access-mode-in-closures.stderr
@@ -0,0 +1,11 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/access-mode-in-closures.rs:19:15
+ |
+LL | match *s { sty(v) => v } //~ ERROR cannot move out
+ | ^^ - hint: to prevent move, use `ref v` or `ref mut v`
+ | |
+ | cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/alloc-error-handler-bad-signature-1.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs
similarity index 100%
rename from src/test/compile-fail/alloc-error-handler-bad-signature-1.rs
rename to src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.rs
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
new file mode 100644
index 0000000..6dd905c
--- /dev/null
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-1.stderr
@@ -0,0 +1,14 @@
+error: return type should be `!`
+ --> $DIR/alloc-error-handler-bad-signature-1.rs:22:6
+ |
+LL | ) -> () //~ ERROR return type should be `!`
+ | ^^
+
+error: argument should be `Layout`
+ --> $DIR/alloc-error-handler-bad-signature-1.rs:21:11
+ |
+LL | info: &Layout, //~ ERROR argument should be `Layout`
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/alloc-error-handler-bad-signature-2.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs
similarity index 100%
rename from src/test/compile-fail/alloc-error-handler-bad-signature-2.rs
rename to src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.rs
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
new file mode 100644
index 0000000..c1fcdc7
--- /dev/null
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-2.stderr
@@ -0,0 +1,14 @@
+error: return type should be `!`
+ --> $DIR/alloc-error-handler-bad-signature-2.rs:22:3
+ |
+LL | ) { //~ ERROR return type should be `!`
+ | ^
+
+error: argument should be `Layout`
+ --> $DIR/alloc-error-handler-bad-signature-2.rs:21:11
+ |
+LL | info: Layout, //~ ERROR argument should be `Layout`
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/alloc-error-handler-bad-signature-3.rs b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs
similarity index 100%
rename from src/test/compile-fail/alloc-error-handler-bad-signature-3.rs
rename to src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.rs
diff --git a/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
new file mode 100644
index 0000000..9b792c4
--- /dev/null
+++ b/src/test/ui/alloc-error/alloc-error-handler-bad-signature-3.stderr
@@ -0,0 +1,10 @@
+error: function should have one argument
+ --> $DIR/alloc-error-handler-bad-signature-3.rs:20:1
+ |
+LL | / fn oom() -> ! { //~ ERROR function should have one argument
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/allocator/auxiliary/system-allocator.rs b/src/test/ui/allocator/auxiliary/system-allocator.rs
similarity index 100%
rename from src/test/compile-fail/allocator/auxiliary/system-allocator.rs
rename to src/test/ui/allocator/auxiliary/system-allocator.rs
diff --git a/src/test/compile-fail/allocator/auxiliary/system-allocator2.rs b/src/test/ui/allocator/auxiliary/system-allocator2.rs
similarity index 100%
rename from src/test/compile-fail/allocator/auxiliary/system-allocator2.rs
rename to src/test/ui/allocator/auxiliary/system-allocator2.rs
diff --git a/src/test/compile-fail/allocator/function-allocator.rs b/src/test/ui/allocator/function-allocator.rs
similarity index 100%
rename from src/test/compile-fail/allocator/function-allocator.rs
rename to src/test/ui/allocator/function-allocator.rs
diff --git a/src/test/ui/allocator/function-allocator.stderr b/src/test/ui/allocator/function-allocator.stderr
new file mode 100644
index 0000000..8649b6b
--- /dev/null
+++ b/src/test/ui/allocator/function-allocator.stderr
@@ -0,0 +1,8 @@
+error: allocators must be statics
+ --> $DIR/function-allocator.rs:13:1
+ |
+LL | fn foo() {} //~ ERROR: allocators must be statics
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/allocator/not-an-allocator.rs b/src/test/ui/allocator/not-an-allocator.rs
similarity index 100%
rename from src/test/compile-fail/allocator/not-an-allocator.rs
rename to src/test/ui/allocator/not-an-allocator.rs
diff --git a/src/test/ui/allocator/not-an-allocator.stderr b/src/test/ui/allocator/not-an-allocator.stderr
new file mode 100644
index 0000000..757c506
--- /dev/null
+++ b/src/test/ui/allocator/not-an-allocator.stderr
@@ -0,0 +1,35 @@
+error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
+ --> $DIR/not-an-allocator.rs:12:1
+ |
+LL | static A: usize = 0;
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
+ |
+ = note: required by `std::alloc::GlobalAlloc::alloc`
+
+error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
+ --> $DIR/not-an-allocator.rs:12:1
+ |
+LL | static A: usize = 0;
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
+ |
+ = note: required by `std::alloc::GlobalAlloc::dealloc`
+
+error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
+ --> $DIR/not-an-allocator.rs:12:1
+ |
+LL | static A: usize = 0;
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
+ |
+ = note: required by `std::alloc::GlobalAlloc::realloc`
+
+error[E0277]: the trait bound `usize: std::alloc::GlobalAlloc` is not satisfied
+ --> $DIR/not-an-allocator.rs:12:1
+ |
+LL | static A: usize = 0;
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `std::alloc::GlobalAlloc` is not implemented for `usize`
+ |
+ = note: required by `std::alloc::GlobalAlloc::alloc_zeroed`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/allocator/two-allocators.rs b/src/test/ui/allocator/two-allocators.rs
similarity index 100%
rename from src/test/compile-fail/allocator/two-allocators.rs
rename to src/test/ui/allocator/two-allocators.rs
diff --git a/src/test/ui/allocator/two-allocators.stderr b/src/test/ui/allocator/two-allocators.stderr
new file mode 100644
index 0000000..5285ee9
--- /dev/null
+++ b/src/test/ui/allocator/two-allocators.stderr
@@ -0,0 +1,8 @@
+error: cannot define more than one #[global_allocator]
+ --> $DIR/two-allocators.rs:16:1
+ |
+LL | static B: System = System;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/allocator/two-allocators2.rs b/src/test/ui/allocator/two-allocators2.rs
similarity index 100%
rename from src/test/compile-fail/allocator/two-allocators2.rs
rename to src/test/ui/allocator/two-allocators2.rs
diff --git a/src/test/ui/allocator/two-allocators2.stderr b/src/test/ui/allocator/two-allocators2.stderr
new file mode 100644
index 0000000..2b23ce3
--- /dev/null
+++ b/src/test/ui/allocator/two-allocators2.stderr
@@ -0,0 +1,4 @@
+error: the #[global_allocator] in this crate conflicts with global allocator in: system_allocator
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/allocator/two-allocators3.rs b/src/test/ui/allocator/two-allocators3.rs
similarity index 100%
rename from src/test/compile-fail/allocator/two-allocators3.rs
rename to src/test/ui/allocator/two-allocators3.rs
diff --git a/src/test/ui/allocator/two-allocators3.stderr b/src/test/ui/allocator/two-allocators3.stderr
new file mode 100644
index 0000000..86e385a
--- /dev/null
+++ b/src/test/ui/allocator/two-allocators3.stderr
@@ -0,0 +1,4 @@
+error: the #[global_allocator] in system_allocator conflicts with this global allocator in: system_allocator2
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/anon-params-deprecated.rs b/src/test/ui/anon-params-deprecated.rs
similarity index 100%
rename from src/test/compile-fail/anon-params-deprecated.rs
rename to src/test/ui/anon-params-deprecated.rs
diff --git a/src/test/ui/anon-params-deprecated.stderr b/src/test/ui/anon-params-deprecated.stderr
new file mode 100644
index 0000000..fa13b8d
--- /dev/null
+++ b/src/test/ui/anon-params-deprecated.stderr
@@ -0,0 +1,34 @@
+error: anonymous parameters are deprecated and will be removed in the next edition.
+ --> $DIR/anon-params-deprecated.rs:15:12
+ |
+LL | fn foo(i32); //~ ERROR anonymous parameters are deprecated
+ | ^^^ help: Try naming the parameter or explicitly ignoring it: `_: i32`
+ |
+note: lint level defined here
+ --> $DIR/anon-params-deprecated.rs:11:11
+ |
+LL | #![forbid(anonymous_parameters)]
+ | ^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
+
+error: anonymous parameters are deprecated and will be removed in the next edition.
+ --> $DIR/anon-params-deprecated.rs:18:30
+ |
+LL | fn bar_with_default_impl(String, String) {}
+ | ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String`
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
+
+error: anonymous parameters are deprecated and will be removed in the next edition.
+ --> $DIR/anon-params-deprecated.rs:18:38
+ |
+LL | fn bar_with_default_impl(String, String) {}
+ | ^^^^^^ help: Try naming the parameter or explicitly ignoring it: `_: String`
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/arg-count-mismatch.rs b/src/test/ui/arg-count-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/arg-count-mismatch.rs
rename to src/test/ui/arg-count-mismatch.rs
diff --git a/src/test/ui/arg-count-mismatch.stderr b/src/test/ui/arg-count-mismatch.stderr
new file mode 100644
index 0000000..699e36f
--- /dev/null
+++ b/src/test/ui/arg-count-mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0061]: this function takes 1 parameter but 0 parameters were supplied
+ --> $DIR/arg-count-mismatch.rs:15:28
+ |
+LL | fn f(x: isize) { }
+ | -------------- defined here
+LL |
+LL | fn main() { let i: (); i = f(); }
+ | ^^^ expected 1 parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.
diff --git a/src/test/compile-fail/arg-type-mismatch.rs b/src/test/ui/arg-type-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/arg-type-mismatch.rs
rename to src/test/ui/arg-type-mismatch.rs
diff --git a/src/test/ui/arg-type-mismatch.stderr b/src/test/ui/arg-type-mismatch.stderr
new file mode 100644
index 0000000..2b24d9d
--- /dev/null
+++ b/src/test/ui/arg-type-mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/arg-type-mismatch.rs:16:30
+ |
+LL | fn main() { let i: (); i = f(()); }
+ | ^^ expected isize, found ()
+ |
+ = note: expected type `isize`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/array-not-vector.rs b/src/test/ui/array-not-vector.rs
similarity index 100%
rename from src/test/compile-fail/array-not-vector.rs
rename to src/test/ui/array-not-vector.rs
diff --git a/src/test/ui/array-not-vector.stderr b/src/test/ui/array-not-vector.stderr
new file mode 100644
index 0000000..83bf058
--- /dev/null
+++ b/src/test/ui/array-not-vector.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/array-not-vector.rs:12:19
+ |
+LL | let _x: i32 = [1, 2, 3];
+ | ^^^^^^^^^ expected i32, found array of 3 elements
+ |
+ = note: expected type `i32`
+ found type `[{integer}; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/array-not-vector.rs:19:20
+ |
+LL | let _y: &i32 = x;
+ | ^ expected i32, found slice
+ |
+ = note: expected type `&i32`
+ found type `&[i32]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/array_const_index-0.rs b/src/test/ui/array_const_index-0.rs
similarity index 100%
rename from src/test/compile-fail/array_const_index-0.rs
rename to src/test/ui/array_const_index-0.rs
diff --git a/src/test/ui/array_const_index-0.stderr b/src/test/ui/array_const_index-0.stderr
new file mode 100644
index 0000000..b71d224
--- /dev/null
+++ b/src/test/ui/array_const_index-0.stderr
@@ -0,0 +1,12 @@
+error: this constant cannot be used
+ --> $DIR/array_const_index-0.rs:12:1
+ |
+LL | const B: i32 = (&A)[1];
+ | ^^^^^^^^^^^^^^^-------^
+ | |
+ | index out of bounds: the len is 0 but the index is 1
+ |
+ = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/array_const_index-1.rs b/src/test/ui/array_const_index-1.rs
similarity index 100%
rename from src/test/compile-fail/array_const_index-1.rs
rename to src/test/ui/array_const_index-1.rs
diff --git a/src/test/ui/array_const_index-1.stderr b/src/test/ui/array_const_index-1.stderr
new file mode 100644
index 0000000..02f86a6
--- /dev/null
+++ b/src/test/ui/array_const_index-1.stderr
@@ -0,0 +1,12 @@
+error: this constant cannot be used
+ --> $DIR/array_const_index-1.rs:12:1
+ |
+LL | const B: i32 = A[1];
+ | ^^^^^^^^^^^^^^^----^
+ | |
+ | index out of bounds: the len is 0 but the index is 1
+ |
+ = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/asm-bad-clobber.rs b/src/test/ui/asm/asm-bad-clobber.rs
similarity index 100%
rename from src/test/compile-fail/asm-bad-clobber.rs
rename to src/test/ui/asm/asm-bad-clobber.rs
diff --git a/src/test/ui/asm/asm-bad-clobber.stderr b/src/test/ui/asm/asm-bad-clobber.stderr
new file mode 100644
index 0000000..81ab006
--- /dev/null
+++ b/src/test/ui/asm/asm-bad-clobber.stderr
@@ -0,0 +1,9 @@
+error[E0664]: clobber should not be surrounded by braces
+ --> $DIR/asm-bad-clobber.rs:32:37
+ |
+LL | asm!("xor %eax, %eax" : : : "{eax}");
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0664`.
diff --git a/src/test/compile-fail/asm-in-bad-modifier.rs b/src/test/ui/asm/asm-in-bad-modifier.rs
similarity index 100%
rename from src/test/compile-fail/asm-in-bad-modifier.rs
rename to src/test/ui/asm/asm-in-bad-modifier.rs
diff --git a/src/test/ui/asm/asm-in-bad-modifier.stderr b/src/test/ui/asm/asm-in-bad-modifier.stderr
new file mode 100644
index 0000000..dcb11bd
--- /dev/null
+++ b/src/test/ui/asm/asm-in-bad-modifier.stderr
@@ -0,0 +1,16 @@
+error[E0662]: input operand constraint contains '='
+ --> $DIR/asm-in-bad-modifier.rs:33:39
+ |
+LL | asm!("mov $1, $0" : "=r"(x) : "=r"(5)); //~ ERROR operand constraint contains '='
+ | ^^^^
+
+error[E0663]: input operand constraint contains '+'
+ --> $DIR/asm-in-bad-modifier.rs:34:39
+ |
+LL | asm!("mov $1, $0" : "=r"(y) : "+r"(5)); //~ ERROR operand constraint contains '+'
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0662, E0663.
+For more information about an error, try `rustc --explain E0662`.
diff --git a/src/test/compile-fail/asm-misplaced-option.rs b/src/test/ui/asm/asm-misplaced-option.rs
similarity index 100%
rename from src/test/compile-fail/asm-misplaced-option.rs
rename to src/test/ui/asm/asm-misplaced-option.rs
diff --git a/src/test/ui/asm/asm-misplaced-option.stderr b/src/test/ui/asm/asm-misplaced-option.stderr
new file mode 100644
index 0000000..4672391
--- /dev/null
+++ b/src/test/ui/asm/asm-misplaced-option.stderr
@@ -0,0 +1,26 @@
+warning: unrecognized option
+ --> $DIR/asm-misplaced-option.rs:36:64
+ |
+LL | asm!("mov $1, $0" : "=r"(x) : "r"(5_usize), "0"(x) : : "cc");
+ | ^^^^
+
+warning: expected a clobber, found an option
+ --> $DIR/asm-misplaced-option.rs:43:80
+ |
+LL | asm!("add $2, $1; mov $1, $0" : "=r"(x) : "r"(x), "r"(8_usize) : "cc", "volatile");
+ | ^^^^^^^^^^
+
+error: compilation successful
+ --> $DIR/asm-misplaced-option.rs:31:1
+ |
+LL | / pub fn main() { //~ ERROR compilation successful
+LL | | // assignment not dead
+LL | | let mut x: isize = 0;
+LL | | unsafe {
+... |
+LL | | assert_eq!(x, 13);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/asm-out-assign-imm.nll.stderr b/src/test/ui/asm/asm-out-assign-imm.nll.stderr
similarity index 100%
rename from src/test/ui/asm-out-assign-imm.nll.stderr
rename to src/test/ui/asm/asm-out-assign-imm.nll.stderr
diff --git a/src/test/ui/asm-out-assign-imm.rs b/src/test/ui/asm/asm-out-assign-imm.rs
similarity index 100%
rename from src/test/ui/asm-out-assign-imm.rs
rename to src/test/ui/asm/asm-out-assign-imm.rs
diff --git a/src/test/ui/asm-out-assign-imm.stderr b/src/test/ui/asm/asm-out-assign-imm.stderr
similarity index 100%
rename from src/test/ui/asm-out-assign-imm.stderr
rename to src/test/ui/asm/asm-out-assign-imm.stderr
diff --git a/src/test/compile-fail/asm-out-no-modifier.rs b/src/test/ui/asm/asm-out-no-modifier.rs
similarity index 100%
rename from src/test/compile-fail/asm-out-no-modifier.rs
rename to src/test/ui/asm/asm-out-no-modifier.rs
diff --git a/src/test/ui/asm/asm-out-no-modifier.stderr b/src/test/ui/asm/asm-out-no-modifier.stderr
new file mode 100644
index 0000000..4e9d7b8
--- /dev/null
+++ b/src/test/ui/asm/asm-out-no-modifier.stderr
@@ -0,0 +1,9 @@
+error[E0661]: output operand constraint lacks '=' or '+'
+ --> $DIR/asm-out-no-modifier.rs:32:29
+ |
+LL | asm!("mov $1, $0" : "r"(x) : "r"(5)); //~ ERROR output operand constraint lacks '='
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0661`.
diff --git a/src/test/ui/asm/asm-out-read-uninit.ast.stderr b/src/test/ui/asm/asm-out-read-uninit.ast.stderr
new file mode 100644
index 0000000..5f6685e
--- /dev/null
+++ b/src/test/ui/asm/asm-out-read-uninit.ast.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/asm-out-read-uninit.rs:35:43
+ |
+LL | asm!("mov $1, $0" : "=r"(x) : "r"(x));
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/asm/asm-out-read-uninit.mir.stderr b/src/test/ui/asm/asm-out-read-uninit.mir.stderr
new file mode 100644
index 0000000..5f6685e
--- /dev/null
+++ b/src/test/ui/asm/asm-out-read-uninit.mir.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/asm-out-read-uninit.rs:35:43
+ |
+LL | asm!("mov $1, $0" : "=r"(x) : "r"(x));
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/asm-out-read-uninit.rs b/src/test/ui/asm/asm-out-read-uninit.rs
similarity index 100%
rename from src/test/compile-fail/asm-out-read-uninit.rs
rename to src/test/ui/asm/asm-out-read-uninit.rs
diff --git a/src/test/ui/assign-imm-local-twice.ast.nll.stderr b/src/test/ui/assign-imm-local-twice.ast.nll.stderr
new file mode 100644
index 0000000..6d415eb
--- /dev/null
+++ b/src/test/ui/assign-imm-local-twice.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/assign-imm-local-twice.rs:20:5
+ |
+LL | let v: isize;
+ | - consider changing this to `mut v`
+LL | //[mir]~^ NOTE consider changing this to `mut v`
+LL | v = 1; //[ast]~ NOTE first assignment
+ | ----- first assignment to `v`
+...
+LL | v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/assign-imm-local-twice.ast.stderr b/src/test/ui/assign-imm-local-twice.ast.stderr
new file mode 100644
index 0000000..3275262
--- /dev/null
+++ b/src/test/ui/assign-imm-local-twice.ast.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/assign-imm-local-twice.rs:20:5
+ |
+LL | v = 1; //[ast]~ NOTE first assignment
+ | ----- first assignment to `v`
+...
+LL | v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/assign-imm-local-twice.mir.stderr b/src/test/ui/assign-imm-local-twice.mir.stderr
new file mode 100644
index 0000000..6d415eb
--- /dev/null
+++ b/src/test/ui/assign-imm-local-twice.mir.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/assign-imm-local-twice.rs:20:5
+ |
+LL | let v: isize;
+ | - consider changing this to `mut v`
+LL | //[mir]~^ NOTE consider changing this to `mut v`
+LL | v = 1; //[ast]~ NOTE first assignment
+ | ----- first assignment to `v`
+...
+LL | v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/assign-imm-local-twice.rs b/src/test/ui/assign-imm-local-twice.rs
similarity index 100%
rename from src/test/compile-fail/assign-imm-local-twice.rs
rename to src/test/ui/assign-imm-local-twice.rs
diff --git a/src/test/compile-fail/assign-to-method.rs b/src/test/ui/assign-to-method.rs
similarity index 100%
rename from src/test/compile-fail/assign-to-method.rs
rename to src/test/ui/assign-to-method.rs
diff --git a/src/test/ui/assign-to-method.stderr b/src/test/ui/assign-to-method.stderr
new file mode 100644
index 0000000..930b451
--- /dev/null
+++ b/src/test/ui/assign-to-method.stderr
@@ -0,0 +1,11 @@
+error[E0615]: attempted to take value of method `speak` on type `cat`
+ --> $DIR/assign-to-method.rs:30:8
+ |
+LL | nyan.speak = || println!("meow"); //~ ERROR attempted to take value of method
+ | ^^^^^
+ |
+ = help: maybe a `()` to call it is missing?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0615`.
diff --git a/src/test/compile-fail/assignment-operator-unimplemented.rs b/src/test/ui/assignment-operator-unimplemented.rs
similarity index 100%
rename from src/test/compile-fail/assignment-operator-unimplemented.rs
rename to src/test/ui/assignment-operator-unimplemented.rs
diff --git a/src/test/ui/assignment-operator-unimplemented.stderr b/src/test/ui/assignment-operator-unimplemented.stderr
new file mode 100644
index 0000000..983d698
--- /dev/null
+++ b/src/test/ui/assignment-operator-unimplemented.stderr
@@ -0,0 +1,13 @@
+error[E0368]: binary assignment operation `+=` cannot be applied to type `Foo`
+ --> $DIR/assignment-operator-unimplemented.rs:16:3
+ |
+LL | a += *b; //~ Error: binary assignment operation `+=` cannot be applied to type `Foo`
+ | -^^^^^^
+ | |
+ | cannot use `+=` on type `Foo`
+ |
+ = note: an implementation of `std::ops::AddAssign` might be missing for `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0368`.
diff --git a/src/test/compile-fail/assoc-inherent.rs b/src/test/ui/assoc-inherent.rs
similarity index 100%
rename from src/test/compile-fail/assoc-inherent.rs
rename to src/test/ui/assoc-inherent.rs
diff --git a/src/test/ui/assoc-inherent.stderr b/src/test/ui/assoc-inherent.stderr
new file mode 100644
index 0000000..11497cb
--- /dev/null
+++ b/src/test/ui/assoc-inherent.stderr
@@ -0,0 +1,9 @@
+error[E0202]: associated types are not allowed in inherent impls
+ --> $DIR/assoc-inherent.rs:16:5
+ |
+LL | type Bar = isize; //~ERROR associated types are not allowed in inherent impls
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0202`.
diff --git a/src/test/compile-fail/associated-const-ambiguity-report.rs b/src/test/ui/associated-const/associated-const-ambiguity-report.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-ambiguity-report.rs
rename to src/test/ui/associated-const/associated-const-ambiguity-report.rs
diff --git a/src/test/ui/associated-const/associated-const-ambiguity-report.stderr b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr
new file mode 100644
index 0000000..0832b1a
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-ambiguity-report.stderr
@@ -0,0 +1,20 @@
+error[E0034]: multiple applicable items in scope
+ --> $DIR/associated-const-ambiguity-report.rs:28:16
+ |
+LL | const X: i32 = <i32>::ID; //~ ERROR E0034
+ | ^^^^^^^^^ multiple `ID` found
+ |
+note: candidate #1 is defined in an impl of the trait `Foo` for the type `i32`
+ --> $DIR/associated-const-ambiguity-report.rs:21:5
+ |
+LL | const ID: i32 = 1;
+ | ^^^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `Bar` for the type `i32`
+ --> $DIR/associated-const-ambiguity-report.rs:25:5
+ |
+LL | const ID: i32 = 3;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0034`.
diff --git a/src/test/compile-fail/associated-const-array-len.rs b/src/test/ui/associated-const/associated-const-array-len.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-array-len.rs
rename to src/test/ui/associated-const/associated-const-array-len.rs
diff --git a/src/test/ui/associated-const/associated-const-array-len.stderr b/src/test/ui/associated-const/associated-const-array-len.stderr
new file mode 100644
index 0000000..5504af8
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-array-len.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/associated-const-array-len.rs:16:16
+ |
+LL | const X: [i32; <i32 as Foo>::ID] = [0, 1, 2];
+ | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+note: required by `Foo::ID`
+ --> $DIR/associated-const-array-len.rs:13:5
+ |
+LL | const ID: usize;
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-const-dead-code.rs b/src/test/ui/associated-const/associated-const-dead-code.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-dead-code.rs
rename to src/test/ui/associated-const/associated-const-dead-code.rs
diff --git a/src/test/ui/associated-const/associated-const-dead-code.stderr b/src/test/ui/associated-const/associated-const-dead-code.stderr
new file mode 100644
index 0000000..ee06581
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-dead-code.stderr
@@ -0,0 +1,14 @@
+error: associated const is never used: `BAR`
+ --> $DIR/associated-const-dead-code.rs:16:5
+ |
+LL | const BAR: u32 = 1;
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/associated-const-dead-code.rs:11:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/associated-const-generic-obligations.rs b/src/test/ui/associated-const/associated-const-generic-obligations.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-generic-obligations.rs
rename to src/test/ui/associated-const/associated-const-generic-obligations.rs
diff --git a/src/test/ui/associated-const/associated-const-generic-obligations.stderr b/src/test/ui/associated-const/associated-const-generic-obligations.stderr
new file mode 100644
index 0000000..97986a2
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-generic-obligations.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `T: Foo` is not satisfied
+ --> $DIR/associated-const-generic-obligations.rs:25:5
+ |
+LL | const FROM: &'static str = "foo";
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `T`
+ |
+ = help: consider adding a `where T: Foo` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-const-impl-wrong-lifetime.rs b/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs
similarity index 100%
rename from src/test/ui/associated-const-impl-wrong-lifetime.rs
rename to src/test/ui/associated-const/associated-const-impl-wrong-lifetime.rs
diff --git a/src/test/ui/associated-const-impl-wrong-lifetime.stderr b/src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr
similarity index 100%
rename from src/test/ui/associated-const-impl-wrong-lifetime.stderr
rename to src/test/ui/associated-const/associated-const-impl-wrong-lifetime.stderr
diff --git a/src/test/ui/associated-const-impl-wrong-type.rs b/src/test/ui/associated-const/associated-const-impl-wrong-type.rs
similarity index 100%
rename from src/test/ui/associated-const-impl-wrong-type.rs
rename to src/test/ui/associated-const/associated-const-impl-wrong-type.rs
diff --git a/src/test/ui/associated-const-impl-wrong-type.stderr b/src/test/ui/associated-const/associated-const-impl-wrong-type.stderr
similarity index 100%
rename from src/test/ui/associated-const-impl-wrong-type.stderr
rename to src/test/ui/associated-const/associated-const-impl-wrong-type.stderr
diff --git a/src/test/compile-fail/associated-const-in-trait.rs b/src/test/ui/associated-const/associated-const-in-trait.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-in-trait.rs
rename to src/test/ui/associated-const/associated-const-in-trait.rs
diff --git a/src/test/ui/associated-const/associated-const-in-trait.stderr b/src/test/ui/associated-const/associated-const-in-trait.stderr
new file mode 100644
index 0000000..7804e44
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-in-trait.stderr
@@ -0,0 +1,11 @@
+error[E0038]: the trait `Trait` cannot be made into an object
+ --> $DIR/associated-const-in-trait.rs:19:6
+ |
+LL | impl Trait {
+ | ^^^^^ the trait `Trait` cannot be made into an object
+ |
+ = note: the trait cannot contain associated consts like `N`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/associated-const-no-item.rs b/src/test/ui/associated-const/associated-const-no-item.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-no-item.rs
rename to src/test/ui/associated-const/associated-const-no-item.rs
diff --git a/src/test/ui/associated-const/associated-const-no-item.stderr b/src/test/ui/associated-const/associated-const-no-item.stderr
new file mode 100644
index 0000000..a09c04e
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-no-item.stderr
@@ -0,0 +1,13 @@
+error[E0599]: no associated item named `ID` found for type `i32` in the current scope
+ --> $DIR/associated-const-no-item.rs:16:16
+ |
+LL | const X: i32 = <i32>::ID;
+ | ^^^^^^^^^ associated item not found in `i32`
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `ID`, perhaps you need to implement it:
+ candidate #1: `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/associated-const-private-impl.rs b/src/test/ui/associated-const/associated-const-private-impl.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-private-impl.rs
rename to src/test/ui/associated-const/associated-const-private-impl.rs
diff --git a/src/test/ui/associated-const/associated-const-private-impl.stderr b/src/test/ui/associated-const/associated-const-private-impl.stderr
new file mode 100644
index 0000000..65be375
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-private-impl.stderr
@@ -0,0 +1,9 @@
+error[E0624]: associated constant `ID` is private
+ --> $DIR/associated-const-private-impl.rs:24:19
+ |
+LL | assert_eq!(1, bar1::Foo::ID);
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/associated-const-type-parameter-arms.rs b/src/test/ui/associated-const/associated-const-type-parameter-arms.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-type-parameter-arms.rs
rename to src/test/ui/associated-const/associated-const-type-parameter-arms.rs
diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr
new file mode 100644
index 0000000..a88dd4d
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-type-parameter-arms.stderr
@@ -0,0 +1,15 @@
+error[E0158]: associated consts cannot be referenced in patterns
+ --> $DIR/associated-const-type-parameter-arms.rs:31:9
+ |
+LL | A::X => println!("A::X"),
+ | ^^^^
+
+error[E0158]: associated consts cannot be referenced in patterns
+ --> $DIR/associated-const-type-parameter-arms.rs:33:9
+ |
+LL | B::X => println!("B::X"),
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0158`.
diff --git a/src/test/compile-fail/associated-const-type-parameter-arrays-2.rs b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-type-parameter-arrays-2.rs
rename to src/test/ui/associated-const/associated-const-type-parameter-arrays-2.rs
diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr
new file mode 100644
index 0000000..a440f1f
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays-2.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `A: Foo` is not satisfied
+ --> $DIR/associated-const-type-parameter-arrays-2.rs:27:22
+ |
+LL | let _array = [4; <A as Foo>::Y];
+ | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A`
+ |
+ = help: consider adding a `where A: Foo` bound
+note: required by `Foo::Y`
+ --> $DIR/associated-const-type-parameter-arrays-2.rs:13:5
+ |
+LL | const Y: usize;
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-const-type-parameter-arrays.rs b/src/test/ui/associated-const/associated-const-type-parameter-arrays.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-type-parameter-arrays.rs
rename to src/test/ui/associated-const/associated-const-type-parameter-arrays.rs
diff --git a/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr
new file mode 100644
index 0000000..4889154
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-type-parameter-arrays.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `A: Foo` is not satisfied
+ --> $DIR/associated-const-type-parameter-arrays.rs:27:23
+ |
+LL | let _array: [u32; <A as Foo>::Y];
+ | ^^^^^^^^^^^^^ the trait `Foo` is not implemented for `A`
+ |
+ = help: consider adding a `where A: Foo` bound
+note: required by `Foo::Y`
+ --> $DIR/associated-const-type-parameter-arrays.rs:13:5
+ |
+LL | const Y: usize;
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-const-upper-case-lint.rs b/src/test/ui/associated-const/associated-const-upper-case-lint.rs
similarity index 100%
rename from src/test/compile-fail/associated-const-upper-case-lint.rs
rename to src/test/ui/associated-const/associated-const-upper-case-lint.rs
diff --git a/src/test/ui/associated-const/associated-const-upper-case-lint.stderr b/src/test/ui/associated-const/associated-const-upper-case-lint.stderr
new file mode 100644
index 0000000..7a5cad6
--- /dev/null
+++ b/src/test/ui/associated-const/associated-const-upper-case-lint.stderr
@@ -0,0 +1,14 @@
+error: associated constant `not_upper` should have an upper case name such as `NOT_UPPER`
+ --> $DIR/associated-const-upper-case-lint.rs:17:5
+ |
+LL | const not_upper: bool = true;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/associated-const-upper-case-lint.rs:11:9
+ |
+LL | #![deny(non_upper_case_globals)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/associated-item-duplicate-names-2.rs b/src/test/ui/associated-item/associated-item-duplicate-names-2.rs
similarity index 100%
rename from src/test/compile-fail/associated-item-duplicate-names-2.rs
rename to src/test/ui/associated-item/associated-item-duplicate-names-2.rs
diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr
new file mode 100644
index 0000000..3b9be89
--- /dev/null
+++ b/src/test/ui/associated-item/associated-item-duplicate-names-2.stderr
@@ -0,0 +1,11 @@
+error[E0201]: duplicate definitions with name `bar`:
+ --> $DIR/associated-item-duplicate-names-2.rs:16:5
+ |
+LL | const bar: bool = true;
+ | ----------------------- previous definition of `bar` here
+LL | fn bar() {} //~ ERROR duplicate definitions
+ | ^^^^^^^^^^^ duplicate definition
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0201`.
diff --git a/src/test/compile-fail/associated-item-duplicate-names-3.rs b/src/test/ui/associated-item/associated-item-duplicate-names-3.rs
similarity index 100%
rename from src/test/compile-fail/associated-item-duplicate-names-3.rs
rename to src/test/ui/associated-item/associated-item-duplicate-names-3.rs
diff --git a/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr
new file mode 100644
index 0000000..3edf59f
--- /dev/null
+++ b/src/test/ui/associated-item/associated-item-duplicate-names-3.stderr
@@ -0,0 +1,11 @@
+error[E0201]: duplicate definitions with name `Bar`:
+ --> $DIR/associated-item-duplicate-names-3.rs:23:5
+ |
+LL | type Bar = i16;
+ | --------------- previous definition of `Bar` here
+LL | type Bar = u16; //~ ERROR duplicate definitions
+ | ^^^^^^^^^^^^^^^ duplicate definition
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0201`.
diff --git a/src/test/compile-fail/associated-item-duplicate-names.rs b/src/test/ui/associated-item/associated-item-duplicate-names.rs
similarity index 100%
rename from src/test/compile-fail/associated-item-duplicate-names.rs
rename to src/test/ui/associated-item/associated-item-duplicate-names.rs
diff --git a/src/test/ui/associated-item/associated-item-duplicate-names.stderr b/src/test/ui/associated-item/associated-item-duplicate-names.stderr
new file mode 100644
index 0000000..4b060a99
--- /dev/null
+++ b/src/test/ui/associated-item/associated-item-duplicate-names.stderr
@@ -0,0 +1,19 @@
+error[E0201]: duplicate definitions with name `Ty`:
+ --> $DIR/associated-item-duplicate-names.rs:21:5
+ |
+LL | type Ty = ();
+ | ------------- previous definition of `Ty` here
+LL | type Ty = usize; //~ ERROR duplicate definitions
+ | ^^^^^^^^^^^^^^^^ duplicate definition
+
+error[E0201]: duplicate definitions with name `BAR`:
+ --> $DIR/associated-item-duplicate-names.rs:23:5
+ |
+LL | const BAR: u32 = 7;
+ | ------------------- previous definition of `BAR` here
+LL | const BAR: u32 = 8; //~ ERROR duplicate definitions
+ | ^^^^^^^^^^^^^^^^^^^ duplicate definition
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0201`.
diff --git a/src/test/compile-fail/associated-path-shl.rs b/src/test/ui/associated-path-shl.rs
similarity index 100%
rename from src/test/compile-fail/associated-path-shl.rs
rename to src/test/ui/associated-path-shl.rs
diff --git a/src/test/ui/associated-path-shl.stderr b/src/test/ui/associated-path-shl.stderr
new file mode 100644
index 0000000..fa41d4a
--- /dev/null
+++ b/src/test/ui/associated-path-shl.stderr
@@ -0,0 +1,43 @@
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/associated-path-shl.rs:14:14
+ |
+LL | let _: <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
+ | ^ not found in this scope
+
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/associated-path-shl.rs:15:15
+ |
+LL | let _ = <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
+ | ^ not found in this scope
+
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/associated-path-shl.rs:16:11
+ |
+LL | let <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
+ | ^ not found in this scope
+
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/associated-path-shl.rs:17:17
+ |
+LL | let 0 ..= <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
+ | ^ not found in this scope
+
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/associated-path-shl.rs:19:7
+ |
+LL | <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
+ | ^ not found in this scope
+
+error[E0029]: only char and numeric types are allowed in range patterns
+ --> $DIR/associated-path-shl.rs:17:15
+ |
+LL | let 0 ..= <<A>::B>::C; //~ ERROR cannot find type `A` in this scope
+ | ^^^^^^^^^^^ ranges require char or numeric types
+ |
+ = note: start type: {integer}
+ = note: end type: [type error]
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0029, E0412.
+For more information about an error, try `rustc --explain E0029`.
diff --git a/src/test/compile-fail/associated-type-projection-ambig-between-bound-and-where-clause.rs b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/associated-type-projection-ambig-between-bound-and-where-clause.rs
rename to src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.rs
diff --git a/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr
new file mode 100644
index 0000000..2706dda
--- /dev/null
+++ b/src/test/ui/associated-type/associated-type-projection-ambig-between-bound-and-where-clause.stderr
@@ -0,0 +1,75 @@
+error[E0221]: ambiguous associated type `Color` in bounds of `C`
+ --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:26:24
+ |
+LL | type Color;
+ | ----------- ambiguous `Color` from `Vehicle`
+...
+LL | type Color;
+ | ----------- ambiguous `Color` from `Box`
+...
+LL | fn a<C:Vehicle+Box>(_: C::Color) {
+ | ^^^^^^^^ ambiguous associated type `Color`
+
+error[E0221]: ambiguous associated type `Color` in bounds of `C`
+ --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:12
+ |
+LL | type Color;
+ | ----------- ambiguous `Color` from `Vehicle`
+...
+LL | type Color;
+ | ----------- ambiguous `Color` from `Box`
+...
+LL | fn b<C>(_: C::Color) where C : Vehicle+Box {
+ | ^^^^^^^^ ambiguous associated type `Color`
+
+error[E0221]: ambiguous associated type `Color` in bounds of `C`
+ --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:34:12
+ |
+LL | type Color;
+ | ----------- ambiguous `Color` from `Vehicle`
+...
+LL | type Color;
+ | ----------- ambiguous `Color` from `Box`
+...
+LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box {
+ | ^^^^^^^^ ambiguous associated type `Color`
+
+error[E0221]: ambiguous associated type `Color` in bounds of `X`
+ --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:45:20
+ |
+LL | type Color;
+ | ----------- ambiguous `Color` from `Vehicle`
+...
+LL | type Color;
+ | ----------- ambiguous `Color` from `Box`
+...
+LL | fn e(&self, _: X::Color) where X : Box;
+ | ^^^^^^^^ ambiguous associated type `Color`
+
+error[E0221]: ambiguous associated type `Color` in bounds of `X`
+ --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:48:20
+ |
+LL | type Color;
+ | ----------- ambiguous `Color` from `Vehicle`
+...
+LL | type Color;
+ | ----------- ambiguous `Color` from `Box`
+...
+LL | fn f(&self, _: X::Color) where X : Box { }
+ | ^^^^^^^^ ambiguous associated type `Color`
+
+error[E0221]: ambiguous associated type `Color` in bounds of `X`
+ --> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:40:20
+ |
+LL | type Color;
+ | ----------- ambiguous `Color` from `Vehicle`
+...
+LL | type Color;
+ | ----------- ambiguous `Color` from `Box`
+...
+LL | fn d(&self, _: X::Color) where X : Box { }
+ | ^^^^^^^^ ambiguous associated type `Color`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0221`.
diff --git a/src/test/ui/associated-type-projection-from-multiple-supertraits.rs b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs
similarity index 100%
rename from src/test/ui/associated-type-projection-from-multiple-supertraits.rs
rename to src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.rs
diff --git a/src/test/ui/associated-type-projection-from-multiple-supertraits.stderr b/src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr
similarity index 100%
rename from src/test/ui/associated-type-projection-from-multiple-supertraits.stderr
rename to src/test/ui/associated-type/associated-type-projection-from-multiple-supertraits.stderr
diff --git a/src/test/compile-fail/associated-type-projection-from-supertrait.rs b/src/test/ui/associated-type/associated-type-projection-from-supertrait.rs
similarity index 100%
rename from src/test/compile-fail/associated-type-projection-from-supertrait.rs
rename to src/test/ui/associated-type/associated-type-projection-from-supertrait.rs
diff --git a/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr
new file mode 100644
index 0000000..4bc09b6
--- /dev/null
+++ b/src/test/ui/associated-type/associated-type-projection-from-supertrait.stderr
@@ -0,0 +1,39 @@
+error[E0308]: mismatched types
+ --> $DIR/associated-type-projection-from-supertrait.rs:43:23
+ |
+LL | fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types
+ | ^^^^ expected struct `Black`, found struct `Blue`
+ |
+ = note: expected type `Black`
+ found type `Blue`
+
+error[E0308]: mismatched types
+ --> $DIR/associated-type-projection-from-supertrait.rs:44:23
+ |
+LL | fn c() { dent(ModelU, Black); } //~ ERROR mismatched types
+ | ^^^^^ expected struct `Blue`, found struct `Black`
+ |
+ = note: expected type `Blue`
+ found type `Black`
+
+error[E0308]: mismatched types
+ --> $DIR/associated-type-projection-from-supertrait.rs:50:28
+ |
+LL | fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types
+ | ^^^^ expected struct `Black`, found struct `Blue`
+ |
+ = note: expected type `Black`
+ found type `Blue`
+
+error[E0308]: mismatched types
+ --> $DIR/associated-type-projection-from-supertrait.rs:51:28
+ |
+LL | fn g() { ModelU.chip_paint(Black); } //~ ERROR mismatched types
+ | ^^^^^ expected struct `Blue`, found struct `Black`
+ |
+ = note: expected type `Blue`
+ found type `Black`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs
similarity index 100%
rename from src/test/ui/associated-types-ICE-when-projecting-out-of-err.rs
rename to src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.rs
diff --git a/src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr b/src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
similarity index 100%
rename from src/test/ui/associated-types-ICE-when-projecting-out-of-err.stderr
rename to src/test/ui/associated-types/associated-types-ICE-when-projecting-out-of-err.stderr
diff --git a/src/test/compile-fail/associated-types-binding-to-type-defined-in-supertrait.rs b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-binding-to-type-defined-in-supertrait.rs
rename to src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.rs
diff --git a/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr
new file mode 100644
index 0000000..c43ff1a
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-binding-to-type-defined-in-supertrait.stderr
@@ -0,0 +1,31 @@
+error[E0271]: type mismatch resolving `<ModelT as Vehicle>::Color == Blue`
+ --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:47:10
+ |
+LL | fn b() { blue_car(ModelT); } //~ ERROR type mismatch
+ | ^^^^^^^^ expected struct `Black`, found struct `Blue`
+ |
+ = note: expected type `Black`
+ found type `Blue`
+note: required by `blue_car`
+ --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:43:1
+ |
+LL | fn blue_car<C:Car<Color=Blue>>(c: C) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0271]: type mismatch resolving `<ModelU as Vehicle>::Color == Black`
+ --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:48:10
+ |
+LL | fn c() { black_car(ModelU); } //~ ERROR type mismatch
+ | ^^^^^^^^^ expected struct `Blue`, found struct `Black`
+ |
+ = note: expected type `Blue`
+ found type `Black`
+note: required by `black_car`
+ --> $DIR/associated-types-binding-to-type-defined-in-supertrait.rs:40:1
+ |
+LL | fn black_car<C:Car<Color=Black>>(c: C) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/associated-types-bound-failure.rs b/src/test/ui/associated-types/associated-types-bound-failure.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-bound-failure.rs
rename to src/test/ui/associated-types/associated-types-bound-failure.rs
diff --git a/src/test/ui/associated-types/associated-types-bound-failure.stderr b/src/test/ui/associated-types/associated-types-bound-failure.stderr
new file mode 100644
index 0000000..067dfeb
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-bound-failure.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `<G as GetToInt>::R: ToInt` is not satisfied
+ --> $DIR/associated-types-bound-failure.rs:27:5
+ |
+LL | ToInt::to_int(&g.get()) //~ ERROR E0277
+ | ^^^^^^^^^^^^^ the trait `ToInt` is not implemented for `<G as GetToInt>::R`
+ |
+ = help: consider adding a `where <G as GetToInt>::R: ToInt` bound
+note: required by `ToInt::to_int`
+ --> $DIR/associated-types-bound-failure.rs:14:5
+ |
+LL | fn to_int(&self) -> isize;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-types-coherence-failure.rs b/src/test/ui/associated-types/associated-types-coherence-failure.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-coherence-failure.rs
rename to src/test/ui/associated-types/associated-types-coherence-failure.rs
diff --git a/src/test/ui/associated-types/associated-types-coherence-failure.stderr b/src/test/ui/associated-types/associated-types-coherence-failure.stderr
new file mode 100644
index 0000000..85d4bf7
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-coherence-failure.stderr
@@ -0,0 +1,21 @@
+error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `Cow<'_, _>`:
+ --> $DIR/associated-types-coherence-failure.rs:31:1
+ |
+LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
+ | ----------------------------------------------------------------------------- first implementation here
+...
+LL | impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Cow<'_, _>`
+
+error[E0119]: conflicting implementations of trait `IntoCow<'_, _>` for type `&_`:
+ --> $DIR/associated-types-coherence-failure.rs:38:1
+ |
+LL | impl<'a, B: ?Sized> IntoCow<'a, B> for <B as ToOwned>::Owned where B: ToOwned {
+ | ----------------------------------------------------------------------------- first implementation here
+...
+LL | impl<'a, B: ?Sized> IntoCow<'a, B> for &'a B where B: ToOwned {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `&_`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/associated-types-eq-1.rs b/src/test/ui/associated-types/associated-types-eq-1.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-eq-1.rs
rename to src/test/ui/associated-types/associated-types-eq-1.rs
diff --git a/src/test/ui/associated-types/associated-types-eq-1.stderr b/src/test/ui/associated-types/associated-types-eq-1.stderr
new file mode 100644
index 0000000..81bb2ae
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-eq-1.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/associated-types-eq-1.rs:20:12
+ |
+LL | let _: A = x.boo(); //~ ERROR cannot find type `A` in this scope
+ | ^ did you mean `I`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/compile-fail/associated-types-eq-2.rs b/src/test/ui/associated-types/associated-types-eq-2.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-eq-2.rs
rename to src/test/ui/associated-types/associated-types-eq-2.rs
diff --git a/src/test/ui/associated-types/associated-types-eq-2.stderr b/src/test/ui/associated-types/associated-types-eq-2.stderr
new file mode 100644
index 0000000..0b80f34
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-eq-2.stderr
@@ -0,0 +1,9 @@
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/associated-types-eq-2.rs:26:30
+ |
+LL | fn baz<I: Foo>(x: &<I as Foo<A=Bar>>::A) {}
+ | ^^^^^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
diff --git a/src/test/compile-fail/associated-types-eq-3.rs b/src/test/ui/associated-types/associated-types-eq-3.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-eq-3.rs
rename to src/test/ui/associated-types/associated-types-eq-3.rs
diff --git a/src/test/ui/associated-types/associated-types-eq-3.stderr b/src/test/ui/associated-types/associated-types-eq-3.stderr
new file mode 100644
index 0000000..d8b2be0
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-eq-3.stderr
@@ -0,0 +1,37 @@
+error[E0308]: mismatched types
+ --> $DIR/associated-types-eq-3.rs:33:18
+ |
+LL | let _: Bar = x.boo();
+ | ^^^^^^^ expected struct `Bar`, found associated type
+ |
+ = note: expected type `Bar`
+ found type `<I as Foo>::A`
+
+error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
+ --> $DIR/associated-types-eq-3.rs:48:5
+ |
+LL | foo1(a);
+ | ^^^^ expected usize, found struct `Bar`
+ |
+ = note: expected type `usize`
+ found type `Bar`
+note: required by `foo1`
+ --> $DIR/associated-types-eq-3.rs:28:1
+ |
+LL | fn foo1<I: Foo<A=Bar>>(x: I) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0271]: type mismatch resolving `<isize as Foo>::A == Bar`
+ --> $DIR/associated-types-eq-3.rs:51:9
+ |
+LL | baz(&a);
+ | ^^ expected usize, found struct `Bar`
+ |
+ = note: expected type `usize`
+ found type `Bar`
+ = note: required for the cast to the object type `dyn Foo<A=Bar>`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0271, E0308.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/associated-types-eq-expr-path.rs b/src/test/ui/associated-types/associated-types-eq-expr-path.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-eq-expr-path.rs
rename to src/test/ui/associated-types/associated-types-eq-expr-path.rs
diff --git a/src/test/ui/associated-types/associated-types-eq-expr-path.stderr b/src/test/ui/associated-types/associated-types-eq-expr-path.stderr
new file mode 100644
index 0000000..36c31cd
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-eq-expr-path.stderr
@@ -0,0 +1,9 @@
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/associated-types-eq-expr-path.rs:24:26
+ |
+LL | let x: isize = Foo::<A=usize>::bar();
+ | ^^^^^^^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
diff --git a/src/test/compile-fail/associated-types-eq-hr.rs b/src/test/ui/associated-types/associated-types-eq-hr.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-eq-hr.rs
rename to src/test/ui/associated-types/associated-types-eq-hr.rs
diff --git a/src/test/ui/associated-types/associated-types-eq-hr.stderr b/src/test/ui/associated-types/associated-types-eq-hr.stderr
new file mode 100644
index 0000000..5081a26
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-eq-hr.stderr
@@ -0,0 +1,126 @@
+error[E0271]: type mismatch resolving `for<'x> <UintStruct as TheTrait<&'x isize>>::A == &'x isize`
+ --> $DIR/associated-types-eq-hr.rs:92:5
+ |
+LL | foo::<UintStruct>(); //~ ERROR type mismatch
+ | ^^^^^^^^^^^^^^^^^ expected usize, found isize
+ |
+ = note: expected type `&usize`
+ found type `&isize`
+note: required by `foo`
+ --> $DIR/associated-types-eq-hr.rs:54:1
+ |
+LL | / fn foo<T>()
+LL | | where T : for<'x> TheTrait<&'x isize, A = &'x isize>
+LL | | {
+LL | | // ok for IntStruct, but not UintStruct
+LL | | }
+ | |_^
+
+error[E0271]: type mismatch resolving `for<'x> <IntStruct as TheTrait<&'x isize>>::A == &'x usize`
+ --> $DIR/associated-types-eq-hr.rs:94:5
+ |
+LL | bar::<IntStruct>(); //~ ERROR type mismatch
+ | ^^^^^^^^^^^^^^^^ expected isize, found usize
+ |
+ = note: expected type `&isize`
+ found type `&usize`
+note: required by `bar`
+ --> $DIR/associated-types-eq-hr.rs:60:1
+ |
+LL | / fn bar<T>()
+LL | | where T : for<'x> TheTrait<&'x isize, A = &'x usize>
+LL | | {
+LL | | // ok for UintStruct, but not IntStruct
+LL | | }
+ | |_^
+
+error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
+ --> $DIR/associated-types-eq-hr.rs:97:5
+ |
+LL | tuple_one::<Tuple>();
+ | ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple`
+ |
+ = help: the following implementations were found:
+ <Tuple as TheTrait<(&'a isize, &'a isize)>>
+note: required by `tuple_one`
+ --> $DIR/associated-types-eq-hr.rs:66:1
+ |
+LL | / fn tuple_one<T>()
+LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>
+LL | | {
+LL | | // not ok for tuple, two lifetimes and we pick first
+LL | | }
+ | |_^
+
+error[E0271]: type mismatch resolving `for<'x, 'y> <Tuple as TheTrait<(&'x isize, &'y isize)>>::A == &'x isize`
+ --> $DIR/associated-types-eq-hr.rs:97:5
+ |
+LL | tuple_one::<Tuple>();
+ | ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
+ |
+note: required by `tuple_one`
+ --> $DIR/associated-types-eq-hr.rs:66:1
+ |
+LL | / fn tuple_one<T>()
+LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'x isize>
+LL | | {
+LL | | // not ok for tuple, two lifetimes and we pick first
+LL | | }
+ | |_^
+
+error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
+ --> $DIR/associated-types-eq-hr.rs:101:5
+ |
+LL | tuple_two::<Tuple>();
+ | ^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple`
+ |
+ = help: the following implementations were found:
+ <Tuple as TheTrait<(&'a isize, &'a isize)>>
+note: required by `tuple_two`
+ --> $DIR/associated-types-eq-hr.rs:72:1
+ |
+LL | / fn tuple_two<T>()
+LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>
+LL | | {
+LL | | // not ok for tuple, two lifetimes and we pick second
+LL | | }
+ | |_^
+
+error[E0271]: type mismatch resolving `for<'x, 'y> <Tuple as TheTrait<(&'x isize, &'y isize)>>::A == &'y isize`
+ --> $DIR/associated-types-eq-hr.rs:101:5
+ |
+LL | tuple_two::<Tuple>();
+ | ^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
+ |
+note: required by `tuple_two`
+ --> $DIR/associated-types-eq-hr.rs:72:1
+ |
+LL | / fn tuple_two<T>()
+LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>
+LL | | {
+LL | | // not ok for tuple, two lifetimes and we pick second
+LL | | }
+ | |_^
+
+error[E0277]: the trait bound `for<'x, 'y> Tuple: TheTrait<(&'x isize, &'y isize)>` is not satisfied
+ --> $DIR/associated-types-eq-hr.rs:107:5
+ |
+LL | tuple_four::<Tuple>();
+ | ^^^^^^^^^^^^^^^^^^^ the trait `for<'x, 'y> TheTrait<(&'x isize, &'y isize)>` is not implemented for `Tuple`
+ |
+ = help: the following implementations were found:
+ <Tuple as TheTrait<(&'a isize, &'a isize)>>
+note: required by `tuple_four`
+ --> $DIR/associated-types-eq-hr.rs:84:1
+ |
+LL | / fn tuple_four<T>()
+LL | | where T : for<'x,'y> TheTrait<(&'x isize, &'y isize)>
+LL | | {
+LL | | // not ok for tuple, two lifetimes, and lifetime matching is invariant
+LL | | }
+ | |_^
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0271, E0277.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/associated-types-for-unimpl-trait.rs b/src/test/ui/associated-types/associated-types-for-unimpl-trait.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-for-unimpl-trait.rs
rename to src/test/ui/associated-types/associated-types-for-unimpl-trait.rs
diff --git a/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr
new file mode 100644
index 0000000..e6c15e4
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-for-unimpl-trait.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Self: Get` is not satisfied
+ --> $DIR/associated-types-for-unimpl-trait.rs:17:5
+ |
+LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: Get` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-types-in-ambiguous-context.rs b/src/test/ui/associated-types/associated-types-in-ambiguous-context.rs
similarity index 100%
rename from src/test/ui/associated-types-in-ambiguous-context.rs
rename to src/test/ui/associated-types/associated-types-in-ambiguous-context.rs
diff --git a/src/test/ui/associated-types-in-ambiguous-context.stderr b/src/test/ui/associated-types/associated-types-in-ambiguous-context.stderr
similarity index 100%
rename from src/test/ui/associated-types-in-ambiguous-context.stderr
rename to src/test/ui/associated-types/associated-types-in-ambiguous-context.stderr
diff --git a/src/test/compile-fail/associated-types-incomplete-object.rs b/src/test/ui/associated-types/associated-types-incomplete-object.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-incomplete-object.rs
rename to src/test/ui/associated-types/associated-types-incomplete-object.rs
diff --git a/src/test/ui/associated-types/associated-types-incomplete-object.stderr b/src/test/ui/associated-types/associated-types-incomplete-object.stderr
new file mode 100644
index 0000000..95b1c63
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-incomplete-object.stderr
@@ -0,0 +1,27 @@
+error[E0191]: the value of the associated type `B` (from the trait `Foo`) must be specified
+ --> $DIR/associated-types-incomplete-object.rs:33:26
+ |
+LL | let b = &42isize as &Foo<A=usize>;
+ | ^^^^^^^^^^^^ missing associated type `B` value
+
+error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
+ --> $DIR/associated-types-incomplete-object.rs:36:26
+ |
+LL | let c = &42isize as &Foo<B=char>;
+ | ^^^^^^^^^^^ missing associated type `A` value
+
+error[E0191]: the value of the associated type `A` (from the trait `Foo`) must be specified
+ --> $DIR/associated-types-incomplete-object.rs:39:26
+ |
+LL | let d = &42isize as &Foo;
+ | ^^^ missing associated type `A` value
+
+error[E0191]: the value of the associated type `B` (from the trait `Foo`) must be specified
+ --> $DIR/associated-types-incomplete-object.rs:39:26
+ |
+LL | let d = &42isize as &Foo;
+ | ^^^ missing associated type `B` value
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0191`.
diff --git a/src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-invalid-trait-ref-issue-18865.rs
rename to src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.rs
diff --git a/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
new file mode 100644
index 0000000..40cba5e
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-invalid-trait-ref-issue-18865.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `T: Foo<usize>` is not satisfied
+ --> $DIR/associated-types-invalid-trait-ref-issue-18865.rs:20:12
+ |
+LL | let u: <T as Foo<usize>>::Bar = t.get_bar();
+ | ^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo<usize>` is not implemented for `T`
+ |
+ = help: consider adding a `where T: Foo<usize>` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-types-issue-17359.rs b/src/test/ui/associated-types/associated-types-issue-17359.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-issue-17359.rs
rename to src/test/ui/associated-types/associated-types-issue-17359.rs
diff --git a/src/test/ui/associated-types/associated-types-issue-17359.stderr b/src/test/ui/associated-types/associated-types-issue-17359.stderr
new file mode 100644
index 0000000..8ba8194
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-issue-17359.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `Type`
+ --> $DIR/associated-types-issue-17359.rs:18:1
+ |
+LL | type Type;
+ | ---------- `Type` from trait
+...
+LL | impl Trait for isize {} //~ ERROR missing: `Type`
+ | ^^^^^^^^^^^^^^^^^^^^ missing `Type` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/src/test/compile-fail/associated-types-issue-20346.rs b/src/test/ui/associated-types/associated-types-issue-20346.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-issue-20346.rs
rename to src/test/ui/associated-types/associated-types-issue-20346.rs
diff --git a/src/test/ui/associated-types/associated-types-issue-20346.stderr b/src/test/ui/associated-types/associated-types-issue-20346.stderr
new file mode 100644
index 0000000..6f3dfbe
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-issue-20346.stderr
@@ -0,0 +1,17 @@
+error[E0271]: type mismatch resolving `<Adapter<I> as Iterator>::Item == std::option::Option<T>`
+ --> $DIR/associated-types-issue-20346.rs:44:5
+ |
+LL | is_iterator_of::<Option<T>, _>(&adapter); //~ ERROR type mismatch
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter, found enum `std::option::Option`
+ |
+ = note: expected type `T`
+ found type `std::option::Option<T>`
+note: required by `is_iterator_of`
+ --> $DIR/associated-types-issue-20346.rs:25:1
+ |
+LL | fn is_iterator_of<A, I: Iterator<Item=A>>(_: &I) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/associated-types-multiple-types-one-trait.rs b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-multiple-types-one-trait.rs
rename to src/test/ui/associated-types/associated-types-multiple-types-one-trait.rs
diff --git a/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr
new file mode 100644
index 0000000..c38a5f6
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-multiple-types-one-trait.stderr
@@ -0,0 +1,31 @@
+error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
+ --> $DIR/associated-types-multiple-types-one-trait.rs:23:5
+ |
+LL | want_y(t); //~ ERROR type mismatch
+ | ^^^^^^ expected associated type, found i32
+ |
+ = note: expected type `<T as Foo>::Y`
+ found type `i32`
+note: required by `want_y`
+ --> $DIR/associated-types-multiple-types-one-trait.rs:54:1
+ |
+LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0271]: type mismatch resolving `<T as Foo>::X == u32`
+ --> $DIR/associated-types-multiple-types-one-trait.rs:28:5
+ |
+LL | want_x(t); //~ ERROR type mismatch
+ | ^^^^^^ expected associated type, found u32
+ |
+ = note: expected type `<T as Foo>::X`
+ found type `u32`
+note: required by `want_x`
+ --> $DIR/associated-types-multiple-types-one-trait.rs:52:1
+ |
+LL | fn want_x<T:Foo<X=u32>>(t: &T) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/associated-types-no-suitable-bound.rs b/src/test/ui/associated-types/associated-types-no-suitable-bound.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-no-suitable-bound.rs
rename to src/test/ui/associated-types/associated-types-no-suitable-bound.rs
diff --git a/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr
new file mode 100644
index 0000000..84802d4
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-no-suitable-bound.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `T: Get` is not satisfied
+ --> $DIR/associated-types-no-suitable-bound.rs:21:5
+ |
+LL | fn uhoh<T>(foo: <T as Get>::Value) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `T`
+ |
+ = help: consider adding a `where T: Get` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-no-suitable-supertrait-2.rs
rename to src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.rs
diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr
new file mode 100644
index 0000000..712b95f
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait-2.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Self: Get` is not satisfied
+ --> $DIR/associated-types-no-suitable-supertrait-2.rs:27:5
+ |
+LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: Get` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/associated-types-no-suitable-supertrait.rs b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-no-suitable-supertrait.rs
rename to src/test/ui/associated-types/associated-types-no-suitable-supertrait.rs
diff --git a/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr
new file mode 100644
index 0000000..6927146
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-no-suitable-supertrait.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `Self: Get` is not satisfied
+ --> $DIR/associated-types-no-suitable-supertrait.rs:27:5
+ |
+LL | fn uhoh<U:Get>(&self, foo: U, bar: <Self as Get>::Value) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: Get` bound
+
+error[E0277]: the trait bound `(T, U): Get` is not satisfied
+ --> $DIR/associated-types-no-suitable-supertrait.rs:32:5
+ |
+LL | fn uhoh<U:Get>(&self, foo: U, bar: <(T, U) as Get>::Value) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `(T, U)`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-types/associated-types-outlives.nll.stderr b/src/test/ui/associated-types/associated-types-outlives.nll.stderr
new file mode 100644
index 0000000..384ed8f
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-outlives.nll.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/associated-types-outlives.rs:32:14
+ |
+LL | 's: loop { y = denormalise(&x); break }
+ | -- borrow of `x` occurs here
+LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+LL | return f(y);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/associated-types-outlives.rs b/src/test/ui/associated-types/associated-types-outlives.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-outlives.rs
rename to src/test/ui/associated-types/associated-types-outlives.rs
diff --git a/src/test/ui/associated-types/associated-types-outlives.stderr b/src/test/ui/associated-types/associated-types-outlives.stderr
new file mode 100644
index 0000000..6d46392
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-outlives.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/associated-types-outlives.rs:32:14
+ |
+LL | 's: loop { y = denormalise(&x); break }
+ | - borrow of `x` occurs here
+LL | drop(x); //~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/associated-types-overridden-default.rs b/src/test/ui/associated-types/associated-types-overridden-default.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-overridden-default.rs
rename to src/test/ui/associated-types/associated-types-overridden-default.rs
diff --git a/src/test/ui/associated-types/associated-types-overridden-default.stderr b/src/test/ui/associated-types/associated-types-overridden-default.stderr
new file mode 100644
index 0000000..e9a480b
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-overridden-default.stderr
@@ -0,0 +1,9 @@
+error[E0399]: the following trait items need to be reimplemented as `Assoc` was overridden: `Assoc2`, `C`, `foo`
+ --> $DIR/associated-types-overridden-default.rs:21:5
+ |
+LL | type Assoc = ();
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0399`.
diff --git a/src/test/compile-fail/associated-types-path-1.rs b/src/test/ui/associated-types/associated-types-path-1.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-path-1.rs
rename to src/test/ui/associated-types/associated-types-path-1.rs
diff --git a/src/test/ui/associated-types/associated-types-path-1.stderr b/src/test/ui/associated-types/associated-types-path-1.stderr
new file mode 100644
index 0000000..0414792
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-path-1.stderr
@@ -0,0 +1,22 @@
+error[E0220]: associated type `A` not found for `T`
+ --> $DIR/associated-types-path-1.rs:20:23
+ |
+LL | pub fn f1<T>(a: T, x: T::A) {} //~ERROR associated type `A` not found
+ | ^^^^ associated type `A` not found
+
+error[E0221]: ambiguous associated type `A` in bounds of `T`
+ --> $DIR/associated-types-path-1.rs:21:34
+ |
+LL | type A;
+ | ------- ambiguous `A` from `Foo`
+...
+LL | type A;
+ | ------- ambiguous `A` from `Bar`
+...
+LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {} //~ERROR ambiguous associated type `A`
+ | ^^^^ ambiguous associated type `A`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0220, E0221.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/src/test/compile-fail/associated-types-path-2.rs b/src/test/ui/associated-types/associated-types-path-2.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-path-2.rs
rename to src/test/ui/associated-types/associated-types-path-2.rs
diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr
new file mode 100644
index 0000000..403b4fd
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-path-2.stderr
@@ -0,0 +1,52 @@
+error[E0308]: mismatched types
+ --> $DIR/associated-types-path-2.rs:29:14
+ |
+LL | f1(2i32, 4i32);
+ | ^^^^ expected u32, found i32
+
+error[E0277]: the trait bound `u32: Foo` is not satisfied
+ --> $DIR/associated-types-path-2.rs:39:5
+ |
+LL | f1(2u32, 4u32);
+ | ^^ the trait `Foo` is not implemented for `u32`
+ |
+note: required by `f1`
+ --> $DIR/associated-types-path-2.rs:23:1
+ |
+LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `u32: Foo` is not satisfied
+ --> $DIR/associated-types-path-2.rs:39:5
+ |
+LL | f1(2u32, 4u32);
+ | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32`
+
+error[E0277]: the trait bound `u32: Foo` is not satisfied
+ --> $DIR/associated-types-path-2.rs:45:5
+ |
+LL | f1(2u32, 4i32);
+ | ^^ the trait `Foo` is not implemented for `u32`
+ |
+note: required by `f1`
+ --> $DIR/associated-types-path-2.rs:23:1
+ |
+LL | pub fn f1<T: Foo>(a: T, x: T::A) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `u32: Foo` is not satisfied
+ --> $DIR/associated-types-path-2.rs:45:5
+ |
+LL | f1(2u32, 4i32);
+ | ^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `u32`
+
+error[E0308]: mismatched types
+ --> $DIR/associated-types-path-2.rs:51:18
+ |
+LL | let _: i32 = f2(2i32);
+ | ^^^^^^^^ expected i32, found u32
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr
new file mode 100644
index 0000000..5b8223f
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.nll.stderr
@@ -0,0 +1,30 @@
+warning: not reporting region error due to nll
+ --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:12
+ |
+LL | let z: I::A = if cond { x } else { y };
+ | ^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:29
+ |
+LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | let z: I::A = if cond { x } else { y };
+ | ^ assignment requires that `'a` must outlive `'b`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:40
+ |
+LL | fn bar<'a, 'b, I : for<'x> Foo<&'x isize>>(
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | let z: I::A = if cond { x } else { y };
+ | ^ assignment requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/associated-types-project-from-hrtb-in-fn-body.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-project-from-hrtb-in-fn-body.rs
rename to src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.rs
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr
new file mode 100644
index 0000000..12bbfb2
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn-body.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/associated-types-project-from-hrtb-in-fn-body.rs:32:40
+ |
+LL | x: <I as Foo<&'a isize>>::A,
+ | --------- these two types are declared with different lifetimes...
+LL | y: <I as Foo<&'b isize>>::A,
+ | ---------
+...
+LL | let z: I::A = if cond { x } else { y };
+ | ^ ...but data from `x` flows into `y` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/compile-fail/associated-types-project-from-hrtb-in-fn.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-project-from-hrtb-in-fn.rs
rename to src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.rs
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr
new file mode 100644
index 0000000..399f4d9
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-fn.stderr
@@ -0,0 +1,9 @@
+error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context
+ --> $DIR/associated-types-project-from-hrtb-in-fn.rs:21:8
+ |
+LL | x: I::A)
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0212`.
diff --git a/src/test/compile-fail/associated-types-project-from-hrtb-in-struct.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-project-from-hrtb-in-struct.rs
rename to src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.rs
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr
new file mode 100644
index 0000000..05c0c38
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-struct.stderr
@@ -0,0 +1,9 @@
+error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context
+ --> $DIR/associated-types-project-from-hrtb-in-struct.rs:21:12
+ |
+LL | field: I::A
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0212`.
diff --git a/src/test/compile-fail/associated-types-project-from-hrtb-in-trait-method.rs b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-project-from-hrtb-in-trait-method.rs
rename to src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.rs
diff --git a/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr
new file mode 100644
index 0000000..ccd568b
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-project-from-hrtb-in-trait-method.stderr
@@ -0,0 +1,9 @@
+error[E0212]: cannot extract an associated type from a higher-ranked trait bound in this context
+ --> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:21:32
+ |
+LL | fn some_method(&self, arg: I::A);
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0212`.
diff --git a/src/test/compile-fail/associated-types-projection-to-unrelated-trait-in-method-without-default.rs b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-projection-to-unrelated-trait-in-method-without-default.rs
rename to src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.rs
diff --git a/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr
new file mode 100644
index 0000000..e7e68dc
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-projection-to-unrelated-trait-in-method-without-default.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Self: Get` is not satisfied
+ --> $DIR/associated-types-projection-to-unrelated-trait-in-method-without-default.rs:19:5
+ |
+LL | fn okay<U:Get>(&self, foo: U, bar: <Self as Get>::Value);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Get` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: Get` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.rs b/src/test/ui/associated-types/associated-types-subtyping-1.rs
new file mode 100644
index 0000000..c3acfff
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-subtyping-1.rs
@@ -0,0 +1,57 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(unused_variables)]
+
+trait Trait<'a> {
+ type Type;
+
+ fn method(&'a self) { }
+}
+
+fn method1<'a,'b,T>(x: &'a T, y: &'b T)
+ where T : for<'z> Trait<'z>, 'a : 'b
+{
+ // Note that &'static T <: &'a T.
+ let a: <T as Trait<'a>>::Type = loop { };
+ let b: <T as Trait<'b>>::Type = loop { };
+ let _c: <T as Trait<'a>>::Type = a;
+}
+
+fn method2<'a,'b,T>(x: &'a T, y: &'b T)
+ where T : for<'z> Trait<'z>, 'a : 'b
+{
+ // Note that &'static T <: &'a T.
+ let a: <T as Trait<'a>>::Type = loop { };
+ let b: <T as Trait<'b>>::Type = loop { };
+ let _c: <T as Trait<'b>>::Type = a; //~ ERROR E0623
+}
+
+fn method3<'a,'b,T>(x: &'a T, y: &'b T)
+ where T : for<'z> Trait<'z>, 'a : 'b
+{
+ // Note that &'static T <: &'a T.
+ let a: <T as Trait<'a>>::Type = loop { };
+ let b: <T as Trait<'b>>::Type = loop { };
+ let _c: <T as Trait<'a>>::Type = b; //~ ERROR E0623
+}
+
+fn method4<'a,'b,T>(x: &'a T, y: &'b T)
+ where T : for<'z> Trait<'z>, 'a : 'b
+{
+ // Note that &'static T <: &'a T.
+ let a: <T as Trait<'a>>::Type = loop { };
+ let b: <T as Trait<'b>>::Type = loop { };
+ let _c: <T as Trait<'b>>::Type = b;
+}
+
+fn main() { }
diff --git a/src/test/ui/associated-types/associated-types-subtyping-1.stderr b/src/test/ui/associated-types/associated-types-subtyping-1.stderr
new file mode 100644
index 0000000..3cc7b07
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-subtyping-1.stderr
@@ -0,0 +1,21 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/associated-types-subtyping-1.rs:36:38
+ |
+LL | fn method2<'a,'b,T>(x: &'a T, y: &'b T)
+ | ----- ----- these two types are declared with different lifetimes...
+...
+LL | let _c: <T as Trait<'b>>::Type = a; //~ ERROR E0623
+ | ^ ...but data from `y` flows into `x` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/associated-types-subtyping-1.rs:45:38
+ |
+LL | fn method3<'a,'b,T>(x: &'a T, y: &'b T)
+ | ----- ----- these two types are declared with different lifetimes...
+...
+LL | let _c: <T as Trait<'a>>::Type = b; //~ ERROR E0623
+ | ^ ...but data from `y` flows into `x` here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/compile-fail/associated-types-unconstrained.rs b/src/test/ui/associated-types/associated-types-unconstrained.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-unconstrained.rs
rename to src/test/ui/associated-types/associated-types-unconstrained.rs
diff --git a/src/test/ui/associated-types/associated-types-unconstrained.stderr b/src/test/ui/associated-types/associated-types-unconstrained.stderr
new file mode 100644
index 0000000..abb220c
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-unconstrained.stderr
@@ -0,0 +1,9 @@
+error[E0284]: type annotations required: cannot resolve `<_ as Foo>::A == _`
+ --> $DIR/associated-types-unconstrained.rs:24:20
+ |
+LL | let x: isize = Foo::bar();
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0284`.
diff --git a/src/test/compile-fail/associated-types-unsized.rs b/src/test/ui/associated-types/associated-types-unsized.rs
similarity index 100%
rename from src/test/compile-fail/associated-types-unsized.rs
rename to src/test/ui/associated-types/associated-types-unsized.rs
diff --git a/src/test/ui/associated-types/associated-types-unsized.stderr b/src/test/ui/associated-types/associated-types-unsized.stderr
new file mode 100644
index 0000000..09e3cb8
--- /dev/null
+++ b/src/test/ui/associated-types/associated-types-unsized.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the size for values of type `<T as Get>::Value` cannot be known at compilation time
+ --> $DIR/associated-types-unsized.rs:17:9
+ |
+LL | let x = t.get(); //~ ERROR the size for values of type
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `<T as Get>::Value`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where <T as Get>::Value: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr
new file mode 100644
index 0000000..23a67b5
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-constrained.clause.stderr
@@ -0,0 +1,15 @@
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-constrained.rs:48:63
+ |
+LL | fn clause1<T>() where T: for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32 {
+ | ^^^^^^^
+
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-constrained.rs:53:42
+ |
+LL | fn clause2<T>() where T: for<'a> Fn() -> <() as Foo<'a>>::Item {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0582`.
diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr
new file mode 100644
index 0000000..c969bae
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-constrained.func.stderr
@@ -0,0 +1,15 @@
+error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
+ --> $DIR/bound-lifetime-constrained.rs:26:50
+ |
+LL | fn func1(_: for<'a> fn(<() as Foo<'a>>::Item) -> &'a i32) {
+ | ^^^^^^^
+
+error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
+ --> $DIR/bound-lifetime-constrained.rs:33:29
+ |
+LL | fn func2(_: for<'a> fn() -> <() as Foo<'a>>::Item) {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0581`.
diff --git a/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr
new file mode 100644
index 0000000..f24fed0
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-constrained.object.stderr
@@ -0,0 +1,15 @@
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-constrained.rs:38:56
+ |
+LL | fn object1(_: Box<for<'a> Fn(<() as Foo<'a>>::Item) -> &'a i32>) {
+ | ^^^^^^^
+
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-constrained.rs:43:35
+ |
+LL | fn object2(_: Box<for<'a> Fn() -> <() as Foo<'a>>::Item>) {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0582`.
diff --git a/src/test/compile-fail/associated-types/bound-lifetime-constrained.rs b/src/test/ui/associated-types/bound-lifetime-constrained.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/bound-lifetime-constrained.rs
rename to src/test/ui/associated-types/bound-lifetime-constrained.rs
diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr
new file mode 100644
index 0000000..5df8a82
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.angle.stderr
@@ -0,0 +1,27 @@
+error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:22:25
+ |
+LL | fn angle<T: for<'a> Foo<Item=&'a i32>>() {
+ | ^^^^^^^^^^^^
+
+error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:27:37
+ |
+LL | fn angle1<T>() where T: for<'a> Foo<Item=&'a i32> {
+ | ^^^^^^^^^^^^
+
+error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:32:37
+ |
+LL | fn angle2<T>() where for<'a> T: Foo<Item=&'a i32> {
+ | ^^^^^^^^^^^^
+
+error[E0582]: binding for associated type `Item` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:37:27
+ |
+LL | fn angle3(_: &for<'a> Foo<Item=&'a i32>) {
+ | ^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0582`.
diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr
new file mode 100644
index 0000000..0a12aa7
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.elision.stderr
@@ -0,0 +1,12 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/bound-lifetime-in-binding-only.rs:62:23
+ |
+LL | fn elision<T: Fn() -> &i32>() {
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
+ = help: consider giving it a 'static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr
new file mode 100644
index 0000000..53594cb
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.ok.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/bound-lifetime-in-binding-only.rs:81:1
+ |
+LL | fn main() { } //[ok]~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr
new file mode 100644
index 0000000..39a5366
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-binding-only.paren.stderr
@@ -0,0 +1,27 @@
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:42:29
+ |
+LL | fn paren<T: for<'a> Fn() -> &'a i32>() {
+ | ^^^^^^^
+
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:47:41
+ |
+LL | fn paren1<T>() where T: for<'a> Fn() -> &'a i32 {
+ | ^^^^^^^
+
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:52:41
+ |
+LL | fn paren2<T>() where for<'a> T: Fn() -> &'a i32 {
+ | ^^^^^^^
+
+error[E0582]: binding for associated type `Output` references lifetime `'a`, which does not appear in the trait input types
+ --> $DIR/bound-lifetime-in-binding-only.rs:57:31
+ |
+LL | fn paren3(_: &for<'a> Fn() -> &'a i32) {
+ | ^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0582`.
diff --git a/src/test/compile-fail/associated-types/bound-lifetime-in-binding-only.rs b/src/test/ui/associated-types/bound-lifetime-in-binding-only.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/bound-lifetime-in-binding-only.rs
rename to src/test/ui/associated-types/bound-lifetime-in-binding-only.rs
diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr
new file mode 100644
index 0000000..8fefdfd
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.elision.stderr
@@ -0,0 +1,12 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/bound-lifetime-in-return-only.rs:44:23
+ |
+LL | fn elision(_: fn() -> &i32) {
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
+ = help: consider giving it a 'static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr
new file mode 100644
index 0000000..ce2cfa6
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.local.stderr
@@ -0,0 +1,9 @@
+error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
+ --> $DIR/bound-lifetime-in-return-only.rs:33:28
+ |
+LL | let _: for<'a> fn() -> &'a i32 = loop { };
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0581`.
diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr
new file mode 100644
index 0000000..21bef7e
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.ok.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/bound-lifetime-in-return-only.rs:59:1
+ |
+LL | fn main() { } //[ok]~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/associated-types/bound-lifetime-in-return-only.rs b/src/test/ui/associated-types/bound-lifetime-in-return-only.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/bound-lifetime-in-return-only.rs
rename to src/test/ui/associated-types/bound-lifetime-in-return-only.rs
diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr
new file mode 100644
index 0000000..26a1585
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.sig.stderr
@@ -0,0 +1,15 @@
+error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
+ --> $DIR/bound-lifetime-in-return-only.rs:22:28
+ |
+LL | fn sig1(_: for<'a> fn() -> &'a i32) {
+ | ^^^^^^^
+
+error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
+ --> $DIR/bound-lifetime-in-return-only.rs:27:39
+ |
+LL | fn sig2(_: for<'a, 'b> fn(&'b i32) -> &'a i32) {
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0581`.
diff --git a/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr b/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr
new file mode 100644
index 0000000..db52e4d
--- /dev/null
+++ b/src/test/ui/associated-types/bound-lifetime-in-return-only.structure.stderr
@@ -0,0 +1,9 @@
+error[E0581]: return type references lifetime `'a`, which is not constrained by the fn input types
+ --> $DIR/bound-lifetime-in-return-only.rs:39:24
+ |
+LL | x: for<'a> fn() -> &'a i32
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0581`.
diff --git a/src/test/compile-fail/associated-types/cache/chrono-scan.rs b/src/test/ui/associated-types/cache/chrono-scan.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/cache/chrono-scan.rs
rename to src/test/ui/associated-types/cache/chrono-scan.rs
diff --git a/src/test/ui/associated-types/cache/chrono-scan.stderr b/src/test/ui/associated-types/cache/chrono-scan.stderr
new file mode 100644
index 0000000..99281e7
--- /dev/null
+++ b/src/test/ui/associated-types/cache/chrono-scan.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/chrono-scan.rs:39:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/associated-types/cache/elision.rs b/src/test/ui/associated-types/cache/elision.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/cache/elision.rs
rename to src/test/ui/associated-types/cache/elision.rs
diff --git a/src/test/ui/associated-types/cache/elision.stderr b/src/test/ui/associated-types/cache/elision.stderr
new file mode 100644
index 0000000..c5314b5
--- /dev/null
+++ b/src/test/ui/associated-types/cache/elision.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/elision.rs:34:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr
new file mode 100644
index 0000000..ac758a8
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.nll.stderr
@@ -0,0 +1,35 @@
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-contravariant.rs:53:16
+ |
+LL | let a = bar(foo, y);
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-contravariant.rs:54:16
+ |
+LL | let b = bar(foo, x);
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-contravariant.rs:53:12
+ |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | let a = bar(foo, y);
+ | ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-contravariant.rs:54:12
+ |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | let a = bar(foo, y);
+LL | let b = bar(foo, x);
+ | ^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr
new file mode 100644
index 0000000..6cecf68
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.krisskross.stderr
@@ -0,0 +1,25 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/project-fn-ret-contravariant.rs:55:5
+ |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+ | ------- ------------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+...
+LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
+ | ^ ...but data from `y` is returned here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/project-fn-ret-contravariant.rs:55:8
+ |
+LL | fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+ | ------- ------------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+...
+LL | (a, b) //[krisskross]~ ERROR 55:5: 55:6: lifetime mismatch [E0623]
+ | ^ ...but data from `x` is returned here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr
new file mode 100644
index 0000000..c92aa37
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.ok.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/project-fn-ret-contravariant.rs:60:1
+ |
+LL | fn main() { }
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr
new file mode 100644
index 0000000..c92aa37
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.oneuse.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/project-fn-ret-contravariant.rs:60:1
+ |
+LL | fn main() { }
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs
rename to src/test/ui/associated-types/cache/project-fn-ret-contravariant.rs
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr
new file mode 100644
index 0000000..75c35d0
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-contravariant.rs:48:8
+ |
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-contravariant.rs:48:4
+ |
+LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
+ | -- lifetime `'a` defined here
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr
new file mode 100644
index 0000000..9d42c8e
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-contravariant.transmute.stderr
@@ -0,0 +1,26 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/project-fn-ret-contravariant.rs:48:8
+ |
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 47:8...
+ --> $DIR/project-fn-ret-contravariant.rs:47:8
+ |
+LL | fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/project-fn-ret-contravariant.rs:48:13
+ |
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^
+ = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/project-fn-ret-contravariant.rs:48:4
+ |
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr
new file mode 100644
index 0000000..4b2ba24
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.nll.stderr
@@ -0,0 +1,35 @@
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-invariant.rs:63:16
+ |
+LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-invariant.rs:64:16
+ |
+LL | let b = bar(foo, x);
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-invariant.rs:63:12
+ |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
+ | ^^^^^^^^^^^ assignment requires that `'b` must outlive `'a`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-invariant.rs:64:12
+ |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
+LL | let b = bar(foo, x);
+ | ^^^^^^^^^^^ assignment requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr
new file mode 100644
index 0000000..e867ac4
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr
@@ -0,0 +1,24 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/project-fn-ret-invariant.rs:63:21
+ |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -------- --------------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | let a = bar(foo, y); //[krisskross]~ ERROR E0623
+ | ^ ...but data from `x` is returned here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/project-fn-ret-invariant.rs:65:8
+ |
+LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -------- --------------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+...
+LL | (a, b) //[krisskross]~ ERROR E0623
+ | ^ ...but data from `x` is returned here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr
new file mode 100644
index 0000000..e3e620e
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.ok.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/project-fn-ret-invariant.rs:69:1
+ |
+LL | fn main() { }
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr
new file mode 100644
index 0000000..a669c7a
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.nll.stderr
@@ -0,0 +1,30 @@
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-invariant.rs:47:12
+ |
+LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-invariant.rs:48:12
+ |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | let f = foo; // <-- No consistent type can be inferred for `f` here.
+LL | let a = bar(f, x);
+ | ^^^^^^^^^ argument requires that `'a` must outlive `'b`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-invariant.rs:49:12
+ |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | let b = bar(f, y); //[oneuse]~ ERROR 49:19: 49:20: lifetime mismatch [E0623]
+ | ^^^^^^^^^ argument requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr
new file mode 100644
index 0000000..7c86e20
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.oneuse.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/project-fn-ret-invariant.rs:49:19
+ |
+LL | fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+ | -------- --------------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+...
+LL | let b = bar(f, y); //[oneuse]~ ERROR 49:19: 49:20: lifetime mismatch [E0623]
+ | ^ ...but data from `x` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs b/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs
rename to src/test/ui/associated-types/cache/project-fn-ret-invariant.rs
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr
new file mode 100644
index 0000000..604974a
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/project-fn-ret-invariant.rs:58:8
+ |
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/project-fn-ret-invariant.rs:58:4
+ |
+LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
+ | -- lifetime `'a` defined here
+...
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^^^^^^^^^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
new file mode 100644
index 0000000..6432ab9
--- /dev/null
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
@@ -0,0 +1,22 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/project-fn-ret-invariant.rs:58:8
+ |
+LL | bar(foo, x) //[transmute]~ ERROR E0495
+ | ^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 54:8...
+ --> $DIR/project-fn-ret-invariant.rs:54:8
+ |
+LL | fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected Type<'_>
+ found Type<'a>
+ = note: but, the lifetime must be valid for the static lifetime...
+ = note: ...so that the expression is assignable:
+ expected Type<'static>
+ found Type<'_>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr
new file mode 100644
index 0000000..1351d14
--- /dev/null
+++ b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr
@@ -0,0 +1,17 @@
+error[E0271]: type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _`
+ --> $DIR/higher-ranked-projection.rs:35:5
+ |
+LL | foo(());
+ | ^^^ expected bound lifetime parameter 'a, found concrete lifetime
+ |
+note: required by `foo`
+ --> $DIR/higher-ranked-projection.rs:24:1
+ |
+LL | / fn foo<U, T>(_t: T)
+LL | | where for<'a> &'a T: Mirror<Image=U>
+LL | | {}
+ | |__^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/ui/associated-types/higher-ranked-projection.good.stderr b/src/test/ui/associated-types/higher-ranked-projection.good.stderr
new file mode 100644
index 0000000..861827f
--- /dev/null
+++ b/src/test/ui/associated-types/higher-ranked-projection.good.stderr
@@ -0,0 +1,12 @@
+error: compilation successful
+ --> $DIR/higher-ranked-projection.rs:34:1
+ |
+LL | / fn main() { //[good]~ ERROR compilation successful
+LL | | foo(());
+LL | | //[bad]~^ ERROR type mismatch resolving `for<'a> <&'a _ as Mirror>::Image == _`
+LL | | //[bad]~| expected bound lifetime parameter 'a, found concrete lifetime
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/associated-types/higher-ranked-projection.rs b/src/test/ui/associated-types/higher-ranked-projection.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/higher-ranked-projection.rs
rename to src/test/ui/associated-types/higher-ranked-projection.rs
diff --git a/src/test/compile-fail/associated-types/issue-36499.rs b/src/test/ui/associated-types/issue-36499.rs
similarity index 100%
rename from src/test/compile-fail/associated-types/issue-36499.rs
rename to src/test/ui/associated-types/issue-36499.rs
diff --git a/src/test/ui/associated-types/issue-36499.stderr b/src/test/ui/associated-types/issue-36499.stderr
new file mode 100644
index 0000000..5167c47
--- /dev/null
+++ b/src/test/ui/associated-types/issue-36499.stderr
@@ -0,0 +1,8 @@
+error: expected expression, found `+`
+ --> $DIR/issue-36499.rs:14:9
+ |
+LL | 2 + +2;
+ | ^ expected expression
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/attempted-access-non-fatal.rs b/src/test/ui/attempted-access-non-fatal.rs
similarity index 100%
rename from src/test/compile-fail/attempted-access-non-fatal.rs
rename to src/test/ui/attempted-access-non-fatal.rs
diff --git a/src/test/ui/attempted-access-non-fatal.stderr b/src/test/ui/attempted-access-non-fatal.stderr
new file mode 100644
index 0000000..d056a3e
--- /dev/null
+++ b/src/test/ui/attempted-access-non-fatal.stderr
@@ -0,0 +1,15 @@
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+ --> $DIR/attempted-access-non-fatal.rs:14:15
+ |
+LL | let _ = x.foo; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610]
+ | ^^^
+
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+ --> $DIR/attempted-access-non-fatal.rs:15:15
+ |
+LL | let _ = x.bar; //~ `{integer}` is a primitive type and therefore doesn't have fields [E0610]
+ | ^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0610`.
diff --git a/src/test/compile-fail/attr-bad-crate-attr.rc b/src/test/ui/attr-bad-crate-attr.rc
similarity index 100%
rename from src/test/compile-fail/attr-bad-crate-attr.rc
rename to src/test/ui/attr-bad-crate-attr.rc
diff --git a/src/test/ui/attr-eq-token-tree.rs b/src/test/ui/attr-eq-token-tree.rs
new file mode 100644
index 0000000..c759e62
--- /dev/null
+++ b/src/test/ui/attr-eq-token-tree.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// compile-pass
+
+#![feature(custom_attribute, unrestricted_attribute_tokens)]
+
+#[my_attr = !] // OK under feature gate
+fn main() {}
diff --git a/src/test/compile-fail/attr-usage-inline.rs b/src/test/ui/attr-usage-inline.rs
similarity index 100%
rename from src/test/compile-fail/attr-usage-inline.rs
rename to src/test/ui/attr-usage-inline.rs
diff --git a/src/test/ui/attr-usage-inline.stderr b/src/test/ui/attr-usage-inline.stderr
new file mode 100644
index 0000000..171bd94
--- /dev/null
+++ b/src/test/ui/attr-usage-inline.stderr
@@ -0,0 +1,11 @@
+error[E0518]: attribute should be applied to function or closure
+ --> $DIR/attr-usage-inline.rs:16:1
+ |
+LL | #[inline] //~ ERROR: attribute should be applied to function or closure
+ | ^^^^^^^^^
+LL | struct S;
+ | --------- not a function or closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0518`.
diff --git a/src/test/compile-fail/attrs-with-no-formal-in-generics-1.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs
similarity index 100%
rename from src/test/compile-fail/attrs-with-no-formal-in-generics-1.rs
rename to src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.rs
diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr
new file mode 100644
index 0000000..afab999
--- /dev/null
+++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-1.stderr
@@ -0,0 +1,8 @@
+error: trailing attribute after lifetime parameters
+ --> $DIR/attrs-with-no-formal-in-generics-1.rs:19:25
+ |
+LL | impl<#[rustc_1] 'a, 'b, #[oops]> RefIntPair<'a, 'b> {
+ | ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/attrs-with-no-formal-in-generics-2.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs
similarity index 100%
rename from src/test/compile-fail/attrs-with-no-formal-in-generics-2.rs
rename to src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.rs
diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr
new file mode 100644
index 0000000..8bff45e
--- /dev/null
+++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-2.stderr
@@ -0,0 +1,8 @@
+error: trailing attribute after type parameters
+ --> $DIR/attrs-with-no-formal-in-generics-2.rs:19:35
+ |
+LL | impl<#[rustc_1] 'a, #[rustc_2] T, #[oops]> RefAny<'a, T> {}
+ | ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/attrs-with-no-formal-in-generics-3.rs b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs
similarity index 100%
rename from src/test/compile-fail/attrs-with-no-formal-in-generics-3.rs
rename to src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.rs
diff --git a/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr
new file mode 100644
index 0000000..351c788
--- /dev/null
+++ b/src/test/ui/attrs-with-no-formal-in-generics/attrs-with-no-formal-in-generics-3.stderr
@@ -0,0 +1,8 @@
+error: trailing attribute after lifetime parameters
+ --> $DIR/attrs-with-no-formal-in-generics-3.rs:18:38
+ |
+LL | where Q: for <#[rustc_1] 'a, 'b, #[oops]> Fn(RefIntPair<'a,'b>) -> &'b u32
+ | ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/auto-ref-slice-plus-ref.rs b/src/test/ui/auto-ref-slice-plus-ref.rs
similarity index 100%
rename from src/test/compile-fail/auto-ref-slice-plus-ref.rs
rename to src/test/ui/auto-ref-slice-plus-ref.rs
diff --git a/src/test/ui/auto-ref-slice-plus-ref.stderr b/src/test/ui/auto-ref-slice-plus-ref.stderr
new file mode 100644
index 0000000..f62ac84
--- /dev/null
+++ b/src/test/ui/auto-ref-slice-plus-ref.stderr
@@ -0,0 +1,44 @@
+error[E0599]: no method named `test_mut` found for type `std::vec::Vec<{integer}>` in the current scope
+ --> $DIR/auto-ref-slice-plus-ref.rs:18:7
+ |
+LL | a.test_mut(); //~ ERROR no method named `test_mut` found
+ | ^^^^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `test_mut`, perhaps you need to implement it:
+ candidate #1: `MyIter`
+ = help: did you mean `get_mut`?
+
+error[E0599]: no method named `test` found for type `std::vec::Vec<{integer}>` in the current scope
+ --> $DIR/auto-ref-slice-plus-ref.rs:19:7
+ |
+LL | a.test(); //~ ERROR no method named `test` found
+ | ^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `test`, perhaps you need to implement it:
+ candidate #1: `MyIter`
+
+error[E0599]: no method named `test` found for type `[{integer}; 1]` in the current scope
+ --> $DIR/auto-ref-slice-plus-ref.rs:21:11
+ |
+LL | ([1]).test(); //~ ERROR no method named `test` found
+ | ^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `test`, perhaps you need to implement it:
+ candidate #1: `MyIter`
+
+error[E0599]: no method named `test` found for type `&[{integer}; 1]` in the current scope
+ --> $DIR/auto-ref-slice-plus-ref.rs:22:12
+ |
+LL | (&[1]).test(); //~ ERROR no method named `test` found
+ | ^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `test`, perhaps you need to implement it:
+ candidate #1: `MyIter`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/auto-trait-validation.rs b/src/test/ui/auto-trait-validation.rs
similarity index 100%
rename from src/test/compile-fail/auto-trait-validation.rs
rename to src/test/ui/auto-trait-validation.rs
diff --git a/src/test/ui/auto-trait-validation.stderr b/src/test/ui/auto-trait-validation.stderr
new file mode 100644
index 0000000..a6bd887
--- /dev/null
+++ b/src/test/ui/auto-trait-validation.stderr
@@ -0,0 +1,22 @@
+error[E0567]: auto traits cannot have generic parameters
+ --> $DIR/auto-trait-validation.rs:13:1
+ |
+LL | auto trait Generic<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0568]: auto traits cannot have super traits
+ --> $DIR/auto-trait-validation.rs:15:1
+ |
+LL | auto trait Bound : Copy {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0380]: auto traits cannot have methods or associated items
+ --> $DIR/auto-trait-validation.rs:17:1
+ |
+LL | auto trait MyTrait { fn foo() {} }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0380, E0567, E0568.
+For more information about an error, try `rustc --explain E0380`.
diff --git a/src/test/compile-fail/autoderef-full-lval.rs b/src/test/ui/autoderef-full-lval.rs
similarity index 100%
rename from src/test/compile-fail/autoderef-full-lval.rs
rename to src/test/ui/autoderef-full-lval.rs
diff --git a/src/test/ui/autoderef-full-lval.stderr b/src/test/ui/autoderef-full-lval.stderr
new file mode 100644
index 0000000..df8eeb5
--- /dev/null
+++ b/src/test/ui/autoderef-full-lval.stderr
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
+ --> $DIR/autoderef-full-lval.rs:25:20
+ |
+LL | let z: isize = a.x + b.y;
+ | ^^^^^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
+
+error[E0369]: binary operation `+` cannot be applied to type `std::boxed::Box<isize>`
+ --> $DIR/autoderef-full-lval.rs:31:25
+ |
+LL | let answer: isize = forty.a + two.a;
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `std::boxed::Box<isize>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/auxiliary/cdylib-dep.rs b/src/test/ui/auxiliary/cdylib-dep.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/cdylib-dep.rs
rename to src/test/ui/auxiliary/cdylib-dep.rs
diff --git a/src/test/compile-fail/auxiliary/default_ty_param_cross_crate_crate.rs b/src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/default_ty_param_cross_crate_crate.rs
rename to src/test/ui/auxiliary/default_ty_param_cross_crate_crate.rs
diff --git a/src/test/compile-fail/auxiliary/define_macro.rs b/src/test/ui/auxiliary/define_macro.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/define_macro.rs
rename to src/test/ui/auxiliary/define_macro.rs
diff --git a/src/test/compile-fail/auxiliary/extern-statics.rs b/src/test/ui/auxiliary/extern-statics.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/extern-statics.rs
rename to src/test/ui/auxiliary/extern-statics.rs
diff --git a/src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs b/src/test/ui/auxiliary/lto-duplicate-symbols1.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lto-duplicate-symbols1.rs
rename to src/test/ui/auxiliary/lto-duplicate-symbols1.rs
diff --git a/src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs b/src/test/ui/auxiliary/lto-duplicate-symbols2.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lto-duplicate-symbols2.rs
rename to src/test/ui/auxiliary/lto-duplicate-symbols2.rs
diff --git a/src/test/compile-fail/auxiliary/namespaced_enums.rs b/src/test/ui/auxiliary/namespaced_enums.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/namespaced_enums.rs
rename to src/test/ui/auxiliary/namespaced_enums.rs
diff --git a/src/test/compile-fail/auxiliary/noexporttypelib.rs b/src/test/ui/auxiliary/noexporttypelib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/noexporttypelib.rs
rename to src/test/ui/auxiliary/noexporttypelib.rs
diff --git a/src/test/compile-fail/auxiliary/orphan_check_diagnostics.rs b/src/test/ui/auxiliary/orphan_check_diagnostics.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/orphan_check_diagnostics.rs
rename to src/test/ui/auxiliary/orphan_check_diagnostics.rs
diff --git a/src/test/compile-fail/auxiliary/rmeta_meta.rs b/src/test/ui/auxiliary/rmeta_meta.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/rmeta_meta.rs
rename to src/test/ui/auxiliary/rmeta_meta.rs
diff --git a/src/test/compile-fail/auxiliary/rmeta_rlib.rs b/src/test/ui/auxiliary/rmeta_rlib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/rmeta_rlib.rs
rename to src/test/ui/auxiliary/rmeta_rlib.rs
diff --git a/src/test/compile-fail/auxiliary/stability_cfg2.rs b/src/test/ui/auxiliary/stability_cfg2.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/stability_cfg2.rs
rename to src/test/ui/auxiliary/stability_cfg2.rs
diff --git a/src/test/ui/auxiliary/weak-lang-items.rs b/src/test/ui/auxiliary/weak-lang-items.rs
new file mode 100644
index 0000000..6434e62
--- /dev/null
+++ b/src/test/ui/auxiliary/weak-lang-items.rs
@@ -0,0 +1,32 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// no-prefer-dynamic
+
+// This aux-file will require the eh_personality function to be codegen'd, but
+// it hasn't been defined just yet. Make sure we don't explode.
+
+#![no_std]
+#![crate_type = "rlib"]
+
+struct A;
+
+impl core::ops::Drop for A {
+ fn drop(&mut self) {}
+}
+
+pub fn foo() {
+ let _a = A;
+ panic!("wut");
+}
+
+mod std {
+ pub use core::{option, fmt};
+}
diff --git a/src/test/compile-fail/auxiliary/xc_private_method_lib.rs b/src/test/ui/auxiliary/xc_private_method_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/xc_private_method_lib.rs
rename to src/test/ui/auxiliary/xc_private_method_lib.rs
diff --git a/src/test/compile-fail/bad-const-type.rs b/src/test/ui/bad/bad-const-type.rs
similarity index 100%
rename from src/test/compile-fail/bad-const-type.rs
rename to src/test/ui/bad/bad-const-type.rs
diff --git a/src/test/ui/bad/bad-const-type.stderr b/src/test/ui/bad/bad-const-type.stderr
new file mode 100644
index 0000000..fbde157
--- /dev/null
+++ b/src/test/ui/bad/bad-const-type.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/bad-const-type.rs:11:20
+ |
+LL | static i: String = 10;
+ | ^^
+ | |
+ | expected struct `std::string::String`, found integral variable
+ | help: try using a conversion method: `10.to_string()`
+ |
+ = note: expected type `std::string::String`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/bad-crate-name.rs b/src/test/ui/bad/bad-crate-name.rs
similarity index 100%
rename from src/test/ui/bad-crate-name.rs
rename to src/test/ui/bad/bad-crate-name.rs
diff --git a/src/test/ui/bad-crate-name.stderr b/src/test/ui/bad/bad-crate-name.stderr
similarity index 100%
rename from src/test/ui/bad-crate-name.stderr
rename to src/test/ui/bad/bad-crate-name.stderr
diff --git a/src/test/compile-fail/bad-env-capture.rs b/src/test/ui/bad/bad-env-capture.rs
similarity index 100%
rename from src/test/compile-fail/bad-env-capture.rs
rename to src/test/ui/bad/bad-env-capture.rs
diff --git a/src/test/ui/bad/bad-env-capture.stderr b/src/test/ui/bad/bad-env-capture.stderr
new file mode 100644
index 0000000..bf460d2
--- /dev/null
+++ b/src/test/ui/bad/bad-env-capture.stderr
@@ -0,0 +1,24 @@
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/bad-env-capture.rs:14:27
+ |
+LL | fn bar() { log(debug, x); }
+ | ^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-env-capture.rs:14:16
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/bad-env-capture.rs:14:20
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^^^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0425, E0434.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/bad-env-capture2.rs b/src/test/ui/bad/bad-env-capture2.rs
similarity index 100%
rename from src/test/compile-fail/bad-env-capture2.rs
rename to src/test/ui/bad/bad-env-capture2.rs
diff --git a/src/test/ui/bad/bad-env-capture2.stderr b/src/test/ui/bad/bad-env-capture2.stderr
new file mode 100644
index 0000000..8d5703d
--- /dev/null
+++ b/src/test/ui/bad/bad-env-capture2.stderr
@@ -0,0 +1,24 @@
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/bad-env-capture2.rs:13:27
+ |
+LL | fn bar() { log(debug, x); }
+ | ^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-env-capture2.rs:13:16
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/bad-env-capture2.rs:13:20
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^^^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0425, E0434.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/bad-env-capture3.rs b/src/test/ui/bad/bad-env-capture3.rs
similarity index 100%
rename from src/test/compile-fail/bad-env-capture3.rs
rename to src/test/ui/bad/bad-env-capture3.rs
diff --git a/src/test/ui/bad/bad-env-capture3.stderr b/src/test/ui/bad/bad-env-capture3.stderr
new file mode 100644
index 0000000..258f7d4
--- /dev/null
+++ b/src/test/ui/bad/bad-env-capture3.stderr
@@ -0,0 +1,24 @@
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/bad-env-capture3.rs:14:31
+ |
+LL | fn bar() { log(debug, x); }
+ | ^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-env-capture3.rs:14:20
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/bad-env-capture3.rs:14:24
+ |
+LL | fn bar() { log(debug, x); }
+ | ^^^^^ not found in this scope
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0425, E0434.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/bad-expr-lhs.rs b/src/test/ui/bad/bad-expr-lhs.rs
similarity index 100%
rename from src/test/compile-fail/bad-expr-lhs.rs
rename to src/test/ui/bad/bad-expr-lhs.rs
diff --git a/src/test/ui/bad/bad-expr-lhs.stderr b/src/test/ui/bad/bad-expr-lhs.stderr
new file mode 100644
index 0000000..5937bee
--- /dev/null
+++ b/src/test/ui/bad/bad-expr-lhs.stderr
@@ -0,0 +1,34 @@
+error[E0070]: invalid left-hand side expression
+ --> $DIR/bad-expr-lhs.rs:12:5
+ |
+LL | 1 = 2; //~ ERROR invalid left-hand side expression
+ | ^^^^^ left-hand of expression not valid
+
+error[E0067]: invalid left-hand side expression
+ --> $DIR/bad-expr-lhs.rs:13:5
+ |
+LL | 1 += 2; //~ ERROR invalid left-hand side expression
+ | ^ invalid expression for left-hand side
+
+error[E0070]: invalid left-hand side expression
+ --> $DIR/bad-expr-lhs.rs:14:5
+ |
+LL | (1, 2) = (3, 4); //~ ERROR invalid left-hand side expression
+ | ^^^^^^^^^^^^^^^ left-hand of expression not valid
+
+error[E0070]: invalid left-hand side expression
+ --> $DIR/bad-expr-lhs.rs:17:5
+ |
+LL | (a, b) = (3, 4); //~ ERROR invalid left-hand side expression
+ | ^^^^^^^^^^^^^^^ left-hand of expression not valid
+
+error[E0070]: invalid left-hand side expression
+ --> $DIR/bad-expr-lhs.rs:19:5
+ |
+LL | None = Some(3); //~ ERROR invalid left-hand side expression
+ | ^^^^^^^^^^^^^^ left-hand of expression not valid
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0067, E0070.
+For more information about an error, try `rustc --explain E0067`.
diff --git a/src/test/compile-fail/bad-expr-path.rs b/src/test/ui/bad/bad-expr-path.rs
similarity index 100%
rename from src/test/compile-fail/bad-expr-path.rs
rename to src/test/ui/bad/bad-expr-path.rs
diff --git a/src/test/ui/bad/bad-expr-path.stderr b/src/test/ui/bad/bad-expr-path.stderr
new file mode 100644
index 0000000..a1ac17c
--- /dev/null
+++ b/src/test/ui/bad/bad-expr-path.stderr
@@ -0,0 +1,31 @@
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-expr-path.rs:14:5
+ |
+LL | log(debug, m1::arguments);
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/bad-expr-path.rs:14:9
+ |
+LL | log(debug, m1::arguments);
+ | ^^^^^ not found in this scope
+
+error[E0425]: cannot find value `arguments` in module `m1`
+ --> $DIR/bad-expr-path.rs:14:20
+ |
+LL | log(debug, m1::arguments);
+ | ^^^^^^^^^ not found in `m1`
+
+error[E0580]: main function has wrong type
+ --> $DIR/bad-expr-path.rs:13:1
+ |
+LL | fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected type `fn()`
+ found type `fn(std::vec::Vec<std::string::String>)`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0425, E0580.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/bad-expr-path2.rs b/src/test/ui/bad/bad-expr-path2.rs
similarity index 100%
rename from src/test/compile-fail/bad-expr-path2.rs
rename to src/test/ui/bad/bad-expr-path2.rs
diff --git a/src/test/ui/bad/bad-expr-path2.stderr b/src/test/ui/bad/bad-expr-path2.stderr
new file mode 100644
index 0000000..bb7d01c
--- /dev/null
+++ b/src/test/ui/bad/bad-expr-path2.stderr
@@ -0,0 +1,31 @@
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/bad-expr-path2.rs:16:5
+ |
+LL | log(debug, m1::arguments);
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/bad-expr-path2.rs:16:9
+ |
+LL | log(debug, m1::arguments);
+ | ^^^^^ not found in this scope
+
+error[E0423]: expected value, found module `m1::arguments`
+ --> $DIR/bad-expr-path2.rs:16:16
+ |
+LL | log(debug, m1::arguments);
+ | ^^^^^^^^^^^^^ not a value
+
+error[E0580]: main function has wrong type
+ --> $DIR/bad-expr-path2.rs:15:1
+ |
+LL | fn main(arguments: Vec<String>) { //~ ERROR main function has wrong type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected type `fn()`
+ found type `fn(std::vec::Vec<std::string::String>)`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0423, E0425, E0580.
+For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/compile-fail/bad-extern-link-attrs.rs b/src/test/ui/bad/bad-extern-link-attrs.rs
similarity index 100%
rename from src/test/compile-fail/bad-extern-link-attrs.rs
rename to src/test/ui/bad/bad-extern-link-attrs.rs
diff --git a/src/test/ui/bad/bad-extern-link-attrs.stderr b/src/test/ui/bad/bad-extern-link-attrs.stderr
new file mode 100644
index 0000000..5e58bcd
--- /dev/null
+++ b/src/test/ui/bad/bad-extern-link-attrs.stderr
@@ -0,0 +1,24 @@
+error[E0459]: #[link(...)] specified without `name = "foo"`
+ --> $DIR/bad-extern-link-attrs.rs:11:1
+ |
+LL | #[link()] //~ ERROR: specified without `name =
+ | ^^^^^^^^^ missing `name` argument
+
+error[E0454]: #[link(name = "")] given with empty name
+ --> $DIR/bad-extern-link-attrs.rs:12:1
+ |
+LL | #[link(name = "")] //~ ERROR: with empty name
+ | ^^^^^^^^^^^^^^^^^^ empty name given
+
+error[E0458]: unknown kind: `bar`
+ --> $DIR/bad-extern-link-attrs.rs:14:1
+ |
+LL | #[link(name = "foo", kind = "bar")] //~ ERROR: unknown kind
+ | ^^^^^^^^^^^^^^^^^^^^^------------^^
+ | |
+ | unknown kind
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0454, E0458, E0459.
+For more information about an error, try `rustc --explain E0454`.
diff --git a/src/test/compile-fail/bad-intrinsic-monomorphization.rs b/src/test/ui/bad/bad-intrinsic-monomorphization.rs
similarity index 100%
rename from src/test/compile-fail/bad-intrinsic-monomorphization.rs
rename to src/test/ui/bad/bad-intrinsic-monomorphization.rs
diff --git a/src/test/ui/bad/bad-intrinsic-monomorphization.stderr b/src/test/ui/bad/bad-intrinsic-monomorphization.stderr
new file mode 100644
index 0000000..a088dd0
--- /dev/null
+++ b/src/test/ui/bad/bad-intrinsic-monomorphization.stderr
@@ -0,0 +1,21 @@
+error[E0511]: invalid monomorphization of `cttz` intrinsic: expected basic integer type, found `Foo`
+ --> $DIR/bad-intrinsic-monomorphization.rs:28:5
+ |
+LL | intrinsics::cttz(v)
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `fadd_fast` intrinsic: expected basic float type, found `Foo`
+ --> $DIR/bad-intrinsic-monomorphization.rs:33:5
+ |
+LL | intrinsics::fadd_fast(a, b)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `Foo`
+ --> $DIR/bad-intrinsic-monomorphization.rs:38:5
+ |
+LL | simd_add(a, b)
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/bad-lint-cap.rs b/src/test/ui/bad/bad-lint-cap.rs
similarity index 100%
rename from src/test/compile-fail/bad-lint-cap.rs
rename to src/test/ui/bad/bad-lint-cap.rs
diff --git a/src/test/ui/bad/bad-lint-cap.stderr b/src/test/ui/bad/bad-lint-cap.stderr
new file mode 100644
index 0000000..f284dbf
--- /dev/null
+++ b/src/test/ui/bad/bad-lint-cap.stderr
@@ -0,0 +1,2 @@
+error: unknown lint level: `test`
+
diff --git a/src/test/compile-fail/bad-lint-cap2.rs b/src/test/ui/bad/bad-lint-cap2.rs
similarity index 100%
rename from src/test/compile-fail/bad-lint-cap2.rs
rename to src/test/ui/bad/bad-lint-cap2.rs
diff --git a/src/test/ui/bad/bad-lint-cap2.stderr b/src/test/ui/bad/bad-lint-cap2.stderr
new file mode 100644
index 0000000..7471aa2
--- /dev/null
+++ b/src/test/ui/bad/bad-lint-cap2.stderr
@@ -0,0 +1,15 @@
+error: unused import: `std::option`
+ --> $DIR/bad-lint-cap2.rs:16:5
+ |
+LL | use std::option; //~ ERROR
+ | ^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/bad-lint-cap2.rs:14:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(unused_imports)] implied by #[deny(warnings)]
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/bad-lint-cap3.rs b/src/test/ui/bad/bad-lint-cap3.rs
similarity index 100%
rename from src/test/compile-fail/bad-lint-cap3.rs
rename to src/test/ui/bad/bad-lint-cap3.rs
diff --git a/src/test/ui/bad/bad-lint-cap3.stderr b/src/test/ui/bad/bad-lint-cap3.stderr
new file mode 100644
index 0000000..d322460
--- /dev/null
+++ b/src/test/ui/bad/bad-lint-cap3.stderr
@@ -0,0 +1,21 @@
+warning: unused import: `std::option`
+ --> $DIR/bad-lint-cap3.rs:17:5
+ |
+LL | use std::option; //~ WARN
+ | ^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/bad-lint-cap3.rs:14:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: #[warn(unused_imports)] implied by #[warn(warnings)]
+
+error: compilation successful
+ --> $DIR/bad-lint-cap3.rs:20:1
+ |
+LL | fn main() {} //~ ERROR: compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/bad-main.rs b/src/test/ui/bad/bad-main.rs
similarity index 100%
rename from src/test/compile-fail/bad-main.rs
rename to src/test/ui/bad/bad-main.rs
diff --git a/src/test/ui/bad/bad-main.stderr b/src/test/ui/bad/bad-main.stderr
new file mode 100644
index 0000000..3388e08
--- /dev/null
+++ b/src/test/ui/bad/bad-main.stderr
@@ -0,0 +1,12 @@
+error[E0580]: main function has wrong type
+ --> $DIR/bad-main.rs:11:1
+ |
+LL | fn main(x: isize) { } //~ ERROR: main function has wrong type [E0580]
+ | ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected type `fn()`
+ found type `fn(isize)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0580`.
diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/ui/bad/bad-method-typaram-kind.rs
similarity index 100%
rename from src/test/compile-fail/bad-method-typaram-kind.rs
rename to src/test/ui/bad/bad-method-typaram-kind.rs
diff --git a/src/test/ui/bad/bad-method-typaram-kind.stderr b/src/test/ui/bad/bad-method-typaram-kind.stderr
new file mode 100644
index 0000000..ed0c49a
--- /dev/null
+++ b/src/test/ui/bad/bad-method-typaram-kind.stderr
@@ -0,0 +1,12 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/bad-method-typaram-kind.rs:12:7
+ |
+LL | 1.bar::<T>(); //~ ERROR `T` cannot be sent between threads safely
+ | ^^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/bad-mid-path-type-params.rs b/src/test/ui/bad/bad-mid-path-type-params.rs
similarity index 100%
rename from src/test/compile-fail/bad-mid-path-type-params.rs
rename to src/test/ui/bad/bad-mid-path-type-params.rs
diff --git a/src/test/ui/bad/bad-mid-path-type-params.stderr b/src/test/ui/bad/bad-mid-path-type-params.stderr
new file mode 100644
index 0000000..d2b002e
--- /dev/null
+++ b/src/test/ui/bad/bad-mid-path-type-params.stderr
@@ -0,0 +1,28 @@
+error[E0087]: too many type parameters provided: expected at most 1 type parameter, found 2 type parameters
+ --> $DIR/bad-mid-path-type-params.rs:40:28
+ |
+LL | let _ = S::new::<isize,f64>(1, 1.0);
+ | ^^^ expected 1 type parameter
+
+error[E0107]: wrong number of lifetime parameters: expected 0, found 1
+ --> $DIR/bad-mid-path-type-params.rs:43:13
+ |
+LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime parameter
+
+error[E0087]: too many type parameters provided: expected at most 1 type parameter, found 2 type parameters
+ --> $DIR/bad-mid-path-type-params.rs:46:36
+ |
+LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
+ | ^^^ expected 1 type parameter
+
+error[E0088]: too many lifetime parameters provided: expected at most 0 lifetime parameters, found 1 lifetime parameter
+ --> $DIR/bad-mid-path-type-params.rs:49:25
+ |
+LL | let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0);
+ | ^^ expected 0 lifetime parameters
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0087, E0088, E0107.
+For more information about an error, try `rustc --explain E0087`.
diff --git a/src/test/compile-fail/bad-module.rs b/src/test/ui/bad/bad-module.rs
similarity index 100%
rename from src/test/compile-fail/bad-module.rs
rename to src/test/ui/bad/bad-module.rs
diff --git a/src/test/ui/bad/bad-module.stderr b/src/test/ui/bad/bad-module.stderr
new file mode 100644
index 0000000..8c19922
--- /dev/null
+++ b/src/test/ui/bad/bad-module.stderr
@@ -0,0 +1,15 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `thing`
+ --> $DIR/bad-module.rs:12:15
+ |
+LL | let foo = thing::len(Vec::new());
+ | ^^^^^ Use of undeclared type or module `thing`
+
+error[E0433]: failed to resolve. Use of undeclared type or module `foo`
+ --> $DIR/bad-module.rs:15:15
+ |
+LL | let foo = foo::bar::baz();
+ | ^^^ Use of undeclared type or module `foo`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/ui/bad/bad-sized.rs
similarity index 100%
rename from src/test/compile-fail/bad-sized.rs
rename to src/test/ui/bad/bad-sized.rs
diff --git a/src/test/ui/bad/bad-sized.stderr b/src/test/ui/bad/bad-sized.stderr
new file mode 100644
index 0000000..5f80138
--- /dev/null
+++ b/src/test/ui/bad/bad-sized.stderr
@@ -0,0 +1,30 @@
+error[E0225]: only auto traits can be used as additional traits in a trait object
+ --> $DIR/bad-sized.rs:14:24
+ |
+LL | let x: Vec<Trait + Sized> = Vec::new();
+ | ^^^^^ non-auto additional trait
+
+error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
+ --> $DIR/bad-sized.rs:14:12
+ |
+LL | let x: Vec<Trait + Sized> = Vec::new();
+ | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::vec::Vec`
+
+error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time
+ --> $DIR/bad-sized.rs:14:33
+ |
+LL | let x: Vec<Trait + Sized> = Vec::new();
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn Trait`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `<std::vec::Vec<T>>::new`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0225, E0277.
+For more information about an error, try `rustc --explain E0225`.
diff --git a/src/test/compile-fail/bad-type-env-capture.rs b/src/test/ui/bad/bad-type-env-capture.rs
similarity index 100%
rename from src/test/compile-fail/bad-type-env-capture.rs
rename to src/test/ui/bad/bad-type-env-capture.rs
diff --git a/src/test/ui/bad/bad-type-env-capture.stderr b/src/test/ui/bad/bad-type-env-capture.stderr
new file mode 100644
index 0000000..3cb087a
--- /dev/null
+++ b/src/test/ui/bad/bad-type-env-capture.stderr
@@ -0,0 +1,13 @@
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/bad-type-env-capture.rs:12:15
+ |
+LL | fn foo<T>() {
+ | - type variable from outer function
+LL | fn bar(b: T) { } //~ ERROR can't use type parameters from outer
+ | --- ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `bar<T>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.rs
similarity index 100%
rename from src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-2.rs
rename to src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.rs
diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr
new file mode 100644
index 0000000..2f05755
--- /dev/null
+++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-2.stderr
@@ -0,0 +1,11 @@
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-2.rs:22:23
+ |
+LL | Some((ref _y, _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
+ | ------ ^^ by-move pattern here
+ | |
+ | both by-ref and by-move used
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0009`.
diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.rs
similarity index 100%
rename from src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-3.rs
rename to src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.rs
diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr
new file mode 100644
index 0000000..a573b9a
--- /dev/null
+++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-3.stderr
@@ -0,0 +1,11 @@
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-3.rs:24:38
+ |
+LL | double_option::some2(ref _y, _z) => { },
+ | ------ ^^ by-move pattern here
+ | |
+ | both by-ref and by-move used
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0009`.
diff --git a/src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.rs
similarity index 100%
rename from src/test/compile-fail/bind-by-move-neither-can-live-while-the-other-survives-4.rs
rename to src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.rs
diff --git a/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr
new file mode 100644
index 0000000..e38916b
--- /dev/null
+++ b/src/test/ui/bind-by-move/bind-by-move-neither-can-live-while-the-other-survives-4.stderr
@@ -0,0 +1,11 @@
+error[E0009]: cannot bind by-move and by-ref in the same pattern
+ --> $DIR/bind-by-move-neither-can-live-while-the-other-survives-4.rs:22:15
+ |
+LL | Some((_y, ref _z)) => { }, //~ ERROR cannot bind by-move and by-ref in the same pattern
+ | ^^ ------ both by-ref and by-move used
+ | |
+ | by-move pattern here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0009`.
diff --git a/src/test/compile-fail/bind-by-move-no-guards.rs b/src/test/ui/bind-by-move/bind-by-move-no-guards.rs
similarity index 100%
rename from src/test/compile-fail/bind-by-move-no-guards.rs
rename to src/test/ui/bind-by-move/bind-by-move-no-guards.rs
diff --git a/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr b/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr
new file mode 100644
index 0000000..ed516cd
--- /dev/null
+++ b/src/test/ui/bind-by-move/bind-by-move-no-guards.stderr
@@ -0,0 +1,9 @@
+error[E0008]: cannot bind by-move into a pattern guard
+ --> $DIR/bind-by-move-no-guards.rs:18:14
+ |
+LL | Some(z) if z.recv().unwrap() => { panic!() },
+ | ^ moves value into pattern guard
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0008`.
diff --git a/src/test/compile-fail/binop-bitxor-str.rs b/src/test/ui/binop/binop-bitxor-str.rs
similarity index 100%
rename from src/test/compile-fail/binop-bitxor-str.rs
rename to src/test/ui/binop/binop-bitxor-str.rs
diff --git a/src/test/ui/binop/binop-bitxor-str.stderr b/src/test/ui/binop/binop-bitxor-str.stderr
new file mode 100644
index 0000000..a6804a6
--- /dev/null
+++ b/src/test/ui/binop/binop-bitxor-str.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `^` cannot be applied to type `std::string::String`
+ --> $DIR/binop-bitxor-str.rs:13:21
+ |
+LL | fn main() { let x = "a".to_string() ^ "b".to_string(); }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an implementation of `std::ops::BitXor` might be missing for `std::string::String`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/binop-consume-args.rs b/src/test/ui/binop/binop-consume-args.rs
similarity index 100%
rename from src/test/compile-fail/binop-consume-args.rs
rename to src/test/ui/binop/binop-consume-args.rs
diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr
new file mode 100644
index 0000000..07627d3
--- /dev/null
+++ b/src/test/ui/binop/binop-consume-args.stderr
@@ -0,0 +1,213 @@
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:17:10
+ |
+LL | lhs + rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:18:10
+ |
+LL | lhs + rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:23:10
+ |
+LL | lhs - rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:24:10
+ |
+LL | lhs - rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:29:10
+ |
+LL | lhs * rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:30:10
+ |
+LL | lhs * rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:35:10
+ |
+LL | lhs / rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:36:10
+ |
+LL | lhs / rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:41:10
+ |
+LL | lhs % rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:42:10
+ |
+LL | lhs % rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:47:10
+ |
+LL | lhs & rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:48:10
+ |
+LL | lhs & rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:53:10
+ |
+LL | lhs | rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:54:10
+ |
+LL | lhs | rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:59:10
+ |
+LL | lhs ^ rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:60:10
+ |
+LL | lhs ^ rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:65:10
+ |
+LL | lhs << rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:66:10
+ |
+LL | lhs << rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `lhs`
+ --> $DIR/binop-consume-args.rs:71:10
+ |
+LL | lhs >> rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `lhs` has type `A`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `rhs`
+ --> $DIR/binop-consume-args.rs:72:10
+ |
+LL | lhs >> rhs;
+ | --- value moved here
+LL | drop(lhs); //~ ERROR use of moved value: `lhs`
+LL | drop(rhs); //~ ERROR use of moved value: `rhs`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `rhs` has type `B`, which does not implement the `Copy` trait
+
+error: aborting due to 20 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/binop-logic-float.rs b/src/test/ui/binop/binop-logic-float.rs
similarity index 100%
rename from src/test/compile-fail/binop-logic-float.rs
rename to src/test/ui/binop/binop-logic-float.rs
diff --git a/src/test/ui/binop/binop-logic-float.stderr b/src/test/ui/binop/binop-logic-float.stderr
new file mode 100644
index 0000000..947ee4e
--- /dev/null
+++ b/src/test/ui/binop/binop-logic-float.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/binop-logic-float.rs:11:21
+ |
+LL | fn main() { let x = 1.0_f32 || 2.0_f32; }
+ | ^^^^^^^ expected bool, found f32
+
+error[E0308]: mismatched types
+ --> $DIR/binop-logic-float.rs:11:32
+ |
+LL | fn main() { let x = 1.0_f32 || 2.0_f32; }
+ | ^^^^^^^ expected bool, found f32
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/binop-logic-int.rs b/src/test/ui/binop/binop-logic-int.rs
similarity index 100%
rename from src/test/compile-fail/binop-logic-int.rs
rename to src/test/ui/binop/binop-logic-int.rs
diff --git a/src/test/ui/binop/binop-logic-int.stderr b/src/test/ui/binop/binop-logic-int.stderr
new file mode 100644
index 0000000..56f7601
--- /dev/null
+++ b/src/test/ui/binop/binop-logic-int.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/binop-logic-int.rs:11:21
+ |
+LL | fn main() { let x = 1 && 2; }
+ | ^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/binop-logic-int.rs:11:26
+ |
+LL | fn main() { let x = 1 && 2; }
+ | ^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr
new file mode 100644
index 0000000..98762a0
--- /dev/null
+++ b/src/test/ui/binop/binop-move-semantics.nll.stderr
@@ -0,0 +1,68 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/binop-move-semantics.rs:18:5
+ |
+LL | x
+ | - value moved here
+LL | +
+LL | x; //~ ERROR: use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/binop-move-semantics.rs:24:5
+ |
+LL | x
+ | - value moved here
+LL | +
+LL | x.clone(); //~ ERROR: use of moved value
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/binop-move-semantics.rs:40:5
+ |
+LL | *m //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/binop-move-semantics.rs:42:5
+ |
+LL | *n; //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
+ --> $DIR/binop-move-semantics.rs:64:5
+ |
+LL | &mut f
+ | ------
+ | |
+ | _____mutable borrow occurs here
+ | |
+LL | | +
+LL | | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
+ | | ^-
+ | |_____||
+ | |borrow later used here
+ | immutable borrow occurs here
+
+error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
+ --> $DIR/binop-move-semantics.rs:72:5
+ |
+LL | &f
+ | --
+ | |
+ | _____immutable borrow occurs here
+ | |
+LL | | +
+LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
+ | | ^^^^^-
+ | |_____|____|
+ | | borrow later used here
+ | mutable borrow occurs here
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0382, E0502, E0507.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/binop-move-semantics.rs b/src/test/ui/binop/binop-move-semantics.rs
similarity index 100%
rename from src/test/compile-fail/binop-move-semantics.rs
rename to src/test/ui/binop/binop-move-semantics.rs
diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr
new file mode 100644
index 0000000..81b8a33
--- /dev/null
+++ b/src/test/ui/binop/binop-move-semantics.stderr
@@ -0,0 +1,80 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/binop-move-semantics.rs:18:5
+ |
+LL | x
+ | - value moved here
+LL | +
+LL | x; //~ ERROR: use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/binop-move-semantics.rs:24:5
+ |
+LL | x
+ | - value moved here
+LL | +
+LL | x.clone(); //~ ERROR: use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/binop-move-semantics.rs:31:5
+ |
+LL | let m = &x;
+ | - borrow of `x` occurs here
+...
+LL | x //~ ERROR: cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+ --> $DIR/binop-move-semantics.rs:33:5
+ |
+LL | let n = &mut y;
+ | - borrow of `y` occurs here
+...
+LL | y; //~ ERROR: cannot move out of `y` because it is borrowed
+ | ^ move out of `y` occurs here
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/binop-move-semantics.rs:40:5
+ |
+LL | *m //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/binop-move-semantics.rs:42:5
+ |
+LL | *n; //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
+ --> $DIR/binop-move-semantics.rs:64:6
+ |
+LL | &mut f
+ | - mutable borrow occurs here
+LL | +
+LL | &f; //~ ERROR: cannot borrow `f` as immutable because it is also borrowed as mutable
+ | ^
+ | |
+ | immutable borrow occurs here
+ | mutable borrow ends here
+
+error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
+ --> $DIR/binop-move-semantics.rs:72:10
+ |
+LL | &f
+ | - immutable borrow occurs here
+LL | +
+LL | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also borrowed as immutable
+ | ^
+ | |
+ | mutable borrow occurs here
+ | immutable borrow ends here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0382, E0502, E0505, E0507.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/binop-mul-bool.rs b/src/test/ui/binop/binop-mul-bool.rs
similarity index 100%
rename from src/test/compile-fail/binop-mul-bool.rs
rename to src/test/ui/binop/binop-mul-bool.rs
diff --git a/src/test/ui/binop/binop-mul-bool.stderr b/src/test/ui/binop/binop-mul-bool.stderr
new file mode 100644
index 0000000..1df5087
--- /dev/null
+++ b/src/test/ui/binop/binop-mul-bool.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `*` cannot be applied to type `bool`
+ --> $DIR/binop-mul-bool.rs:13:21
+ |
+LL | fn main() { let x = true * false; }
+ | ^^^^^^^^^^^^
+ |
+ = note: an implementation of `std::ops::Mul` might be missing for `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/binop-typeck.rs b/src/test/ui/binop/binop-typeck.rs
similarity index 100%
rename from src/test/compile-fail/binop-typeck.rs
rename to src/test/ui/binop/binop-typeck.rs
diff --git a/src/test/ui/binop/binop-typeck.stderr b/src/test/ui/binop/binop-typeck.stderr
new file mode 100644
index 0000000..1ff8177
--- /dev/null
+++ b/src/test/ui/binop/binop-typeck.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `+` cannot be applied to type `bool`
+ --> $DIR/binop-typeck.rs:16:13
+ |
+LL | let z = x + y;
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/blind-item-block-item-shadow.rs b/src/test/ui/blind/blind-item-block-item-shadow.rs
similarity index 100%
rename from src/test/compile-fail/blind-item-block-item-shadow.rs
rename to src/test/ui/blind/blind-item-block-item-shadow.rs
diff --git a/src/test/ui/blind/blind-item-block-item-shadow.stderr b/src/test/ui/blind/blind-item-block-item-shadow.stderr
new file mode 100644
index 0000000..5adc953
--- /dev/null
+++ b/src/test/ui/blind/blind-item-block-item-shadow.stderr
@@ -0,0 +1,17 @@
+error[E0255]: the name `Bar` is defined multiple times
+ --> $DIR/blind-item-block-item-shadow.rs:16:13
+ |
+LL | struct Bar;
+ | ----------- previous definition of the type `Bar` here
+LL | use foo::Bar;
+ | ^^^^^^^^ `Bar` reimported here
+ |
+ = note: `Bar` must be defined only once in the type namespace of this block
+help: You can use `as` to change the binding name of the import
+ |
+LL | use foo::Bar as OtherBar;
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0255`.
diff --git a/src/test/compile-fail/blind-item-block-middle.rs b/src/test/ui/blind/blind-item-block-middle.rs
similarity index 100%
rename from src/test/compile-fail/blind-item-block-middle.rs
rename to src/test/ui/blind/blind-item-block-middle.rs
diff --git a/src/test/ui/blind/blind-item-block-middle.stderr b/src/test/ui/blind/blind-item-block-middle.stderr
new file mode 100644
index 0000000..0123fd0
--- /dev/null
+++ b/src/test/ui/blind/blind-item-block-middle.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/blind-item-block-middle.rs:14:9
+ |
+LL | let bar = 5;
+ | ^^^ expected integral variable, found struct `foo::bar`
+ |
+ = note: expected type `{integer}`
+ found type `foo::bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/blind-item-item-shadow.rs b/src/test/ui/blind/blind-item-item-shadow.rs
similarity index 100%
rename from src/test/ui/blind-item-item-shadow.rs
rename to src/test/ui/blind/blind-item-item-shadow.rs
diff --git a/src/test/ui/blind-item-item-shadow.stderr b/src/test/ui/blind/blind-item-item-shadow.stderr
similarity index 100%
rename from src/test/ui/blind-item-item-shadow.stderr
rename to src/test/ui/blind/blind-item-item-shadow.stderr
diff --git a/src/test/ui/borrowck/assign_mutable_fields.nll.stderr b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr
new file mode 100644
index 0000000..5147075
--- /dev/null
+++ b/src/test/ui/borrowck/assign_mutable_fields.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/assign_mutable_fields.rs:29:10
+ |
+LL | drop(x); //~ ERROR
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/assign_mutable_fields.rs b/src/test/ui/borrowck/assign_mutable_fields.rs
new file mode 100644
index 0000000..4e41f44
--- /dev/null
+++ b/src/test/ui/borrowck/assign_mutable_fields.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 <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.
+
+// Currently, we permit you to assign to individual fields of a mut
+// var, but we do not permit you to use the complete var afterwards.
+// We hope to fix this at some point.
+//
+// FIXME(#21232)
+
+fn assign_both_fields_and_use() {
+ let mut x: (u32, u32);
+ x.0 = 1;
+ x.1 = 22;
+ drop(x.0); //~ ERROR
+ drop(x.1); //~ ERROR
+}
+
+fn assign_both_fields_the_use_var() {
+ let mut x: (u32, u32);
+ x.0 = 1;
+ x.1 = 22;
+ drop(x); //~ ERROR
+}
+
+fn main() { }
diff --git a/src/test/ui/borrowck/assign_mutable_fields.stderr b/src/test/ui/borrowck/assign_mutable_fields.stderr
new file mode 100644
index 0000000..677887b
--- /dev/null
+++ b/src/test/ui/borrowck/assign_mutable_fields.stderr
@@ -0,0 +1,21 @@
+error[E0381]: use of possibly uninitialized variable: `x.0`
+ --> $DIR/assign_mutable_fields.rs:21:10
+ |
+LL | drop(x.0); //~ ERROR
+ | ^^^ use of possibly uninitialized `x.0`
+
+error[E0381]: use of possibly uninitialized variable: `x.1`
+ --> $DIR/assign_mutable_fields.rs:22:10
+ |
+LL | drop(x.1); //~ ERROR
+ | ^^^ use of possibly uninitialized `x.1`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/assign_mutable_fields.rs:29:10
+ |
+LL | drop(x); //~ ERROR
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr
new file mode 100644
index 0000000..631add3
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.nll.stderr
@@ -0,0 +1,76 @@
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:25:27
+ |
+LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/borrow-immutable-upvar-mutation.rs:25:24
+ |
+LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign
+ | ^^^^^^^^^
+
+error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:28:31
+ |
+LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
+ | ^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/borrow-immutable-upvar-mutation.rs:28:24
+ |
+LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^
+
+error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:31:55
+ |
+LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/borrow-immutable-upvar-mutation.rs:31:52
+ |
+LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^^^^
+
+error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:37:32
+ |
+LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/borrow-immutable-upvar-mutation.rs:37:24
+ |
+LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^
+
+error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:40:36
+ |
+LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
+ | ^^^^^^ cannot borrow as mutable
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/borrow-immutable-upvar-mutation.rs:40:24
+ |
+LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:43:65
+ |
+LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/borrow-immutable-upvar-mutation.rs:43:57
+ |
+LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/borrow-immutable-upvar-mutation.rs b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs
similarity index 100%
rename from src/test/compile-fail/borrow-immutable-upvar-mutation.rs
rename to src/test/ui/borrowck/borrow-immutable-upvar-mutation.rs
diff --git a/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
new file mode 100644
index 0000000..740e182
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-immutable-upvar-mutation.stderr
@@ -0,0 +1,78 @@
+error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:25:27
+ |
+LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign
+ | ^^^^^^
+ |
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/borrow-immutable-upvar-mutation.rs:25:24
+ |
+LL | let _f = to_fn(|| x = 42); //~ ERROR cannot assign
+ | ^^^^^^^^^
+
+error[E0387]: cannot borrow data mutably in a captured outer variable in an `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:28:36
+ |
+LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
+ | ^
+ |
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/borrow-immutable-upvar-mutation.rs:28:24
+ |
+LL | let _g = to_fn(|| set(&mut y)); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^
+
+error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:31:55
+ |
+LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^
+ |
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/borrow-immutable-upvar-mutation.rs:31:52
+ |
+LL | let _h = to_fn_mut(|| { set(&mut z); to_fn(|| z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^^^^
+
+error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:37:32
+ |
+LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign
+ | ^^^^^^
+ |
+ = note: `Fn` closures cannot capture their enclosing environment for modifications
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/borrow-immutable-upvar-mutation.rs:37:24
+ |
+LL | let _f = to_fn(move || x = 42); //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^
+
+error[E0596]: cannot borrow captured outer variable in an `Fn` closure as mutable
+ --> $DIR/borrow-immutable-upvar-mutation.rs:40:41
+ |
+LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
+ | ^
+ |
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/borrow-immutable-upvar-mutation.rs:40:24
+ |
+LL | let _g = to_fn(move || set(&mut y)); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+ --> $DIR/borrow-immutable-upvar-mutation.rs:43:65
+ |
+LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^
+ |
+ = note: `Fn` closures cannot capture their enclosing environment for modifications
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/borrow-immutable-upvar-mutation.rs:43:57
+ |
+LL | let _h = to_fn_mut(move || { set(&mut z); to_fn(move || z = 42); }); //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0387, E0594, E0596.
+For more information about an error, try `rustc --explain E0387`.
diff --git a/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr
new file mode 100644
index 0000000..855488e
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-tuple-fields.nll.stderr
@@ -0,0 +1,65 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrow-tuple-fields.rs:22:13
+ |
+LL | let r = &x.0;
+ | ---- borrow of `x.0` occurs here
+LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+LL |
+LL | r.use_ref();
+ | - borrow later used here
+
+error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrow-tuple-fields.rs:28:13
+ |
+LL | let a = &x.0;
+ | ---- immutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
+ | ^^^^^^^^ mutable borrow occurs here
+LL | a.use_ref();
+ | - borrow later used here
+
+error[E0499]: cannot borrow `x.0` as mutable more than once at a time
+ --> $DIR/borrow-tuple-fields.rs:33:13
+ |
+LL | let a = &mut x.0;
+ | -------- first mutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | a.use_ref();
+ | - borrow later used here
+
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrow-tuple-fields.rs:38:13
+ |
+LL | let r = &x.0;
+ | ---- borrow of `x.0` occurs here
+LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+LL | r.use_ref();
+ | - borrow later used here
+
+error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrow-tuple-fields.rs:43:13
+ |
+LL | let a = &x.0;
+ | ---- immutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
+ | ^^^^^^^^ mutable borrow occurs here
+LL | a.use_ref();
+ | - borrow later used here
+
+error[E0499]: cannot borrow `x.0` as mutable more than once at a time
+ --> $DIR/borrow-tuple-fields.rs:48:13
+ |
+LL | let a = &mut x.0;
+ | -------- first mutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | a.use_mut();
+ | - borrow later used here
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0499, E0502, E0505.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrow-tuple-fields.rs b/src/test/ui/borrowck/borrow-tuple-fields.rs
new file mode 100644
index 0000000..de3a5c7
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-tuple-fields.rs
@@ -0,0 +1,53 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(box_syntax)]
+
+
+
+struct Foo(Box<isize>, isize);
+
+struct Bar(isize, isize);
+
+fn main() {
+ let x: (Box<_>, _) = (box 1, 2);
+ let r = &x.0;
+ let y = x; //~ ERROR cannot move out of `x` because it is borrowed
+
+ r.use_ref();
+
+ let mut x = (1, 2);
+ let a = &x.0;
+ let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
+ a.use_ref();
+
+ let mut x = (1, 2);
+ let a = &mut x.0;
+ let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
+ a.use_ref();
+
+ let x = Foo(box 1, 2);
+ let r = &x.0;
+ let y = x; //~ ERROR cannot move out of `x` because it is borrowed
+ r.use_ref();
+
+ let mut x = Bar(1, 2);
+ let a = &x.0;
+ let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
+ a.use_ref();
+
+ let mut x = Bar(1, 2);
+ let a = &mut x.0;
+ let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
+ a.use_mut();
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrow-tuple-fields.stderr b/src/test/ui/borrowck/borrow-tuple-fields.stderr
new file mode 100644
index 0000000..1cbfcdf
--- /dev/null
+++ b/src/test/ui/borrowck/borrow-tuple-fields.stderr
@@ -0,0 +1,64 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrow-tuple-fields.rs:22:9
+ |
+LL | let r = &x.0;
+ | --- borrow of `x.0` occurs here
+LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+
+error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrow-tuple-fields.rs:28:18
+ |
+LL | let a = &x.0;
+ | --- immutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
+ | ^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0499]: cannot borrow `x.0` as mutable more than once at a time
+ --> $DIR/borrow-tuple-fields.rs:33:18
+ |
+LL | let a = &mut x.0;
+ | --- first mutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
+ | ^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrow-tuple-fields.rs:38:9
+ |
+LL | let r = &x.0;
+ | --- borrow of `x.0` occurs here
+LL | let y = x; //~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+
+error[E0502]: cannot borrow `x.0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrow-tuple-fields.rs:43:18
+ |
+LL | let a = &x.0;
+ | --- immutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable because it is also borrowed as
+ | ^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0499]: cannot borrow `x.0` as mutable more than once at a time
+ --> $DIR/borrow-tuple-fields.rs:48:18
+ |
+LL | let a = &mut x.0;
+ | --- first mutable borrow occurs here
+LL | let b = &mut x.0; //~ ERROR cannot borrow `x.0` as mutable more than once at a time
+ | ^^^ second mutable borrow occurs here
+LL | a.use_mut();
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0499, E0502, E0505.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr b/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr
new file mode 100644
index 0000000..0df5e0c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-access-permissions.ast.nll.stderr
@@ -0,0 +1,53 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-access-permissions.rs:22:19
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | let _y1 = &mut x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable static item `static_x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:28:19
+ |
+LL | let _y1 = &mut static_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
+ --> $DIR/borrowck-access-permissions.rs:37:19
+ |
+LL | let box_x = Box::new(1);
+ | ----- help: consider changing this to be mutable: `mut box_x`
+...
+LL | let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:46:19
+ |
+LL | let ref_x = &x;
+ | -- help: consider changing this to be a mutable reference: `&mut x`
+...
+LL | let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
+ --> $DIR/borrowck-access-permissions.rs:56:23
+ |
+LL | let ptr_x : *const _ = &x;
+ | -- help: consider changing this to be a mutable pointer: `&mut x`
+...
+LL | let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:66:18
+ |
+LL | let foo_ref = &foo;
+ | ---- help: consider changing this to be a mutable reference: `&mut foo`
+LL | let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389]
+ | ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr b/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr
new file mode 100644
index 0000000..b172456
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-access-permissions.ast.stderr
@@ -0,0 +1,46 @@
+error[E0596]: cannot borrow immutable local variable `x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:22:24
+ |
+LL | let x = 1;
+ | - consider changing this to `mut x`
+...
+LL | let _y1 = &mut x; //[ast]~ ERROR [E0596]
+ | ^ cannot borrow mutably
+
+error[E0596]: cannot borrow immutable static item as mutable
+ --> $DIR/borrowck-access-permissions.rs:28:24
+ |
+LL | let _y1 = &mut static_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^
+
+error[E0596]: cannot borrow immutable `Box` content `*box_x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:37:24
+ |
+LL | let box_x = Box::new(1);
+ | ----- consider changing this to `mut box_x`
+...
+LL | let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content `*ref_x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:46:24
+ |
+LL | let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable dereference of raw pointer `*ptr_x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:56:28
+ |
+LL | let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0389]: cannot borrow data mutably in a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:66:23
+ |
+LL | let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389]
+ | ^^^^^^^^^^ assignment into an immutable reference
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0389, E0596.
+For more information about an error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr b/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr
new file mode 100644
index 0000000..0df5e0c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-access-permissions.mir.stderr
@@ -0,0 +1,53 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-access-permissions.rs:22:19
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | let _y1 = &mut x; //[ast]~ ERROR [E0596]
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable static item `static_x` as mutable
+ --> $DIR/borrowck-access-permissions.rs:28:19
+ |
+LL | let _y1 = &mut static_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
+ --> $DIR/borrowck-access-permissions.rs:37:19
+ |
+LL | let box_x = Box::new(1);
+ | ----- help: consider changing this to be mutable: `mut box_x`
+...
+LL | let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:46:19
+ |
+LL | let ref_x = &x;
+ | -- help: consider changing this to be a mutable reference: `&mut x`
+...
+LL | let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
+ --> $DIR/borrowck-access-permissions.rs:56:23
+ |
+LL | let ptr_x : *const _ = &x;
+ | -- help: consider changing this to be a mutable pointer: `&mut x`
+...
+LL | let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596]
+ | ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
+
+error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-access-permissions.rs:66:18
+ |
+LL | let foo_ref = &foo;
+ | ---- help: consider changing this to be a mutable reference: `&mut foo`
+LL | let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389]
+ | ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-access-permissions.rs b/src/test/ui/borrowck/borrowck-access-permissions.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-access-permissions.rs
rename to src/test/ui/borrowck/borrowck-access-permissions.rs
diff --git a/src/test/ui/borrowck/borrowck-and-init.nll.stderr b/src/test/ui/borrowck/borrowck-and-init.nll.stderr
new file mode 100644
index 0000000..0b1b157
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-and-init.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `i`
+ --> $DIR/borrowck-and-init.rs:15:20
+ |
+LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ | ^ use of possibly uninitialized `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-and-init.rs b/src/test/ui/borrowck/borrowck-and-init.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-and-init.rs
rename to src/test/ui/borrowck/borrowck-and-init.rs
diff --git a/src/test/ui/borrowck/borrowck-and-init.stderr b/src/test/ui/borrowck/borrowck-and-init.stderr
new file mode 100644
index 0000000..2cbc57d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-and-init.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `i`
+ --> $DIR/borrowck-and-init.rs:15:20
+ |
+LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ | ^ use of possibly uninitialized `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr
new file mode 100644
index 0000000..0fe9106
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.nll.stderr
@@ -0,0 +1,40 @@
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-anon-fields-struct.rs:23:19
+ |
+LL | Y(ref mut a, _) => a
+ | --------- mutable borrow occurs here
+...
+LL | let b = match y {
+ | ^ immutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-anon-fields-struct.rs:38:19
+ |
+LL | Y(ref mut a, _) => a
+ | --------- mutable borrow occurs here
+...
+LL | let b = match y {
+ | ^ immutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+ --> $DIR/borrowck-anon-fields-struct.rs:39:11
+ |
+LL | Y(ref mut a, _) => a
+ | --------- first mutable borrow occurs here
+...
+LL | Y(ref mut b, _) => b //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-anon-fields-struct.rs b/src/test/ui/borrowck/borrowck-anon-fields-struct.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-anon-fields-struct.rs
rename to src/test/ui/borrowck/borrowck-anon-fields-struct.rs
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr
new file mode 100644
index 0000000..e635a23
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-anon-fields-struct.stderr
@@ -0,0 +1,15 @@
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+ --> $DIR/borrowck-anon-fields-struct.rs:39:11
+ |
+LL | Y(ref mut a, _) => a
+ | --------- first mutable borrow occurs here
+...
+LL | Y(ref mut b, _) => b //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr
new file mode 100644
index 0000000..015174a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.nll.stderr
@@ -0,0 +1,40 @@
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-anon-fields-tuple.rs:21:19
+ |
+LL | (ref mut a, _) => a
+ | --------- mutable borrow occurs here
+...
+LL | let b = match y {
+ | ^ immutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-anon-fields-tuple.rs:36:19
+ |
+LL | (ref mut a, _) => a
+ | --------- mutable borrow occurs here
+...
+LL | let b = match y {
+ | ^ immutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+ --> $DIR/borrowck-anon-fields-tuple.rs:37:10
+ |
+LL | (ref mut a, _) => a
+ | --------- first mutable borrow occurs here
+...
+LL | (ref mut b, _) => b //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-anon-fields-tuple.rs b/src/test/ui/borrowck/borrowck-anon-fields-tuple.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-anon-fields-tuple.rs
rename to src/test/ui/borrowck/borrowck-anon-fields-tuple.rs
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr
new file mode 100644
index 0000000..d05d1c3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-anon-fields-tuple.stderr
@@ -0,0 +1,15 @@
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+ --> $DIR/borrowck-anon-fields-tuple.rs:37:10
+ |
+LL | (ref mut a, _) => a
+ | --------- first mutable borrow occurs here
+...
+LL | (ref mut b, _) => b //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
new file mode 100644
index 0000000..e4b9f2f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.nll.stderr
@@ -0,0 +1,40 @@
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-anon-fields-variant.rs:26:19
+ |
+LL | Foo::Y(ref mut a, _) => a,
+ | --------- mutable borrow occurs here
+...
+LL | let b = match y {
+ | ^ immutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error[E0502]: cannot borrow `y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-anon-fields-variant.rs:43:19
+ |
+LL | Foo::Y(ref mut a, _) => a,
+ | --------- mutable borrow occurs here
+...
+LL | let b = match y {
+ | ^ immutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+ --> $DIR/borrowck-anon-fields-variant.rs:44:14
+ |
+LL | Foo::Y(ref mut a, _) => a,
+ | --------- first mutable borrow occurs here
+...
+LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+...
+LL | *a += 1;
+ | ------- borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-anon-fields-variant.rs b/src/test/ui/borrowck/borrowck-anon-fields-variant.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-anon-fields-variant.rs
rename to src/test/ui/borrowck/borrowck-anon-fields-variant.rs
diff --git a/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr
new file mode 100644
index 0000000..817d015
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-anon-fields-variant.stderr
@@ -0,0 +1,15 @@
+error[E0499]: cannot borrow `y.0` as mutable more than once at a time
+ --> $DIR/borrowck-anon-fields-variant.rs:44:14
+ |
+LL | Foo::Y(ref mut a, _) => a,
+ | --------- first mutable borrow occurs here
+...
+LL | Foo::Y(ref mut b, _) => b, //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-argument.nll.stderr b/src/test/ui/borrowck/borrowck-argument.nll.stderr
new file mode 100644
index 0000000..4470566
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-argument.nll.stderr
@@ -0,0 +1,35 @@
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-argument.rs:20:5
+ |
+LL | fn func(arg: S) {
+ | --- help: consider changing this to be mutable: `mut arg`
+LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ | ^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-argument.rs:25:9
+ |
+LL | fn method(&self, arg: S) {
+ | --- help: consider changing this to be mutable: `mut arg`
+LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ | ^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-argument.rs:31:9
+ |
+LL | fn default(&self, arg: S) {
+ | --- help: consider changing this to be mutable: `mut arg`
+LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ | ^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-argument.rs:42:17
+ |
+LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument
+ | --- ^^^ cannot borrow as mutable
+ | |
+ | help: consider changing this to be mutable: `mut arg`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-argument.rs b/src/test/ui/borrowck/borrowck-argument.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-argument.rs
rename to src/test/ui/borrowck/borrowck-argument.rs
diff --git a/src/test/ui/borrowck/borrowck-argument.stderr b/src/test/ui/borrowck/borrowck-argument.stderr
new file mode 100644
index 0000000..2a7a7b3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-argument.stderr
@@ -0,0 +1,35 @@
+error[E0596]: cannot borrow immutable argument `arg` as mutable
+ --> $DIR/borrowck-argument.rs:20:5
+ |
+LL | fn func(arg: S) {
+ | --- consider changing this to `mut arg`
+LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ | ^^^ cannot borrow mutably
+
+error[E0596]: cannot borrow immutable argument `arg` as mutable
+ --> $DIR/borrowck-argument.rs:25:9
+ |
+LL | fn method(&self, arg: S) {
+ | --- consider changing this to `mut arg`
+LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ | ^^^ cannot borrow mutably
+
+error[E0596]: cannot borrow immutable argument `arg` as mutable
+ --> $DIR/borrowck-argument.rs:31:9
+ |
+LL | fn default(&self, arg: S) {
+ | --- consider changing this to `mut arg`
+LL | arg.mutate(); //~ ERROR: cannot borrow immutable argument
+ | ^^^ cannot borrow mutably
+
+error[E0596]: cannot borrow immutable argument `arg` as mutable
+ --> $DIR/borrowck-argument.rs:42:17
+ |
+LL | (|arg: S| { arg.mutate() })(s); //~ ERROR: cannot borrow immutable argument
+ | --- ^^^ cannot borrow mutably
+ | |
+ | consider changing this to `mut arg`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr
new file mode 100644
index 0000000..6936d32
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-asm.ast.nll.stderr
@@ -0,0 +1,79 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:37:17
+ |
+LL | asm!("nop" : : "r"(x));
+ | - value moved here
+LL | }
+LL | let z = x; //[ast]~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-asm.rs:45:32
+ |
+LL | let y = &mut x;
+ | ------ borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use
+ | ^ use of borrowed `x`
+...
+LL | let z = y;
+ | - borrow later used here
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:54:13
+ |
+LL | let x = 3;
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | unsafe {
+LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:70:13
+ |
+LL | let x = 3;
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | unsafe {
+LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-asm.rs:78:13
+ |
+LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
+ | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `x`
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-asm.rs:87:13
+ |
+LL | let y = &*x;
+ | --- borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+...
+LL | let z = y;
+ | - borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:96:40
+ |
+LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0381, E0382, E0384, E0503, E0506.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-asm.ast.stderr b/src/test/ui/borrowck/borrowck-asm.ast.stderr
new file mode 100644
index 0000000..e2e54aa
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-asm.ast.stderr
@@ -0,0 +1,76 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:37:13
+ |
+LL | asm!("nop" : : "r"(x));
+ | - value moved here
+LL | }
+LL | let z = x; //[ast]~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-asm.rs:45:32
+ |
+LL | let y = &mut x;
+ | - borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use
+ | ^ use of borrowed `x`
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:54:13
+ |
+LL | let x = 3;
+ | - first assignment to `x`
+LL | unsafe {
+LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0506]: cannot assign to `a` because it is borrowed
+ --> $DIR/borrowck-asm.rs:60:13
+ |
+LL | let b = &*a;
+ | -- borrow of `a` occurs here
+LL | unsafe {
+LL | asm!("nop" : "=r"(a)); //[ast]~ ERROR cannot assign to `a` because it is borrowed
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `a` occurs here
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:70:13
+ |
+LL | let x = 3;
+ | - first assignment to `x`
+LL | unsafe {
+LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-asm.rs:78:32
+ |
+LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
+ | ^ use of possibly uninitialized `x`
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-asm.rs:87:13
+ |
+LL | let y = &*x;
+ | -- borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:96:40
+ |
+LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0381, E0382, E0384, E0503, E0506.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-asm.mir.stderr b/src/test/ui/borrowck/borrowck-asm.mir.stderr
new file mode 100644
index 0000000..6936d32
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-asm.mir.stderr
@@ -0,0 +1,79 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:37:17
+ |
+LL | asm!("nop" : : "r"(x));
+ | - value moved here
+LL | }
+LL | let z = x; //[ast]~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `&mut isize`, which does not implement the `Copy` trait
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-asm.rs:45:32
+ |
+LL | let y = &mut x;
+ | ------ borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : : "r"(x)); //[ast]~ ERROR cannot use
+ | ^ use of borrowed `x`
+...
+LL | let z = y;
+ | - borrow later used here
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:54:13
+ |
+LL | let x = 3;
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | unsafe {
+LL | asm!("nop" : "=r"(x)); //[ast]~ ERROR cannot assign twice
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-asm.rs:70:13
+ |
+LL | let x = 3;
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | unsafe {
+LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign twice
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-asm.rs:78:13
+ |
+LL | asm!("nop" : "=*r"(x)); //[ast]~ ERROR use of possibly uninitialized variable
+ | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `x`
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-asm.rs:87:13
+ |
+LL | let y = &*x;
+ | --- borrow of `x` occurs here
+LL | unsafe {
+LL | asm!("nop" : "+r"(x)); //[ast]~ ERROR cannot assign to `x` because it is borrowed
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+...
+LL | let z = y;
+ | - borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-asm.rs:96:40
+ |
+LL | asm!("nop" : : "r"(x), "r"(x) ); //[ast]~ ERROR use of moved value
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `x` has type `&mut i32`, which does not implement the `Copy` trait
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0381, E0382, E0384, E0503, E0506.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-asm.rs b/src/test/ui/borrowck/borrowck-asm.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-asm.rs
rename to src/test/ui/borrowck/borrowck-asm.rs
diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr
new file mode 100644
index 0000000..f4568d7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.nll.stderr
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-assign-comp-idx.rs:22:5
+ |
+LL | let q: &isize = &p[0];
+ | - immutable borrow occurs here
+LL |
+LL | p[0] = 5; //~ ERROR cannot borrow
+ | ^ mutable borrow occurs here
+LL |
+LL | println!("{}", *q);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-assign-comp-idx.rs:37:9
+ |
+LL | / borrow(
+LL | | &p,
+ | | -- immutable borrow occurs here
+LL | | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable
+ | |_________^^_-_______- borrow later used here
+ | | |
+ | | second borrow occurs due to use of `p` in closure
+ | mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-assign-comp-idx.rs b/src/test/ui/borrowck/borrowck-assign-comp-idx.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-assign-comp-idx.rs
rename to src/test/ui/borrowck/borrowck-assign-comp-idx.rs
diff --git a/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr
new file mode 100644
index 0000000..69a69b3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-comp-idx.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-assign-comp-idx.rs:22:5
+ |
+LL | let q: &isize = &p[0];
+ | - immutable borrow occurs here
+LL |
+LL | p[0] = 5; //~ ERROR cannot borrow
+ | ^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-assign-comp-idx.rs:37:9
+ |
+LL | &p,
+ | - immutable borrow occurs here
+LL | || p[0] = 5); //~ ERROR cannot borrow `p` as mutable
+ | ^^ - - immutable borrow ends here
+ | | |
+ | | borrow occurs due to use of `p` in closure
+ | mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr b/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr
new file mode 100644
index 0000000..2a1fbfd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-comp.ast.nll.stderr
@@ -0,0 +1,37 @@
+error[E0506]: cannot assign to `p.x` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:23:5
+ |
+LL | let q = &p;
+ | -- borrow of `p.x` occurs here
+...
+LL | p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
+ | ^^^^^^^ assignment to borrowed `p.x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed
+LL | q.x;
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `p` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:34:5
+ |
+LL | let q = &p.y;
+ | ---- borrow of `p` occurs here
+LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
+...
+LL | *q; // stretch loan
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `p.y` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:46:5
+ |
+LL | let q = &p.y;
+ | ---- borrow of `p.y` occurs here
+LL | p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
+ | ^^^^^^^ assignment to borrowed `p.y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed
+LL | *q;
+ | -- borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr b/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr
new file mode 100644
index 0000000..9e5e0e1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-comp.ast.stderr
@@ -0,0 +1,28 @@
+error[E0506]: cannot assign to `p.x` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:23:5
+ |
+LL | let q = &p;
+ | - borrow of `p.x` occurs here
+...
+LL | p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
+ | ^^^^^^^ assignment to borrowed `p.x` occurs here
+
+error[E0506]: cannot assign to `p` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:34:5
+ |
+LL | let q = &p.y;
+ | --- borrow of `p` occurs here
+LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
+
+error[E0506]: cannot assign to `p.y` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:46:5
+ |
+LL | let q = &p.y;
+ | --- borrow of `p.y` occurs here
+LL | p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
+ | ^^^^^^^ assignment to borrowed `p.y` occurs here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr b/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr
new file mode 100644
index 0000000..2a1fbfd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-comp.mir.stderr
@@ -0,0 +1,37 @@
+error[E0506]: cannot assign to `p.x` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:23:5
+ |
+LL | let q = &p;
+ | -- borrow of `p.x` occurs here
+...
+LL | p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
+ | ^^^^^^^ assignment to borrowed `p.x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed
+LL | q.x;
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `p` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:34:5
+ |
+LL | let q = &p.y;
+ | ---- borrow of `p` occurs here
+LL | p = point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
+ | ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
+...
+LL | *q; // stretch loan
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `p.y` because it is borrowed
+ --> $DIR/borrowck-assign-comp.rs:46:5
+ |
+LL | let q = &p.y;
+ | ---- borrow of `p.y` occurs here
+LL | p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
+ | ^^^^^^^ assignment to borrowed `p.y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed
+LL | *q;
+ | -- borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-assign-comp.rs b/src/test/ui/borrowck/borrowck-assign-comp.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-assign-comp.rs
rename to src/test/ui/borrowck/borrowck-assign-comp.rs
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr
new file mode 100644
index 0000000..eb4c1ff
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.nll.stderr
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference
+ --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:19:5
+ |
+LL | fn a(s: &S) {
+ | -- help: consider changing this to be a mutable reference: `&mut S<'_>`
+LL | *s.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
+
+error[E0594]: cannot assign to `*s.pointer` which is behind a `&` reference
+ --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:27:5
+ |
+LL | fn c(s: & &mut S) {
+ | -------- help: consider changing this to be a mutable reference: `&mut &mut S<'_>`
+LL | *s.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ `s` is a `&` reference, so the data it refers to cannot be written
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs
rename to src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.rs
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
new file mode 100644
index 0000000..4fb6598
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr
@@ -0,0 +1,19 @@
+error[E0389]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:19:5
+ |
+LL | fn a(s: &S) {
+ | -- use `&mut S` here to make mutable
+LL | *s.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ assignment into an immutable reference
+
+error[E0389]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:27:5
+ |
+LL | fn c(s: & &mut S) {
+ | -------- use `&mut &mut S` here to make mutable
+LL | *s.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ assignment into an immutable reference
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr
new file mode 100644
index 0000000..8ca7229
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.nll.stderr
@@ -0,0 +1,24 @@
+error[E0503]: cannot use `*y.pointer` because it was mutably borrowed
+ --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:28:9
+ |
+LL | let z = copy_borrowed_ptr(&mut y);
+ | ------ borrow of `y` occurs here
+LL | *y.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ use of borrowed `y`
+LL | *z.pointer += 1;
+ | --------------- borrow later used here
+
+error[E0506]: cannot assign to `*y.pointer` because it is borrowed
+ --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:28:9
+ |
+LL | let z = copy_borrowed_ptr(&mut y);
+ | ------ borrow of `*y.pointer` occurs here
+LL | *y.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+LL | *z.pointer += 1;
+ | --------------- borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0503, E0506.
+For more information about an error, try `rustc --explain E0503`.
diff --git a/src/test/compile-fail/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs
rename to src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.rs
diff --git a/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr
new file mode 100644
index 0000000..9a7c833
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-andmut-in-borrowed-loc.stderr
@@ -0,0 +1,11 @@
+error[E0506]: cannot assign to `*y.pointer` because it is borrowed
+ --> $DIR/borrowck-assign-to-andmut-in-borrowed-loc.rs:28:9
+ |
+LL | let z = copy_borrowed_ptr(&mut y);
+ | - borrow of `*y.pointer` occurs here
+LL | *y.pointer += 1; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^ assignment to borrowed `*y.pointer` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr
new file mode 100644
index 0000000..861fe2f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.nll.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item `foo`
+ --> $DIR/borrowck-assign-to-constants.rs:18:5
+ |
+LL | foo = 6; //[ast]~ ERROR cannot assign to immutable static item
+ | ^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr
new file mode 100644
index 0000000..09ddf83
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-constants.ast.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item
+ --> $DIR/borrowck-assign-to-constants.rs:18:5
+ |
+LL | foo = 6; //[ast]~ ERROR cannot assign to immutable static item
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr b/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr
new file mode 100644
index 0000000..861fe2f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-assign-to-constants.mir.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item `foo`
+ --> $DIR/borrowck-assign-to-constants.rs:18:5
+ |
+LL | foo = 6; //[ast]~ ERROR cannot assign to immutable static item
+ | ^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs b/src/test/ui/borrowck/borrowck-assign-to-constants.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-assign-to-constants.rs
rename to src/test/ui/borrowck/borrowck-assign-to-constants.rs
diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr
new file mode 100644
index 0000000..b41d5cd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:25:5
+ |
+LL | let x = Foo { x: 3 };
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.printme(); //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-auto-mut-ref-to-immut-var.rs b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-auto-mut-ref-to-immut-var.rs
rename to src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.rs
diff --git a/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
new file mode 100644
index 0000000..ca6b86e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-auto-mut-ref-to-immut-var.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `x` as mutable
+ --> $DIR/borrowck-auto-mut-ref-to-immut-var.rs:25:5
+ |
+LL | let x = Foo { x: 3 };
+ | - consider changing this to `mut x`
+LL | x.printme(); //~ ERROR cannot borrow
+ | ^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr
new file mode 100644
index 0000000..eb26676c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-autoref-3261.nll.stderr
@@ -0,0 +1,22 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-autoref-3261.rs:25:9
+ |
+LL | (&mut x).with(
+ | --------
+ | |
+ | _____first mutable borrow occurs here
+ | |
+LL | | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time
+ | | ^^^^^ second mutable borrow occurs here
+LL | | match opt {
+LL | | &Either::Right(ref f) => {
+LL | | x = X(Either::Left((0, 0)));
+ | | - second borrow occurs due to use of `x` in closure
+... |
+LL | | }
+LL | | })
+ | |__________- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-autoref-3261.rs b/src/test/ui/borrowck/borrowck-autoref-3261.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-autoref-3261.rs
rename to src/test/ui/borrowck/borrowck-autoref-3261.rs
diff --git a/src/test/ui/borrowck/borrowck-autoref-3261.stderr b/src/test/ui/borrowck/borrowck-autoref-3261.stderr
new file mode 100644
index 0000000..c9e649d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-autoref-3261.stderr
@@ -0,0 +1,17 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-autoref-3261.rs:25:9
+ |
+LL | (&mut x).with(
+ | - first mutable borrow occurs here
+LL | |opt| { //~ ERROR cannot borrow `x` as mutable more than once at a time
+ | ^^^^^ second mutable borrow occurs here
+...
+LL | x = X(Either::Left((0, 0)));
+ | - borrow occurs due to use of `x` in closure
+...
+LL | })
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr
new file mode 100644
index 0000000..73f533a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.nll.stderr
@@ -0,0 +1,25 @@
+error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-bad-nested-calls-free.rs:35:17
+ |
+LL | / add(
+LL | | &*a,
+ | | --- immutable borrow occurs here
+LL | | rewrite(&mut a)); //~ ERROR cannot borrow
+ | |_________________^^^^^^_- borrow later used here
+ | |
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-bad-nested-calls-free.rs:42:17
+ |
+LL | / add(
+LL | | &*a,
+ | | --- immutable borrow occurs here
+LL | | rewrite(&mut a)); //~ ERROR cannot borrow
+ | |_________________^^^^^^_- borrow later used here
+ | |
+ | mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-bad-nested-calls-free.rs b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-bad-nested-calls-free.rs
rename to src/test/ui/borrowck/borrowck-bad-nested-calls-free.rs
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr
new file mode 100644
index 0000000..461d2fe
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-free.stderr
@@ -0,0 +1,23 @@
+error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immutable
+ --> $DIR/borrowck-bad-nested-calls-free.rs:35:22
+ |
+LL | &*a,
+ | -- immutable borrow occurs here
+LL | rewrite(&mut a)); //~ ERROR cannot borrow
+ | ^ - immutable borrow ends here
+ | |
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `a` as mutable because `*a` is also borrowed as immutable
+ --> $DIR/borrowck-bad-nested-calls-free.rs:42:22
+ |
+LL | &*a,
+ | -- immutable borrow occurs here
+LL | rewrite(&mut a)); //~ ERROR cannot borrow
+ | ^ - immutable borrow ends here
+ | |
+ | mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr
new file mode 100644
index 0000000..ecb7006
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.nll.stderr
@@ -0,0 +1,25 @@
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/borrowck-bad-nested-calls-move.rs:35:9
+ |
+LL | / add(
+LL | | &*a,
+ | | --- borrow of `*a` occurs here
+LL | | a); //~ ERROR cannot move
+ | |_________^- borrow later used here
+ | |
+ | move out of `a` occurs here
+
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/borrowck-bad-nested-calls-move.rs:42:9
+ |
+LL | / add(
+LL | | &*a,
+ | | --- borrow of `*a` occurs here
+LL | | a); //~ ERROR cannot move
+ | |_________^- borrow later used here
+ | |
+ | move out of `a` occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/borrowck/borrowck-bad-nested-calls-move.rs b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-bad-nested-calls-move.rs
rename to src/test/ui/borrowck/borrowck-bad-nested-calls-move.rs
diff --git a/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr
new file mode 100644
index 0000000..7ed1f2c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-bad-nested-calls-move.stderr
@@ -0,0 +1,19 @@
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/borrowck-bad-nested-calls-move.rs:35:9
+ |
+LL | &*a,
+ | -- borrow of `*a` occurs here
+LL | a); //~ ERROR cannot move
+ | ^ move out of `a` occurs here
+
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/borrowck-bad-nested-calls-move.rs:42:9
+ |
+LL | &*a,
+ | -- borrow of `*a` occurs here
+LL | a); //~ ERROR cannot move
+ | ^ move out of `a` occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-block-unint.nll.stderr b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr
new file mode 100644
index 0000000..f3246c1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-block-unint.nll.stderr
@@ -0,0 +1,11 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-block-unint.rs:14:11
+ |
+LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x`
+ | ^^ use of possibly uninitialized `x`
+LL | println!("{}", x);
+ | - borrow occurs due to use in closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-block-unint.rs b/src/test/ui/borrowck/borrowck-block-unint.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-block-unint.rs
rename to src/test/ui/borrowck/borrowck-block-unint.rs
diff --git a/src/test/ui/borrowck/borrowck-block-unint.stderr b/src/test/ui/borrowck/borrowck-block-unint.stderr
new file mode 100644
index 0000000..53aa891
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-block-unint.stderr
@@ -0,0 +1,9 @@
+error[E0381]: capture of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-block-unint.rs:14:11
+ |
+LL | force(|| { //~ ERROR capture of possibly uninitialized variable: `x`
+ | ^^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr
new file mode 100644
index 0000000..08d66eb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.nll.stderr
@@ -0,0 +1,127 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:29:17
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- first mutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:36:17
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- mutable borrow occurs here
+LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:43:17
+ |
+LL | let bar1 = &foo.bar1;
+ | --------- immutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:72:11
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- mutable borrow occurs here
+LL | match *foo {
+ | ^^^^ immutable borrow occurs here
+...
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:21
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- first mutable borrow occurs here
+LL | match *foo {
+LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:82:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &*foo; //~ ERROR cannot borrow
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `*foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:83:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL | let _foo2 = &*foo; //~ ERROR cannot borrow
+ | ^^^^^ immutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:90:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ first mutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `*foo` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:97:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ first mutable borrow occurs here
+LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
+ | ^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:104:17
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | -------------- immutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `*foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:111:17
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | -------------- immutable borrow occurs here
+LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
+ | ^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:132:16
+ |
+LL | let foo = make_foo();
+ | --- help: consider changing this to be mutable: `mut foo`
+LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-from-owned-ptr.rs b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-from-owned-ptr.rs
rename to src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
new file mode 100644
index 0000000..9fc030f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-from-owned-ptr.stderr
@@ -0,0 +1,168 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:29:22
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:36:18
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- mutable borrow occurs here
+LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:43:22
+ |
+LL | let bar1 = &foo.bar1;
+ | -------- immutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - immutable borrow ends here
+
+error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:57:22
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here (via `foo.bar1`)
+LL | let _bar2 = &mut foo.bar2; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:64:42
+ |
+LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
+ | ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
+ | |
+ | first mutable borrow occurs here (via `foo.bar1`)
+LL | //~^ ERROR cannot borrow
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:21
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here
+LL | match *foo {
+LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:82:18
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:83:18
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL | let _foo2 = &*foo; //~ ERROR cannot borrow
+ | ^^^^ immutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:90:22
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `*foo` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:97:22
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here
+LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
+ | ^^^^ second mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:104:22
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | ------------- immutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:111:22
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | ------------- immutable borrow occurs here
+LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
+ | ^^^^ mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is also borrowed as mutable (via `foo.bar1`)
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:126:18
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- mutable borrow occurs here (via `foo.bar1`)
+LL | let _foo1 = &foo.bar2; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here (via `foo.bar2`)
+LL | *bar1;
+LL | }
+ | - mutable borrow ends here
+
+error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:132:21
+ |
+LL | let foo = make_foo();
+ | --- consider changing this to `mut foo`
+LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-owned-ptr.rs:139:21
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here (via `foo.bar1.int1`)
+LL | let foo1 = &mut foo.bar2.int2; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2.int2`)
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 15 previous errors
+
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr
new file mode 100644
index 0000000..8d1b9ca
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.nll.stderr
@@ -0,0 +1,127 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:28:17
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- first mutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:35:17
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- mutable borrow occurs here
+LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:42:17
+ |
+LL | let bar1 = &foo.bar1;
+ | --------- immutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:70:11
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- mutable borrow occurs here
+LL | match foo {
+ | ^^^ immutable borrow occurs here
+...
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:71:21
+ |
+LL | let bar1 = &mut foo.bar1;
+ | ------------- first mutable borrow occurs here
+LL | match foo {
+LL | Foo { bar1: ref mut _bar1, bar2: _ } => {} //
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:80:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &foo; //~ ERROR cannot borrow
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:81:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL | let _foo2 = &foo; //~ ERROR cannot borrow
+ | ^^^^ immutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:88:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ first mutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:95:17
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------------ first mutable borrow occurs here
+LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:102:17
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | -------------- immutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:109:17
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | -------------- immutable borrow occurs here
+LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+ | ----- borrow later used here
+
+error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:130:16
+ |
+LL | let foo = make_foo();
+ | --- help: consider changing this to be mutable: `mut foo`
+LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-from-stack-variable.rs b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-from-stack-variable.rs
rename to src/test/ui/borrowck/borrowck-borrow-from-stack-variable.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
new file mode 100644
index 0000000..cd0d6aa
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
@@ -0,0 +1,124 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:28:22
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:35:18
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- mutable borrow occurs here
+LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:42:22
+ |
+LL | let bar1 = &foo.bar1;
+ | -------- immutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - immutable borrow ends here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:71:21
+ |
+LL | let bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here
+LL | match foo {
+LL | Foo { bar1: ref mut _bar1, bar2: _ } => {} //
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:80:18
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:81:18
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL | let _foo2 = &foo; //~ ERROR cannot borrow
+ | ^^^ immutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:88:22
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:95:22
+ |
+LL | let bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here
+LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
+ | ^^^ second mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:102:22
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | ------------- immutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:109:22
+ |
+LL | let bar1 = &foo.bar1.int1;
+ | ------------- immutable borrow occurs here
+LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
+ | ^^^ mutable borrow occurs here
+LL | *bar1;
+LL | }
+ | - immutable borrow ends here
+
+error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
+ --> $DIR/borrowck-borrow-from-stack-variable.rs:130:21
+ |
+LL | let foo = make_foo();
+ | --- consider changing this to `mut foo`
+LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to 11 previous errors
+
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-from-temporary.rs b/src/test/ui/borrowck/borrowck-borrow-from-temporary.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-from-temporary.rs
rename to src/test/ui/borrowck/borrowck-borrow-from-temporary.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr
new file mode 100644
index 0000000..7dcfb3e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-from-temporary.stderr
@@ -0,0 +1,18 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/borrowck-borrow-from-temporary.rs:19:24
+ |
+LL | let &Foo(ref x) = &id(Foo(3)); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^ temporary value does not live long enough
+LL | x
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 18:8...
+ --> $DIR/borrowck-borrow-from-temporary.rs:18:8
+ |
+LL | fn foo<'a>() -> &'a isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr
new file mode 100644
index 0000000..c2b7d79
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `*a` as mutable, as `a` is not declared as mutable
+ --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:22:5
+ |
+LL | let a: Box<_> = box A;
+ | - help: consider changing this to be mutable: `mut a`
+LL | a.foo();
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
rename to src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
new file mode 100644
index 0000000..d852125
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-immut-deref-of-box-as-mut.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable `Box` content `*a` as mutable
+ --> $DIR/borrowck-borrow-immut-deref-of-box-as-mut.rs:22:5
+ |
+LL | let a: Box<_> = box A;
+ | - consider changing this to `mut a`
+LL | a.foo();
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr
new file mode 100644
index 0000000..8c30e6a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.nll.stderr
@@ -0,0 +1,31 @@
+error[E0594]: cannot assign to `**t1` which is behind a `&` reference
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:5
+ |
+LL | let t1 = t0;
+ | -- help: consider changing this to be a mutable reference: `&mut &mut isize`
+LL | let p: &isize = &**t0;
+LL | **t1 = 22; //~ ERROR cannot assign
+ | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written
+
+error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:24:21
+ |
+LL | let t1 = &mut *t0;
+ | -------- mutable borrow occurs here
+LL | let p: &isize = &**t0; //~ ERROR cannot borrow
+ | ^^^^^ immutable borrow occurs here
+LL | **t1 = 22;
+ | --------- borrow later used here
+
+error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:29:26
+ |
+LL | fn foo4(t0: & &mut isize) {
+ | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize`
+LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow
+ | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0502, E0594, E0596.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs
rename to src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
new file mode 100644
index 0000000..f90ffa8
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
@@ -0,0 +1,29 @@
+error[E0389]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:5
+ |
+LL | **t1 = 22; //~ ERROR cannot assign
+ | ^^^^^^^^^ assignment into an immutable reference
+
+error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:24:22
+ |
+LL | let t1 = &mut *t0;
+ | --- mutable borrow occurs here
+LL | let p: &isize = &**t0; //~ ERROR cannot borrow
+ | ^^^^ immutable borrow occurs here
+LL | **t1 = 22;
+LL | }
+ | - mutable borrow ends here
+
+error[E0389]: cannot borrow data mutably in a `&` reference
+ --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:29:31
+ |
+LL | fn foo4(t0: & &mut isize) {
+ | ------------ use `&mut &mut isize` here to make mutable
+LL | let x: &mut isize = &mut **t0; //~ ERROR cannot borrow
+ | ^^^^ assignment into an immutable reference
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0389, E0502.
+For more information about an error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr
new file mode 100644
index 0000000..9c3d0b1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.nll.stderr
@@ -0,0 +1,13 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-mut-object-twice.rs:23:5
+ |
+LL | let y = x.f1();
+ | - first mutable borrow occurs here
+LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable
+ | ^ second mutable borrow occurs here
+LL | y.use_ref();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs
new file mode 100644
index 0000000..63a6463
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.rs
@@ -0,0 +1,30 @@
+// Copyright 2012 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 `&mut` objects cannot be borrowed twice, just like
+// other `&mut` pointers.
+
+
+
+trait Foo {
+ fn f1(&mut self) -> &();
+ fn f2(&mut self);
+}
+
+fn test(x: &mut Foo) {
+ let y = x.f1();
+ x.f2(); //~ ERROR cannot borrow `*x` as mutable
+ y.use_ref();
+}
+
+fn main() {}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
new file mode 100644
index 0000000..de2fa8d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-mut-object-twice.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/borrowck-borrow-mut-object-twice.rs:23:5
+ |
+LL | let y = x.f1();
+ | - first mutable borrow occurs here
+LL | x.f2(); //~ ERROR cannot borrow `*x` as mutable
+ | ^ second mutable borrow occurs here
+LL | y.use_ref();
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr
new file mode 100644
index 0000000..522cdfd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.nll.stderr
@@ -0,0 +1,88 @@
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:57:19
+ |
+LL | let __isize = &mut x.y; //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:61:19
+ |
+LL | let __isize = &mut x.y; //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:69:5
+ |
+LL | &mut x.y //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:73:5
+ |
+LL | &mut x.y //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:77:5
+ |
+LL | x.y = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:81:5
+ |
+LL | x.y = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:85:5
+ |
+LL | x.y = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot assign
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:93:5
+ |
+LL | x.set(0, 0); //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:97:5
+ |
+LL | x.set(0, 0); //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:105:5
+ |
+LL | x.y_mut() //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:109:5
+ |
+LL | x.y_mut() //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:113:6
+ |
+LL | *x.y_mut() = 3; //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:117:6
+ |
+LL | *x.y_mut() = 3; //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:121:6
+ |
+LL | *x.y_mut() = 3; //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error: aborting due to 14 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-overloaded-auto-deref.rs b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-overloaded-auto-deref.rs
rename to src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
new file mode 100644
index 0000000..31563fb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-auto-deref.stderr
@@ -0,0 +1,88 @@
+error[E0596]: cannot borrow field of immutable binding as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:57:24
+ |
+LL | let __isize = &mut x.y; //~ ERROR cannot borrow
+ | ^^^ cannot mutably borrow field of immutable binding
+
+error[E0596]: cannot borrow field of immutable binding as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:61:24
+ |
+LL | let __isize = &mut x.y; //~ ERROR cannot borrow
+ | ^^^ cannot mutably borrow field of immutable binding
+
+error[E0596]: cannot borrow field of immutable binding as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:69:10
+ |
+LL | &mut x.y //~ ERROR cannot borrow
+ | ^^^ cannot mutably borrow field of immutable binding
+
+error[E0596]: cannot borrow field of immutable binding as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:73:10
+ |
+LL | &mut x.y //~ ERROR cannot borrow
+ | ^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field of immutable binding
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:77:5
+ |
+LL | x.y = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field of immutable binding
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:81:5
+ |
+LL | x.y = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field of immutable binding
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:85:5
+ |
+LL | x.y = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:93:5
+ |
+LL | x.set(0, 0); //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:97:5
+ |
+LL | x.set(0, 0); //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:105:5
+ |
+LL | x.y_mut() //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:109:5
+ |
+LL | x.y_mut() //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:113:6
+ |
+LL | *x.y_mut() = 3; //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:117:6
+ |
+LL | *x.y_mut() = 3; //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-auto-deref.rs:121:6
+ |
+LL | *x.y_mut() = 3; //~ ERROR cannot borrow
+ | ^ cannot borrow as mutable
+
+error: aborting due to 14 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr
new file mode 100644
index 0000000..1e8d81f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.nll.stderr
@@ -0,0 +1,46 @@
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:33:19
+ |
+LL | let __isize = &mut *x; //~ ERROR cannot borrow
+ | ^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:37:19
+ |
+LL | let __isize = &mut *x; //~ ERROR cannot borrow
+ | ^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:45:5
+ |
+LL | &mut **x //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:49:5
+ |
+LL | &mut **x //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:53:5
+ |
+LL | *x = 3; //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:57:5
+ |
+LL | **x = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:61:5
+ |
+LL | **x = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot assign
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrow-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrow-overloaded-deref.rs
rename to src/test/ui/borrowck/borrowck-borrow-overloaded-deref.rs
diff --git a/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr
new file mode 100644
index 0000000..641f943
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrow-overloaded-deref.stderr
@@ -0,0 +1,46 @@
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:33:24
+ |
+LL | let __isize = &mut *x; //~ ERROR cannot borrow
+ | ^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:37:24
+ |
+LL | let __isize = &mut *x; //~ ERROR cannot borrow
+ | ^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:45:10
+ |
+LL | &mut **x //~ ERROR cannot borrow
+ | ^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:49:10
+ |
+LL | &mut **x //~ ERROR cannot borrow
+ | ^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to immutable borrowed content
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:53:5
+ |
+LL | *x = 3; //~ ERROR cannot assign
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to immutable borrowed content
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:57:5
+ |
+LL | **x = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to immutable borrowed content
+ --> $DIR/borrowck-borrow-overloaded-deref.rs:61:5
+ |
+LL | **x = 3; //~ ERROR cannot assign
+ | ^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr
new file mode 100644
index 0000000..8f42fb4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.nll.stderr
@@ -0,0 +1,15 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20
+ |
+LL | let x = defer(&vec!["Goodbye", "world!"]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+LL | x.x[0];
+ | ------ borrow later used here
+ |
+ = 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: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
rename to src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.rs
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
new file mode 100644
index 0000000..890b289
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue-2.stderr
@@ -0,0 +1,17 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/borrowck-borrowed-uniq-rvalue-2.rs:32:20
+ |
+LL | let x = defer(&vec!["Goodbye", "world!"]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+LL | x.x[0];
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+ = 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: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr
new file mode 100644
index 0000000..04f74af
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.nll.stderr
@@ -0,0 +1,14 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/borrowck-borrowed-uniq-rvalue.rs:20:28
+ |
+LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+...
+LL | buggy_map.insert(43, &*tmp);
+ | --------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-borrowed-uniq-rvalue.rs
rename to src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.rs
diff --git a/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
new file mode 100644
index 0000000..7defd1e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-borrowed-uniq-rvalue.stderr
@@ -0,0 +1,16 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/borrowck-borrowed-uniq-rvalue.rs:20:27
+ |
+LL | buggy_map.insert(42, &*Box::new(1)); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^^^ - borrowed value dropped here while still borrowed
+ | |
+ | borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr
new file mode 100644
index 0000000..8c96183
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-break-uninit-2.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-break-uninit-2.rs:19:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-break-uninit-2.rs b/src/test/ui/borrowck/borrowck-break-uninit-2.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-break-uninit-2.rs
rename to src/test/ui/borrowck/borrowck-break-uninit-2.rs
diff --git a/src/test/ui/borrowck/borrowck-break-uninit-2.stderr b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
new file mode 100644
index 0000000..4d7d1a0
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-break-uninit-2.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-break-uninit-2.rs:19:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr
new file mode 100644
index 0000000..4441c72
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-break-uninit.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-break-uninit.rs:19:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-break-uninit.rs b/src/test/ui/borrowck/borrowck-break-uninit.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-break-uninit.rs
rename to src/test/ui/borrowck/borrowck-break-uninit.rs
diff --git a/src/test/ui/borrowck/borrowck-break-uninit.stderr b/src/test/ui/borrowck/borrowck-break-uninit.stderr
new file mode 100644
index 0000000..9d5a213
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-break-uninit.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-break-uninit.rs:19:20
+ |
+LL | println!("{}", x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr
new file mode 100644
index 0000000..f24d0ed
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.nll.stderr
@@ -0,0 +1,116 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:31:14
+ |
+LL | let c1 = || x = 4;
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:39:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:47:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:55:5
+ |
+LL | let c2 = || x * 5;
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(c2);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:63:5
+ |
+LL | let c1 = || get(&x);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `*x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:71:5
+ |
+LL | let c1 = || get(&*x);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `*x` occurs here
+LL | *x = 5; //[ast]~ ERROR cannot assign to `*x`
+ | ^^^^^^ assignment to borrowed `*x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `*x` because it is borrowed
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `*x.f` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:83:5
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `*x.f` occurs here
+LL | *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
+ | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
+LL | //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:95:14
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0502, E0506.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr
new file mode 100644
index 0000000..628fbbd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.ast.stderr
@@ -0,0 +1,96 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:31:14
+ |
+LL | let c1 = || x = 4;
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:39:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:47:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:55:5
+ |
+LL | let c2 = || x * 5;
+ | -- borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:63:5
+ |
+LL | let c1 = || get(&x);
+ | -- borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+
+error[E0506]: cannot assign to `*x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:71:5
+ |
+LL | let c1 = || get(&*x);
+ | -- borrow of `*x` occurs here
+LL | *x = 5; //[ast]~ ERROR cannot assign to `*x`
+ | ^^^^^^ assignment to borrowed `*x` occurs here
+
+error[E0506]: cannot assign to `*x.f` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:83:5
+ |
+LL | let c1 = || get(&*x.f);
+ | -- borrow of `*x.f` occurs here
+LL | *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
+ | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:95:14
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0502, E0506.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr
new file mode 100644
index 0000000..f24d0ed
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.mir.stderr
@@ -0,0 +1,116 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:31:14
+ |
+LL | let c1 = || x = 4;
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:39:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || get(&x); //[ast]~ ERROR cannot borrow `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:47:14
+ |
+LL | let c1 = || set(&mut x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | let c2 = || x * 5; //[ast]~ ERROR cannot borrow `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:55:5
+ |
+LL | let c2 = || x * 5;
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(c2);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:63:5
+ |
+LL | let c1 = || get(&x);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `*x` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:71:5
+ |
+LL | let c1 = || get(&*x);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `*x` occurs here
+LL | *x = 5; //[ast]~ ERROR cannot assign to `*x`
+ | ^^^^^^ assignment to borrowed `*x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `*x` because it is borrowed
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `*x.f` because it is borrowed
+ --> $DIR/borrowck-closures-mut-and-imm.rs:83:5
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - borrow occurs due to use in closure
+ | |
+ | borrow of `*x.f` occurs here
+LL | *x.f = 5; //[ast]~ ERROR cannot assign to `*x.f`
+ | ^^^^^^^^ assignment to borrowed `*x.f` occurs here
+LL | //[mir]~^ ERROR cannot assign to `*x.f` because it is borrowed
+LL | drop(c1);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-closures-mut-and-imm.rs:95:14
+ |
+LL | let c1 = || get(&*x.f);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | immutable borrow occurs here
+LL | let c2 = || *x.f = 5; //[ast]~ ERROR cannot borrow `x` as mutable
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as mutable because it is also borrowed as immutable
+LL | drop(c1);
+ | -- borrow later used here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0502, E0506.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-closures-mut-and-imm.rs
rename to src/test/ui/borrowck/borrowck-closures-mut-and-imm.rs
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
new file mode 100644
index 0000000..e8fae63
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.nll.stderr
@@ -0,0 +1,15 @@
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-closures-mut-of-imm.rs:23:21
+ |
+LL | let c1 = || set(&mut *x);
+ | ^^^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-closures-mut-of-imm.rs:25:21
+ |
+LL | let c2 = || set(&mut *x);
+ | ^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-mut-of-imm.rs b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-closures-mut-of-imm.rs
rename to src/test/ui/borrowck/borrowck-closures-mut-of-imm.rs
diff --git a/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
new file mode 100644
index 0000000..87eb52b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-mut-of-imm.stderr
@@ -0,0 +1,32 @@
+error[E0524]: two closures require unique access to `x` at the same time
+ --> $DIR/borrowck-closures-mut-of-imm.rs:25:14
+ |
+LL | let c1 = || set(&mut *x);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first closure is constructed here
+LL | //~^ ERROR cannot borrow
+LL | let c2 = || set(&mut *x);
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second closure is constructed here
+...
+LL | }
+ | - borrow from first closure ends here
+
+error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
+ --> $DIR/borrowck-closures-mut-of-imm.rs:23:26
+ |
+LL | let c1 = || set(&mut *x);
+ | ^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow immutable borrowed content `***x` as mutable
+ --> $DIR/borrowck-closures-mut-of-imm.rs:25:26
+ |
+LL | let c2 = || set(&mut *x);
+ | ^^ cannot borrow as mutable
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0524, E0596.
+For more information about an error, try `rustc --explain E0524`.
diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr
new file mode 100644
index 0000000..c96799c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.nll.stderr
@@ -0,0 +1,75 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:26:24
+ |
+LL | let c1 = to_fn_mut(|| x = 4);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | c1;
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:37:24
+ |
+LL | let c1 = to_fn_mut(|| set(&mut x));
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | c1;
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:44:24
+ |
+LL | let c1 = to_fn_mut(|| x = 5);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | c1;
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:51:24
+ |
+LL | let c1 = to_fn_mut(|| x = 5);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | //~^ ERROR cannot borrow `x` as mutable more than once
+LL | c1;
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:63:24
+ |
+LL | let c1 = to_fn_mut(|| set(&mut *x.f));
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| set(&mut *x.f));
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | //~^ ERROR cannot borrow `x` as mutable more than once
+LL | c1;
+ | -- borrow later used here
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs
new file mode 100644
index 0000000..66ebd34
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.rs
@@ -0,0 +1,69 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that two closures cannot simultaneously have mutable
+// access to the variable, whether that mutable access be used
+// for direct assignment or for taking mutable ref. Issue #6801.
+
+#![feature(box_syntax)]
+
+
+
+
+
+fn to_fn_mut<F: FnMut()>(f: F) -> F { f }
+
+fn a() {
+ let mut x = 3;
+ let c1 = to_fn_mut(|| x = 4);
+ let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
+ c1;
+}
+
+fn set(x: &mut isize) {
+ *x = 4;
+}
+
+fn b() {
+ let mut x = 3;
+ let c1 = to_fn_mut(|| set(&mut x));
+ let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
+ c1;
+}
+
+fn c() {
+ let mut x = 3;
+ let c1 = to_fn_mut(|| x = 5);
+ let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
+ c1;
+}
+
+fn d() {
+ let mut x = 3;
+ let c1 = to_fn_mut(|| x = 5);
+ let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
+ //~^ ERROR cannot borrow `x` as mutable more than once
+ c1;
+}
+
+fn g() {
+ struct Foo {
+ f: Box<isize>
+ }
+
+ let mut x: Box<_> = box Foo { f: box 3 };
+ let c1 = to_fn_mut(|| set(&mut *x.f));
+ let c2 = to_fn_mut(|| set(&mut *x.f));
+ //~^ ERROR cannot borrow `x` as mutable more than once
+ c1;
+}
+
+fn main() {
+}
diff --git a/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr
new file mode 100644
index 0000000..59104cc
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-two-mut-fail.stderr
@@ -0,0 +1,78 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:26:24
+ |
+LL | let c1 = to_fn_mut(|| x = 4);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| x = 5); //~ ERROR cannot borrow `x` as mutable more than once
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | c1;
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:37:24
+ |
+LL | let c1 = to_fn_mut(|| set(&mut x));
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | c1;
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:44:24
+ |
+LL | let c1 = to_fn_mut(|| x = 5);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| set(&mut x)); //~ ERROR cannot borrow `x` as mutable more than once
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+LL | c1;
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:51:24
+ |
+LL | let c1 = to_fn_mut(|| x = 5);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| { let _y = to_fn_mut(|| set(&mut x)); }); // (nested closure)
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-closures-two-mut-fail.rs:63:24
+ |
+LL | let c1 = to_fn_mut(|| set(&mut *x.f));
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first mutable borrow occurs here
+LL | let c2 = to_fn_mut(|| set(&mut *x.f));
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr
new file mode 100644
index 0000000..b8f1757
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.nll.stderr
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-closures-unique-imm.rs:23:9
+ |
+LL | let p = &this.x;
+ | ------- immutable borrow occurs here
+LL | &mut this.x; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^ mutable borrow occurs here
+LL | p.use_ref();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.rs b/src/test/ui/borrowck/borrowck-closures-unique-imm.rs
new file mode 100644
index 0000000..c4b15a9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.rs
@@ -0,0 +1,30 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+
+struct Foo {
+ x: isize,
+}
+
+pub fn main() {
+ let mut this = &mut Foo {
+ x: 1,
+ };
+ let mut r = || {
+ let p = &this.x;
+ &mut this.x; //~ ERROR cannot borrow
+ p.use_ref();
+ };
+ r()
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr
new file mode 100644
index 0000000..5ab9685
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-unique-imm.stderr
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `this.x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-closures-unique-imm.rs:23:14
+ |
+LL | let p = &this.x;
+ | ------ immutable borrow occurs here
+LL | &mut this.x; //~ ERROR cannot borrow
+ | ^^^^^^ mutable borrow occurs here
+LL | p.use_ref();
+LL | };
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr
new file mode 100644
index 0000000..17519cc
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-unique.nll.stderr
@@ -0,0 +1,54 @@
+error[E0500]: closure requires unique access to `x` but it is already borrowed
+ --> $DIR/borrowck-closures-unique.rs:36:14
+ |
+LL | let c1 = || get(x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | borrow occurs here
+LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | closure construction occurs here
+LL | c1;
+ | -- borrow later used here
+
+error[E0500]: closure requires unique access to `x` but it is already borrowed
+ --> $DIR/borrowck-closures-unique.rs:42:14
+ |
+LL | let c1 = || get(x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | borrow occurs here
+LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | closure construction occurs here
+LL | c1;
+ | -- borrow later used here
+
+error[E0524]: two closures require unique access to `x` at the same time
+ --> $DIR/borrowck-closures-unique.rs:48:14
+ |
+LL | let c1 = || set(x);
+ | -- - first borrow occurs due to use of `x` in closure
+ | |
+ | first closure is constructed here
+LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
+ | ^^ - second borrow occurs due to use of `x` in closure
+ | |
+ | second closure is constructed here
+LL | c1;
+ | -- borrow later used here
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/borrowck-closures-unique.rs:57:38
+ |
+LL | fn e(x: &'static mut isize) {
+ | - help: consider changing this to be mutable: `mut x`
+LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument
+ | ^^^^^ cannot assign
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0500, E0524, E0594.
+For more information about an error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-closures-unique.rs b/src/test/ui/borrowck/borrowck-closures-unique.rs
new file mode 100644
index 0000000..caf5785
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-unique.rs
@@ -0,0 +1,67 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Tests that a closure which requires mutable access to the referent
+// of an `&mut` requires a "unique" borrow -- that is, the variable to
+// be borrowed (here, `x`) will not be borrowed *mutably*, but
+// may be *immutable*, but we cannot allow
+// multiple borrows.
+
+
+
+fn get(x: &isize) -> isize {
+ *x
+}
+
+fn set(x: &mut isize) -> isize {
+ *x
+}
+
+fn a(x: &mut isize) {
+ let c1 = || get(x);
+ let c2 = || get(x);
+ c1();
+ c2();
+}
+
+fn b(x: &mut isize) {
+ let c1 = || get(x);
+ let c2 = || set(x); //~ ERROR closure requires unique access to `x`
+ c1;
+}
+
+fn c(x: &mut isize) {
+ let c1 = || get(x);
+ let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
+ c1;
+}
+
+fn d(x: &mut isize) {
+ let c1 = || set(x);
+ let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
+ c1;
+}
+
+// This test was originally encoded in the form shown as `fn f` below.
+// However, since MIR-borrowck and thus NLL takes more control-flow information
+// into account, it was necessary to change the test in order to witness the
+// same (expected) error under both AST-borrowck and NLL.
+fn e(x: &'static mut isize) {
+ let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument
+ c1;
+}
+
+fn f(x: &'static mut isize) {
+ let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
+ c1;
+}
+
+fn main() {
+}
diff --git a/src/test/ui/borrowck/borrowck-closures-unique.stderr b/src/test/ui/borrowck/borrowck-closures-unique.stderr
new file mode 100644
index 0000000..cfcb81b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-unique.stderr
@@ -0,0 +1,69 @@
+error[E0500]: closure requires unique access to `x` but it is already borrowed
+ --> $DIR/borrowck-closures-unique.rs:36:14
+ |
+LL | let c1 = || get(x);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | borrow occurs here
+LL | let c2 = || set(x); //~ ERROR closure requires unique access to `x`
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | closure construction occurs here
+LL | c1;
+LL | }
+ | - borrow ends here
+
+error[E0500]: closure requires unique access to `x` but it is already borrowed
+ --> $DIR/borrowck-closures-unique.rs:42:14
+ |
+LL | let c1 = || get(x);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | borrow occurs here
+LL | let c2 = || { get(x); set(x); }; //~ ERROR closure requires unique access to `x`
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | closure construction occurs here
+LL | c1;
+LL | }
+ | - borrow ends here
+
+error[E0524]: two closures require unique access to `x` at the same time
+ --> $DIR/borrowck-closures-unique.rs:48:14
+ |
+LL | let c1 = || set(x);
+ | -- - previous borrow occurs due to use of `x` in closure
+ | |
+ | first closure is constructed here
+LL | let c2 = || set(x); //~ ERROR two closures require unique access to `x` at the same time
+ | ^^ - borrow occurs due to use of `x` in closure
+ | |
+ | second closure is constructed here
+LL | c1;
+LL | }
+ | - borrow from first closure ends here
+
+error[E0595]: closure cannot assign to immutable argument `x`
+ --> $DIR/borrowck-closures-unique.rs:57:14
+ |
+LL | let c1 = |y: &'static mut isize| x = y; //~ ERROR closure cannot assign to immutable argument
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow mutably
+help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
+ |
+LL | x //~ ERROR closure cannot assign to immutable argument
+ | ^
+
+error[E0595]: closure cannot assign to immutable argument `x`
+ --> $DIR/borrowck-closures-unique.rs:62:14
+ |
+LL | let c1 = || x = panic!(); //~ ERROR closure cannot assign to immutable argument
+ | ^^ cannot borrow mutably
+help: consider removing the `&mut`, as it is an immutable binding to a mutable reference
+ |
+LL | x //~ ERROR closure cannot assign to immutable argument
+ | ^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0500, E0524, E0595.
+For more information about an error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr
new file mode 100644
index 0000000..dc73929
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.nll.stderr
@@ -0,0 +1,17 @@
+error[E0502]: cannot borrow `*ptr` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-closures-use-after-free.rs:32:8
+ |
+LL | let mut test = |foo: &Foo| {
+ | ----------- mutable borrow occurs here
+LL | ptr = box Foo { x: ptr.x + 1 };
+ | --- first borrow occurs due to use of `ptr` in closure
+LL | };
+LL | test(&*ptr); //~ ERROR cannot borrow `*ptr`
+ | -----^^^^^-
+ | | |
+ | | immutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-closures-use-after-free.rs b/src/test/ui/borrowck/borrowck-closures-use-after-free.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-closures-use-after-free.rs
rename to src/test/ui/borrowck/borrowck-closures-use-after-free.rs
diff --git a/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr
new file mode 100644
index 0000000..7beb31f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-closures-use-after-free.stderr
@@ -0,0 +1,16 @@
+error[E0502]: cannot borrow `*ptr` as immutable because `ptr` is also borrowed as mutable
+ --> $DIR/borrowck-closures-use-after-free.rs:32:9
+ |
+LL | let mut test = |foo: &Foo| {
+ | ----------- mutable borrow occurs here
+LL | ptr = box Foo { x: ptr.x + 1 };
+ | --- previous borrow occurs due to use of `ptr` in closure
+LL | };
+LL | test(&*ptr); //~ ERROR cannot borrow `*ptr`
+ | ^^^^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-consume-unsize-vec.rs b/src/test/ui/borrowck/borrowck-consume-unsize-vec.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-consume-unsize-vec.rs
rename to src/test/ui/borrowck/borrowck-consume-unsize-vec.rs
diff --git a/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr
new file mode 100644
index 0000000..8199ce7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-consume-unsize-vec.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `b`
+ --> $DIR/borrowck-consume-unsize-vec.rs:18:13
+ |
+LL | consume(b);
+ | - value moved here
+LL | consume(b); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `b` has type `std::boxed::Box<[i32; 5]>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr
new file mode 100644
index 0000000..b999e09
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `b`
+ --> $DIR/borrowck-consume-upcast-box.rs:20:13
+ |
+LL | consume(b);
+ | - value moved here
+LL | consume(b); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `b` has type `std::boxed::Box<dyn Foo + std::marker::Send>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-consume-upcast-box.rs b/src/test/ui/borrowck/borrowck-consume-upcast-box.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-consume-upcast-box.rs
rename to src/test/ui/borrowck/borrowck-consume-upcast-box.rs
diff --git a/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr
new file mode 100644
index 0000000..159933a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-consume-upcast-box.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `b`
+ --> $DIR/borrowck-consume-upcast-box.rs:20:13
+ |
+LL | consume(b);
+ | - value moved here
+LL | consume(b); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `b` has type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr
new file mode 100644
index 0000000..ae706ef
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.nll.stderr
@@ -0,0 +1,540 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:295:13
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+ | ^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+LL | *y = 1;
+ | ------ borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:307:20
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+ | ^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+LL | *y = 1;
+ | ------ borrow later used here
+
+error: unsatisfied lifetime constraints
+ --> $DIR/borrowck-describe-lvalue.rs:305:16
+ |
+LL | || {
+ | --
+ | ||
+ | |return type of closure is [closure@$DIR/borrowck-describe-lvalue.rs:305:16: 311:18 x:&'2 mut i32]
+ | lifetime `'1` represents this closure's body
+LL | / || { //[mir]~ ERROR unsatisfied lifetime constraints
+LL | | let y = &mut x;
+LL | | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+LL | | //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+LL | | *y = 1;
+LL | | drop(y);
+LL | | }
+ | |_________________^ returning this value requires that `'1` must outlive `'2`
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:53:9
+ |
+LL | let x = f.x();
+ | - borrow of `f` occurs here
+LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
+ | ^^^ use of borrowed `f`
+LL | //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:61:9
+ |
+LL | let x = g.x();
+ | - borrow of `g` occurs here
+LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
+ | ^^^ use of borrowed `g`
+LL | //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:69:9
+ |
+LL | let x = &mut h.0;
+ | -------- borrow of `h.0` occurs here
+LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
+ | ^^^ use of borrowed `h.0`
+LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:77:15
+ |
+LL | let x = e.x();
+ | - borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+ | ^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:78:20
+ |
+LL | let x = e.x();
+ | - borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:88:9
+ |
+LL | let x = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:96:9
+ |
+LL | let x = f.x();
+ | - borrow of `*f` occurs here
+LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
+ | ^^^ use of borrowed `*f`
+LL | //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:104:9
+ |
+LL | let x = g.x();
+ | - borrow of `*g` occurs here
+LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
+ | ^^^ use of borrowed `*g`
+LL | //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:112:9
+ |
+LL | let x = &mut h.0;
+ | -------- borrow of `h.0` occurs here
+LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
+ | ^^^ use of borrowed `h.0`
+LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `*e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:120:15
+ |
+LL | let x = e.x();
+ | - borrow of `*e` occurs here
+LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
+ | ^^ use of borrowed `*e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:121:20
+ |
+LL | let x = e.x();
+ | - borrow of `*e` occurs here
+LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `*e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:131:9
+ |
+LL | let x = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:139:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:140:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[x, _, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:145:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:146:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:151:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:152:25
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, _, .., x, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:157:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:158:28
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, _, .., _, x] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:169:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:170:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:175:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:176:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:181:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:182:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:187:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:188:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:201:15
+ |
+LL | let x = &mut e;
+ | ------ borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+ | ^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:202:13
+ |
+LL | let x = &mut e;
+ | ------ borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | E::A(ref ax) =>
+ | ^^^^^^^^^^^^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:202:18
+ |
+LL | let x = &mut e;
+ | ------ mutable borrow occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | E::A(ref ax) =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:207:23
+ |
+LL | let x = &mut e;
+ | ------ mutable borrow occurs here
+...
+LL | E::B { x: ref bx } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `s` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:220:15
+ |
+LL | let x = &mut s;
+ | ------ borrow of `s` occurs here
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+ | ^ use of borrowed `s`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:221:22
+ |
+LL | let x = &mut s;
+ | ------ mutable borrow occurs here
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+LL | S { y: (ref y0, _), .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `s` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:227:15
+ |
+LL | let x = &mut s;
+ | ------ borrow of `s` occurs here
+...
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+ | ^ use of borrowed `s`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:228:28
+ |
+LL | let x = &mut s;
+ | ------ mutable borrow occurs here
+...
+LL | S { x: F { y: ref x0, .. }, .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `*v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:271:9
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..].y` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:271:9
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^^^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:282:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:283:24
+ |
+LL | let x = &mut v;
+ | ------ mutable borrow occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:245:29
+ |
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p: &'a u8 = &*block.current;
+ | ^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:260:33
+ |
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p : *const u8 = &*(*block).current;
+ | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-describe-lvalue.rs:318:22
+ |
+LL | drop(x);
+ | - value moved here
+LL | drop(x); //[ast]~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 46 previous errors
+
+Some errors occurred: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr
new file mode 100644
index 0000000..ca9b2dd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-describe-lvalue.ast.stderr
@@ -0,0 +1,246 @@
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:53:9
+ |
+LL | let x = f.x();
+ | - borrow of `f` occurs here
+LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
+ | ^^^ use of borrowed `f`
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:61:9
+ |
+LL | let x = g.x();
+ | - borrow of `g` occurs here
+LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
+ | ^^^ use of borrowed `g`
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:69:9
+ |
+LL | let x = &mut h.0;
+ | --- borrow of `h.0` occurs here
+LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
+ | ^^^ use of borrowed `h.0`
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:78:20
+ |
+LL | let x = e.x();
+ | - borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `e`
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:88:9
+ |
+LL | let x = &mut u.a;
+ | --- borrow of `u.a` occurs here
+LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:96:9
+ |
+LL | let x = f.x();
+ | - borrow of `*f` occurs here
+LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
+ | ^^^ use of borrowed `*f`
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:104:9
+ |
+LL | let x = g.x();
+ | - borrow of `*g` occurs here
+LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
+ | ^^^ use of borrowed `*g`
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:112:9
+ |
+LL | let x = &mut h.0;
+ | --- borrow of `h.0` occurs here
+LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
+ | ^^^ use of borrowed `h.0`
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:121:20
+ |
+LL | let x = e.x();
+ | - borrow of `*e` occurs here
+LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `*e`
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:131:9
+ |
+LL | let x = &mut u.a;
+ | --- borrow of `u.a` occurs here
+LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:140:15
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[x, _, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:146:18
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+...
+LL | &[_, x, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:152:25
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+...
+LL | &[_, _, .., x, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:158:28
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+...
+LL | &[_, _, .., _, x] => println!("{}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:170:15
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:176:18
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+...
+LL | &[_, x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:182:15
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+...
+LL | &[x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:188:18
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+...
+LL | &[_, x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+
+error[E0502]: cannot borrow `e.0` as immutable because `e` is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:202:18
+ |
+LL | let x = &mut e;
+ | - mutable borrow occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | E::A(ref ax) =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `e.x` as immutable because `e` is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:207:23
+ |
+LL | let x = &mut e;
+ | - mutable borrow occurs here
+...
+LL | E::B { x: ref bx } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `s.y.0` as immutable because `s` is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:221:22
+ |
+LL | let x = &mut s;
+ | - mutable borrow occurs here
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+LL | S { y: (ref y0, _), .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `s.x.y` as immutable because `s` is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:228:28
+ |
+LL | let x = &mut s;
+ | - mutable borrow occurs here
+...
+LL | S { x: F { y: ref x0, .. }, .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0503]: cannot use `v[..].y` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:271:9
+ |
+LL | let x = &mut v;
+ | - borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^^^ use of borrowed `v`
+
+error[E0499]: cannot borrow `**x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:295:18
+ |
+LL | let y = &mut x;
+ | - first mutable borrow occurs here
+LL | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+ | ^ second mutable borrow occurs here
+...
+LL | };
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `**x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:307:25
+ |
+LL | let y = &mut x;
+ | - first mutable borrow occurs here
+LL | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+ | ^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-describe-lvalue.rs:318:22
+ |
+LL | drop(x);
+ | - value moved here
+LL | drop(x); //[ast]~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 26 previous errors
+
+Some errors occurred: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr
new file mode 100644
index 0000000..ae706ef
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-describe-lvalue.mir.stderr
@@ -0,0 +1,540 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:295:13
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+ | ^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+LL | *y = 1;
+ | ------ borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-describe-lvalue.rs:307:20
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+ | ^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+LL | *y = 1;
+ | ------ borrow later used here
+
+error: unsatisfied lifetime constraints
+ --> $DIR/borrowck-describe-lvalue.rs:305:16
+ |
+LL | || {
+ | --
+ | ||
+ | |return type of closure is [closure@$DIR/borrowck-describe-lvalue.rs:305:16: 311:18 x:&'2 mut i32]
+ | lifetime `'1` represents this closure's body
+LL | / || { //[mir]~ ERROR unsatisfied lifetime constraints
+LL | | let y = &mut x;
+LL | | &mut x; //[ast]~ ERROR cannot borrow `**x` as mutable more than once at a time
+LL | | //[mir]~^ ERROR cannot borrow `x` as mutable more than once at a time
+LL | | *y = 1;
+LL | | drop(y);
+LL | | }
+ | |_________________^ returning this value requires that `'1` must outlive `'2`
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:53:9
+ |
+LL | let x = f.x();
+ | - borrow of `f` occurs here
+LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
+ | ^^^ use of borrowed `f`
+LL | //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:61:9
+ |
+LL | let x = g.x();
+ | - borrow of `g` occurs here
+LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
+ | ^^^ use of borrowed `g`
+LL | //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:69:9
+ |
+LL | let x = &mut h.0;
+ | -------- borrow of `h.0` occurs here
+LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
+ | ^^^ use of borrowed `h.0`
+LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:77:15
+ |
+LL | let x = e.x();
+ | - borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+ | ^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:78:20
+ |
+LL | let x = e.x();
+ | - borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:88:9
+ |
+LL | let x = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `f.x` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:96:9
+ |
+LL | let x = f.x();
+ | - borrow of `*f` occurs here
+LL | f.x; //[ast]~ ERROR cannot use `f.x` because it was mutably borrowed
+ | ^^^ use of borrowed `*f`
+LL | //[mir]~^ ERROR cannot use `f.x` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `g.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:104:9
+ |
+LL | let x = g.x();
+ | - borrow of `*g` occurs here
+LL | g.0; //[ast]~ ERROR cannot use `g.0` because it was mutably borrowed
+ | ^^^ use of borrowed `*g`
+LL | //[mir]~^ ERROR cannot use `g.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `h.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:112:9
+ |
+LL | let x = &mut h.0;
+ | -------- borrow of `h.0` occurs here
+LL | h.0; //[ast]~ ERROR cannot use `h.0` because it was mutably borrowed
+ | ^^^ use of borrowed `h.0`
+LL | //[mir]~^ ERROR cannot use `h.0` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `*e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:120:15
+ |
+LL | let x = e.x();
+ | - borrow of `*e` occurs here
+LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
+ | ^^ use of borrowed `*e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e.0` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:121:20
+ |
+LL | let x = e.x();
+ | - borrow of `*e` occurs here
+LL | match *e { //[mir]~ ERROR cannot use `*e` because it was mutably borrowed
+LL | Baz::X(value) => value
+ | ^^^^^ use of borrowed `*e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:131:9
+ |
+LL | let x = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:139:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:140:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[x, _, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:145:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:146:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x, .., _, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:151:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:152:25
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, _, .., x, _] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:157:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:158:28
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, _, .., _, x] => println!("{}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:169:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:170:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:175:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:176:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x..] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:181:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:182:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:187:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..]` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:188:18
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+...
+LL | &[_, x.., _] => println!("{:?}", x),
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:201:15
+ |
+LL | let x = &mut e;
+ | ------ borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+ | ^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `e` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:202:13
+ |
+LL | let x = &mut e;
+ | ------ borrow of `e` occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | E::A(ref ax) =>
+ | ^^^^^^^^^^^^ use of borrowed `e`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `e.0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:202:18
+ |
+LL | let x = &mut e;
+ | ------ mutable borrow occurs here
+LL | match e { //[mir]~ ERROR cannot use `e` because it was mutably borrowed
+LL | E::A(ref ax) =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `e.x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:207:23
+ |
+LL | let x = &mut e;
+ | ------ mutable borrow occurs here
+...
+LL | E::B { x: ref bx } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `s` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:220:15
+ |
+LL | let x = &mut s;
+ | ------ borrow of `s` occurs here
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+ | ^ use of borrowed `s`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `s.y.0` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:221:22
+ |
+LL | let x = &mut s;
+ | ------ mutable borrow occurs here
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+LL | S { y: (ref y0, _), .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `s` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:227:15
+ |
+LL | let x = &mut s;
+ | ------ borrow of `s` occurs here
+...
+LL | match s { //[mir]~ ERROR cannot use `s` because it was mutably borrowed
+ | ^ use of borrowed `s`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `s.x.y` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:228:28
+ |
+LL | let x = &mut s;
+ | ------ mutable borrow occurs here
+...
+LL | S { x: F { y: ref x0, .. }, .. } =>
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `*v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:271:9
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v[..].y` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:271:9
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | v[0].y;
+ | ^^^^^^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0503]: cannot use `v` because it was mutably borrowed
+ --> $DIR/borrowck-describe-lvalue.rs:282:15
+ |
+LL | let x = &mut v;
+ | ------ borrow of `v` occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+ | ^ use of borrowed `v`
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `v[..].x` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:283:24
+ |
+LL | let x = &mut v;
+ | ------ mutable borrow occurs here
+LL | match v { //[mir]~ ERROR cannot use `v` because it was mutably borrowed
+LL | &[_, F {x: ref xf, ..}] => println!("{}", xf),
+ | ^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:245:29
+ |
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p: &'a u8 = &*block.current;
+ | ^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0502]: cannot borrow `*block.current` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-describe-lvalue.rs:260:33
+ |
+LL | let x = &mut block;
+ | ---------- mutable borrow occurs here
+LL | let p : *const u8 = &*(*block).current;
+ | ^^^^^^^^^^^^^^^^^^ immutable borrow occurs here
+...
+LL | drop(x);
+ | - borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-describe-lvalue.rs:318:22
+ |
+LL | drop(x);
+ | - value moved here
+LL | drop(x); //[ast]~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 46 previous errors
+
+Some errors occurred: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs b/src/test/ui/borrowck/borrowck-describe-lvalue.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-describe-lvalue.rs
rename to src/test/ui/borrowck/borrowck-describe-lvalue.rs
diff --git a/src/test/compile-fail/borrowck/borrowck-drop-from-guard.rs b/src/test/ui/borrowck/borrowck-drop-from-guard.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-drop-from-guard.rs
rename to src/test/ui/borrowck/borrowck-drop-from-guard.rs
diff --git a/src/test/ui/borrowck/borrowck-drop-from-guard.stderr b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr
new file mode 100644
index 0000000..e28b500
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-drop-from-guard.stderr
@@ -0,0 +1,14 @@
+error[E0382]: use of moved value: `my_str`
+ --> $DIR/borrowck-drop-from-guard.rs:22:23
+ |
+LL | Some(_) if { drop(my_str); false } => {}
+ | ------ value moved here
+LL | Some(_) => {}
+LL | None => { foo(my_str); } //~ ERROR [E0382]
+ | ^^^^^^ value used here after move
+ |
+ = note: move occurs because `my_str` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs
index 7204393..104c088 100644
--- a/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs
+++ b/src/test/ui/borrowck/borrowck-feature-nll-overrides-migrate.rs
@@ -20,7 +20,7 @@
// revisions: zflag edition
// [zflag]compile-flags: -Z borrowck=migrate
-// [edition]compile-flags: --edition 2018
+// [edition]edition:2018
#![feature(nll)]
diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr
new file mode 100644
index 0000000..fb300d3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-field-sensitivity.nll.stderr
@@ -0,0 +1,110 @@
+error[E0382]: use of moved value: `*x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:18:10
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
+ | ^^^^ value used here after move
+
+error[E0382]: use of moved value: `*x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:24:10
+ |
+LL | let y = A { a: 3, .. x };
+ | ---------------- value moved here
+LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
+ | ^^^^ value used here after move
+
+error[E0382]: borrow of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:30:13
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | let p = &x.b; //~ ERROR use of moved value: `x.b`
+ | ^^^^ value borrowed here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:37:13
+ |
+LL | let _y = A { a: 3, .. x };
+ | ---------------- value moved here
+LL | let p = &x.b; //~ ERROR use of moved value: `x.b`
+ | ^^^^ value borrowed here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0505]: cannot move out of `x.b` because it is borrowed
+ --> $DIR/borrowck-field-sensitivity.rs:44:10
+ |
+LL | let p = &x.b;
+ | ---- borrow of `x.b` occurs here
+LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed
+ | ^^^ move out of `x.b` occurs here
+LL | drop(**p);
+ | --- borrow later used here
+
+error[E0505]: cannot move out of `x.b` because it is borrowed
+ --> $DIR/borrowck-field-sensitivity.rs:51:14
+ |
+LL | let p = &x.b;
+ | ---- borrow of `x.b` occurs here
+LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed
+ | ^^^^^^^^^^^^^^^^ move out of `x.b` occurs here
+LL | drop(**p);
+ | --- borrow later used here
+
+error[E0499]: cannot borrow `x.a` as mutable more than once at a time
+ --> $DIR/borrowck-field-sensitivity.rs:58:13
+ |
+LL | let p = &mut x.a;
+ | -------- first mutable borrow occurs here
+LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | drop(*p);
+ | -- borrow later used here
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:66:10
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | drop(x.b); //~ ERROR use of moved value: `x.b`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:72:10
+ |
+LL | let _y = A { a: 3, .. x };
+ | ---------------- value moved here
+LL | drop(x.b); //~ ERROR use of moved value: `x.b`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:78:14
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b`
+ | ^^^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:84:14
+ |
+LL | let _y = A { a: 3, .. x };
+ | ---------------- value moved here
+LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b`
+ | ^^^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to 11 previous errors
+
+Some errors occurred: E0382, E0499, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-field-sensitivity.rs b/src/test/ui/borrowck/borrowck-field-sensitivity.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-field-sensitivity.rs
rename to src/test/ui/borrowck/borrowck-field-sensitivity.rs
diff --git a/src/test/ui/borrowck/borrowck-field-sensitivity.stderr b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr
new file mode 100644
index 0000000..e5eba37
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-field-sensitivity.stderr
@@ -0,0 +1,129 @@
+error[E0382]: use of moved value: `*x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:18:10
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `*x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:24:10
+ |
+LL | let y = A { a: 3, .. x };
+ | - value moved here
+LL | drop(*x.b); //~ ERROR use of moved value: `*x.b`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:30:14
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | let p = &x.b; //~ ERROR use of moved value: `x.b`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:37:14
+ |
+LL | let _y = A { a: 3, .. x };
+ | - value moved here
+LL | let p = &x.b; //~ ERROR use of moved value: `x.b`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0505]: cannot move out of `x.b` because it is borrowed
+ --> $DIR/borrowck-field-sensitivity.rs:44:10
+ |
+LL | let p = &x.b;
+ | --- borrow of `x.b` occurs here
+LL | drop(x.b); //~ ERROR cannot move out of `x.b` because it is borrowed
+ | ^^^ move out of `x.b` occurs here
+
+error[E0505]: cannot move out of `x.b` because it is borrowed
+ --> $DIR/borrowck-field-sensitivity.rs:51:27
+ |
+LL | let p = &x.b;
+ | --- borrow of `x.b` occurs here
+LL | let _y = A { a: 3, .. x }; //~ ERROR cannot move out of `x.b` because it is borrowed
+ | ^ move out of `x.b` occurs here
+
+error[E0499]: cannot borrow `x.a` as mutable more than once at a time
+ --> $DIR/borrowck-field-sensitivity.rs:58:18
+ |
+LL | let p = &mut x.a;
+ | --- first mutable borrow occurs here
+LL | let q = &mut x.a; //~ ERROR cannot borrow `x.a` as mutable more than once at a time
+ | ^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:66:10
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | drop(x.b); //~ ERROR use of moved value: `x.b`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:72:10
+ |
+LL | let _y = A { a: 3, .. x };
+ | - value moved here
+LL | drop(x.b); //~ ERROR use of moved value: `x.b`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:78:27
+ |
+LL | drop(x.b);
+ | --- value moved here
+LL | let _z = A { a: 3, .. x }; //~ ERROR use of moved value: `x.b`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:84:27
+ |
+LL | let _y = A { a: 3, .. x };
+ | - value moved here
+LL | let _z = A { a: 4, .. x }; //~ ERROR use of moved value: `x.b`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x.b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0381]: use of possibly uninitialized variable: `x.a`
+ --> $DIR/borrowck-field-sensitivity.rs:92:10
+ |
+LL | drop(x.a); //~ ERROR use of possibly uninitialized variable: `x.a`
+ | ^^^ use of possibly uninitialized `x.a`
+
+error[E0381]: use of possibly uninitialized variable: `x.a`
+ --> $DIR/borrowck-field-sensitivity.rs:98:14
+ |
+LL | let p = &x.a; //~ ERROR use of possibly uninitialized variable: `x.a`
+ | ^^^ use of possibly uninitialized `x.a`
+
+error[E0381]: use of possibly uninitialized variable: `x.b`
+ --> $DIR/borrowck-field-sensitivity.rs:105:10
+ |
+LL | drop(x.b); //~ ERROR use of possibly uninitialized variable: `x.b`
+ | ^^^ use of possibly uninitialized `x.b`
+
+error: aborting due to 14 previous errors
+
+Some errors occurred: E0381, E0382, E0499, E0505.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr
new file mode 100644
index 0000000..4d0c762
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-fn-in-const-a.rs:19:16
+ |
+LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
+ | ^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr
new file mode 100644
index 0000000..4d0c762
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-a.mir.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-fn-in-const-a.rs:19:16
+ |
+LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507]
+ | ^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-fn-in-const-a.rs b/src/test/ui/borrowck/borrowck-fn-in-const-a.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-fn-in-const-a.rs
rename to src/test/ui/borrowck/borrowck-fn-in-const-a.rs
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr
new file mode 100644
index 0000000..827b66c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.nll.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `local.inner` does not live long enough
+ --> $DIR/borrowck-fn-in-const-c.rs:27:16
+ |
+LL | return &local.inner; //~ ERROR does not live long enough
+ | ^^^^^^^^^^^^ borrowed value does not live long enough
+LL | }
+ | - `local.inner` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-fn-in-const-c.rs b/src/test/ui/borrowck/borrowck-fn-in-const-c.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-fn-in-const-c.rs
rename to src/test/ui/borrowck/borrowck-fn-in-const-c.rs
diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr
new file mode 100644
index 0000000..1dda8d4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-fn-in-const-c.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `local.inner` does not live long enough
+ --> $DIR/borrowck-fn-in-const-c.rs:27:17
+ |
+LL | return &local.inner; //~ ERROR does not live long enough
+ | ^^^^^^^^^^^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr
new file mode 100644
index 0000000..25eb69a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr
@@ -0,0 +1,48 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | -- ^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `&mut i32`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | ^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15
+ |
+LL | for &a in &f.a { //~ ERROR cannot move out
+ | -- ^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10
+ |
+LL | for &a in &f.a { //~ ERROR cannot move out
+ | ^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | -- ^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `a`
+ |
+note: move occurs because `a` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | ^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs
rename to src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.rs
diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr
new file mode 100644
index 0000000..baa8a66
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.stderr
@@ -0,0 +1,30 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:9
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | ^-
+ | ||
+ | |hint: to prevent move, use `ref a` or `ref mut a`
+ | cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:9
+ |
+LL | for &a in &f.a { //~ ERROR cannot move out
+ | ^-
+ | ||
+ | |hint: to prevent move, use `ref a` or `ref mut a`
+ | cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:9
+ |
+LL | for &a in x.iter() { //~ ERROR cannot move out
+ | ^-
+ | ||
+ | |hint: to prevent move, use `ref a` or `ref mut a`
+ | cannot move out of borrowed content
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr
new file mode 100644
index 0000000..c3f71d6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.nll.stderr
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-for-loop-head-linkage.rs:17:9
+ |
+LL | for &x in &vector {
+ | -------
+ | |
+ | immutable borrow occurs here
+ | borrow used here in later iteration of loop
+LL | let cap = vector.capacity();
+LL | vector.extend(repeat(0)); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-for-loop-head-linkage.rs:18:9
+ |
+LL | for &x in &vector {
+ | -------
+ | |
+ | immutable borrow occurs here
+ | borrow used here in later iteration of loop
+...
+LL | vector[1] = 5; //~ ERROR cannot borrow
+ | ^^^^^^ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-for-loop-head-linkage.rs b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-for-loop-head-linkage.rs
rename to src/test/ui/borrowck/borrowck-for-loop-head-linkage.rs
diff --git a/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr
new file mode 100644
index 0000000..fd00138
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-for-loop-head-linkage.stderr
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-for-loop-head-linkage.rs:17:9
+ |
+LL | for &x in &vector {
+ | ------
+ | | |
+ | | immutable borrow ends here
+ | immutable borrow occurs here
+LL | let cap = vector.capacity();
+LL | vector.extend(repeat(0)); //~ ERROR cannot borrow
+ | ^^^^^^ mutable borrow occurs here
+
+error[E0502]: cannot borrow `vector` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-for-loop-head-linkage.rs:18:9
+ |
+LL | for &x in &vector {
+ | ------
+ | | |
+ | | immutable borrow ends here
+ | immutable borrow occurs here
+...
+LL | vector[1] = 5; //~ ERROR cannot borrow
+ | ^^^^^^ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-if-no-else.rs b/src/test/ui/borrowck/borrowck-if-no-else.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-if-no-else.rs
rename to src/test/ui/borrowck/borrowck-if-no-else.rs
diff --git a/src/test/ui/borrowck/borrowck-if-no-else.stderr b/src/test/ui/borrowck/borrowck-if-no-else.stderr
new file mode 100644
index 0000000..6c4a53a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-if-no-else.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-if-no-else.rs:15:9
+ |
+LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-if-with-else.rs b/src/test/ui/borrowck/borrowck-if-with-else.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-if-with-else.rs
rename to src/test/ui/borrowck/borrowck-if-with-else.rs
diff --git a/src/test/ui/borrowck/borrowck-if-with-else.stderr b/src/test/ui/borrowck/borrowck-if-with-else.stderr
new file mode 100644
index 0000000..097d11e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-if-with-else.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-if-with-else.rs:20:9
+ |
+LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr
new file mode 100644
index 0000000..0a1bc2c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `_a` because it is borrowed
+ --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:19:9
+ |
+LL | let b = &mut _a;
+ | ------- borrow of `_a` occurs here
+...
+LL | _a = 4; //[ast]~ ERROR cannot assign to `_a`
+ | ^^^^^^ assignment to borrowed `_a` occurs here
+...
+LL | drop(b);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr
new file mode 100644
index 0000000..cb6d987
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.ast.stderr
@@ -0,0 +1,12 @@
+error[E0506]: cannot assign to `_a` because it is borrowed
+ --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:19:9
+ |
+LL | let b = &mut _a;
+ | -- borrow of `_a` occurs here
+...
+LL | _a = 4; //[ast]~ ERROR cannot assign to `_a`
+ | ^^^^^^ assignment to borrowed `_a` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr
new file mode 100644
index 0000000..0a1bc2c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.mir.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `_a` because it is borrowed
+ --> $DIR/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs:19:9
+ |
+LL | let b = &mut _a;
+ | ------- borrow of `_a` occurs here
+...
+LL | _a = 4; //[ast]~ ERROR cannot assign to `_a`
+ | ^^^^^^ assignment to borrowed `_a` occurs here
+...
+LL | drop(b);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
rename to src/test/ui/borrowck/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr
index 05a022a..45fa176 100644
--- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr
@@ -1,6 +1,8 @@
error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/borrowck-in-static.rs:15:17
|
+LL | let x = Box::new(0);
+ | - captured outer variable
LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable
| ^ cannot move out of captured variable in an `Fn` closure
diff --git a/src/test/compile-fail/borrowck/borrowck-init-in-called-fn-expr.rs b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-init-in-called-fn-expr.rs
rename to src/test/ui/borrowck/borrowck-init-in-called-fn-expr.rs
diff --git a/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr
new file mode 100644
index 0000000..e55603c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-in-called-fn-expr.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `i`
+ --> $DIR/borrowck-init-in-called-fn-expr.rs:14:9
+ |
+LL | i //~ ERROR use of possibly uninitialized variable: `i`
+ | ^ use of possibly uninitialized `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-init-in-fn-expr.rs b/src/test/ui/borrowck/borrowck-init-in-fn-expr.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-init-in-fn-expr.rs
rename to src/test/ui/borrowck/borrowck-init-in-fn-expr.rs
diff --git a/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr
new file mode 100644
index 0000000..406fb5e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-in-fn-expr.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `i`
+ --> $DIR/borrowck-init-in-fn-expr.rs:14:9
+ |
+LL | i //~ ERROR use of possibly uninitialized variable: `i`
+ | ^ use of possibly uninitialized `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr
new file mode 100644
index 0000000..cac9d89
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-in-fru.ast.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `origin.y`
+ --> $DIR/borrowck-init-in-fru.rs:22:5
+ |
+LL | origin = point {x: 10,.. origin};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr
new file mode 100644
index 0000000..a5c1ef7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-in-fru.ast.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `origin.y`
+ --> $DIR/borrowck-init-in-fru.rs:22:30
+ |
+LL | origin = point {x: 10,.. origin};
+ | ^^^^^^ use of possibly uninitialized `origin.y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr b/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr
new file mode 100644
index 0000000..cac9d89
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-in-fru.mir.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `origin.y`
+ --> $DIR/borrowck-init-in-fru.rs:22:5
+ |
+LL | origin = point {x: 10,.. origin};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `origin.y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-init-in-fru.rs b/src/test/ui/borrowck/borrowck-init-in-fru.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-init-in-fru.rs
rename to src/test/ui/borrowck/borrowck-init-in-fru.rs
diff --git a/src/test/compile-fail/borrowck/borrowck-init-op-equal.rs b/src/test/ui/borrowck/borrowck-init-op-equal.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-init-op-equal.rs
rename to src/test/ui/borrowck/borrowck-init-op-equal.rs
diff --git a/src/test/ui/borrowck/borrowck-init-op-equal.stderr b/src/test/ui/borrowck/borrowck-init-op-equal.stderr
new file mode 100644
index 0000000..b8e91e3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-op-equal.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `v`
+ --> $DIR/borrowck-init-op-equal.rs:14:5
+ |
+LL | v += 1; //~ ERROR use of possibly uninitialized variable: `v`
+ | ^^^^^^ use of possibly uninitialized `v`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-init-plus-equal.rs b/src/test/ui/borrowck/borrowck-init-plus-equal.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-init-plus-equal.rs
rename to src/test/ui/borrowck/borrowck-init-plus-equal.rs
diff --git a/src/test/ui/borrowck/borrowck-init-plus-equal.stderr b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr
new file mode 100644
index 0000000..f49c06c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-init-plus-equal.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `v`
+ --> $DIR/borrowck-init-plus-equal.rs:13:9
+ |
+LL | v = v + 1; //~ ERROR use of possibly uninitialized variable: `v`
+ | ^ use of possibly uninitialized `v`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr
new file mode 100644
index 0000000..e403b07
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-insert-during-each.nll.stderr
@@ -0,0 +1,36 @@
+error[E0501]: cannot borrow `*f` as mutable because previous closure requires unique access
+ --> $DIR/borrowck-insert-during-each.rs:26:3
+ |
+LL | f.foo(
+ | ___^
+ | |___|
+ | ||
+LL | || |a| { //~ ERROR closure requires unique access to `f`
+ | || --- closure construction occurs here
+LL | || f.n.insert(*a);
+ | || - first borrow occurs due to use of `f` in closure
+LL | || })
+ | || ^
+ | ||__________|
+ | |___________borrow occurs here
+ | borrow later used here
+
+error[E0500]: closure requires unique access to `f` but it is already borrowed
+ --> $DIR/borrowck-insert-during-each.rs:27:9
+ |
+LL | f.foo(
+ | -
+ | |
+ | ___borrow occurs here
+ | |
+LL | | |a| { //~ ERROR closure requires unique access to `f`
+ | | ^^^ closure construction occurs here
+LL | | f.n.insert(*a);
+ | | - second borrow occurs due to use of `f` in closure
+LL | | })
+ | |__________- borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0500, E0501.
+For more information about an error, try `rustc --explain E0500`.
diff --git a/src/test/compile-fail/borrowck/borrowck-insert-during-each.rs b/src/test/ui/borrowck/borrowck-insert-during-each.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-insert-during-each.rs
rename to src/test/ui/borrowck/borrowck-insert-during-each.rs
diff --git a/src/test/ui/borrowck/borrowck-insert-during-each.stderr b/src/test/ui/borrowck/borrowck-insert-during-each.stderr
new file mode 100644
index 0000000..30648ed
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-insert-during-each.stderr
@@ -0,0 +1,15 @@
+error[E0500]: closure requires unique access to `f` but `*f` is already borrowed
+ --> $DIR/borrowck-insert-during-each.rs:27:9
+ |
+LL | f.foo(
+ | - borrow occurs here
+LL | |a| { //~ ERROR closure requires unique access to `f`
+ | ^^^ closure construction occurs here
+LL | f.n.insert(*a);
+ | - borrow occurs due to use of `f` in closure
+LL | })
+ | - borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0500`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr b/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr
new file mode 100644
index 0000000..d90eda4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-14498.ast.nll.stderr
@@ -0,0 +1,108 @@
+error[E0594]: cannot assign to `***p` which is behind a `&` reference
+ --> $DIR/borrowck-issue-14498.rs:29:5
+ |
+LL | let p = &y;
+ | -- help: consider changing this to be a mutable reference: `&mut y`
+LL | ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference
+ | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:39:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:50:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:61:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:72:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:83:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:94:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:105:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:116:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0506, E0594.
+For more information about an error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr b/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr
new file mode 100644
index 0000000..ffb793e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-14498.ast.stderr
@@ -0,0 +1,82 @@
+error[E0389]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-issue-14498.rs:29:5
+ |
+LL | ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference
+ | ^^^^^^^^ assignment into an immutable reference
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:39:5
+ |
+LL | let p = &y;
+ | - borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:50:5
+ |
+LL | let p = &y;
+ | - borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:61:5
+ |
+LL | let p = &y;
+ | - borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:72:5
+ |
+LL | let p = &y;
+ | - borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:83:5
+ |
+LL | let p = &y.a;
+ | --- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:94:5
+ |
+LL | let p = &y.a;
+ | --- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:105:5
+ |
+LL | let p = &y.a;
+ | --- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:116:5
+ |
+LL | let p = &y.a;
+ | --- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0389, E0506.
+For more information about an error, try `rustc --explain E0389`.
diff --git a/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr b/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr
new file mode 100644
index 0000000..d90eda4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-14498.mir.stderr
@@ -0,0 +1,108 @@
+error[E0594]: cannot assign to `***p` which is behind a `&` reference
+ --> $DIR/borrowck-issue-14498.rs:29:5
+ |
+LL | let p = &y;
+ | -- help: consider changing this to be a mutable reference: `&mut y`
+LL | ***p = 2; //[ast]~ ERROR cannot assign to data in a `&` reference
+ | ^^^^^^^^ `p` is a `&` reference, so the data it refers to cannot be written
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:39:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:50:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:61:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:72:5
+ |
+LL | let p = &y;
+ | -- borrow of `**y` occurs here
+LL | let q = &***p;
+LL | **y = 2; //[ast]~ ERROR cannot assign to `**y` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `**y` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:83:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:94:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:105:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**y.a` because it is borrowed
+ --> $DIR/borrowck-issue-14498.rs:116:5
+ |
+LL | let p = &y.a;
+ | ---- borrow of `**y.a` occurs here
+LL | let q = &***p;
+LL | **y.a = 2; //[ast]~ ERROR cannot assign to `**y.a` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `**y.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `**y.a` because it is borrowed
+LL | drop(p);
+ | - borrow later used here
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0506, E0594.
+For more information about an error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-issue-14498.rs b/src/test/ui/borrowck/borrowck-issue-14498.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-issue-14498.rs
rename to src/test/ui/borrowck/borrowck-issue-14498.rs
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr
new file mode 100644
index 0000000..8d2bef31
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-2657-1.nll.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-issue-2657-1.rs:19:18
+ |
+LL | Some(ref _y) => {
+ | ------ borrow of `x.0` occurs here
+LL | let _a = x; //~ ERROR cannot move
+ | ^ move out of `x` occurs here
+LL | _y.use_ref();
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.rs b/src/test/ui/borrowck/borrowck-issue-2657-1.rs
new file mode 100644
index 0000000..3eb939c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-2657-1.rs
@@ -0,0 +1,27 @@
+// Copyright 2012 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.
+
+#![feature(box_syntax)]
+
+
+
+fn main() {
+ let x: Option<Box<_>> = Some(box 1);
+ match x {
+ Some(ref _y) => {
+ let _a = x; //~ ERROR cannot move
+ _y.use_ref();
+ }
+ _ => {}
+ }
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-1.stderr b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr
new file mode 100644
index 0000000..532f0e6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-2657-1.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-issue-2657-1.rs:19:13
+ |
+LL | Some(ref _y) => {
+ | ------ borrow of `x.0` occurs here
+LL | let _a = x; //~ ERROR cannot move
+ | ^^ move out of `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr
new file mode 100644
index 0000000..cdbfab8
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-issue-2657-2.rs:17:18
+ |
+LL | let _b = *y; //~ ERROR cannot move out
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-issue-2657-2.rs b/src/test/ui/borrowck/borrowck-issue-2657-2.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-issue-2657-2.rs
rename to src/test/ui/borrowck/borrowck-issue-2657-2.rs
diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr
new file mode 100644
index 0000000..42baecd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-2657-2.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-issue-2657-2.rs:17:18
+ |
+LL | let _b = *y; //~ ERROR cannot move out
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider using a reference instead: `&*y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-issue-48962.rs b/src/test/ui/borrowck/borrowck-issue-48962.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-issue-48962.rs
rename to src/test/ui/borrowck/borrowck-issue-48962.rs
diff --git a/src/test/ui/borrowck/borrowck-issue-48962.stderr b/src/test/ui/borrowck/borrowck-issue-48962.stderr
new file mode 100644
index 0000000..4448ced
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-issue-48962.stderr
@@ -0,0 +1,23 @@
+error[E0382]: use of moved value: `src`
+ --> $DIR/borrowck-issue-48962.rs:26:5
+ |
+LL | {src};
+ | --- value moved here
+LL | src.next = None; //~ ERROR use of moved value: `src` [E0382]
+ | ^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `src` has type `&mut Node`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `src`
+ --> $DIR/borrowck-issue-48962.rs:32:5
+ |
+LL | {src};
+ | --- value moved here
+LL | src.0 = 66; //~ ERROR use of moved value: `src` [E0382]
+ | ^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `src` has type `&mut (i32, i32)`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.rs b/src/test/ui/borrowck/borrowck-lend-flow-if.rs
new file mode 100644
index 0000000..3df174b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-if.rs
@@ -0,0 +1,56 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Note: the borrowck analysis is currently flow-insensitive.
+// Therefore, some of these errors are marked as spurious and could be
+// corrected by a simple change to the analysis. The others are
+// either genuine or would require more advanced changes. The latter
+// cases are noted.
+
+#![feature(box_syntax)]
+
+fn borrow(_v: &isize) {}
+fn borrow_mut(_v: &mut isize) {}
+fn cond() -> bool { panic!() }
+fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
+fn produce<T>() -> T { panic!(); }
+
+fn inc(v: &mut Box<isize>) {
+ *v = box (**v + 1);
+}
+
+fn pre_freeze_cond() {
+ // In this instance, the freeze is conditional and starts before
+ // the mut borrow.
+
+ let mut v: Box<_> = box 3;
+ let _w;
+ if cond() {
+ _w = &v;
+ }
+ borrow_mut(&mut *v); //~ ERROR cannot borrow
+}
+
+fn pre_freeze_else() {
+ // In this instance, the freeze and mut borrow are on separate sides
+ // of the if.
+
+ let mut v: Box<_> = box 3;
+ let _w;
+ if cond() {
+ _w = &v;
+ } else {
+ borrow_mut(&mut *v);
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-if.stderr b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr
new file mode 100644
index 0000000..c53c4e4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-if.stderr
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow-if.rs:40:21
+ |
+LL | _w = &v;
+ | - immutable borrow occurs here
+LL | }
+LL | borrow_mut(&mut *v); //~ ERROR cannot borrow
+ | ^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
new file mode 100644
index 0000000..c46e948
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.nll.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:45:16
+ |
+LL | let mut x = &mut v;
+ | ------ mutable borrow occurs here
+LL | for _ in 0..3 {
+LL | borrow(&*v); //~ ERROR cannot borrow
+ | ^^^ immutable borrow occurs here
+LL | }
+LL | *x = box 5;
+ | -- borrow used here in later iteration of loop
+
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:109:16
+ |
+LL | **x += 1;
+ | -------- borrow used here in later iteration of loop
+LL | borrow(&*v); //~ ERROR cannot borrow
+ | ^^^ immutable borrow occurs here
+LL | if cond2 {
+LL | x = &mut v; //~ ERROR cannot borrow
+ | ------ mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-lend-flow-loop.rs b/src/test/ui/borrowck/borrowck-lend-flow-loop.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-lend-flow-loop.rs
rename to src/test/ui/borrowck/borrowck-lend-flow-loop.rs
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
new file mode 100644
index 0000000..534e30b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
@@ -0,0 +1,93 @@
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:35:17
+ |
+LL | let mut x = &mut v;
+ | - mutable borrow occurs here
+...
+LL | borrow(&*v); //~ ERROR cannot borrow
+ | ^^ immutable borrow occurs here
+LL | }
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:45:17
+ |
+LL | let mut x = &mut v;
+ | - mutable borrow occurs here
+LL | for _ in 0..3 {
+LL | borrow(&*v); //~ ERROR cannot borrow
+ | ^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow-loop.rs:57:25
+ |
+LL | borrow_mut(&mut *v); //~ ERROR cannot borrow
+ | ^^ mutable borrow occurs here
+LL | _x = &v;
+ | - immutable borrow occurs here
+LL | }
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow-loop.rs:69:25
+ |
+LL | borrow_mut(&mut *v); //~ ERROR cannot borrow
+ | ^^ mutable borrow occurs here
+LL | _x = &v;
+ | - immutable borrow occurs here
+LL | }
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow-loop.rs:86:21
+ |
+LL | _x = &v;
+ | - immutable borrow occurs here
+...
+LL | borrow_mut(&mut *v); //~ ERROR cannot borrow
+ | ^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow-loop.rs:100:21
+ |
+LL | _x = &v;
+ | - immutable borrow occurs here
+...
+LL | borrow_mut(&mut *v); //~ ERROR cannot borrow
+ | ^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+ --> $DIR/borrowck-lend-flow-loop.rs:109:17
+ |
+LL | borrow(&*v); //~ ERROR cannot borrow
+ | ^^ immutable borrow occurs here
+LL | if cond2 {
+LL | x = &mut v; //~ ERROR cannot borrow
+ | - mutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/borrowck-lend-flow-loop.rs:111:22
+ |
+LL | x = &mut v; //~ ERROR cannot borrow
+ | ^ mutable borrow starts here in previous iteration of loop
+...
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr
new file mode 100644
index 0000000..0b6eabf
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-lend-flow-match.rs:28:13
+ |
+LL | Some(ref r) => {
+ | ----- borrow of `x` occurs here
+LL | x = Some(1); //[ast]~ ERROR cannot assign
+ | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(r);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr
new file mode 100644
index 0000000..0fcc6bb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-match.ast.stderr
@@ -0,0 +1,11 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-lend-flow-match.rs:28:13
+ |
+LL | Some(ref r) => {
+ | ----- borrow of `x` occurs here
+LL | x = Some(1); //[ast]~ ERROR cannot assign
+ | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr b/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr
new file mode 100644
index 0000000..0b6eabf
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow-match.mir.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-lend-flow-match.rs:28:13
+ |
+LL | Some(ref r) => {
+ | ----- borrow of `x` occurs here
+LL | x = Some(1); //[ast]~ ERROR cannot assign
+ | ^^^^^^^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(r);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs b/src/test/ui/borrowck/borrowck-lend-flow-match.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-lend-flow-match.rs
rename to src/test/ui/borrowck/borrowck-lend-flow-match.rs
diff --git a/src/test/ui/borrowck/borrowck-lend-flow.rs b/src/test/ui/borrowck/borrowck-lend-flow.rs
new file mode 100644
index 0000000..27a21f0
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow.rs
@@ -0,0 +1,47 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Note: the borrowck analysis is currently flow-insensitive.
+// Therefore, some of these errors are marked as spurious and could be
+// corrected by a simple change to the analysis. The others are
+// either genuine or would require more advanced changes. The latter
+// cases are noted.
+
+#![feature(box_syntax)]
+
+fn borrow(_v: &isize) {}
+fn borrow_mut(_v: &mut isize) {}
+fn cond() -> bool { panic!() }
+fn for_func<F>(_f: F) where F: FnOnce() -> bool { panic!() }
+fn produce<T>() -> T { panic!(); }
+
+fn inc(v: &mut Box<isize>) {
+ *v = box (**v + 1);
+}
+
+fn pre_freeze() {
+ // In this instance, the freeze starts before the mut borrow.
+
+ let mut v: Box<_> = box 3;
+ let _w = &v;
+ borrow_mut(&mut *v); //~ ERROR cannot borrow
+}
+
+fn post_freeze() {
+ // In this instance, the const alias starts after the borrow.
+
+ let mut v: Box<_> = box 3;
+ borrow_mut(&mut *v);
+ let _w = &v;
+}
+
+fn main() {}
diff --git a/src/test/ui/borrowck/borrowck-lend-flow.stderr b/src/test/ui/borrowck/borrowck-lend-flow.stderr
new file mode 100644
index 0000000..abb83c8
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-lend-flow.stderr
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
+ --> $DIR/borrowck-lend-flow.rs:36:21
+ |
+LL | let _w = &v;
+ | - immutable borrow occurs here
+LL | borrow_mut(&mut *v); //~ ERROR cannot borrow
+ | ^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr
new file mode 100644
index 0000000..6f0f23b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.nll.stderr
@@ -0,0 +1,29 @@
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move-cc.rs:24:19
+ |
+LL | let w = &v;
+ | -- borrow of `v` occurs here
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `v` occurs here
+LL | println!("v={}", *v);
+ | - move occurs due to use in closure
+...
+LL | w.use_ref();
+ | - borrow later used here
+
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move-cc.rs:34:19
+ |
+LL | let w = &v;
+ | -- borrow of `v` occurs here
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `v` occurs here
+LL | println!("v={}", *v);
+ | - move occurs due to use in closure
+...
+LL | w.use_ref();
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs
new file mode 100644
index 0000000..2729608
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.rs
@@ -0,0 +1,45 @@
+// Copyright 2012 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.
+
+#![feature(box_syntax)]
+
+use std::thread;
+
+
+
+fn borrow<F>(v: &isize, f: F) where F: FnOnce(&isize) {
+ f(v);
+}
+
+fn box_imm() {
+ let v: Box<_> = box 3;
+ let w = &v;
+ thread::spawn(move|| {
+ println!("v={}", *v);
+ //~^ ERROR cannot move `v` into closure
+ });
+ w.use_ref();
+}
+
+fn box_imm_explicit() {
+ let v: Box<_> = box 3;
+ let w = &v;
+ thread::spawn(move|| {
+ println!("v={}", *v);
+ //~^ ERROR cannot move
+ });
+ w.use_ref();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
new file mode 100644
index 0000000..5756729
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move-cc.stderr
@@ -0,0 +1,21 @@
+error[E0504]: cannot move `v` into closure because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move-cc.rs:25:27
+ |
+LL | let w = &v;
+ | - borrow of `v` occurs here
+LL | thread::spawn(move|| {
+LL | println!("v={}", *v);
+ | ^ move into closure occurs here
+
+error[E0504]: cannot move `v` into closure because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move-cc.rs:35:27
+ |
+LL | let w = &v;
+ | - borrow of `v` occurs here
+LL | thread::spawn(move|| {
+LL | println!("v={}", *v);
+ | ^ move into closure occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0504`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr
new file mode 100644
index 0000000..432137c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.nll.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move.rs:21:10
+ |
+LL | let w = &v;
+ | -- borrow of `v` occurs here
+LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed
+ | ^ move out of `v` occurs here
+LL | w.use_ref();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.rs b/src/test/ui/borrowck/borrowck-loan-blocks-move.rs
new file mode 100644
index 0000000..b1241ae
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.rs
@@ -0,0 +1,29 @@
+// Copyright 2012 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.
+
+#![feature(box_syntax)]
+
+
+
+fn take(_v: Box<isize>) {
+}
+
+fn box_imm() {
+ let v = box 3;
+ let w = &v;
+ take(v); //~ ERROR cannot move out of `v` because it is borrowed
+ w.use_ref();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr
new file mode 100644
index 0000000..5edbf6a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-move.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `v` because it is borrowed
+ --> $DIR/borrowck-loan-blocks-move.rs:21:10
+ |
+LL | let w = &v;
+ | - borrow of `v` occurs here
+LL | take(v); //~ ERROR cannot move out of `v` because it is borrowed
+ | ^ move out of `v` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr
new file mode 100644
index 0000000..5c3cd46
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.nll.stderr
@@ -0,0 +1,19 @@
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-loan-blocks-mut-uniq.rs:20:12
+ |
+LL | borrow(&*v,
+ | - --- immutable borrow occurs here
+ | _____|
+ | |
+LL | | |w| { //~ ERROR cannot borrow `v` as mutable
+ | | ^^^ mutable borrow occurs here
+LL | | v = box 4;
+ | | - second borrow occurs due to use of `v` in closure
+LL | | assert_eq!(*v, 3);
+LL | | assert_eq!(*w, 4);
+LL | | })
+ | |__________- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-blocks-mut-uniq.rs b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-loan-blocks-mut-uniq.rs
rename to src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.rs
diff --git a/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr
new file mode 100644
index 0000000..752322d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-blocks-mut-uniq.stderr
@@ -0,0 +1,16 @@
+error[E0502]: cannot borrow `v` as mutable because `*v` is also borrowed as immutable
+ --> $DIR/borrowck-loan-blocks-mut-uniq.rs:20:12
+ |
+LL | borrow(&*v,
+ | -- immutable borrow occurs here
+LL | |w| { //~ ERROR cannot borrow `v` as mutable
+ | ^^^ mutable borrow occurs here
+LL | v = box 4;
+ | - borrow occurs due to use of `v` in closure
+...
+LL | })
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr
new file mode 100644
index 0000000..03ddfb4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/borrowck-loan-in-overloaded-op.rs:31:20
+ |
+LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
+ | - ^ value borrowed here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `x` has type `foo`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-in-overloaded-op.rs b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-loan-in-overloaded-op.rs
rename to src/test/ui/borrowck/borrowck-loan-in-overloaded-op.rs
diff --git a/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
new file mode 100644
index 0000000..7cd54e2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-in-overloaded-op.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-loan-in-overloaded-op.rs:31:20
+ |
+LL | let _y = {x} + x.clone(); // the `{x}` forces a move to occur
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `x` has type `foo`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr
new file mode 100644
index 0000000..eb9e72a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.nll.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `*s` because it is borrowed
+ --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:26:5
+ |
+LL | let alias: &'static mut String = s;
+ | - borrow of `*s` occurs here
+...
+LL | *s = String::new(); //~ ERROR cannot assign
+ | ^^ assignment to borrowed `*s` occurs here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-of-static-data-issue-27616.rs b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-loan-of-static-data-issue-27616.rs
rename to src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.rs
diff --git a/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr
new file mode 100644
index 0000000..3f5e09b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-of-static-data-issue-27616.stderr
@@ -0,0 +1,12 @@
+error[E0506]: cannot assign to `*s` because it is borrowed
+ --> $DIR/borrowck-loan-of-static-data-issue-27616.rs:26:5
+ |
+LL | let alias: &'static mut String = s;
+ | - borrow of `*s` occurs here
+...
+LL | *s = String::new(); //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^^^^ assignment to borrowed `*s` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr
new file mode 100644
index 0000000..b7c8716
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.nll.stderr
@@ -0,0 +1,28 @@
+error[E0503]: cannot use `p` because it was mutably borrowed
+ --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:48:5
+ |
+LL | let q = &mut p;
+ | ------ borrow of `p` occurs here
+LL |
+LL | p + 3; //~ ERROR cannot use `p`
+ | ^ use of borrowed `p`
+...
+LL | *q + 3; // OK to use the new alias `q`
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:49:5
+ |
+LL | let q = &mut p;
+ | ------ mutable borrow occurs here
+...
+LL | p.times(3); //~ ERROR cannot borrow `p`
+ | ^ immutable borrow occurs here
+LL |
+LL | *q + 3; // OK to use the new alias `q`
+ | -- borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0502, E0503.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-rcvr-overloaded-op.rs b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-loan-rcvr-overloaded-op.rs
rename to src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.rs
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
new file mode 100644
index 0000000..4db1d1f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-rcvr-overloaded-op.stderr
@@ -0,0 +1,25 @@
+error[E0503]: cannot use `p` because it was mutably borrowed
+ --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:48:5
+ |
+LL | let q = &mut p;
+ | - borrow of `p` occurs here
+LL |
+LL | p + 3; //~ ERROR cannot use `p`
+ | ^ use of borrowed `p`
+
+error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-loan-rcvr-overloaded-op.rs:49:5
+ |
+LL | let q = &mut p;
+ | - mutable borrow occurs here
+...
+LL | p.times(3); //~ ERROR cannot borrow `p`
+ | ^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0502, E0503.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr
new file mode 100644
index 0000000..a5b8102
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-rcvr.nll.stderr
@@ -0,0 +1,27 @@
+error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-loan-rcvr.rs:34:14
+ |
+LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable
+ | - ^^ mutable borrow occurs here
+ | |
+ | _____immutable borrow occurs here
+ | |
+LL | | p.x = 10;
+ | | - second borrow occurs due to use of `p` in closure
+LL | | })
+ | |______- borrow later used here
+
+error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-loan-rcvr.rs:45:5
+ |
+LL | let l = &mut p;
+ | ------ mutable borrow occurs here
+LL | p.impurem(); //~ ERROR cannot borrow
+ | ^ immutable borrow occurs here
+LL |
+LL | l.x += 1;
+ | -------- borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-rcvr.rs b/src/test/ui/borrowck/borrowck-loan-rcvr.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-loan-rcvr.rs
rename to src/test/ui/borrowck/borrowck-loan-rcvr.rs
diff --git a/src/test/ui/borrowck/borrowck-loan-rcvr.stderr b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr
new file mode 100644
index 0000000..f5d3cfb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-rcvr.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `p` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-loan-rcvr.rs:34:14
+ |
+LL | p.blockm(|| { //~ ERROR cannot borrow `p` as mutable
+ | - ^^ mutable borrow occurs here
+ | |
+ | immutable borrow occurs here
+LL | p.x = 10;
+ | - borrow occurs due to use of `p` in closure
+LL | })
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `p` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-loan-rcvr.rs:45:5
+ |
+LL | let l = &mut p;
+ | - mutable borrow occurs here
+LL | p.impurem(); //~ ERROR cannot borrow
+ | ^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr
new file mode 100644
index 0000000..492e909
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-vec-content.nll.stderr
@@ -0,0 +1,16 @@
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-loan-vec-content.rs:28:9
+ |
+LL | / takes_imm_elt(
+LL | | &v[0],
+ | | - immutable borrow occurs here
+LL | | || { //~ ERROR cannot borrow `v` as mutable
+ | | ^^ mutable borrow occurs here
+LL | | v[1] = 4;
+ | | - second borrow occurs due to use of `v` in closure
+LL | | })
+ | |__________- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-loan-vec-content.rs b/src/test/ui/borrowck/borrowck-loan-vec-content.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-loan-vec-content.rs
rename to src/test/ui/borrowck/borrowck-loan-vec-content.rs
diff --git a/src/test/ui/borrowck/borrowck-loan-vec-content.stderr b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr
new file mode 100644
index 0000000..2fcfd1f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-loan-vec-content.stderr
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-loan-vec-content.rs:28:9
+ |
+LL | &v[0],
+ | - immutable borrow occurs here
+LL | || { //~ ERROR cannot borrow `v` as mutable
+ | ^^ mutable borrow occurs here
+LL | v[1] = 4;
+ | - borrow occurs due to use of `v` in closure
+LL | })
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr
new file mode 100644
index 0000000..97bf509
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/borrowck-local-borrow-outlives-fn.rs:15:5
+ |
+LL | &x
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - `x` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr
new file mode 100644
index 0000000..af1d294
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.ast.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/borrowck-local-borrow-outlives-fn.rs:15:6
+ |
+LL | &x
+ | ^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr
new file mode 100644
index 0000000..97bf509
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.mir.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/borrowck-local-borrow-outlives-fn.rs:15:5
+ |
+LL | &x
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - `x` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-local-borrow-outlives-fn.rs b/src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-local-borrow-outlives-fn.rs
rename to src/test/ui/borrowck/borrowck-local-borrow-outlives-fn.rs
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr
new file mode 100644
index 0000000..5e2b469
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `z.1` does not live long enough
+ --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:16:15
+ |
+LL | *x = Some(&mut z.1);
+ | ^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `z.1` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr
new file mode 100644
index 0000000..0c61c13
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.ast.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `z.1` does not live long enough
+ --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:16:20
+ |
+LL | *x = Some(&mut z.1);
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr
new file mode 100644
index 0000000..5e2b469
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.mir.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `z.1` does not live long enough
+ --> $DIR/borrowck-local-borrow-with-panic-outlives-fn.rs:16:15
+ |
+LL | *x = Some(&mut z.1);
+ | ^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `z.1` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs b/src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
rename to src/test/ui/borrowck/borrowck-local-borrow-with-panic-outlives-fn.rs
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr
new file mode 100644
index 0000000..8dec405
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.nll.stderr
@@ -0,0 +1,73 @@
+error[E0503]: cannot use `foo` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:22:19
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+LL | let _ = match foo { //[mir]~ ERROR [E0503]
+ | ^^^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `foo` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:23:9
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+LL | let _ = match foo { //[mir]~ ERROR [E0503]
+LL | Foo::B => 1, //[mir]~ ERROR [E0503]
+ | ^^^^^^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `foo.0` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:25:16
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+...
+LL | Foo::A(x) => x //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:35:19
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+LL | let _ = match x { //[mir]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:36:9
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+LL | let _ = match x { //[mir]~ ERROR [E0503]
+LL | x => x + 1, //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:38:9
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+...
+LL | y => y + 2, //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr
new file mode 100644
index 0000000..2e49f90
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.ast.stderr
@@ -0,0 +1,30 @@
+error[E0503]: cannot use `(foo as Foo::A).0` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:25:16
+ |
+LL | let p = &mut foo;
+ | --- borrow of `foo` occurs here
+...
+LL | Foo::A(x) => x //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `foo`
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:36:9
+ |
+LL | let r = &mut x;
+ | - borrow of `x` occurs here
+LL | let _ = match x { //[mir]~ ERROR [E0503]
+LL | x => x + 1, //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:38:9
+ |
+LL | let r = &mut x;
+ | - borrow of `x` occurs here
+...
+LL | y => y + 2, //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr b/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr
new file mode 100644
index 0000000..8dec405
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-already-borrowed.mir.stderr
@@ -0,0 +1,73 @@
+error[E0503]: cannot use `foo` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:22:19
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+LL | let _ = match foo { //[mir]~ ERROR [E0503]
+ | ^^^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `foo` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:23:9
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+LL | let _ = match foo { //[mir]~ ERROR [E0503]
+LL | Foo::B => 1, //[mir]~ ERROR [E0503]
+ | ^^^^^^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `foo.0` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:25:16
+ |
+LL | let p = &mut foo;
+ | -------- borrow of `foo` occurs here
+...
+LL | Foo::A(x) => x //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `foo`
+...
+LL | drop(p);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:35:19
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+LL | let _ = match x { //[mir]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:36:9
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+LL | let _ = match x { //[mir]~ ERROR [E0503]
+LL | x => x + 1, //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-match-already-borrowed.rs:38:9
+ |
+LL | let r = &mut x;
+ | ------ borrow of `x` occurs here
+...
+LL | y => y + 2, //[ast]~ ERROR [E0503]
+ | ^ use of borrowed `x`
+...
+LL | drop(r);
+ | - borrow later used here
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs b/src/test/ui/borrowck/borrowck-match-already-borrowed.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-match-already-borrowed.rs
rename to src/test/ui/borrowck/borrowck-match-already-borrowed.rs
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr
new file mode 100644
index 0000000..0191e07
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.nll.stderr
@@ -0,0 +1,58 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:27:13
+ |
+LL | x => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:34:13
+ |
+LL | E::Foo(x) => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:41:13
+ |
+LL | S { bar: x } => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:48:13
+ |
+LL | (x,) => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:55:13
+ |
+LL | [x,_,_] => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr
new file mode 100644
index 0000000..0d776f4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.ast.stderr
@@ -0,0 +1,43 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:27:13
+ |
+LL | x => {
+ | - first assignment to `x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:34:13
+ |
+LL | E::Foo(x) => {
+ | - first assignment to `x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:41:13
+ |
+LL | S { bar: x } => {
+ | - first assignment to `x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:48:13
+ |
+LL | (x,) => {
+ | - first assignment to `x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:55:13
+ |
+LL | [x,_,_] => {
+ | - first assignment to `x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr
new file mode 100644
index 0000000..0191e07
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.mir.stderr
@@ -0,0 +1,58 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:27:13
+ |
+LL | x => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:34:13
+ |
+LL | E::Foo(x) => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:41:13
+ |
+LL | S { bar: x } => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:48:13
+ |
+LL | (x,) => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/borrowck-match-binding-is-assignment.rs:55:13
+ |
+LL | [x,_,_] => {
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable `x`
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs b/src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-match-binding-is-assignment.rs
rename to src/test/ui/borrowck/borrowck-match-binding-is-assignment.rs
diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.rs b/src/test/ui/borrowck/borrowck-migrate-to-nll.rs
index e7f2bfb..bb6b290 100644
--- a/src/test/ui/borrowck/borrowck-migrate-to-nll.rs
+++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.rs
@@ -23,7 +23,7 @@
// revisions: zflag edition
//[zflag]compile-flags: -Z borrowck=migrate
-//[edition]compile-flags: --edition 2018
+//[edition]edition:2018
//[zflag] run-pass
//[edition] run-pass
diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr
new file mode 100644
index 0000000..9f56b26
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-by-capture.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/borrowck-move-by-capture.rs:19:29
+ |
+LL | let bar: Box<_> = box 3;
+ | --- captured outer variable
+LL | let _g = to_fn_mut(|| {
+LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of captured variable in an `FnMut` closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-by-capture.rs b/src/test/ui/borrowck/borrowck-move-by-capture.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-by-capture.rs
rename to src/test/ui/borrowck/borrowck-move-by-capture.rs
diff --git a/src/test/ui/borrowck/borrowck-move-by-capture.stderr b/src/test/ui/borrowck/borrowck-move-by-capture.stderr
new file mode 100644
index 0000000..a88af15
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-by-capture.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
+ --> $DIR/borrowck-move-by-capture.rs:19:29
+ |
+LL | let bar: Box<_> = box 3;
+ | --- captured outer variable
+LL | let _g = to_fn_mut(|| {
+LL | let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of
+ | ^^^^^^^^^^^^^^^^ cannot move out of captured outer variable in an `FnMut` closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
index 1b91347..2df520a 100644
--- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr
@@ -5,14 +5,24 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `f`
+ | help: consider removing the `*`: `f`
LL | //~| cannot move out
LL | Foo::Foo1(num1,
- | ---- move occurs because num1 has type `std::boxed::Box<u32>`, which does not implement the `Copy` trait
+ | ---- data moved here
LL | num2) => (),
- | ---- move occurs because num2 has type `std::boxed::Box<u32>`, which does not implement the `Copy` trait
+ | ---- ...and here
LL | Foo::Foo2(num) => (),
- | --- move occurs because num has type `std::boxed::Box<u32>`, which does not implement the `Copy` trait
+ | --- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-move-error-with-note.rs:23:19
+ |
+LL | Foo::Foo1(num1,
+ | ^^^^
+LL | num2) => (),
+ | ^^^^
+LL | Foo::Foo2(num) => (),
+ | ^^^
error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
--> $DIR/borrowck-move-error-with-note.rs:39:11
@@ -23,12 +33,15 @@
LL | f: _s,
| -- data moved here
LL | g: _t
- | -- ... and here
-help: to prevent move, use ref or ref mut
+ | -- ...and here
|
-LL | f: ref _s,
-LL | g: ref _t
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-move-error-with-note.rs:42:16
|
+LL | f: _s,
+ | ^^
+LL | g: _t
+ | ^^
error[E0507]: cannot move out of borrowed content
--> $DIR/borrowck-move-error-with-note.rs:57:11
@@ -37,10 +50,16 @@
| ^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&a.a`
+ | help: consider borrowing here: `&a.a`
LL | //~| cannot move out
LL | n => {
- | - move occurs because n has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ | - data moved here
+ |
+note: move occurs because `n` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-error-with-note.rs:59:9
+ |
+LL | n => {
+ | ^
error: aborting due to 3 previous errors
diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr
new file mode 100644
index 0000000..bd5d19f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.nll.stderr
@@ -0,0 +1,14 @@
+error[E0505]: cannot move out of `*a` because it is borrowed
+ --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:22:13
+ |
+LL | let b = &a;
+ | -- borrow of `a` occurs here
+LL |
+LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
+ | ^^ move out of `*a` occurs here
+LL | b.use_ref();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs
new file mode 100644
index 0000000..1216fb8
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.rs
@@ -0,0 +1,27 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// verify that an error is raised when trying to move out of a
+// borrowed path.
+
+
+
+#![feature(box_syntax)]
+
+fn main() {
+ let a: Box<Box<_>> = box box 2;
+ let b = &a;
+
+ let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
+ b.use_ref();
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
new file mode 100644
index 0000000..e5557eca
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-from-subpath-of-borrowed-path.stderr
@@ -0,0 +1,12 @@
+error[E0505]: cannot move out of `*a` because it is borrowed
+ --> $DIR/borrowck-move-from-subpath-of-borrowed-path.rs:22:9
+ |
+LL | let b = &a;
+ | - borrow of `a` occurs here
+LL |
+LL | let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed
+ | ^ move out of `*a` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr
new file mode 100644
index 0000000..f823a6f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13
+ |
+LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-from-unsafe-ptr.rs b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-from-unsafe-ptr.rs
rename to src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.rs
diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr
new file mode 100644
index 0000000..cad1551
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of dereference of raw pointer
+ --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13
+ |
+LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer
+ | ^^
+ | |
+ | cannot move out of dereference of raw pointer
+ | help: consider using a reference instead: `&*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr
new file mode 100644
index 0000000..49c2ec0
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr
@@ -0,0 +1,50 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:13
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^--
+ | ||
+ | |data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
+ |
+LL | with(|&_x| ())
+ | ^--
+ | ||
+ | |data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
+ |
+LL | with(|&_x| ())
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
+ |
+LL | let &_x = &"hi".to_string();
+ | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
+ |
+LL | let &_x = &"hi".to_string();
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr
new file mode 100644
index 0000000..fa7fb64
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.stderr
@@ -0,0 +1,30 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:13
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^--
+ | ||
+ | |hint: to prevent move, use `ref _x` or `ref mut _x`
+ | cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
+ |
+LL | with(|&_x| ())
+ | ^--
+ | ||
+ | |hint: to prevent move, use `ref _x` or `ref mut _x`
+ | cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:9
+ |
+LL | let &_x = &"hi".to_string();
+ | ^--
+ | ||
+ | |hint: to prevent move, use `ref _x` or `ref mut _x`
+ | cannot move out of borrowed content
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr
new file mode 100644
index 0000000..49c2ec0
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.mir.stderr
@@ -0,0 +1,50 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:13
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^--
+ | ||
+ | |data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14
+ |
+LL | fn arg_item(&_x: &String) {}
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11
+ |
+LL | with(|&_x| ())
+ | ^--
+ | ||
+ | |data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12
+ |
+LL | with(|&_x| ())
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15
+ |
+LL | let &_x = &"hi".to_string();
+ | --- ^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | ||
+ | |data moved here
+ | help: consider removing the `&`: `_x`
+ |
+note: move occurs because `_x` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10
+ |
+LL | let &_x = &"hi".to_string();
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-in-irrefut-pat.rs b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-in-irrefut-pat.rs
rename to src/test/ui/borrowck/borrowck-move-in-irrefut-pat.rs
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr
new file mode 100644
index 0000000..d896ff4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.nll.stderr
@@ -0,0 +1,17 @@
+error[E0382]: use of moved value: `t`
+ --> $DIR/borrowck-move-moved-value-into-closure.rs:24:12
+ |
+LL | call_f(move|| { *t + 1 });
+ | ------ - variable moved due to use in closure
+ | |
+ | value moved into closure here
+LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
+ | ^^^^^^ - use occurs due to use in closure
+ | |
+ | value used here after move
+ |
+ = note: move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr
new file mode 100644
index 0000000..c7576b1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.ast.stderr
@@ -0,0 +1,13 @@
+error[E0382]: capture of moved value: `t`
+ --> $DIR/borrowck-move-moved-value-into-closure.rs:24:22
+ |
+LL | call_f(move|| { *t + 1 });
+ | ------ value moved (into closure) here
+LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
+ | ^ value captured here after move
+ |
+ = note: move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr
new file mode 100644
index 0000000..d896ff4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.mir.stderr
@@ -0,0 +1,17 @@
+error[E0382]: use of moved value: `t`
+ --> $DIR/borrowck-move-moved-value-into-closure.rs:24:12
+ |
+LL | call_f(move|| { *t + 1 });
+ | ------ - variable moved due to use in closure
+ | |
+ | value moved into closure here
+LL | call_f(move|| { *t + 1 }); //[ast]~ ERROR capture of moved value
+ | ^^^^^^ - use occurs due to use in closure
+ | |
+ | value used here after move
+ |
+ = note: move occurs because `t` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-moved-value-into-closure.rs b/src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-moved-value-into-closure.rs
rename to src/test/ui/borrowck/borrowck-move-moved-value-into-closure.rs
diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr
new file mode 100644
index 0000000..9d31d2b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.nll.stderr
@@ -0,0 +1,14 @@
+error[E0505]: cannot move out of `t0` because it is borrowed
+ --> $DIR/borrowck-move-mut-base-ptr.rs:20:14
+ |
+LL | let p: &isize = &*t0; // Freezes `*t0`
+ | ---- borrow of `*t0` occurs here
+LL | let t1 = t0; //~ ERROR cannot move out of `t0`
+ | ^^ move out of `t0` occurs here
+LL | *t1 = 22;
+LL | p.use_ref();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs
new file mode 100644
index 0000000..eb7b310
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.rs
@@ -0,0 +1,29 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that attempt to move `&mut` pointer while pointee is borrowed
+// yields an error.
+//
+// Example from src/librustc_borrowck/borrowck/README.md
+
+
+
+fn foo(t0: &mut isize) {
+ let p: &isize = &*t0; // Freezes `*t0`
+ let t1 = t0; //~ ERROR cannot move out of `t0`
+ *t1 = 22;
+ p.use_ref();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr
new file mode 100644
index 0000000..33ccd14
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-mut-base-ptr.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `t0` because it is borrowed
+ --> $DIR/borrowck-move-mut-base-ptr.rs:20:9
+ |
+LL | let p: &isize = &*t0; // Freezes `*t0`
+ | --- borrow of `*t0` occurs here
+LL | let t1 = t0; //~ ERROR cannot move out of `t0`
+ | ^^ move out of `t0` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr
new file mode 100644
index 0000000..d67b63b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.nll.stderr
@@ -0,0 +1,19 @@
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:20:14
+ |
+LL | let [_, _x] = a;
+ | -- value moved here
+LL | let [.., _y] = a; //[ast]~ ERROR [E0382]
+ | ^^ value used here after move
+
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:27:10
+ |
+LL | let [_x, _] = a;
+ | -- value moved here
+LL | let [_y..] = a; //[ast]~ ERROR [E0382]
+ | ^^ value used here after move
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr
new file mode 100644
index 0000000..d19c23d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array.ast.stderr
@@ -0,0 +1,23 @@
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:20:14
+ |
+LL | let [_, _x] = a;
+ | -- value moved here
+LL | let [.., _y] = a; //[ast]~ ERROR [E0382]
+ | ^^ value used here after move
+ |
+ = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:27:10
+ |
+LL | let [_x, _] = a;
+ | -- value moved here
+LL | let [_y..] = a; //[ast]~ ERROR [E0382]
+ | ^^ value used here after move
+ |
+ = note: move occurs because `a[..]` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr
new file mode 100644
index 0000000..d67b63b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-from-array.mir.stderr
@@ -0,0 +1,19 @@
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:20:14
+ |
+LL | let [_, _x] = a;
+ | -- value moved here
+LL | let [.., _y] = a; //[ast]~ ERROR [E0382]
+ | ^^ value used here after move
+
+error[E0382]: use of moved value: `a[..]`
+ --> $DIR/borrowck-move-out-from-array.rs:27:10
+ |
+LL | let [_x, _] = a;
+ | -- value moved here
+LL | let [_y..] = a; //[ast]~ ERROR [E0382]
+ | ^^ value used here after move
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs b/src/test/ui/borrowck/borrowck-move-out-from-array.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-out-from-array.rs
rename to src/test/ui/borrowck/borrowck-move-out-from-array.rs
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr
new file mode 100644
index 0000000..94f7eba
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14
+ |
+LL | let _x = Rc::new(vec![1, 2]).into_iter();
+ | ^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr
new file mode 100644
index 0000000..94f7eba
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.mir.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14
+ |
+LL | let _x = Rc::new(vec![1, 2]).into_iter();
+ | ^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs
rename to src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.rs
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr
new file mode 100644
index 0000000..b9c47e6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14
+ |
+LL | let _x = *Rc::new("hi".to_string());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `Rc::new("hi".to_string())`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-out-of-overloaded-deref.rs
rename to src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.rs
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr
new file mode 100644
index 0000000..df5d911
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14
+ |
+LL | let _x = *Rc::new("hi".to_string());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider using a reference instead: `&*Rc::new("hi".to_string())`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr
new file mode 100644
index 0000000..65f70a7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of static item
+ --> $DIR/borrowck-move-out-of-static-item.rs:28:10
+ |
+LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
+ | ^^^ cannot move out of static item
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr
new file mode 100644
index 0000000..65f70a7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-static-item.mir.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of static item
+ --> $DIR/borrowck-move-out-of-static-item.rs:28:10
+ |
+LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507]
+ | ^^^ cannot move out of static item
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-static-item.rs b/src/test/ui/borrowck/borrowck-move-out-of-static-item.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-out-of-static-item.rs
rename to src/test/ui/borrowck/borrowck-move-out-of-static-item.rs
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr
new file mode 100644
index 0000000..34f9f03
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.nll.stderr
@@ -0,0 +1,47 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:20:11
+ |
+LL | match (S {f:"foo".to_string()}) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+LL | //[mir]~^ ERROR [E0509]
+LL | S {f:_s} => {}
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:14
+ |
+LL | S {f:_s} => {}
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:20
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:14
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^^^^--^
+ | | |
+ | | data moved here
+ | cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:24
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr
new file mode 100644
index 0000000..4384f04
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.ast.stderr
@@ -0,0 +1,30 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:9
+ |
+LL | S {f:_s} => {}
+ | ^^^^^--^
+ | | |
+ | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | cannot move out of here
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:9
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | ^^^^^--^
+ | | |
+ | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | cannot move out of here
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^^^^--^
+ | | |
+ | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | cannot move out of here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr
new file mode 100644
index 0000000..34f9f03
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.mir.stderr
@@ -0,0 +1,47 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:20:11
+ |
+LL | match (S {f:"foo".to_string()}) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+LL | //[mir]~^ ERROR [E0509]
+LL | S {f:_s} => {}
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:22:14
+ |
+LL | S {f:_s} => {}
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:20
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | -- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:28:14
+ |
+LL | let S {f:_s} = S {f:"foo".to_string()};
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:19
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^^^^--^
+ | | |
+ | | data moved here
+ | cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-struct-with-dtor.rs:33:24
+ |
+LL | fn move_in_fn_arg(S {f:_s}: S) {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-out-of-struct-with-dtor.rs
rename to src/test/ui/borrowck/borrowck-move-out-of-struct-with-dtor.rs
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr
new file mode 100644
index 0000000..278c33c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.nll.stderr
@@ -0,0 +1,46 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:17:11
+ |
+LL | match S("foo".to_string()) {
+ | ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+LL | S(_s) => {}
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:11
+ |
+LL | S(_s) => {}
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:17
+ |
+LL | let S(_s) = S("foo".to_string());
+ | -- ^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:11
+ |
+LL | let S(_s) = S("foo".to_string());
+ | ^^
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:19
+ |
+LL | fn move_in_fn_arg(S(_s): S) {
+ | ^^--^
+ | | |
+ | | data moved here
+ | cannot move out of here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:21
+ |
+LL | fn move_in_fn_arg(S(_s): S) {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs
rename to src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.rs
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr
new file mode 100644
index 0000000..78a065b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-out-of-tuple-struct-with-dtor.stderr
@@ -0,0 +1,30 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:18:9
+ |
+LL | S(_s) => {}
+ | ^^--^
+ | | |
+ | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | cannot move out of here
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:24:9
+ |
+LL | let S(_s) = S("foo".to_string());
+ | ^^--^
+ | | |
+ | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | cannot move out of here
+
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-move-out-of-tuple-struct-with-dtor.rs:28:19
+ |
+LL | fn move_in_fn_arg(S(_s): S) {
+ | ^^--^
+ | | |
+ | | hint: to prevent move, use `ref _s` or `ref mut _s`
+ | cannot move out of here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
index 95a7894..f3430ba 100644
--- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr
@@ -7,14 +7,23 @@
| - data moved here
...
LL | Foo { string: b }] => {
- | - ... and here
-help: to prevent move, use ref or ref mut
+ | - ...and here
|
-LL | &[Foo { string: ref a },
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33
+ |
+LL | &[Foo { string: a },
+ | ^
+...
+LL | Foo { string: b }] => {
+ | ^
+help: consider removing the `&`
+ |
+LL | [Foo { string: a },
LL | //~^ ERROR cannot move out of type `[Foo]`
LL | //~| cannot move out
LL | //~| to prevent move
-LL | Foo { string: ref b }] => {
+LL | Foo { string: b }] => {
|
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr
new file mode 100644
index 0000000..cd8d0cd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-subcomponent.nll.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `a.x` because it is borrowed
+ --> $DIR/borrowck-move-subcomponent.rs:25:14
+ |
+LL | let pb = &a;
+ | -- borrow of `a` occurs here
+LL | let S { x: ax } = a; //~ ERROR cannot move out
+ | ^^ move out of `a.x` occurs here
+LL | f(pb);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/borrowck/borrowck-move-subcomponent.rs b/src/test/ui/borrowck/borrowck-move-subcomponent.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-move-subcomponent.rs
rename to src/test/ui/borrowck/borrowck-move-subcomponent.rs
diff --git a/src/test/ui/borrowck/borrowck-move-subcomponent.stderr b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr
new file mode 100644
index 0000000..f249f0f
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-move-subcomponent.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `a.x` because it is borrowed
+ --> $DIR/borrowck-move-subcomponent.rs:25:14
+ |
+LL | let pb = &a;
+ | - borrow of `a` occurs here
+LL | let S { x: ax } = a; //~ ERROR cannot move out
+ | ^^ move out of `a.x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr
new file mode 100644
index 0000000..ce1880c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-multiple-captures.nll.stderr
@@ -0,0 +1,103 @@
+error[E0505]: cannot move out of `x1` because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:22:19
+ |
+LL | let p1 = &x1;
+ | --- borrow of `x1` occurs here
+...
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `x1` occurs here
+LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
+ | -- move occurs due to use in closure
+...
+LL | borrow(&*p1);
+ | ---- borrow later used here
+
+error[E0505]: cannot move out of `x2` because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:22:19
+ |
+LL | let p2 = &x2;
+ | --- borrow of `x2` occurs here
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `x2` occurs here
+LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
+LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed
+ | -- move occurs due to use in closure
+...
+LL | borrow(&*p2);
+ | ---- borrow later used here
+
+error[E0382]: use of moved value: `x1`
+ --> $DIR/borrowck-multiple-captures.rs:35:19
+ |
+LL | drop(x1);
+ | -- value moved here
+...
+LL | thread::spawn(move|| {
+ | ^^^^^^ value used here after move
+LL | drop(x1); //~ ERROR capture of moved value: `x1`
+ | -- use occurs due to use in closure
+ |
+ = note: move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x2`
+ --> $DIR/borrowck-multiple-captures.rs:35:19
+ |
+LL | drop(x2);
+ | -- value moved here
+LL | thread::spawn(move|| {
+ | ^^^^^^ value used here after move
+LL | drop(x1); //~ ERROR capture of moved value: `x1`
+LL | drop(x2); //~ ERROR capture of moved value: `x2`
+ | -- use occurs due to use in closure
+ |
+ = note: move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:46:14
+ |
+LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
+ | - value moved here
+LL | drop(x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:44:19
+ |
+LL | let p = &x;
+ | -- borrow of `x` occurs here
+LL | thread::spawn(move|| {
+ | ^^^^^^ move out of `x` occurs here
+LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
+ | - move occurs due to use in closure
+...
+LL | borrow(&*p);
+ | --- borrow later used here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:56:14
+ |
+LL | drop(x); //~ ERROR capture of moved value: `x`
+ | - value moved here
+LL | drop(x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:54:19
+ |
+LL | drop(x);
+ | - value moved here
+LL | thread::spawn(move|| {
+ | ^^^^^^ value used here after move
+LL | drop(x); //~ ERROR capture of moved value: `x`
+ | - use occurs due to use in closure
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-multiple-captures.rs b/src/test/ui/borrowck/borrowck-multiple-captures.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-multiple-captures.rs
rename to src/test/ui/borrowck/borrowck-multiple-captures.rs
diff --git a/src/test/ui/borrowck/borrowck-multiple-captures.stderr b/src/test/ui/borrowck/borrowck-multiple-captures.stderr
new file mode 100644
index 0000000..3163ca6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-multiple-captures.stderr
@@ -0,0 +1,84 @@
+error[E0504]: cannot move `x1` into closure because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:23:14
+ |
+LL | let p1 = &x1;
+ | -- borrow of `x1` occurs here
+...
+LL | drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed
+ | ^^ move into closure occurs here
+
+error[E0504]: cannot move `x2` into closure because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:24:14
+ |
+LL | let p2 = &x2;
+ | -- borrow of `x2` occurs here
+...
+LL | drop(x2); //~ ERROR cannot move `x2` into closure because it is borrowed
+ | ^^ move into closure occurs here
+
+error[E0382]: capture of moved value: `x1`
+ --> $DIR/borrowck-multiple-captures.rs:36:14
+ |
+LL | drop(x1);
+ | -- value moved here
+...
+LL | drop(x1); //~ ERROR capture of moved value: `x1`
+ | ^^ value captured here after move
+ |
+ = note: move occurs because `x1` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: capture of moved value: `x2`
+ --> $DIR/borrowck-multiple-captures.rs:37:14
+ |
+LL | drop(x2);
+ | -- value moved here
+...
+LL | drop(x2); //~ ERROR capture of moved value: `x2`
+ | ^^ value captured here after move
+ |
+ = note: move occurs because `x2` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0504]: cannot move `x` into closure because it is borrowed
+ --> $DIR/borrowck-multiple-captures.rs:45:14
+ |
+LL | let p = &x;
+ | - borrow of `x` occurs here
+LL | thread::spawn(move|| {
+LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
+ | ^ move into closure occurs here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:46:14
+ |
+LL | drop(x); //~ ERROR cannot move `x` into closure because it is borrowed
+ | - value moved here
+LL | drop(x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: capture of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:55:14
+ |
+LL | drop(x);
+ | - value moved here
+LL | thread::spawn(move|| {
+LL | drop(x); //~ ERROR capture of moved value: `x`
+ | ^ value captured here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/borrowck-multiple-captures.rs:56:14
+ |
+LL | drop(x); //~ ERROR capture of moved value: `x`
+ | - value moved here
+LL | drop(x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0382, E0504.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr
new file mode 100644
index 0000000..352ace4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-mut-addr-of-imm-var.rs:13:25
+ |
+LL | let x: isize = 3;
+ | - help: consider changing this to be mutable: `mut x`
+LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-mut-addr-of-imm-var.rs b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-mut-addr-of-imm-var.rs
rename to src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.rs
diff --git a/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr
new file mode 100644
index 0000000..0859a4e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-addr-of-imm-var.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `x` as mutable
+ --> $DIR/borrowck-mut-addr-of-imm-var.rs:13:30
+ |
+LL | let x: isize = 3;
+ | - consider changing this to `mut x`
+LL | let y: &mut isize = &mut x; //~ ERROR cannot borrow
+ | ^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr
new file mode 100644
index 0000000..b3c86a5
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.nll.stderr
@@ -0,0 +1,32 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:23:30
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ---- ^^^^^^ second mutable borrow occurs here
+ | |
+ | borrow used here in later iteration of loop
+...
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ------ first mutable borrow occurs here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ---- borrow used here in later iteration of loop
+LL | //[mir]~^ ERROR [E0499]
+LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR [E0499]
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ------ first mutable borrow occurs here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:27:30
+ |
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^^^^^^ mutable borrow starts here in previous iteration of loop
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr
new file mode 100644
index 0000000..7a43cf1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.ast.stderr
@@ -0,0 +1,36 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:23:35
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^ mutable borrow starts here in previous iteration of loop
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:35
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | - first mutable borrow occurs here
+LL | //[mir]~^ ERROR [E0499]
+LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:27:35
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | - first mutable borrow occurs here
+...
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr
new file mode 100644
index 0000000..b3c86a5
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.mir.stderr
@@ -0,0 +1,32 @@
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:23:30
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ---- ^^^^^^ second mutable borrow occurs here
+ | |
+ | borrow used here in later iteration of loop
+...
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ------ first mutable borrow occurs here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:25:30
+ |
+LL | 1 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ---- borrow used here in later iteration of loop
+LL | //[mir]~^ ERROR [E0499]
+LL | 2 => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR [E0499]
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ------ first mutable borrow occurs here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-linear-errors.rs:27:30
+ |
+LL | _ => { addr.push(&mut x); } //[ast]~ ERROR [E0499]
+ | ^^^^^^ mutable borrow starts here in previous iteration of loop
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs b/src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-mut-borrow-linear-errors.rs
rename to src/test/ui/borrowck/borrowck-mut-borrow-linear-errors.rs
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr
new file mode 100644
index 0000000..0684e78
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:18
+ |
+LL | let p: &isize = &*t0; // Freezes `*t0`
+ | ---- immutable borrow occurs here
+LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
+ | ^^^^^^^ mutable borrow occurs here
+LL | **t2 += 1; // Mutates `*t0`
+LL | p.use_ref();
+ | - borrow later used here
+
+error[E0499]: cannot borrow `t0` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:29:18
+ |
+LL | let p: &mut isize = &mut *t0; // Claims `*t0`
+ | -------- first mutable borrow occurs here
+LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
+ | ^^^^^^^ second mutable borrow occurs here
+LL | **t2 += 1; // Mutates `*t0` but not through `*p`
+LL | p.use_mut();
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs
new file mode 100644
index 0000000..45768ef
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.rs
@@ -0,0 +1,38 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that attempt to mutably borrow `&mut` pointer while pointee is
+// borrowed yields an error.
+//
+// Example from src/librustc_borrowck/borrowck/README.md
+
+
+
+fn foo<'a>(mut t0: &'a mut isize,
+ mut t1: &'a mut isize) {
+ let p: &isize = &*t0; // Freezes `*t0`
+ let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
+ **t2 += 1; // Mutates `*t0`
+ p.use_ref();
+}
+
+fn bar<'a>(mut t0: &'a mut isize,
+ mut t1: &'a mut isize) {
+ let p: &mut isize = &mut *t0; // Claims `*t0`
+ let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
+ **t2 += 1; // Mutates `*t0` but not through `*p`
+ p.use_mut();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
new file mode 100644
index 0000000..d5b8831
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
+ --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:23
+ |
+LL | let p: &isize = &*t0; // Freezes `*t0`
+ | --- immutable borrow occurs here
+LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
+ | ^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0499]: cannot borrow `t0` as mutable more than once at a time
+ --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:29:23
+ |
+LL | let p: &mut isize = &mut *t0; // Claims `*t0`
+ | --- first mutable borrow occurs here
+LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
+ | ^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr
new file mode 100644
index 0000000..7c151da
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-mut-slice-of-imm-vec.rs:17:11
+ |
+LL | let v = vec![1, 2, 3];
+ | - help: consider changing this to be mutable: `mut v`
+LL | write(&mut v); //~ ERROR cannot borrow
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-mut-slice-of-imm-vec.rs b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-mut-slice-of-imm-vec.rs
rename to src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.rs
diff --git a/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr
new file mode 100644
index 0000000..e2fd9d7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mut-slice-of-imm-vec.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `v` as mutable
+ --> $DIR/borrowck-mut-slice-of-imm-vec.rs:17:16
+ |
+LL | let v = vec![1, 2, 3];
+ | - consider changing this to `mut v`
+LL | write(&mut v); //~ ERROR cannot borrow
+ | ^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-mutate-in-guard.rs b/src/test/ui/borrowck/borrowck-mutate-in-guard.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-mutate-in-guard.rs
rename to src/test/ui/borrowck/borrowck-mutate-in-guard.rs
diff --git a/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
new file mode 100644
index 0000000..7a111a1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-mutate-in-guard.stderr
@@ -0,0 +1,22 @@
+error[E0302]: cannot assign in a pattern guard
+ --> $DIR/borrowck-mutate-in-guard.rs:20:25
+ |
+LL | Enum::A(_) if { x = Enum::B(false); false } => 1,
+ | ^^^^^^^^^^^^^^^^^^ assignment in pattern guard
+
+error[E0301]: cannot mutably borrow in a pattern guard
+ --> $DIR/borrowck-mutate-in-guard.rs:22:38
+ |
+LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+ | ^ borrowed mutably in pattern guard
+
+error[E0302]: cannot assign in a pattern guard
+ --> $DIR/borrowck-mutate-in-guard.rs:22:41
+ |
+LL | Enum::A(_) if { let y = &mut x; *y = Enum::B(false); false } => 1,
+ | ^^^^^^^^^^^^^^^^^^^ assignment in pattern guard
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0301, E0302.
+For more information about an error, try `rustc --explain E0301`.
diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr
new file mode 100644
index 0000000..9bb1e82
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.nll.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:26:15
+ |
+LL | cycle::node(ref mut y) => {
+ | --------- borrow of `x.0` occurs here
+LL | y.a = x; //~ ERROR cannot move out of
+ | --- ^ move out of `x` occurs here
+ | |
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/borrowck/borrowck-no-cycle-in-exchange-heap.rs b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-no-cycle-in-exchange-heap.rs
rename to src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.rs
diff --git a/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr
new file mode 100644
index 0000000..693f25e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-no-cycle-in-exchange-heap.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-no-cycle-in-exchange-heap.rs:26:15
+ |
+LL | cycle::node(ref mut y) => {
+ | --------- borrow of `x.0` occurs here
+LL | y.a = x; //~ ERROR cannot move out of
+ | ^ move out of `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr
new file mode 100644
index 0000000..e4e2dfe
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-object-lifetime.nll.stderr
@@ -0,0 +1,23 @@
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-object-lifetime.rs:30:13
+ |
+LL | let y = x.borrowed();
+ | - immutable borrow occurs here
+LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^^^ mutable borrow occurs here
+LL | y.use_ref();
+ | - borrow later used here
+
+error[E0502]: cannot borrow `x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-object-lifetime.rs:36:13
+ |
+LL | let y = x.borrowed();
+ | - immutable borrow occurs here
+LL | let z = &mut x; //~ ERROR cannot borrow
+ | ^^^^^^ mutable borrow occurs here
+LL | y.use_ref();
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.rs b/src/test/ui/borrowck/borrowck-object-lifetime.rs
new file mode 100644
index 0000000..cb7486a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-object-lifetime.rs
@@ -0,0 +1,50 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that borrows that occur due to calls to object methods
+// properly "claim" the object path.
+
+
+
+trait Foo {
+ fn borrowed(&self) -> &();
+ fn mut_borrowed(&mut self) -> &();
+}
+
+fn borrowed_receiver(x: &Foo) {
+ let y = x.borrowed();
+ let z = x.borrowed();
+ z.use_ref();
+ y.use_ref();
+}
+
+fn mut_borrowed_receiver(x: &mut Foo) {
+ let y = x.borrowed();
+ let z = x.mut_borrowed(); //~ ERROR cannot borrow
+ y.use_ref();
+}
+
+fn mut_owned_receiver(mut x: Box<Foo>) {
+ let y = x.borrowed();
+ let z = &mut x; //~ ERROR cannot borrow
+ y.use_ref();
+}
+
+fn imm_owned_receiver(mut x: Box<Foo>) {
+ let y = x.borrowed();
+ let z = &x;
+ z.use_ref();
+ y.use_ref();
+}
+
+fn main() {}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-object-lifetime.stderr b/src/test/ui/borrowck/borrowck-object-lifetime.stderr
new file mode 100644
index 0000000..5e9045d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-object-lifetime.stderr
@@ -0,0 +1,25 @@
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-object-lifetime.rs:30:13
+ |
+LL | let y = x.borrowed();
+ | - immutable borrow occurs here
+LL | let z = x.mut_borrowed(); //~ ERROR cannot borrow
+ | ^ mutable borrow occurs here
+LL | y.use_ref();
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `x` as mutable because `*x` is also borrowed as immutable
+ --> $DIR/borrowck-object-lifetime.rs:36:18
+ |
+LL | let y = x.borrowed();
+ | - immutable borrow occurs here
+LL | let z = &mut x; //~ ERROR cannot borrow
+ | ^ mutable borrow occurs here
+LL | y.use_ref();
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-or-init.nll.stderr b/src/test/ui/borrowck/borrowck-or-init.nll.stderr
new file mode 100644
index 0000000..dd8bf87
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-or-init.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `i`
+ --> $DIR/borrowck-or-init.rs:15:20
+ |
+LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ | ^ use of possibly uninitialized `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-or-init.rs b/src/test/ui/borrowck/borrowck-or-init.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-or-init.rs
rename to src/test/ui/borrowck/borrowck-or-init.rs
diff --git a/src/test/ui/borrowck/borrowck-or-init.stderr b/src/test/ui/borrowck/borrowck-or-init.stderr
new file mode 100644
index 0000000..bc1c3a5
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-or-init.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `i`
+ --> $DIR/borrowck-or-init.rs:15:20
+ |
+LL | println!("{}", i); //~ ERROR use of possibly uninitialized variable: `i`
+ | ^ use of possibly uninitialized `i`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
new file mode 100644
index 0000000..dc8d731
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.nll.stderr
@@ -0,0 +1,23 @@
+error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-overloaded-call.rs:77:5
+ |
+LL | let s = SFnMut {
+ | - help: consider changing this to be mutable: `mut s`
+...
+LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable
+ | ^ cannot borrow as mutable
+
+error[E0382]: use of moved value: `s`
+ --> $DIR/borrowck-overloaded-call.rs:85:5
+ |
+LL | s(" world".to_string());
+ | - value moved here
+LL | s(" world".to_string()); //~ ERROR use of moved value: `s`
+ | ^ value used here after move
+ |
+ = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0382, E0596.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-call.rs b/src/test/ui/borrowck/borrowck-overloaded-call.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-overloaded-call.rs
rename to src/test/ui/borrowck/borrowck-overloaded-call.rs
diff --git a/src/test/ui/borrowck/borrowck-overloaded-call.stderr b/src/test/ui/borrowck/borrowck-overloaded-call.stderr
new file mode 100644
index 0000000..213d783
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-call.stderr
@@ -0,0 +1,33 @@
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-call.rs:69:5
+ |
+LL | let sp = &mut s;
+ | - mutable borrow occurs here
+LL | s(3); //~ ERROR cannot borrow `s` as immutable because it is also borrowed as mutable
+ | ^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error[E0596]: cannot borrow immutable local variable `s` as mutable
+ --> $DIR/borrowck-overloaded-call.rs:77:5
+ |
+LL | let s = SFnMut {
+ | - consider changing this to `mut s`
+...
+LL | s(3); //~ ERROR cannot borrow immutable local variable `s` as mutable
+ | ^ cannot borrow mutably
+
+error[E0382]: use of moved value: `s`
+ --> $DIR/borrowck-overloaded-call.rs:85:5
+ |
+LL | s(" world".to_string());
+ | - value moved here
+LL | s(" world".to_string()); //~ ERROR use of moved value: `s`
+ | ^ value used here after move
+ |
+ = note: move occurs because `s` has type `SFnOnce`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0382, E0502, E0596.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr
new file mode 100644
index 0000000..874e6d7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `v` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:44:5
+ |
+LL | let i = &v[0].f;
+ | - borrow of `v` occurs here
+LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
+...
+LL | read(*i);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr
new file mode 100644
index 0000000..8343b60
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.ast.stderr
@@ -0,0 +1,11 @@
+error[E0506]: cannot assign to `v` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:44:5
+ |
+LL | let i = &v[0].f;
+ | - borrow of `v` occurs here
+LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr
new file mode 100644
index 0000000..874e6d7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.mir.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `v` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-and-overloaded-deref.rs:44:5
+ |
+LL | let i = &v[0].f;
+ | - borrow of `v` occurs here
+LL | v = MyVec { x: MyPtr { x: Foo { f: 23 } } };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `v` occurs here
+...
+LL | read(*i);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs b/src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
rename to src/test/ui/borrowck/borrowck-overloaded-index-and-overloaded-deref.rs
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr
new file mode 100644
index 0000000..994492d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.nll.stderr
@@ -0,0 +1,84 @@
+error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:47:14
+ |
+LL | let p = &mut f[&s];
+ | - mutable borrow occurs here
+LL | let q = &f[&s]; //~ ERROR cannot borrow
+ | ^ immutable borrow occurs here
+LL | p.use_mut();
+ | - borrow later used here
+
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
+ |
+LL | let p = &mut f[&s];
+ | - first mutable borrow occurs here
+LL | let q = &mut f[&s]; //~ ERROR cannot borrow
+ | ^ second mutable borrow occurs here
+LL | p.use_mut();
+ | - borrow later used here
+
+error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:63:18
+ |
+LL | let p = &mut f.foo[&s];
+ | ----- first mutable borrow occurs here
+LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow
+ | ^^^^^ second mutable borrow occurs here
+LL | p.use_mut();
+ | - borrow later used here
+
+error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:75:18
+ |
+LL | let p = &f.foo[&s];
+ | ----- immutable borrow occurs here
+LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow
+ | ^^^^^ mutable borrow occurs here
+LL | p.use_ref();
+ | - borrow later used here
+
+error[E0506]: cannot assign to `f.foo` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:81:5
+ |
+LL | let p = &f.foo[&s];
+ | ----- borrow of `f.foo` occurs here
+LL | f.foo = g; //~ ERROR cannot assign
+ | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+LL | p.use_ref();
+ | - borrow later used here
+
+error[E0506]: cannot assign to `*f` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:87:5
+ |
+LL | let p = &f.foo[&s];
+ | ----- borrow of `*f` occurs here
+LL | *f = g; //~ ERROR cannot assign
+ | ^^^^^^ assignment to borrowed `*f` occurs here
+LL | p.use_ref();
+ | - borrow later used here
+
+error[E0506]: cannot assign to `f.foo` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:93:5
+ |
+LL | let p = &mut f.foo[&s];
+ | ----- borrow of `f.foo` occurs here
+LL | f.foo = g; //~ ERROR cannot assign
+ | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+LL | p.use_mut();
+ | - borrow later used here
+
+error[E0506]: cannot assign to `*f` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:99:5
+ |
+LL | let p = &mut f.foo[&s];
+ | ----- borrow of `*f` occurs here
+LL | *f = g; //~ ERROR cannot assign
+ | ^^^^^^ assignment to borrowed `*f` occurs here
+LL | p.use_mut();
+ | - borrow later used here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs
new file mode 100644
index 0000000..5ab3d75
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.rs
@@ -0,0 +1,107 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that we still see borrowck errors of various kinds when using
+// indexing and autoderef in combination.
+
+use std::ops::{Index, IndexMut};
+
+
+
+struct Foo {
+ x: isize,
+ y: isize,
+}
+
+impl<'a> Index<&'a String> for Foo {
+ type Output = isize;
+
+ fn index(&self, z: &String) -> &isize {
+ if *z == "x" {
+ &self.x
+ } else {
+ &self.y
+ }
+ }
+}
+
+impl<'a> IndexMut<&'a String> for Foo {
+ fn index_mut(&mut self, z: &String) -> &mut isize {
+ if *z == "x" {
+ &mut self.x
+ } else {
+ &mut self.y
+ }
+ }
+}
+
+fn test1(mut f: Box<Foo>, s: String) {
+ let p = &mut f[&s];
+ let q = &f[&s]; //~ ERROR cannot borrow
+ p.use_mut();
+}
+
+fn test2(mut f: Box<Foo>, s: String) {
+ let p = &mut f[&s];
+ let q = &mut f[&s]; //~ ERROR cannot borrow
+ p.use_mut();
+}
+
+struct Bar {
+ foo: Foo
+}
+
+fn test3(mut f: Box<Bar>, s: String) {
+ let p = &mut f.foo[&s];
+ let q = &mut f.foo[&s]; //~ ERROR cannot borrow
+ p.use_mut();
+}
+
+fn test4(mut f: Box<Bar>, s: String) {
+ let p = &f.foo[&s];
+ let q = &f.foo[&s];
+ p.use_ref();
+}
+
+fn test5(mut f: Box<Bar>, s: String) {
+ let p = &f.foo[&s];
+ let q = &mut f.foo[&s]; //~ ERROR cannot borrow
+ p.use_ref();
+}
+
+fn test6(mut f: Box<Bar>, g: Foo, s: String) {
+ let p = &f.foo[&s];
+ f.foo = g; //~ ERROR cannot assign
+ p.use_ref();
+}
+
+fn test7(mut f: Box<Bar>, g: Bar, s: String) {
+ let p = &f.foo[&s];
+ *f = g; //~ ERROR cannot assign
+ p.use_ref();
+}
+
+fn test8(mut f: Box<Bar>, g: Foo, s: String) {
+ let p = &mut f.foo[&s];
+ f.foo = g; //~ ERROR cannot assign
+ p.use_mut();
+}
+
+fn test9(mut f: Box<Bar>, g: Bar, s: String) {
+ let p = &mut f.foo[&s];
+ *f = g; //~ ERROR cannot assign
+ p.use_mut();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
new file mode 100644
index 0000000..7a17a55
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-autoderef.stderr
@@ -0,0 +1,80 @@
+error[E0502]: cannot borrow `*f` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:47:14
+ |
+LL | let p = &mut f[&s];
+ | - mutable borrow occurs here
+LL | let q = &f[&s]; //~ ERROR cannot borrow
+ | ^ immutable borrow occurs here
+LL | p.use_mut();
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:53:18
+ |
+LL | let p = &mut f[&s];
+ | - first mutable borrow occurs here
+LL | let q = &mut f[&s]; //~ ERROR cannot borrow
+ | ^ second mutable borrow occurs here
+LL | p.use_mut();
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `f.foo` as mutable more than once at a time
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:63:18
+ |
+LL | let p = &mut f.foo[&s];
+ | ----- first mutable borrow occurs here
+LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow
+ | ^^^^^ second mutable borrow occurs here
+LL | p.use_mut();
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `f.foo` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:75:18
+ |
+LL | let p = &f.foo[&s];
+ | ----- immutable borrow occurs here
+LL | let q = &mut f.foo[&s]; //~ ERROR cannot borrow
+ | ^^^^^ mutable borrow occurs here
+LL | p.use_ref();
+LL | }
+ | - immutable borrow ends here
+
+error[E0506]: cannot assign to `f.foo` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:81:5
+ |
+LL | let p = &f.foo[&s];
+ | ----- borrow of `f.foo` occurs here
+LL | f.foo = g; //~ ERROR cannot assign
+ | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+
+error[E0506]: cannot assign to `*f` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:87:5
+ |
+LL | let p = &f.foo[&s];
+ | ----- borrow of `*f` occurs here
+LL | *f = g; //~ ERROR cannot assign
+ | ^^^^^^ assignment to borrowed `*f` occurs here
+
+error[E0506]: cannot assign to `f.foo` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:93:5
+ |
+LL | let p = &mut f.foo[&s];
+ | ----- borrow of `f.foo` occurs here
+LL | f.foo = g; //~ ERROR cannot assign
+ | ^^^^^^^^^ assignment to borrowed `f.foo` occurs here
+
+error[E0506]: cannot assign to `*f` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-autoderef.rs:99:5
+ |
+LL | let p = &mut f.foo[&s];
+ | ----- borrow of `*f` occurs here
+LL | *f = g; //~ ERROR cannot assign
+ | ^^^^^^ assignment to borrowed `*f` occurs here
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr
new file mode 100644
index 0000000..92e10c2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15
+ |
+LL | let bad = v[0];
+ | ^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&v[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-move-from-vec.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-overloaded-index-move-from-vec.rs
rename to src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.rs
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr
new file mode 100644
index 0000000..56246cb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of indexed content
+ --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15
+ |
+LL | let bad = v[0];
+ | ^^^^
+ | |
+ | cannot move out of indexed content
+ | help: consider using a reference instead: `&v[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
new file mode 100644
index 0000000..824d829
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.nll.stderr
@@ -0,0 +1,14 @@
+error[E0382]: use of moved value: `s`
+ --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
+ |
+LL | println!("{}", f[s]);
+ | - value moved here
+...
+LL | f[s] = 10;
+ | ^ value used here after move
+ |
+ = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-move-index.rs b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-overloaded-index-move-index.rs
rename to src/test/ui/borrowck/borrowck-overloaded-index-move-index.rs
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr
new file mode 100644
index 0000000..cfa5a6e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-index.stderr
@@ -0,0 +1,33 @@
+error[E0505]: cannot move out of `s` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-move-index.rs:60:22
+ |
+LL | let rs = &mut s;
+ | - borrow of `s` occurs here
+LL |
+LL | println!("{}", f[s]);
+ | ^ move out of `s` occurs here
+
+error[E0505]: cannot move out of `s` because it is borrowed
+ --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
+ |
+LL | let rs = &mut s;
+ | - borrow of `s` occurs here
+...
+LL | f[s] = 10;
+ | ^ move out of `s` occurs here
+
+error[E0382]: use of moved value: `s`
+ --> $DIR/borrowck-overloaded-index-move-index.rs:63:7
+ |
+LL | println!("{}", f[s]);
+ | - value moved here
+...
+LL | f[s] = 10;
+ | ^ value used here after move
+ |
+ = note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0382, E0505.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr
new file mode 100644
index 0000000..3a2bfb1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.nll.stderr
@@ -0,0 +1,33 @@
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:62:22
+ |
+LL | let rs = &mut s;
+ | ------ mutable borrow occurs here
+LL | println!("{}", f[&s]);
+ | ^^ immutable borrow occurs here
+...
+LL | drop(rs);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:65:7
+ |
+LL | let rs = &mut s;
+ | ------ mutable borrow occurs here
+...
+LL | f[&s] = 10;
+ | ^^ immutable borrow occurs here
+...
+LL | drop(rs);
+ | -- borrow later used here
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:71:5
+ |
+LL | s[2] = 20;
+ | ^^^^^^^^^ cannot assign
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0502, E0594.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr
new file mode 100644
index 0000000..8675c5b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.ast.stderr
@@ -0,0 +1,35 @@
+error[E0594]: cannot assign to immutable indexed content
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:71:5
+ |
+LL | s[2] = 20;
+ | ^^^^^^^^^ cannot borrow as mutable
+ |
+ = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Bar`
+
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:62:23
+ |
+LL | let rs = &mut s;
+ | - mutable borrow occurs here
+LL | println!("{}", f[&s]);
+ | ^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:65:8
+ |
+LL | let rs = &mut s;
+ | - mutable borrow occurs here
+...
+LL | f[&s] = 10;
+ | ^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0502, E0594.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr
new file mode 100644
index 0000000..3a2bfb1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr
@@ -0,0 +1,33 @@
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:62:22
+ |
+LL | let rs = &mut s;
+ | ------ mutable borrow occurs here
+LL | println!("{}", f[&s]);
+ | ^^ immutable borrow occurs here
+...
+LL | drop(rs);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:65:7
+ |
+LL | let rs = &mut s;
+ | ------ mutable borrow occurs here
+...
+LL | f[&s] = 10;
+ | ^^ immutable borrow occurs here
+...
+LL | drop(rs);
+ | -- borrow later used here
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/borrowck-overloaded-index-ref-index.rs:71:5
+ |
+LL | s[2] = 20;
+ | ^^^^^^^^^ cannot assign
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0502, E0594.
+For more information about an error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs b/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-overloaded-index-ref-index.rs
rename to src/test/ui/borrowck/borrowck-overloaded-index-ref-index.rs
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr
new file mode 100644
index 0000000..0444bf9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.nll.stderr
@@ -0,0 +1,23 @@
+error[E0382]: assign of moved value: `t`
+ --> $DIR/borrowck-partial-reinit-1.rs:37:5
+ |
+LL | drop(t);
+ | - value moved here
+LL | t.b = Some(u);
+ | ^^^ value assigned here after move
+ |
+ = note: move occurs because `t` has type `Test2`, which does not implement the `Copy` trait
+
+error[E0382]: assign of moved value: `t`
+ --> $DIR/borrowck-partial-reinit-1.rs:43:5
+ |
+LL | drop(t);
+ | - value moved here
+LL | t.0 = Some(u);
+ | ^^^ value assigned here after move
+ |
+ = note: move occurs because `t` has type `Test3`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-partial-reinit-1.rs b/src/test/ui/borrowck/borrowck-partial-reinit-1.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-partial-reinit-1.rs
rename to src/test/ui/borrowck/borrowck-partial-reinit-1.rs
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr
new file mode 100644
index 0000000..c03921c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-1.stderr
@@ -0,0 +1,15 @@
+error[E0383]: partial reinitialization of uninitialized structure `t`
+ --> $DIR/borrowck-partial-reinit-1.rs:37:5
+ |
+LL | t.b = Some(u);
+ | ^^^^^^^^^^^^^
+
+error[E0383]: partial reinitialization of uninitialized structure `t`
+ --> $DIR/borrowck-partial-reinit-1.rs:43:5
+ |
+LL | t.0 = Some(u);
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0383`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr
new file mode 100644
index 0000000..14272fa
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: assign of moved value: `t`
+ --> $DIR/borrowck-partial-reinit-2.rs:25:5
+ |
+LL | let mut u = Test { a: 2, b: Some(Box::new(t))};
+ | - value moved here
+LL | t.b = Some(Box::new(u));
+ | ^^^ value assigned here after move
+ |
+ = note: move occurs because `t` has type `Test`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-partial-reinit-2.rs b/src/test/ui/borrowck/borrowck-partial-reinit-2.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-partial-reinit-2.rs
rename to src/test/ui/borrowck/borrowck-partial-reinit-2.rs
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr
new file mode 100644
index 0000000..4ed87b9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-2.stderr
@@ -0,0 +1,9 @@
+error[E0383]: partial reinitialization of uninitialized structure `t`
+ --> $DIR/borrowck-partial-reinit-2.rs:25:5
+ |
+LL | t.b = Some(Box::new(u));
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0383`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr
new file mode 100644
index 0000000..3979f1e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: assign of moved value: `x.0`
+ --> $DIR/borrowck-partial-reinit-3.rs:20:5
+ |
+LL | mem::drop(x.0);
+ | --- value moved here
+LL | x.0.f = 3;
+ | ^^^^^^^^^ value assigned here after move
+ |
+ = note: move occurs because `x.0` has type `Test`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-partial-reinit-3.rs b/src/test/ui/borrowck/borrowck-partial-reinit-3.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-partial-reinit-3.rs
rename to src/test/ui/borrowck/borrowck-partial-reinit-3.rs
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr
new file mode 100644
index 0000000..66465c0
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-3.stderr
@@ -0,0 +1,9 @@
+error[E0383]: partial reinitialization of uninitialized structure `x.0`
+ --> $DIR/borrowck-partial-reinit-3.rs:20:5
+ |
+LL | x.0.f = 3;
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0383`.
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr
new file mode 100644
index 0000000..e1ede72
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: assign of possibly uninitialized variable: `x.0`
+ --> $DIR/borrowck-partial-reinit-4.rs:27:5
+ |
+LL | (x.0).0 = Some(Test);
+ | ^^^^^^^ use of possibly uninitialized `x.0`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-partial-reinit-4.rs b/src/test/ui/borrowck/borrowck-partial-reinit-4.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-partial-reinit-4.rs
rename to src/test/ui/borrowck/borrowck-partial-reinit-4.rs
diff --git a/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr
new file mode 100644
index 0000000..229a53a
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-partial-reinit-4.stderr
@@ -0,0 +1,9 @@
+error[E0383]: partial reinitialization of uninitialized structure `x.0`
+ --> $DIR/borrowck-partial-reinit-4.rs:27:5
+ |
+LL | (x.0).0 = Some(Test);
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0383`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr
new file mode 100644
index 0000000..cfcf177
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-pat-reassign-binding.rs:23:11
+ |
+LL | Some(ref i) => {
+ | ----- borrow of `x` occurs here
+LL | // But on this branch, `i` is an outstanding borrow
+LL | x = Some(*i+1); //[ast]~ ERROR cannot assign to `x`
+ | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(i);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr
new file mode 100644
index 0000000..fdc04e2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.ast.stderr
@@ -0,0 +1,12 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-pat-reassign-binding.rs:23:11
+ |
+LL | Some(ref i) => {
+ | ----- borrow of `x` occurs here
+LL | // But on this branch, `i` is an outstanding borrow
+LL | x = Some(*i+1); //[ast]~ ERROR cannot assign to `x`
+ | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr b/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr
new file mode 100644
index 0000000..cfcf177
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-pat-reassign-binding.mir.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/borrowck-pat-reassign-binding.rs:23:11
+ |
+LL | Some(ref i) => {
+ | ----- borrow of `x` occurs here
+LL | // But on this branch, `i` is an outstanding borrow
+LL | x = Some(*i+1); //[ast]~ ERROR cannot assign to `x`
+ | ^^^^^^^^^^^^^^ assignment to borrowed `x` occurs here
+LL | //[mir]~^ ERROR cannot assign to `x` because it is borrowed
+LL | drop(i);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs b/src/test/ui/borrowck/borrowck-pat-reassign-binding.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-pat-reassign-binding.rs
rename to src/test/ui/borrowck/borrowck-pat-reassign-binding.rs
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
new file mode 100644
index 0000000..4c81bb8
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `foo.bar1` as mutable, as it is behind a `&` reference
+ --> $DIR/borrowck-reborrow-from-mut.rs:98:17
+ |
+LL | fn borrow_mut_from_imm(foo: &Foo) {
+ | ---- help: consider changing this to be a mutable reference: `&mut Foo`
+LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-reborrow-from-mut.rs b/src/test/ui/borrowck/borrowck-reborrow-from-mut.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-reborrow-from-mut.rs
rename to src/test/ui/borrowck/borrowck-reborrow-from-mut.rs
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
new file mode 100644
index 0000000..00660ff
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-mut.stderr
@@ -0,0 +1,116 @@
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-reborrow-from-mut.rs:23:22
+ |
+LL | let _bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:28:18
+ |
+LL | let _bar1 = &mut foo.bar1;
+ | -------- mutable borrow occurs here
+LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:33:22
+ |
+LL | let _bar1 = &foo.bar1;
+ | -------- immutable borrow occurs here
+LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-reborrow-from-mut.rs:55:21
+ |
+LL | let _bar1 = &mut foo.bar1;
+ | -------- first mutable borrow occurs here
+LL | match *foo {
+LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
+ | ^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:62:18
+ |
+LL | let _bar1 = &mut foo.bar1.int1;
+ | ------------- mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ immutable borrow occurs here
+LL | let _foo2 = &*foo; //~ ERROR cannot borrow
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:63:18
+ |
+LL | let _bar1 = &mut foo.bar1.int1;
+ | ------------- mutable borrow occurs here
+LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+LL | let _foo2 = &*foo; //~ ERROR cannot borrow
+ | ^^^^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
+ --> $DIR/borrowck-reborrow-from-mut.rs:68:22
+ |
+LL | let _bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `*foo` as mutable more than once at a time
+ --> $DIR/borrowck-reborrow-from-mut.rs:73:22
+ |
+LL | let _bar1 = &mut foo.bar1.int1;
+ | ------------- first mutable borrow occurs here
+LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
+ | ^^^^ second mutable borrow occurs here
+LL | }
+ | - first borrow ends here
+
+error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:78:22
+ |
+LL | let _bar1 = &foo.bar1.int1;
+ | ------------- immutable borrow occurs here
+LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:83:22
+ |
+LL | let _bar1 = &foo.bar1.int1;
+ | ------------- immutable borrow occurs here
+LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
+ | ^^^^ mutable borrow occurs here
+LL | }
+ | - immutable borrow ends here
+
+error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
+ --> $DIR/borrowck-reborrow-from-mut.rs:98:22
+ |
+LL | fn borrow_mut_from_imm(foo: &Foo) {
+ | ---- use `&mut Foo` here to make mutable
+LL | let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to 11 previous errors
+
+Some errors occurred: E0499, E0502, E0596.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr
new file mode 100644
index 0000000..b7aad5c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:19:18
+ |
+LL | S { pointer: &mut *p.pointer }
+ | ^^^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:19:5
+ |
+LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | S { pointer: &mut *p.pointer }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs
rename to src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.rs
diff --git a/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr
new file mode 100644
index 0000000..52dabfa
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-reborrow-from-shorter-lived-andmut.stderr
@@ -0,0 +1,13 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/borrowck-reborrow-from-shorter-lived-andmut.rs:19:5
+ |
+LL | fn copy_borrowed_ptr<'a,'b>(p: &'a mut S<'b>) -> S<'b> {
+ | ------------- -----
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | S { pointer: &mut *p.pointer }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `p` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr
new file mode 100644
index 0000000..ccea5d9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.nll.stderr
@@ -0,0 +1,12 @@
+error[E0596]: cannot borrow `x.0` as mutable, as `x` is not declared as mutable
+ --> $DIR/borrowck-ref-mut-of-imm.rs:14:12
+ |
+LL | fn destructure(x: Option<isize>) -> isize {
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | Some(ref mut v) => *v //~ ERROR cannot borrow
+ | ^^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/borrowck/borrowck-ref-mut-of-imm.rs b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-ref-mut-of-imm.rs
rename to src/test/ui/borrowck/borrowck-ref-mut-of-imm.rs
diff --git a/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr
new file mode 100644
index 0000000..2e2a122
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-ref-mut-of-imm.stderr
@@ -0,0 +1,12 @@
+error[E0596]: cannot borrow field `(x as std::prelude::v1::Some).0` of immutable binding as mutable
+ --> $DIR/borrowck-ref-mut-of-imm.rs:14:12
+ |
+LL | fn destructure(x: Option<isize>) -> isize {
+ | - consider changing this to `mut x`
+...
+LL | Some(ref mut v) => *v //~ ERROR cannot borrow
+ | ^^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr
new file mode 100644
index 0000000..93436d0
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.nll.stderr
@@ -0,0 +1,17 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:17:5
+ |
+LL | (&x).clone() //~ ERROR `x` does not live long enough
+ | ^^^^ borrowed value does not live long enough
+LL | }
+ | - `x` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 16:9...
+ --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:16:9
+ |
+LL | fn leak<'a, T>(x: T) -> &'a T {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-return-variable-on-stack-via-clone.rs b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-return-variable-on-stack-via-clone.rs
rename to src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.rs
diff --git a/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr
new file mode 100644
index 0000000..69d5229
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-return-variable-on-stack-via-clone.stderr
@@ -0,0 +1,17 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:17:7
+ |
+LL | (&x).clone() //~ ERROR `x` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 16:9...
+ --> $DIR/borrowck-return-variable-on-stack-via-clone.rs:16:9
+ |
+LL | fn leak<'a, T>(x: T) -> &'a T {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-return.rs b/src/test/ui/borrowck/borrowck-return.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-return.rs
rename to src/test/ui/borrowck/borrowck-return.rs
diff --git a/src/test/ui/borrowck/borrowck-return.stderr b/src/test/ui/borrowck/borrowck-return.stderr
new file mode 100644
index 0000000..7223289
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-return.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-return.rs:13:12
+ |
+LL | return x; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-storage-dead.rs b/src/test/ui/borrowck/borrowck-storage-dead.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-storage-dead.rs
rename to src/test/ui/borrowck/borrowck-storage-dead.rs
diff --git a/src/test/ui/borrowck/borrowck-storage-dead.stderr b/src/test/ui/borrowck/borrowck-storage-dead.stderr
new file mode 100644
index 0000000..edb7c13
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-storage-dead.stderr
@@ -0,0 +1,15 @@
+error[E0381]: use of possibly uninitialized variable: `x` (Ast)
+ --> $DIR/borrowck-storage-dead.rs:28:17
+ |
+LL | let _ = x + 1; //~ERROR (Ast) [E0381]
+ | ^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x` (Mir)
+ --> $DIR/borrowck-storage-dead.rs:28:17
+ |
+LL | let _ = x + 1; //~ERROR (Ast) [E0381]
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr
new file mode 100644
index 0000000..a811f5d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:25:15
+ |
+LL | let _s2 = S{a: 2, ..s0};
+ | ^^^^^^^^^^^^^ cannot move out of here
+
+error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:31:15
+ |
+LL | let _s2 = T{a: 2, ..s0};
+ | ^^^^^^^^^^^^^ cannot move out of here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr
new file mode 100644
index 0000000..aebee2c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.ast.stderr
@@ -0,0 +1,15 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:25:25
+ |
+LL | let _s2 = S{a: 2, ..s0};
+ | ^^ cannot move out of here
+
+error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:31:25
+ |
+LL | let _s2 = T{a: 2, ..s0};
+ | ^^ cannot move out of here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr
new file mode 100644
index 0000000..a811f5d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.mir.stderr
@@ -0,0 +1,15 @@
+error[E0509]: cannot move out of type `S`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:25:15
+ |
+LL | let _s2 = S{a: 2, ..s0};
+ | ^^^^^^^^^^^^^ cannot move out of here
+
+error[E0509]: cannot move out of type `T`, which implements the `Drop` trait
+ --> $DIR/borrowck-struct-update-with-dtor.rs:31:15
+ |
+LL | let _s2 = T{a: 2, ..s0};
+ | ^^^^^^^^^^^^^ cannot move out of here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs b/src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-struct-update-with-dtor.rs
rename to src/test/ui/borrowck/borrowck-struct-update-with-dtor.rs
diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr
new file mode 100644
index 0000000..5f60569
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.nll.stderr
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-swap-mut-base-ptr.rs:23:10
+ |
+LL | let p: &isize = &*t0; // Freezes `*t0`
+ | ---- immutable borrow occurs here
+LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0`
+ | ^^^^^^^ mutable borrow occurs here
+LL | *t1 = 22;
+LL | p.use_ref();
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs
new file mode 100644
index 0000000..b4b78bb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.rs
@@ -0,0 +1,32 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that attempt to swap `&mut` pointer while pointee is borrowed
+// yields an error.
+//
+// Example from src/librustc_borrowck/borrowck/README.md
+
+use std::mem::swap;
+
+
+
+fn foo<'a>(mut t0: &'a mut isize,
+ mut t1: &'a mut isize) {
+ let p: &isize = &*t0; // Freezes `*t0`
+ swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0`
+ *t1 = 22;
+ p.use_ref();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
new file mode 100644
index 0000000..2782472
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-swap-mut-base-ptr.stderr
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
+ --> $DIR/borrowck-swap-mut-base-ptr.rs:23:15
+ |
+LL | let p: &isize = &*t0; // Freezes `*t0`
+ | --- immutable borrow occurs here
+LL | swap(&mut t0, &mut t1); //~ ERROR cannot borrow `t0`
+ | ^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr
new file mode 100644
index 0000000..7373457
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.nll.stderr
@@ -0,0 +1,12 @@
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:21:20
+ |
+LL | assert_static(&FOO); //[ast]~ ERROR [E0597]
+ | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
+LL | //[mir]~^ ERROR [E0712]
+LL | }
+ | - end of enclosing function is here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr
new file mode 100644
index 0000000..27e0dba
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.ast.stderr
@@ -0,0 +1,13 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:21:21
+ |
+LL | assert_static(&FOO); //[ast]~ ERROR [E0597]
+ | ^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr
new file mode 100644
index 0000000..7373457
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.mir.stderr
@@ -0,0 +1,12 @@
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/borrowck-thread-local-static-borrow-outlives-fn.rs:21:20
+ |
+LL | assert_static(&FOO); //[ast]~ ERROR [E0597]
+ | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
+LL | //[mir]~^ ERROR [E0712]
+LL | }
+ | - end of enclosing function is here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
new file mode 100644
index 0000000..7aa02558
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-thread-local-static-borrow-outlives-fn.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=mir
+
+#![feature(thread_local)]
+
+#[thread_local]
+static FOO: u8 = 3;
+
+fn assert_static(_t: &'static u8) {}
+fn main() {
+ assert_static(&FOO); //[ast]~ ERROR [E0597]
+ //[mir]~^ ERROR [E0712]
+}
diff --git a/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr b/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr
new file mode 100644
index 0000000..caeaa17
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unary-move.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-unary-move.rs:17:10
+ |
+LL | let y = &*x;
+ | --- borrow of `*x` occurs here
+LL | free(x); //[ast]~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+LL | //[mir]~^ ERROR cannot move out of `x` because it is borrowed
+LL | *y
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-unary-move.ast.stderr b/src/test/ui/borrowck/borrowck-unary-move.ast.stderr
new file mode 100644
index 0000000..968fbb4
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unary-move.ast.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-unary-move.rs:17:10
+ |
+LL | let y = &*x;
+ | -- borrow of `*x` occurs here
+LL | free(x); //[ast]~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/borrowck/borrowck-unary-move.mir.stderr b/src/test/ui/borrowck/borrowck-unary-move.mir.stderr
new file mode 100644
index 0000000..caeaa17
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unary-move.mir.stderr
@@ -0,0 +1,14 @@
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/borrowck-unary-move.rs:17:10
+ |
+LL | let y = &*x;
+ | --- borrow of `*x` occurs here
+LL | free(x); //[ast]~ ERROR cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+LL | //[mir]~^ ERROR cannot move out of `x` because it is borrowed
+LL | *y
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/borrowck/borrowck-unary-move.rs b/src/test/ui/borrowck/borrowck-unary-move.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-unary-move.rs
rename to src/test/ui/borrowck/borrowck-unary-move.rs
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
new file mode 100644
index 0000000..3fbb747
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.nll.stderr
@@ -0,0 +1,22 @@
+error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
+ --> $DIR/borrowck-unboxed-closures.rs:17:5
+ |
+LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) {
+ | - help: consider changing this to be mutable: `mut f`
+LL | f(1, 2); //~ ERROR cannot borrow immutable argument
+ | ^ cannot borrow as mutable
+
+error[E0382]: use of moved value: `f`
+ --> $DIR/borrowck-unboxed-closures.rs:22:5
+ |
+LL | f(1, 2);
+ | - value moved here
+LL | f(1, 2); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0382, E0596.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs b/src/test/ui/borrowck/borrowck-unboxed-closures.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-unboxed-closures.rs
rename to src/test/ui/borrowck/borrowck-unboxed-closures.rs
diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
new file mode 100644
index 0000000..03b835d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr
@@ -0,0 +1,32 @@
+error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-unboxed-closures.rs:13:5
+ |
+LL | let g = &mut f;
+ | - mutable borrow occurs here
+LL | f(1, 2); //~ ERROR cannot borrow `f` as immutable
+ | ^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error[E0596]: cannot borrow immutable argument `f` as mutable
+ --> $DIR/borrowck-unboxed-closures.rs:17:5
+ |
+LL | fn b<F:FnMut(isize, isize) -> isize>(f: F) {
+ | - consider changing this to `mut f`
+LL | f(1, 2); //~ ERROR cannot borrow immutable argument
+ | ^ cannot borrow mutably
+
+error[E0382]: use of moved value: `f`
+ --> $DIR/borrowck-unboxed-closures.rs:22:5
+ |
+LL | f(1, 2);
+ | - value moved here
+LL | f(1, 2); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0382, E0502, E0596.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-uninit-after-item.rs b/src/test/ui/borrowck/borrowck-uninit-after-item.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-uninit-after-item.rs
rename to src/test/ui/borrowck/borrowck-uninit-after-item.rs
diff --git a/src/test/ui/borrowck/borrowck-uninit-after-item.stderr b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr
new file mode 100644
index 0000000..17f9c01
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-after-item.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `bar`
+ --> $DIR/borrowck-uninit-after-item.rs:14:9
+ |
+LL | baz(bar); //~ ERROR use of possibly uninitialized variable: `bar`
+ | ^^^ use of possibly uninitialized `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr
new file mode 100644
index 0000000..9c7dbd7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.nll.stderr
@@ -0,0 +1,30 @@
+error[E0381]: use of possibly uninitialized variable: `a.x`
+ --> $DIR/borrowck-uninit-field-access.rs:34:13
+ |
+LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x`
+ | ^^^ use of possibly uninitialized `a.x`
+
+error[E0382]: use of moved value: `line1.origin.x`
+ --> $DIR/borrowck-uninit-field-access.rs:39:13
+ |
+LL | let _moved = line1.origin;
+ | ------------ value moved here
+LL | let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.origin.x`
+ | ^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `line2`
+ --> $DIR/borrowck-uninit-field-access.rs:44:5
+ |
+LL | let _moved = (line2.origin, line2.middle);
+ | ------------ value moved here
+LL | line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382]
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0381, E0382.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr
new file mode 100644
index 0000000..8536bf2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-field-access.ast.stderr
@@ -0,0 +1,30 @@
+error[E0381]: use of possibly uninitialized variable: `a.x`
+ --> $DIR/borrowck-uninit-field-access.rs:34:13
+ |
+LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x`
+ | ^^^ use of possibly uninitialized `a.x`
+
+error[E0382]: use of moved value: `line1.origin.x`
+ --> $DIR/borrowck-uninit-field-access.rs:39:13
+ |
+LL | let _moved = line1.origin;
+ | ------ value moved here
+LL | let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.origin.x`
+ | ^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
+
+error[E0382]: use of partially moved value: `line2`
+ --> $DIR/borrowck-uninit-field-access.rs:44:5
+ |
+LL | let _moved = (line2.origin, line2.middle);
+ | ------------ value moved here
+LL | line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382]
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `line2.origin` has type `Point`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0381, E0382.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr
new file mode 100644
index 0000000..9c7dbd7
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-field-access.mir.stderr
@@ -0,0 +1,30 @@
+error[E0381]: use of possibly uninitialized variable: `a.x`
+ --> $DIR/borrowck-uninit-field-access.rs:34:13
+ |
+LL | let _ = a.x + 1; //[ast]~ ERROR use of possibly uninitialized variable: `a.x`
+ | ^^^ use of possibly uninitialized `a.x`
+
+error[E0382]: use of moved value: `line1.origin.x`
+ --> $DIR/borrowck-uninit-field-access.rs:39:13
+ |
+LL | let _moved = line1.origin;
+ | ------------ value moved here
+LL | let _ = line1.origin.x + 1; //[ast]~ ERROR use of moved value: `line1.origin.x`
+ | ^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `line1.origin` has type `Point`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `line2`
+ --> $DIR/borrowck-uninit-field-access.rs:44:5
+ |
+LL | let _moved = (line2.origin, line2.middle);
+ | ------------ value moved here
+LL | line2.consume(); //[ast]~ ERROR use of partially moved value: `line2` [E0382]
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `line2.middle` has type `Point`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0381, E0382.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-uninit-field-access.rs b/src/test/ui/borrowck/borrowck-uninit-field-access.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-uninit-field-access.rs
rename to src/test/ui/borrowck/borrowck-uninit-field-access.rs
diff --git a/src/test/compile-fail/borrowck/borrowck-uninit-in-assignop.rs b/src/test/ui/borrowck/borrowck-uninit-in-assignop.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-uninit-in-assignop.rs
rename to src/test/ui/borrowck/borrowck-uninit-in-assignop.rs
diff --git a/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr
new file mode 100644
index 0000000..7d905f6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-in-assignop.stderr
@@ -0,0 +1,63 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:16:5
+ |
+LL | x += 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:19:5
+ |
+LL | x -= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:22:5
+ |
+LL | x *= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:25:5
+ |
+LL | x /= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:28:5
+ |
+LL | x %= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:31:5
+ |
+LL | x ^= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:34:5
+ |
+LL | x &= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:37:5
+ |
+LL | x |= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:40:5
+ |
+LL | x <<= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^^ use of possibly uninitialized `x`
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit-in-assignop.rs:43:5
+ |
+LL | x >>= 1; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^^^^^^^ use of possibly uninitialized `x`
+
+error: aborting due to 10 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr
new file mode 100644
index 0000000..bd9836e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.nll.stderr
@@ -0,0 +1,33 @@
+error[E0381]: borrow of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:21:14
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:25:14
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:29:14
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `a.y`
+ --> $DIR/borrowck-uninit-ref-chain.rs:46:14
+ |
+LL | let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
+ | ^^^^ use of possibly uninitialized `a.y`
+
+error[E0381]: borrow of possibly uninitialized variable: `**a.y`
+ --> $DIR/borrowck-uninit-ref-chain.rs:51:14
+ |
+LL | let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
+ | ^^^^^^ use of possibly uninitialized `**a.y`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr
new file mode 100644
index 0000000..6b51414
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.ast.stderr
@@ -0,0 +1,45 @@
+error[E0381]: use of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:21:15
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^ use of possibly uninitialized `**x`
+
+error[E0381]: use of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:25:15
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^ use of possibly uninitialized `**x`
+
+error[E0381]: use of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:29:15
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^ use of possibly uninitialized `**x`
+
+error[E0381]: use of possibly uninitialized variable: `a.x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:35:15
+ |
+LL | let _b = &a.x; //[ast]~ ERROR use of possibly uninitialized variable: `a.x` [E0381]
+ | ^^^ use of possibly uninitialized `a.x`
+
+error[E0381]: use of possibly uninitialized variable: `**a.x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:40:15
+ |
+LL | let _b = &**a.x; //[ast]~ ERROR use of possibly uninitialized variable: `**a.x` [E0381]
+ | ^^^^^ use of possibly uninitialized `**a.x`
+
+error[E0381]: use of possibly uninitialized variable: `a.y`
+ --> $DIR/borrowck-uninit-ref-chain.rs:46:15
+ |
+LL | let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
+ | ^^^ use of possibly uninitialized `a.y`
+
+error[E0381]: use of possibly uninitialized variable: `**a.y`
+ --> $DIR/borrowck-uninit-ref-chain.rs:51:15
+ |
+LL | let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
+ | ^^^^^ use of possibly uninitialized `**a.y`
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr b/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr
new file mode 100644
index 0000000..bd9836e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit-ref-chain.mir.stderr
@@ -0,0 +1,33 @@
+error[E0381]: borrow of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:21:14
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:25:14
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `**x`
+ --> $DIR/borrowck-uninit-ref-chain.rs:29:14
+ |
+LL | let _y = &**x; //[ast]~ ERROR use of possibly uninitialized variable: `**x` [E0381]
+ | ^^^^ use of possibly uninitialized `**x`
+
+error[E0381]: borrow of possibly uninitialized variable: `a.y`
+ --> $DIR/borrowck-uninit-ref-chain.rs:46:14
+ |
+LL | let _b = &a.y; //[ast]~ ERROR use of possibly uninitialized variable: `a.y` [E0381]
+ | ^^^^ use of possibly uninitialized `a.y`
+
+error[E0381]: borrow of possibly uninitialized variable: `**a.y`
+ --> $DIR/borrowck-uninit-ref-chain.rs:51:14
+ |
+LL | let _b = &**a.y; //[ast]~ ERROR use of possibly uninitialized variable: `**a.y` [E0381]
+ | ^^^^^^ use of possibly uninitialized `**a.y`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-uninit-ref-chain.rs b/src/test/ui/borrowck/borrowck-uninit-ref-chain.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-uninit-ref-chain.rs
rename to src/test/ui/borrowck/borrowck-uninit-ref-chain.rs
diff --git a/src/test/compile-fail/borrowck/borrowck-uninit.rs b/src/test/ui/borrowck/borrowck-uninit.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-uninit.rs
rename to src/test/ui/borrowck/borrowck-uninit.rs
diff --git a/src/test/ui/borrowck/borrowck-uninit.stderr b/src/test/ui/borrowck/borrowck-uninit.stderr
new file mode 100644
index 0000000..ce78001
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uninit.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-uninit.rs:15:9
+ |
+LL | foo(x); //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr
new file mode 100644
index 0000000..eaba196
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.nll.stderr
@@ -0,0 +1,13 @@
+error[E0503]: cannot use `u.c` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow-nested.rs:36:21
+ |
+LL | let ra = &mut u.s.a;
+ | ---------- borrow of `u.s.a` occurs here
+LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed
+ | ^^^ use of borrowed `u.s.a`
+LL | ra.use_mut();
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.rs b/src/test/ui/borrowck/borrowck-union-borrow-nested.rs
new file mode 100644
index 0000000..0839d24
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.rs
@@ -0,0 +1,43 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+
+#[derive(Clone, Copy)]
+struct S {
+ a: u8,
+ b: u16,
+}
+
+#[derive(Clone, Copy)]
+union U {
+ s: S,
+ c: u32,
+}
+
+fn main() {
+ unsafe {
+ {
+ let mut u = U { s: S { a: 0, b: 1 } };
+ let ra = &mut u.s.a;
+ let b = u.s.b; // OK
+ ra.use_mut();
+ }
+ {
+ let mut u = U { s: S { a: 0, b: 1 } };
+ let ra = &mut u.s.a;
+ let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed
+ ra.use_mut();
+ }
+ }
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr
new file mode 100644
index 0000000..8f90254
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-borrow-nested.stderr
@@ -0,0 +1,11 @@
+error[E0503]: cannot use `u.c` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow-nested.rs:36:17
+ |
+LL | let ra = &mut u.s.a;
+ | ----- borrow of `u.s.a` occurs here
+LL | let b = u.c; //~ ERROR cannot use `u.c` because it was mutably borrowed
+ | ^ use of borrowed `u.s.a`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr b/src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr
new file mode 100644
index 0000000..2f14826
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr
@@ -0,0 +1,136 @@
+error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-union-borrow.rs:37:23
+ |
+LL | let ra = &u.a;
+ | ---- immutable borrow occurs here
+LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+ | ^^^^^^^^ mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `u.a` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:43:13
+ |
+LL | let ra = &u.a;
+ | ---- borrow of `u.a` occurs here
+LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `u.b` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-union-borrow.rs:60:23
+ |
+LL | let ra = &u.a;
+ | ---- immutable borrow occurs here
+LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+ | ^^^^^^^^ mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `u.b` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:66:13
+ |
+LL | let ra = &u.a;
+ | ---- borrow of `u.b` occurs here
+LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.b` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-union-borrow.rs:73:22
+ |
+LL | let rma = &mut u.a;
+ | -------- mutable borrow occurs here
+LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+ | ^^^^ immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow.rs:79:21
+ |
+LL | let ra = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `u.a` as mutable more than once at a time
+ --> $DIR/borrowck-union-borrow.rs:85:24
+ |
+LL | let rma = &mut u.a;
+ | -------- first mutable borrow occurs here
+LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `u.a` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:91:13
+ |
+LL | let rma = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0502]: cannot borrow `u.b` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-union-borrow.rs:98:22
+ |
+LL | let rma = &mut u.a;
+ | -------- mutable borrow occurs here
+LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+ | ^^^^ immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0503]: cannot use `u.b` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow.rs:104:21
+ |
+LL | let ra = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+...
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `u.b` as mutable more than once at a time
+ --> $DIR/borrowck-union-borrow.rs:111:24
+ |
+LL | let rma = &mut u.a;
+ | -------- first mutable borrow occurs here
+LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `u.b` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:117:13
+ |
+LL | let rma = &mut u.a;
+ | -------- borrow of `u.b` occurs here
+LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.b` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
+LL | drop(rma);
+ | --- borrow later used here
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0499, E0502, E0503, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow.ast.stderr b/src/test/ui/borrowck/borrowck-union-borrow.ast.stderr
new file mode 100644
index 0000000..9a02070
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-borrow.ast.stderr
@@ -0,0 +1,118 @@
+error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-union-borrow.rs:37:28
+ |
+LL | let ra = &u.a;
+ | --- immutable borrow occurs here
+LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+ | ^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0506]: cannot assign to `u.a` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:43:13
+ |
+LL | let ra = &u.a;
+ | --- borrow of `u.a` occurs here
+LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.a` occurs here
+
+error[E0502]: cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+ --> $DIR/borrowck-union-borrow.rs:60:28
+ |
+LL | let ra = &u.a;
+ | --- immutable borrow occurs here (via `u.a`)
+LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+ | ^^^ mutable borrow occurs here (via `u.b`)
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0506]: cannot assign to `u.b` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:66:13
+ |
+LL | let ra = &u.a;
+ | --- borrow of `u.b` occurs here
+LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.b` occurs here
+
+error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-union-borrow.rs:73:23
+ |
+LL | let rma = &mut u.a;
+ | --- mutable borrow occurs here
+LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+ | ^^^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow.rs:79:17
+ |
+LL | let ra = &mut u.a;
+ | --- borrow of `u.a` occurs here
+LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^ use of borrowed `u.a`
+
+error[E0499]: cannot borrow `u.a` as mutable more than once at a time
+ --> $DIR/borrowck-union-borrow.rs:85:29
+ |
+LL | let rma = &mut u.a;
+ | --- first mutable borrow occurs here
+LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
+ | ^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0506]: cannot assign to `u.a` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:91:13
+ |
+LL | let rma = &mut u.a;
+ | --- borrow of `u.a` occurs here
+LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.a` occurs here
+
+error[E0502]: cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+ --> $DIR/borrowck-union-borrow.rs:98:23
+ |
+LL | let rma = &mut u.a;
+ | --- mutable borrow occurs here (via `u.a`)
+LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+ | ^^^ immutable borrow occurs here (via `u.b`)
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0503]: cannot use `u.b` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow.rs:104:17
+ |
+LL | let ra = &mut u.a;
+ | --- borrow of `u.a` occurs here
+LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
+ | ^ use of borrowed `u.a`
+
+error[E0499]: cannot borrow `u` (via `u.b`) as mutable more than once at a time
+ --> $DIR/borrowck-union-borrow.rs:111:29
+ |
+LL | let rma = &mut u.a;
+ | --- first mutable borrow occurs here (via `u.a`)
+LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
+ | ^^^ second mutable borrow occurs here (via `u.b`)
+...
+LL | }
+ | - first borrow ends here
+
+error[E0506]: cannot assign to `u.b` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:117:13
+ |
+LL | let rma = &mut u.a;
+ | --- borrow of `u.b` occurs here
+LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.b` occurs here
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0499, E0502, E0503, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr b/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr
new file mode 100644
index 0000000..2f14826
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-borrow.mir.stderr
@@ -0,0 +1,136 @@
+error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-union-borrow.rs:37:23
+ |
+LL | let ra = &u.a;
+ | ---- immutable borrow occurs here
+LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+ | ^^^^^^^^ mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `u.a` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:43:13
+ |
+LL | let ra = &u.a;
+ | ---- borrow of `u.a` occurs here
+LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `u.b` as mutable because it is also borrowed as immutable
+ --> $DIR/borrowck-union-borrow.rs:60:23
+ |
+LL | let ra = &u.a;
+ | ---- immutable borrow occurs here
+LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
+ | ^^^^^^^^ mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0506]: cannot assign to `u.b` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:66:13
+ |
+LL | let ra = &u.a;
+ | ---- borrow of `u.b` occurs here
+LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.b` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-union-borrow.rs:73:22
+ |
+LL | let rma = &mut u.a;
+ | -------- mutable borrow occurs here
+LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+ | ^^^^ immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0503]: cannot use `u.a` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow.rs:79:21
+ |
+LL | let ra = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `u.a` as mutable more than once at a time
+ --> $DIR/borrowck-union-borrow.rs:85:24
+ |
+LL | let rma = &mut u.a;
+ | -------- first mutable borrow occurs here
+LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `u.a` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:91:13
+ |
+LL | let rma = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.a` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0502]: cannot borrow `u.b` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-union-borrow.rs:98:22
+ |
+LL | let rma = &mut u.a;
+ | -------- mutable borrow occurs here
+LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
+ | ^^^^ immutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0503]: cannot use `u.b` because it was mutably borrowed
+ --> $DIR/borrowck-union-borrow.rs:104:21
+ |
+LL | let ra = &mut u.a;
+ | -------- borrow of `u.a` occurs here
+LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
+ | ^^^ use of borrowed `u.a`
+...
+LL | drop(ra);
+ | -- borrow later used here
+
+error[E0499]: cannot borrow `u.b` as mutable more than once at a time
+ --> $DIR/borrowck-union-borrow.rs:111:24
+ |
+LL | let rma = &mut u.a;
+ | -------- first mutable borrow occurs here
+LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
+ | ^^^^^^^^ second mutable borrow occurs here
+LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time
+LL | drop(rma);
+ | --- borrow later used here
+
+error[E0506]: cannot assign to `u.b` because it is borrowed
+ --> $DIR/borrowck-union-borrow.rs:117:13
+ |
+LL | let rma = &mut u.a;
+ | -------- borrow of `u.b` occurs here
+LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
+ | ^^^^^^^ assignment to borrowed `u.b` occurs here
+LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
+LL | drop(rma);
+ | --- borrow later used here
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0499, E0502, E0503, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-union-borrow.rs b/src/test/ui/borrowck/borrowck-union-borrow.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-union-borrow.rs
rename to src/test/ui/borrowck/borrowck-union-borrow.rs
diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr
new file mode 100644
index 0000000..2a87705
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-move-assign.nll.stderr
@@ -0,0 +1,35 @@
+error[E0382]: use of moved value: `u.a`
+ --> $DIR/borrowck-union-move-assign.rs:27:21
+ |
+LL | let a = u.a;
+ | --- value moved here
+LL | let a = u.a; //~ ERROR use of moved value: `u.a`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.a`
+ --> $DIR/borrowck-union-move-assign.rs:33:21
+ |
+LL | let a = u.a;
+ | --- value moved here
+LL | u.a = A;
+LL | let a = u.a; // OK
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.a`
+ --> $DIR/borrowck-union-move-assign.rs:39:21
+ |
+LL | let a = u.a;
+ | --- value moved here
+LL | u.b = B;
+LL | let a = u.a; // OK
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-union-move-assign.rs b/src/test/ui/borrowck/borrowck-union-move-assign.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-union-move-assign.rs
rename to src/test/ui/borrowck/borrowck-union-move-assign.rs
diff --git a/src/test/ui/borrowck/borrowck-union-move-assign.stderr b/src/test/ui/borrowck/borrowck-union-move-assign.stderr
new file mode 100644
index 0000000..b0924d2
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-move-assign.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `u.a`
+ --> $DIR/borrowck-union-move-assign.rs:27:17
+ |
+LL | let a = u.a;
+ | - value moved here
+LL | let a = u.a; //~ ERROR use of moved value: `u.a`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.a` has type `A`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-union-move.nll.stderr b/src/test/ui/borrowck/borrowck-union-move.nll.stderr
new file mode 100644
index 0000000..6fd6a1c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-move.nll.stderr
@@ -0,0 +1,63 @@
+error[E0382]: use of moved value: `u.n1`
+ --> $DIR/borrowck-union-move.rs:36:21
+ |
+LL | let a = u.n1;
+ | ---- value moved here
+LL | let a = u.n1; //~ ERROR use of moved value: `u.n1`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:41:21
+ |
+LL | let a = u.n1;
+ | ---- value moved here
+LL | let a = u; //~ ERROR use of partially moved value: `u`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.n2`
+ --> $DIR/borrowck-union-move.rs:46:21
+ |
+LL | let a = u.n1;
+ | ---- value moved here
+LL | let a = u.n2; //~ ERROR use of moved value: `u.n2`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `Unn`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.n`
+ --> $DIR/borrowck-union-move.rs:73:21
+ |
+LL | let a = u.n;
+ | --- value moved here
+LL | let a = u.n; //~ ERROR use of moved value: `u.n`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.c`
+ --> $DIR/borrowck-union-move.rs:78:21
+ |
+LL | let a = u.n;
+ | --- value moved here
+LL | let a = u.c; //~ ERROR use of moved value: `u.c`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u`
+ --> $DIR/borrowck-union-move.rs:93:21
+ |
+LL | let a = u.n;
+ | --- value moved here
+LL | let a = u; //~ ERROR use of partially moved value: `u`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u` has type `Ucn`, which does not implement the `Copy` trait
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/borrowck/borrowck-union-move.rs b/src/test/ui/borrowck/borrowck-union-move.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-union-move.rs
rename to src/test/ui/borrowck/borrowck-union-move.rs
diff --git a/src/test/ui/borrowck/borrowck-union-move.stderr b/src/test/ui/borrowck/borrowck-union-move.stderr
new file mode 100644
index 0000000..d3e441b
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-move.stderr
@@ -0,0 +1,63 @@
+error[E0382]: use of moved value: `u.n1`
+ --> $DIR/borrowck-union-move.rs:36:17
+ |
+LL | let a = u.n1;
+ | - value moved here
+LL | let a = u.n1; //~ ERROR use of moved value: `u.n1`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.n1` has type `NonCopy`, which does not implement the `Copy` trait
+
+error[E0382]: use of partially moved value: `u`
+ --> $DIR/borrowck-union-move.rs:41:17
+ |
+LL | let a = u.n1;
+ | - value moved here
+LL | let a = u; //~ ERROR use of partially moved value: `u`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.n2`
+ --> $DIR/borrowck-union-move.rs:46:17
+ |
+LL | let a = u.n1;
+ | - value moved here
+LL | let a = u.n2; //~ ERROR use of moved value: `u.n2`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.n2` has type `[type error]`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.n`
+ --> $DIR/borrowck-union-move.rs:73:17
+ |
+LL | let a = u.n;
+ | - value moved here
+LL | let a = u.n; //~ ERROR use of moved value: `u.n`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.n` has type `NonCopy`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.c`
+ --> $DIR/borrowck-union-move.rs:78:17
+ |
+LL | let a = u.n;
+ | - value moved here
+LL | let a = u.c; //~ ERROR use of moved value: `u.c`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait
+
+error[E0382]: use of partially moved value: `u`
+ --> $DIR/borrowck-union-move.rs:93:17
+ |
+LL | let a = u.n;
+ | - value moved here
+LL | let a = u; //~ ERROR use of partially moved value: `u`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.c` has type `[type error]`, which does not implement the `Copy` trait
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr
new file mode 100644
index 0000000..49bc6d3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-uninitialized.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `u.a`
+ --> $DIR/borrowck-union-uninitialized.rs:26:18
+ |
+LL | let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a`
+ | ^^^ use of possibly uninitialized `u.a`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-union-uninitialized.rs b/src/test/ui/borrowck/borrowck-union-uninitialized.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-union-uninitialized.rs
rename to src/test/ui/borrowck/borrowck-union-uninitialized.rs
diff --git a/src/test/ui/borrowck/borrowck-union-uninitialized.stderr b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr
new file mode 100644
index 0000000..901d1ec
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-union-uninitialized.stderr
@@ -0,0 +1,15 @@
+error[E0381]: use of possibly uninitialized variable: `s.a`
+ --> $DIR/borrowck-union-uninitialized.rs:25:13
+ |
+LL | let sa = s.a; //~ ERROR use of possibly uninitialized variable: `s.a`
+ | ^^ use of possibly uninitialized `s.a`
+
+error[E0381]: use of possibly uninitialized variable: `u.a`
+ --> $DIR/borrowck-union-uninitialized.rs:26:13
+ |
+LL | let ua = u.a; //~ ERROR use of possibly uninitialized variable: `u.a`
+ | ^^ use of possibly uninitialized `u.a`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr
new file mode 100644
index 0000000..a918550
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.nll.stderr
@@ -0,0 +1,23 @@
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-uniq-via-lend.rs:46:12
+ |
+LL | let w = &mut v;
+ | ------ mutable borrow occurs here
+LL | borrow(&*v); //~ ERROR cannot borrow `*v`
+ | ^^^ immutable borrow occurs here
+LL | w.use_mut();
+ | - borrow later used here
+
+error[E0502]: cannot borrow `*v` as immutable because it is also borrowed as mutable
+ --> $DIR/borrowck-uniq-via-lend.rs:63:12
+ |
+LL | x = &mut v;
+ | ------ mutable borrow occurs here
+LL | borrow(&*v); //~ ERROR cannot borrow `*v`
+ | ^^^ immutable borrow occurs here
+LL | x.use_mut();
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.rs b/src/test/ui/borrowck/borrowck-uniq-via-lend.rs
new file mode 100644
index 0000000..6fbadc9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.rs
@@ -0,0 +1,71 @@
+// Copyright 2012 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.
+
+#![feature(box_syntax)]
+
+
+
+fn borrow(_v: &isize) {}
+
+fn local() {
+ let mut v: Box<_> = box 3;
+ borrow(&*v);
+}
+
+fn local_rec() {
+ struct F { f: Box<isize> }
+ let mut v = F {f: box 3};
+ borrow(&*v.f);
+}
+
+fn local_recs() {
+ struct F { f: G }
+ struct G { g: H }
+ struct H { h: Box<isize> }
+ let mut v = F {f: G {g: H {h: box 3}}};
+ borrow(&*v.f.g.h);
+}
+
+fn aliased_imm() {
+ let mut v: Box<_> = box 3;
+ let w = &v;
+ borrow(&*v);
+ w.use_ref();
+}
+
+fn aliased_mut() {
+ let mut v: Box<_> = box 3;
+ let w = &mut v;
+ borrow(&*v); //~ ERROR cannot borrow `*v`
+ w.use_mut();
+}
+
+fn aliased_other() {
+ let mut v: Box<_> = box 3;
+ let mut w: Box<_> = box 4;
+ let x = &mut w;
+ borrow(&*v);
+ x.use_mut();
+}
+
+fn aliased_other_reassign() {
+ let mut v: Box<_> = box 3;
+ let mut w: Box<_> = box 4;
+ let mut x = &mut w;
+ x = &mut v;
+ borrow(&*v); //~ ERROR cannot borrow `*v`
+ x.use_mut();
+}
+
+fn main() {
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr
new file mode 100644
index 0000000..00b4344
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-uniq-via-lend.stderr
@@ -0,0 +1,25 @@
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+ --> $DIR/borrowck-uniq-via-lend.rs:46:13
+ |
+LL | let w = &mut v;
+ | - mutable borrow occurs here
+LL | borrow(&*v); //~ ERROR cannot borrow `*v`
+ | ^^ immutable borrow occurs here
+LL | w.use_mut();
+LL | }
+ | - mutable borrow ends here
+
+error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
+ --> $DIR/borrowck-uniq-via-lend.rs:63:13
+ |
+LL | x = &mut v;
+ | - mutable borrow occurs here
+LL | borrow(&*v); //~ ERROR cannot borrow `*v`
+ | ^^ immutable borrow occurs here
+LL | x.use_mut();
+LL | }
+ | - mutable borrow ends here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr
new file mode 100644
index 0000000..d69693e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0381]: use of possibly uninitialized variable: `*w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:16:5
+ |
+LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
+ | ^^^^ use of possibly uninitialized `*w`
+
+error[E0381]: use of possibly uninitialized variable: `*w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:20:5
+ |
+LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
+ | ^^^^ use of possibly uninitialized `*w`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr
new file mode 100644
index 0000000..3a33081
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.ast.stderr
@@ -0,0 +1,15 @@
+error[E0381]: use of possibly uninitialized variable: `*w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:16:5
+ |
+LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
+ | ^^^^^^^^ use of possibly uninitialized `*w`
+
+error[E0381]: use of possibly uninitialized variable: `*w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:20:5
+ |
+LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
+ | ^^^^^^^^ use of possibly uninitialized `*w`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr
new file mode 100644
index 0000000..d69693e
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.mir.stderr
@@ -0,0 +1,15 @@
+error[E0381]: use of possibly uninitialized variable: `*w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:16:5
+ |
+LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
+ | ^^^^ use of possibly uninitialized `*w`
+
+error[E0381]: use of possibly uninitialized variable: `*w`
+ --> $DIR/borrowck-use-in-index-lvalue.rs:20:5
+ |
+LL | w[5] = 0; //[ast]~ ERROR use of possibly uninitialized variable: `*w` [E0381]
+ | ^^^^ use of possibly uninitialized `*w`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs b/src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-use-in-index-lvalue.rs
rename to src/test/ui/borrowck/borrowck-use-in-index-lvalue.rs
diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr
new file mode 100644
index 0000000..2289dd6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.nll.stderr
@@ -0,0 +1,95 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:21:10
+ |
+LL | let p = &mut x;
+ | ------ borrow of `x` occurs here
+LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed
+ | ^ use of borrowed `x`
+LL | *p = 2;
+ | ------ borrow later used here
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:28:10
+ |
+LL | let p = &mut x.a;
+ | -------- borrow of `x.a` occurs here
+LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed
+ | ^ use of borrowed `x.a`
+LL | *p = 3;
+ | ------ borrow later used here
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:35:10
+ |
+LL | let p = &mut x;
+ | ------ borrow of `x` occurs here
+LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^^^ use of borrowed `x`
+LL | p.a = 3;
+ | ------- borrow later used here
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:42:10
+ |
+LL | let p = &mut x.a;
+ | -------- borrow of `x.a` occurs here
+LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^^^ use of borrowed `x.a`
+LL | *p = 3;
+ | ------ borrow later used here
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:49:13
+ |
+LL | let p = &mut x;
+ | ------ borrow of `x` occurs here
+LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^^^^^^^^^^^^^^^^ use of borrowed `x`
+LL | drop(y);
+LL | p.a = 4;
+ | ------- borrow later used here
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:57:13
+ |
+LL | let p = &mut x.a;
+ | -------- borrow of `x.a` occurs here
+LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
+LL | drop(y);
+LL | *p = 4;
+ | ------ borrow later used here
+
+error[E0503]: cannot use `*x` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:65:10
+ |
+LL | let p = &mut x;
+ | ------ borrow of `x` occurs here
+LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed
+ | ^^ use of borrowed `x`
+LL | **p = 2;
+ | ------- borrow later used here
+
+error[E0503]: cannot use `*x.b` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:72:10
+ |
+LL | let p = &mut x;
+ | ------ borrow of `x` occurs here
+LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed
+ | ^^^^ use of borrowed `x`
+LL | p.a = 3;
+ | ------- borrow later used here
+
+error[E0503]: cannot use `*x.b` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:79:10
+ |
+LL | let p = &mut x.b;
+ | -------- borrow of `x.b` occurs here
+LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed
+ | ^^^^ use of borrowed `x.b`
+LL | **p = 3;
+ | ------- borrow later used here
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/compile-fail/borrowck/borrowck-use-mut-borrow.rs b/src/test/ui/borrowck/borrowck-use-mut-borrow.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-use-mut-borrow.rs
rename to src/test/ui/borrowck/borrowck-use-mut-borrow.rs
diff --git a/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr
new file mode 100644
index 0000000..c5bfd81
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-mut-borrow.stderr
@@ -0,0 +1,75 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:21:10
+ |
+LL | let p = &mut x;
+ | - borrow of `x` occurs here
+LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed
+ | ^ use of borrowed `x`
+
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:28:10
+ |
+LL | let p = &mut x.a;
+ | --- borrow of `x.a` occurs here
+LL | drop(x); //~ ERROR cannot use `x` because it was mutably borrowed
+ | ^ use of borrowed `x.a`
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:35:10
+ |
+LL | let p = &mut x;
+ | - borrow of `x` occurs here
+LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^^^ use of borrowed `x`
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:42:10
+ |
+LL | let p = &mut x.a;
+ | --- borrow of `x.a` occurs here
+LL | drop(x.a); //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^^^ use of borrowed `x.a`
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:49:26
+ |
+LL | let p = &mut x;
+ | - borrow of `x` occurs here
+LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^ use of borrowed `x`
+
+error[E0503]: cannot use `x.a` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:57:26
+ |
+LL | let p = &mut x.a;
+ | --- borrow of `x.a` occurs here
+LL | let y = A { b: 3, .. x }; //~ ERROR cannot use `x.a` because it was mutably borrowed
+ | ^ use of borrowed `x.a`
+
+error[E0503]: cannot use `*x` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:65:10
+ |
+LL | let p = &mut x;
+ | - borrow of `x` occurs here
+LL | drop(*x); //~ ERROR cannot use `*x` because it was mutably borrowed
+ | ^^ use of borrowed `x`
+
+error[E0503]: cannot use `*x.b` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:72:10
+ |
+LL | let p = &mut x;
+ | - borrow of `x` occurs here
+LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed
+ | ^^^^ use of borrowed `x`
+
+error[E0503]: cannot use `*x.b` because it was mutably borrowed
+ --> $DIR/borrowck-use-mut-borrow.rs:79:10
+ |
+LL | let p = &mut x.b;
+ | --- borrow of `x.b` occurs here
+LL | drop(*x.b); //~ ERROR cannot use `*x.b` because it was mutably borrowed
+ | ^^^^ use of borrowed `x.b`
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr
new file mode 100644
index 0000000..b96379d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `*x`
+ --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13
+ |
+LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr
new file mode 100644
index 0000000..47ea9f3
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.ast.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `*x`
+ --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13
+ |
+LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr
new file mode 100644
index 0000000..b96379d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.mir.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `*x`
+ --> $DIR/borrowck-use-uninitialized-in-cast-trait.rs:22:13
+ |
+LL | let y = x as *const Foo; //[ast]~ ERROR use of possibly uninitialized variable: `*x`
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast-trait.rs
rename to src/test/ui/borrowck/borrowck-use-uninitialized-in-cast-trait.rs
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr
new file mode 100644
index 0000000..6eddbd9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `*x`
+ --> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13
+ |
+LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr
new file mode 100644
index 0000000..75109ab
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.ast.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `*x`
+ --> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13
+ |
+LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr
new file mode 100644
index 0000000..6eddbd9
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.mir.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `*x`
+ --> $DIR/borrowck-use-uninitialized-in-cast.rs:20:13
+ |
+LL | let y = x as *const i32; //[ast]~ ERROR use of possibly uninitialized variable: `*x` [E0381]
+ | ^ use of possibly uninitialized `*x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs b/src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-use-uninitialized-in-cast.rs
rename to src/test/ui/borrowck/borrowck-use-uninitialized-in-cast.rs
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr
new file mode 100644
index 0000000..374256c
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.nll.stderr
@@ -0,0 +1,48 @@
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:15:25
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `vec` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6...
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:13:6
+ |
+LL | fn a<'a>() -> &'a [isize] {
+ | ^^
+
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:25:25
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `vec` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:6...
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:23:6
+ |
+LL | fn b<'a>() -> &'a [isize] {
+ | ^^
+
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:35:25
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `vec` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 33:6...
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:33:6
+ |
+LL | fn c<'a>() -> &'a [isize] {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-vec-pattern-element-loan.rs
rename to src/test/ui/borrowck/borrowck-vec-pattern-element-loan.rs
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr
new file mode 100644
index 0000000..656a25d
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-element-loan.stderr
@@ -0,0 +1,48 @@
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:15:26
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6...
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:13:6
+ |
+LL | fn a<'a>() -> &'a [isize] {
+ | ^^
+
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:25:26
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:6...
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:23:6
+ |
+LL | fn b<'a>() -> &'a [isize] {
+ | ^^
+
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:35:26
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 33:6...
+ --> $DIR/borrowck-vec-pattern-element-loan.rs:33:6
+ |
+LL | fn c<'a>() -> &'a [isize] {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr
new file mode 100644
index 0000000..9b73991
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.nll.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:18:13
+ |
+LL | let vb: &mut [isize] = &mut v;
+ | ------ first mutable borrow occurs here
+...
+LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow
+ | ^ ------- borrow later used here
+ | |
+ | second mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-loan-from-mut.rs b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-vec-pattern-loan-from-mut.rs
rename to src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.rs
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
new file mode 100644
index 0000000..7015923
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-loan-from-mut.stderr
@@ -0,0 +1,15 @@
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/borrowck-vec-pattern-loan-from-mut.rs:18:13
+ |
+LL | let vb: &mut [isize] = &mut v;
+ | - first mutable borrow occurs here
+...
+LL | v.push(tail[0] + tail[1]); //~ ERROR cannot borrow
+ | ^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr
new file mode 100644
index 0000000..f99e2ce
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `a[..]` because it is borrowed
+ --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5
+ |
+LL | [1, 2, ref tail..] => tail,
+ | -------- borrow of `a[..]` occurs here
+...
+LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
+ | ^^^^^^^^ assignment to borrowed `a[..]` occurs here
+...
+LL | println!("t[0]: {}", t[0]);
+ | ---- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr
new file mode 100644
index 0000000..2b32de6
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.ast.stderr
@@ -0,0 +1,12 @@
+error[E0506]: cannot assign to `a[..]` because it is borrowed
+ --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5
+ |
+LL | [1, 2, ref tail..] => tail,
+ | -------- borrow of `a[..]` occurs here
+...
+LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
+ | ^^^^^^^^ assignment to borrowed `a[..]` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr
new file mode 100644
index 0000000..a6aa9cd
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.cmp.stderr
@@ -0,0 +1,24 @@
+error[E0506]: cannot assign to `a[..]` because it is borrowed (Ast)
+ --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5
+ |
+LL | [1, 2, ref tail..] => tail,
+ | -------- borrow of `a[..]` occurs here
+...
+LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
+ | ^^^^^^^^ assignment to borrowed `a[..]` occurs here
+
+error[E0506]: cannot assign to `a[..]` because it is borrowed (Mir)
+ --> $DIR/borrowck-vec-pattern-move-tail.rs:24:5
+ |
+LL | [1, 2, ref tail..] => tail,
+ | -------- borrow of `a[..]` occurs here
+...
+LL | a[2] = 0; //[ast]~ ERROR cannot assign to `a[..]` because it is borrowed
+ | ^^^^^^^^ assignment to borrowed `a[..]` occurs here
+...
+LL | println!("t[0]: {}", t[0]);
+ | ---- borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs b/src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-vec-pattern-move-tail.rs
rename to src/test/ui/borrowck/borrowck-vec-pattern-move-tail.rs
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
index 2779132..d5b1711 100644
--- a/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-nesting.nll.stderr
@@ -28,10 +28,21 @@
LL | match vec {
| ^^^ cannot move out of here
LL | &mut [_a, //~ ERROR cannot move out
- | --
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _a`
+ | -- data moved here
+ |
+note: move occurs because `_a` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-vec-pattern-nesting.rs:44:15
+ |
+LL | &mut [_a, //~ ERROR cannot move out
+ | ^^
+help: consider removing the `&mut`
+ |
+LL | [_a, //~ ERROR cannot move out
+LL | //~| cannot move out
+LL | //~| to prevent move
+LL | ..
+LL | ] => {
+ |
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:57:13
@@ -40,7 +51,7 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&vec[0]`
+ | help: consider borrowing here: `&vec[0]`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:64:11
@@ -49,10 +60,19 @@
| ^^^ cannot move out of here
...
LL | _b] => {}
- | --
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _b`
+ | -- data moved here
+ |
+note: move occurs because `_b` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/borrowck-vec-pattern-nesting.rs:67:10
+ |
+LL | _b] => {}
+ | ^^
+help: consider removing the `&mut`
+ |
+LL | [ //~ ERROR cannot move out
+LL | //~^ cannot move out
+LL | _b] => {}
+ |
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:70:13
@@ -61,7 +81,7 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&vec[0]`
+ | help: consider borrowing here: `&vec[0]`
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:77:11
@@ -69,14 +89,18 @@
LL | match vec {
| ^^^ cannot move out of here
LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out
- | -- -- -- ... and here
- | | |
- | | ... and here
- | data moved here
-help: to prevent move, use ref or ref mut
+ | -----------------
+ | | | | |
+ | | | | ...and here
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `[_a, _b, _c]`
|
-LL | &mut [ref _a, ref _b, ref _c] => {} //~ ERROR cannot move out
- | ^^^^^^ ^^^^^^ ^^^^^^
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/borrowck-vec-pattern-nesting.rs:78:15
+ |
+LL | &mut [_a, _b, _c] => {} //~ ERROR cannot move out
+ | ^^ ^^ ^^
error[E0508]: cannot move out of type `[std::boxed::Box<isize>]`, a non-copy slice
--> $DIR/borrowck-vec-pattern-nesting.rs:82:13
@@ -85,7 +109,7 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&vec[0]`
+ | help: consider borrowing here: `&vec[0]`
error: aborting due to 8 previous errors
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr
new file mode 100644
index 0000000..6d45f15
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.nll.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:15:25
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `vec` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6...
+ --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:13:6
+ |
+LL | fn a<'a>() -> &'a isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/borrowck/borrowck-vec-pattern-tail-element-loan.rs b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-vec-pattern-tail-element-loan.rs
rename to src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.rs
diff --git a/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr
new file mode 100644
index 0000000..36343c1
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-vec-pattern-tail-element-loan.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `vec` does not live long enough
+ --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:15:26
+ |
+LL | let vec: &[isize] = &vec; //~ ERROR `vec` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 13:6...
+ --> $DIR/borrowck-vec-pattern-tail-element-loan.rs:13:6
+ |
+LL | fn a<'a>() -> &'a isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/borrowck/borrowck-while-break.nll.stderr b/src/test/ui/borrowck/borrowck-while-break.nll.stderr
new file mode 100644
index 0000000..de2ba57
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-while-break.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `v`
+ --> $DIR/borrowck-while-break.rs:17:20
+ |
+LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
+ | ^ use of possibly uninitialized `v`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-while-break.rs b/src/test/ui/borrowck/borrowck-while-break.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-while-break.rs
rename to src/test/ui/borrowck/borrowck-while-break.rs
diff --git a/src/test/ui/borrowck/borrowck-while-break.stderr b/src/test/ui/borrowck/borrowck-while-break.stderr
new file mode 100644
index 0000000..eaaecdb
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-while-break.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `v`
+ --> $DIR/borrowck-while-break.rs:17:20
+ |
+LL | println!("{}", v); //~ ERROR use of possibly uninitialized variable: `v`
+ | ^ use of possibly uninitialized `v`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-while-cond.rs b/src/test/ui/borrowck/borrowck-while-cond.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-while-cond.rs
rename to src/test/ui/borrowck/borrowck-while-cond.rs
diff --git a/src/test/ui/borrowck/borrowck-while-cond.stderr b/src/test/ui/borrowck/borrowck-while-cond.stderr
new file mode 100644
index 0000000..41ef9e8
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-while-cond.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-while-cond.rs:13:11
+ |
+LL | while x { } //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/borrowck/borrowck-while.rs b/src/test/ui/borrowck/borrowck-while.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/borrowck-while.rs
rename to src/test/ui/borrowck/borrowck-while.rs
diff --git a/src/test/ui/borrowck/borrowck-while.stderr b/src/test/ui/borrowck/borrowck-while.stderr
new file mode 100644
index 0000000..9fb2dca
--- /dev/null
+++ b/src/test/ui/borrowck/borrowck-while.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/borrowck-while.rs:14:12
+ |
+LL | return x; //~ ERROR use of possibly uninitialized variable: `x`
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/index-mut-help.nll.stderr b/src/test/ui/borrowck/index-mut-help.nll.stderr
new file mode 100644
index 0000000..cc058f1
--- /dev/null
+++ b/src/test/ui/borrowck/index-mut-help.nll.stderr
@@ -0,0 +1,22 @@
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/index-mut-help.rs:21:5
+ |
+LL | map["peter"].clear(); //~ ERROR
+ | ^^^^^^^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to data in a `&` reference
+ --> $DIR/index-mut-help.rs:22:5
+ |
+LL | map["peter"] = "0".to_string(); //~ ERROR
+ | ^^^^^^^^^^^^ cannot assign
+
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/index-mut-help.rs:23:13
+ |
+LL | let _ = &mut map["peter"]; //~ ERROR
+ | ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/index-mut-help.rs b/src/test/ui/borrowck/index-mut-help.rs
new file mode 100644
index 0000000..a4df0ce
--- /dev/null
+++ b/src/test/ui/borrowck/index-mut-help.rs
@@ -0,0 +1,24 @@
+// 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.
+
+// When mutably indexing a type that implements `Index` but not `IndexMut`, a
+// special 'help' message is added to the output.
+
+
+fn main() {
+ use std::collections::HashMap;
+
+ let mut map = HashMap::new();
+ map.insert("peter", "23".to_string());
+
+ map["peter"].clear(); //~ ERROR
+ map["peter"] = "0".to_string(); //~ ERROR
+ let _ = &mut map["peter"]; //~ ERROR
+}
diff --git a/src/test/ui/borrowck/index-mut-help.stderr b/src/test/ui/borrowck/index-mut-help.stderr
new file mode 100644
index 0000000..b8b35ed
--- /dev/null
+++ b/src/test/ui/borrowck/index-mut-help.stderr
@@ -0,0 +1,28 @@
+error[E0596]: cannot borrow immutable indexed content as mutable
+ --> $DIR/index-mut-help.rs:21:5
+ |
+LL | map["peter"].clear(); //~ ERROR
+ | ^^^^^^^^^^^^ cannot borrow as mutable
+ |
+ = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
+
+error[E0594]: cannot assign to immutable indexed content
+ --> $DIR/index-mut-help.rs:22:5
+ |
+LL | map["peter"] = "0".to_string(); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ |
+ = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
+
+error[E0596]: cannot borrow immutable indexed content as mutable
+ --> $DIR/index-mut-help.rs:23:18
+ |
+LL | let _ = &mut map["peter"]; //~ ERROR
+ | ^^^^^^^^^^^^ cannot borrow as mutable
+ |
+ = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr
index 20713c3..d434093 100644
--- a/src/test/ui/borrowck/issue-51415.nll.stderr
+++ b/src/test/ui/borrowck/issue-51415.nll.stderr
@@ -5,8 +5,13 @@
| ^^^^^-^
| | |
| | data moved here
- | | help: to prevent move, use ref or ref mut: `ref s`
| cannot move out of borrowed content
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/issue-51415.rs:16:47
+ |
+LL | let opt = a.iter().enumerate().find(|(_, &s)| {
+ | ^
error: aborting due to previous error
diff --git a/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs b/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
index c39fff2..3b53fb9 100644
--- a/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
+++ b/src/test/ui/borrowck/issue-52967-edition-2018-needs-two-phase-borrows.rs
@@ -14,7 +14,7 @@
// revisions: ast zflags edition
//[zflags]compile-flags: -Z borrowck=migrate -Z two-phase-borrows
-//[edition]compile-flags: --edition 2018
+//[edition]edition:2018
// run-pass
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr
new file mode 100644
index 0000000..4c399ab
--- /dev/null
+++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.stderr
@@ -0,0 +1,15 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/move-in-static-initializer-issue-38520.rs:27:23
+ |
+LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
+ | ^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/move-in-static-initializer-issue-38520.rs:29:22
+ |
+LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
+ | ^^^ cannot move out of borrowed content
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr
new file mode 100644
index 0000000..4c399ab
--- /dev/null
+++ b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.mir.stderr
@@ -0,0 +1,15 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/move-in-static-initializer-issue-38520.rs:27:23
+ |
+LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507
+ | ^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/move-in-static-initializer-issue-38520.rs:29:22
+ |
+LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507
+ | ^^^ cannot move out of borrowed content
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/borrowck/move-in-static-initializer-issue-38520.rs b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/move-in-static-initializer-issue-38520.rs
rename to src/test/ui/borrowck/move-in-static-initializer-issue-38520.rs
diff --git a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr
index 95acdab..52f1547 100644
--- a/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr
+++ b/src/test/ui/borrowck/promote-ref-mut-in-let-issue-46557.nll.stderr
@@ -1,30 +1,24 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:21
|
-LL | fn gimme_static_mut_let() -> &'static mut u32 {
- | _______________________________________________-
-LL | | let ref mut x = 1234543; //~ ERROR
- | | ^^^^^^^ temporary value does not live long enough
-LL | | x
-LL | | }
- | | -
- | | |
- | |_temporary value only lives until here
- | borrow later used here
+LL | let ref mut x = 1234543; //~ ERROR
+ | ^^^^^^^ temporary value does not live long enough
+LL | x
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:25
|
-LL | fn gimme_static_mut_let_nested() -> &'static mut u32 {
- | ______________________________________________________-
-LL | | let (ref mut x, ) = (1234543, ); //~ ERROR
- | | ^^^^^^^^^^^ temporary value does not live long enough
-LL | | x
-LL | | }
- | | -
- | | |
- | |_temporary value only lives until here
- | borrow later used here
+LL | let (ref mut x, ) = (1234543, ); //~ ERROR
+ | ^^^^^^^^^^^ temporary value does not live long enough
+LL | x
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
error[E0597]: borrowed value does not live long enough
--> $DIR/promote-ref-mut-in-let-issue-46557.rs:25:11
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr
new file mode 100644
index 0000000..97f3bf5
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields.nll.stderr
@@ -0,0 +1,44 @@
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields.rs:17:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields.rs:18:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.0 = 1; //~ ERROR
+LL | x.1 = 22; //~ ERROR
+ | ^^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields.rs:25:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields.rs:26:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.0 = 1; //~ ERROR
+LL | x.1 = 22; //~ ERROR
+ | ^^^^^^^^ cannot assign
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/reassignment_immutable_fields.rs:27:10
+ |
+LL | drop(x); //~ ERROR
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0381, E0594.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.rs b/src/test/ui/borrowck/reassignment_immutable_fields.rs
new file mode 100644
index 0000000..c49ae2f
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields.rs
@@ -0,0 +1,30 @@
+// 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.
+
+// This test is currently disallowed, but we hope someday to support it.
+//
+// FIXME(#21232)
+
+fn assign_both_fields_and_use() {
+ let x: (u32, u32);
+ x.0 = 1; //~ ERROR
+ x.1 = 22; //~ ERROR
+ drop(x.0); //~ ERROR
+ drop(x.1); //~ ERROR
+}
+
+fn assign_both_fields_the_use_var() {
+ let x: (u32, u32);
+ x.0 = 1; //~ ERROR
+ x.1 = 22; //~ ERROR
+ drop(x); //~ ERROR
+}
+
+fn main() { }
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields.stderr b/src/test/ui/borrowck/reassignment_immutable_fields.stderr
new file mode 100644
index 0000000..54d12f8
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields.stderr
@@ -0,0 +1,56 @@
+error[E0594]: cannot assign to field `x.0` of immutable binding
+ --> $DIR/reassignment_immutable_fields.rs:17:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field `x.1` of immutable binding
+ --> $DIR/reassignment_immutable_fields.rs:18:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x.0 = 1; //~ ERROR
+LL | x.1 = 22; //~ ERROR
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0381]: use of possibly uninitialized variable: `x.0`
+ --> $DIR/reassignment_immutable_fields.rs:19:10
+ |
+LL | drop(x.0); //~ ERROR
+ | ^^^ use of possibly uninitialized `x.0`
+
+error[E0381]: use of possibly uninitialized variable: `x.1`
+ --> $DIR/reassignment_immutable_fields.rs:20:10
+ |
+LL | drop(x.1); //~ ERROR
+ | ^^^ use of possibly uninitialized `x.1`
+
+error[E0594]: cannot assign to field `x.0` of immutable binding
+ --> $DIR/reassignment_immutable_fields.rs:25:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field `x.1` of immutable binding
+ --> $DIR/reassignment_immutable_fields.rs:26:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x.0 = 1; //~ ERROR
+LL | x.1 = 22; //~ ERROR
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/reassignment_immutable_fields.rs:27:10
+ |
+LL | drop(x); //~ ERROR
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0381, E0594.
+For more information about an error, try `rustc --explain E0381`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr
new file mode 100644
index 0000000..c433d6e
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.nll.stderr
@@ -0,0 +1,20 @@
+error[E0594]: cannot assign to `x.a`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5
+ |
+LL | let x: Foo;
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.a = 1; //~ ERROR
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.b`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5
+ |
+LL | let x: Foo;
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.a = 1; //~ ERROR
+LL | x.b = 22; //~ ERROR
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs
new file mode 100644
index 0000000..add23ec
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.rs
@@ -0,0 +1,26 @@
+// 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.
+
+// This should never be allowed -- `foo.a` and `foo.b` are
+// overlapping, so since `x` is not `mut` we should not permit
+// reassignment.
+
+union Foo {
+ a: u32,
+ b: u32,
+}
+
+unsafe fn overlapping_fields() {
+ let x: Foo;
+ x.a = 1; //~ ERROR
+ x.b = 22; //~ ERROR
+}
+
+fn main() { }
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr
new file mode 100644
index 0000000..7084990
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_overlapping.stderr
@@ -0,0 +1,20 @@
+error[E0594]: cannot assign to field `x.a` of immutable binding
+ --> $DIR/reassignment_immutable_fields_overlapping.rs:22:5
+ |
+LL | let x: Foo;
+ | - consider changing this to `mut x`
+LL | x.a = 1; //~ ERROR
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field `x.b` of immutable binding
+ --> $DIR/reassignment_immutable_fields_overlapping.rs:23:5
+ |
+LL | let x: Foo;
+ | - consider changing this to `mut x`
+LL | x.a = 1; //~ ERROR
+LL | x.b = 22; //~ ERROR
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr
new file mode 100644
index 0000000..2160ae2
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.nll.stderr
@@ -0,0 +1,38 @@
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields_twice.rs:17:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x = (22, 44);
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields_twice.rs:22:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.0`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields_twice.rs:23:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+LL | x.0 = 1; //~ ERROR
+LL | x.0 = 22; //~ ERROR
+ | ^^^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `x.1`, as `x` is not declared as mutable
+ --> $DIR/reassignment_immutable_fields_twice.rs:24:5
+ |
+LL | let x: (u32, u32);
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | x.1 = 44; //~ ERROR
+ | ^^^^^^^^ cannot assign
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs
new file mode 100644
index 0000000..c7e7e5c
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.rs
@@ -0,0 +1,27 @@
+// 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.
+
+// This should never be allowed -- since `x` is not `mut`, so `x.0`
+// cannot be assigned twice.
+
+fn var_then_field() {
+ let x: (u32, u32);
+ x = (22, 44);
+ x.0 = 1; //~ ERROR
+}
+
+fn same_field_twice() {
+ let x: (u32, u32);
+ x.0 = 1; //~ ERROR
+ x.0 = 22; //~ ERROR
+ x.1 = 44; //~ ERROR
+}
+
+fn main() { }
diff --git a/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr
new file mode 100644
index 0000000..b3c013d
--- /dev/null
+++ b/src/test/ui/borrowck/reassignment_immutable_fields_twice.stderr
@@ -0,0 +1,38 @@
+error[E0594]: cannot assign to field `x.0` of immutable binding
+ --> $DIR/reassignment_immutable_fields_twice.rs:17:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x = (22, 44);
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field `x.0` of immutable binding
+ --> $DIR/reassignment_immutable_fields_twice.rs:22:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x.0 = 1; //~ ERROR
+ | ^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field `x.0` of immutable binding
+ --> $DIR/reassignment_immutable_fields_twice.rs:23:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+LL | x.0 = 1; //~ ERROR
+LL | x.0 = 22; //~ ERROR
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error[E0594]: cannot assign to field `x.1` of immutable binding
+ --> $DIR/reassignment_immutable_fields_twice.rs:24:5
+ |
+LL | let x: (u32, u32);
+ | - consider changing this to `mut x`
+...
+LL | x.1 = 44; //~ ERROR
+ | ^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/borrowck/two-phase-across-loop.rs b/src/test/ui/borrowck/two-phase-across-loop.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-across-loop.rs
rename to src/test/ui/borrowck/two-phase-across-loop.rs
diff --git a/src/test/ui/borrowck/two-phase-across-loop.stderr b/src/test/ui/borrowck/two-phase-across-loop.stderr
new file mode 100644
index 0000000..65c3d27
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-across-loop.stderr
@@ -0,0 +1,9 @@
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/two-phase-across-loop.rs:29:22
+ |
+LL | strings.push(foo.get_string()); //~ ERROR cannot borrow `foo` as mutable
+ | ^^^ mutable borrow starts here in previous iteration of loop
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr b/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr
new file mode 100644
index 0000000..5a7f33e
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-activation-sharing-interference.nll_target.stderr
@@ -0,0 +1,47 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-activation-sharing-interference.rs:42:15
+ |
+LL | let y = &mut x;
+ | ------ mutable borrow occurs here
+LL | { let z = &x; read(z); }
+ | ^^ immutable borrow occurs here
+LL | //[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | *y += 1;
+ | ------- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-activation-sharing-interference.rs:50:13
+ |
+LL | let y = &mut x;
+ | ------ mutable borrow occurs here
+LL | let z = &x;
+ | ^^ immutable borrow occurs here
+LL | //[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | *y += 1;
+ | ------- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-activation-sharing-interference.rs:61:13
+ |
+LL | let y = &mut x;
+ | ------ mutable borrow occurs here
+LL | let z = &x;
+ | ^^ immutable borrow occurs here
+...
+LL | *y += 1;
+ | ------- borrow later used here
+
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-activation-sharing-interference.rs:72:14
+ |
+LL | let y = &mut x;
+ | ------ mutable borrow occurs here
+LL | let _z = &x;
+ | ^^ immutable borrow occurs here
+LL | //[nll_target]~^ ERROR cannot borrow `x` as immutable because it is also borrowed as mutable
+LL | *y += 1;
+ | ------- borrow later used here
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-activation-sharing-interference.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-activation-sharing-interference.rs
rename to src/test/ui/borrowck/two-phase-activation-sharing-interference.rs
diff --git a/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr
new file mode 100644
index 0000000..45cfc83
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.nll_target.stderr
@@ -0,0 +1,27 @@
+error[E0503]: cannot use `i` because it was mutably borrowed
+ --> $DIR/two-phase-allow-access-during-reservation.rs:40:19
+ |
+LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
+ | ------ borrow of `i` occurs here
+LL |
+LL | /*2*/ let j = i; // OK: `i` is only reserved here
+ | ^ use of borrowed `i`
+...
+LL | /*3*/ *p += 1; // (mutable borrow of `i` starts here, since `p` is used)
+ | ------- borrow later used here
+
+error[E0503]: cannot use `i` because it was mutably borrowed
+ --> $DIR/two-phase-allow-access-during-reservation.rs:45:19
+ |
+LL | /*1*/ let p = &mut i; // (reservation of `i` starts here)
+ | ------ borrow of `i` occurs here
+...
+LL | /*4*/ let k = i; //[nll_beyond]~ ERROR cannot use `i` because it was mutably borrowed [E0503]
+ | ^ use of borrowed `i`
+...
+LL | /*5*/ *p += 1;
+ | ------- borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs b/src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-allow-access-during-reservation.rs
rename to src/test/ui/borrowck/two-phase-allow-access-during-reservation.rs
diff --git a/src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-cannot-nest-mut-self-calls.rs
rename to src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.rs
diff --git a/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
new file mode 100644
index 0000000..942a38f
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-cannot-nest-mut-self-calls.stderr
@@ -0,0 +1,20 @@
+error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
+ --> $DIR/two-phase-cannot-nest-mut-self-calls.rs:26:9
+ |
+LL | vec.get({
+ | ---
+ | |
+ | _____immutable borrow occurs here
+ | |
+LL | |
+LL | | vec.push(2);
+ | | ^^^^^^^^^^^ mutable borrow occurs here
+LL | | //~^ ERROR cannot borrow `vec` as mutable because it is also borrowed as immutable
+LL | |
+LL | | 0
+LL | | });
+ | |______- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr
new file mode 100644
index 0000000..a8651c0
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.nll.stderr
@@ -0,0 +1,82 @@
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/two-phase-nonrecv-autoref.rs:70:11
+ |
+LL | f(f(10));
+ | --^-----
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0382]: use of moved value: `*f`
+ --> $DIR/two-phase-nonrecv-autoref.rs:79:11
+ |
+LL | f(f(10));
+ | - ^ value used here after move
+ | |
+ | value moved here
+
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/two-phase-nonrecv-autoref.rs:86:11
+ |
+LL | f(f(10));
+ | --^-----
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:9
+ |
+LL | f(f(10));
+ | ^
+
+error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:11
+ |
+LL | f(f(10));
+ | ^
+
+error[E0382]: use of moved value: `*f`
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:11
+ |
+LL | f(f(10));
+ | - ^ value used here after move
+ | |
+ | value moved here
+
+error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:139:27
+ |
+LL | double_access(&mut a, &a);
+ | ----------------------^^-
+ | | | |
+ | | | immutable borrow occurs here
+ | | mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:167:7
+ |
+LL | i[i[3]] = 4;
+ | --^----
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:173:7
+ |
+LL | i[i[3]] = i[4];
+ | --^----
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0161, E0382, E0499, E0502.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr
new file mode 100644
index 0000000..b64323a
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.ast.stderr
@@ -0,0 +1,113 @@
+error[E0503]: cannot use `*x` because it was mutably borrowed
+ --> $DIR/two-phase-nonrecv-autoref.rs:41:12
+ |
+LL | foo(x, *x);
+ | - ^^ use of borrowed `*x`
+ | |
+ | borrow of `*x` occurs here
+
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/two-phase-nonrecv-autoref.rs:70:11
+ |
+LL | f(f(10));
+ | - ^ - first borrow ends here
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+
+error[E0382]: use of moved value: `*f`
+ --> $DIR/two-phase-nonrecv-autoref.rs:79:11
+ |
+LL | f(f(10));
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `*f` has type `F`, which does not implement the `Copy` trait
+
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/two-phase-nonrecv-autoref.rs:86:11
+ |
+LL | f(f(10));
+ | - ^ - first borrow ends here
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+
+error[E0382]: use of moved value: `*f`
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:11
+ |
+LL | f(f(10));
+ | - ^ value used here after move
+ | |
+ | value moved here
+ |
+ = note: move occurs because `*f` has type `(dyn std::ops::FnOnce(i32) -> i32 + 'static)`, which does not implement the `Copy` trait
+
+error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:139:28
+ |
+LL | double_access(&mut a, &a);
+ | - ^- mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:145:9
+ |
+LL | a.m(a.i(10));
+ | - ^ - mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:167:7
+ |
+LL | i[i[3]] = 4;
+ | - ^ - mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:173:7
+ |
+LL | i[i[3]] = i[4];
+ | - ^ - mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:182:12
+ |
+LL | v.push(v.len());
+ | - ^ - mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:193:9
+ |
+LL | s.m(s.i(10));
+ | - ^ - mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `t` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:198:9
+ |
+LL | t.m(t.i(10));
+ | - ^ - mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0382, E0499, E0502, E0503.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr
new file mode 100644
index 0000000..a8651c0
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-nonrecv-autoref.nll.stderr
@@ -0,0 +1,82 @@
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/two-phase-nonrecv-autoref.rs:70:11
+ |
+LL | f(f(10));
+ | --^-----
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0382]: use of moved value: `*f`
+ --> $DIR/two-phase-nonrecv-autoref.rs:79:11
+ |
+LL | f(f(10));
+ | - ^ value used here after move
+ | |
+ | value moved here
+
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/two-phase-nonrecv-autoref.rs:86:11
+ |
+LL | f(f(10));
+ | --^-----
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:9
+ |
+LL | f(f(10));
+ | ^
+
+error[E0161]: cannot move a value of type dyn std::ops::FnOnce(i32) -> i32: the size of dyn std::ops::FnOnce(i32) -> i32 cannot be statically determined
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:11
+ |
+LL | f(f(10));
+ | ^
+
+error[E0382]: use of moved value: `*f`
+ --> $DIR/two-phase-nonrecv-autoref.rs:95:11
+ |
+LL | f(f(10));
+ | - ^ value used here after move
+ | |
+ | value moved here
+
+error[E0502]: cannot borrow `a` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:139:27
+ |
+LL | double_access(&mut a, &a);
+ | ----------------------^^-
+ | | | |
+ | | | immutable borrow occurs here
+ | | mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:167:7
+ |
+LL | i[i[3]] = 4;
+ | --^----
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `i` as immutable because it is also borrowed as mutable
+ --> $DIR/two-phase-nonrecv-autoref.rs:173:7
+ |
+LL | i[i[3]] = i[4];
+ | --^----
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0161, E0382, E0499, E0502.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs b/src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-nonrecv-autoref.rs
rename to src/test/ui/borrowck/two-phase-nonrecv-autoref.rs
diff --git a/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference-2.rs
rename to src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.rs
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr
new file mode 100644
index 0000000..2ac10a8
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference-2.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/two-phase-reservation-sharing-interference-2.rs:27:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let mut v = vec![0, 1, 2];
+LL | | let shared = &v;
+LL | |
+... |
+LL | | assert_eq!(v, [0, 1, 2, 3]);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr
new file mode 100644
index 0000000..62a548a
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.nll_target.stderr
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `vec` as mutable because it is also borrowed as immutable
+ --> $DIR/two-phase-reservation-sharing-interference.rs:46:17
+ |
+LL | let shared = &vec;
+ | ---- immutable borrow occurs here
+...
+LL | delay = &mut vec;
+ | ^^^^^^^^ mutable borrow occurs here
+...
+LL | shared[0];
+ | ------ borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs b/src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-reservation-sharing-interference.rs
rename to src/test/ui/borrowck/two-phase-reservation-sharing-interference.rs
diff --git a/src/test/ui/borrowck/two-phase-sneaky.nll.stderr b/src/test/ui/borrowck/two-phase-sneaky.nll.stderr
new file mode 100644
index 0000000..26a6271
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-sneaky.nll.stderr
@@ -0,0 +1,20 @@
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/two-phase-sneaky.rs:22:9
+ |
+LL | v[0].push_str({
+ | -
+ | |
+ | _____first mutable borrow occurs here
+ | |
+LL | |
+LL | | v.push(format!("foo"));
+ | | ^ second mutable borrow occurs here
+LL | | //~^ ERROR cannot borrow `v` as mutable more than once at a time [E0499]
+LL | |
+LL | | "World!"
+LL | | });
+ | |______- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/borrowck/two-phase-sneaky.rs b/src/test/ui/borrowck/two-phase-sneaky.rs
similarity index 100%
rename from src/test/compile-fail/borrowck/two-phase-sneaky.rs
rename to src/test/ui/borrowck/two-phase-sneaky.rs
diff --git a/src/test/ui/borrowck/two-phase-sneaky.stderr b/src/test/ui/borrowck/two-phase-sneaky.stderr
new file mode 100644
index 0000000..1ab9c18
--- /dev/null
+++ b/src/test/ui/borrowck/two-phase-sneaky.stderr
@@ -0,0 +1,15 @@
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/two-phase-sneaky.rs:22:9
+ |
+LL | v[0].push_str({
+ | - first mutable borrow occurs here
+LL |
+LL | v.push(format!("foo"));
+ | ^ second mutable borrow occurs here
+...
+LL | });
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
index 07a9f37..0eb5fc8 100644
--- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
+++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
@@ -1,6 +1,9 @@
error[E0507]: cannot move out of captured variable in an `Fn` closure
--> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
|
+LL | let y = vec![format!("World")];
+ | - captured outer variable
+LL | call(|| {
LL | y.into_iter();
| ^ cannot move out of captured variable in an `Fn` closure
diff --git a/src/test/compile-fail/bounds-lifetime.rs b/src/test/ui/bounds-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/bounds-lifetime.rs
rename to src/test/ui/bounds-lifetime.rs
diff --git a/src/test/ui/bounds-lifetime.stderr b/src/test/ui/bounds-lifetime.stderr
new file mode 100644
index 0000000..cbd140c
--- /dev/null
+++ b/src/test/ui/bounds-lifetime.stderr
@@ -0,0 +1,32 @@
+error: lifetime bounds cannot be used in this context
+ --> $DIR/bounds-lifetime.rs:11:22
+ |
+LL | type A = for<'b, 'a: 'b> fn(); //~ ERROR lifetime bounds cannot be used in this context
+ | ^^
+
+error: lifetime bounds cannot be used in this context
+ --> $DIR/bounds-lifetime.rs:12:22
+ |
+LL | type B = for<'b, 'a: 'b,> fn(); //~ ERROR lifetime bounds cannot be used in this context
+ | ^^
+
+error: lifetime bounds cannot be used in this context
+ --> $DIR/bounds-lifetime.rs:13:22
+ |
+LL | type C = for<'b, 'a: 'b +> fn(); //~ ERROR lifetime bounds cannot be used in this context
+ | ^^
+
+error: only lifetime parameters can be used in this context
+ --> $DIR/bounds-lifetime.rs:14:18
+ |
+LL | type D = for<'a, T> fn(); //~ ERROR only lifetime parameters can be used in this context
+ | ^
+
+error: only lifetime parameters can be used in this context
+ --> $DIR/bounds-lifetime.rs:15:14
+ |
+LL | type E = for<T> Fn(); //~ ERROR only lifetime parameters can be used in this context
+ | ^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/break-outside-loop.rs b/src/test/ui/break-outside-loop.rs
similarity index 100%
rename from src/test/compile-fail/break-outside-loop.rs
rename to src/test/ui/break-outside-loop.rs
diff --git a/src/test/ui/break-outside-loop.stderr b/src/test/ui/break-outside-loop.stderr
new file mode 100644
index 0000000..820272d
--- /dev/null
+++ b/src/test/ui/break-outside-loop.stderr
@@ -0,0 +1,34 @@
+error[E0268]: `break` outside of loop
+ --> $DIR/break-outside-loop.rs:20:15
+ |
+LL | let pth = break; //~ ERROR: `break` outside of loop
+ | ^^^^^ cannot break outside of a loop
+
+error[E0268]: `continue` outside of loop
+ --> $DIR/break-outside-loop.rs:21:17
+ |
+LL | if cond() { continue } //~ ERROR: `continue` outside of loop
+ | ^^^^^^^^ cannot break outside of a loop
+
+error[E0267]: `break` inside of a closure
+ --> $DIR/break-outside-loop.rs:27:25
+ |
+LL | if cond() { break } //~ ERROR: `break` inside of a closure
+ | ^^^^^ cannot break inside of a closure
+
+error[E0267]: `continue` inside of a closure
+ --> $DIR/break-outside-loop.rs:28:25
+ |
+LL | if cond() { continue } //~ ERROR: `continue` inside of a closure
+ | ^^^^^^^^ cannot break inside of a closure
+
+error[E0268]: `break` outside of loop
+ --> $DIR/break-outside-loop.rs:34:25
+ |
+LL | let unconstrained = break; //~ ERROR: `break` outside of loop
+ | ^^^^^ cannot break outside of a loop
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0267, E0268.
+For more information about an error, try `rustc --explain E0267`.
diff --git a/src/test/compile-fail/auxiliary/trait_superkinds_in_metadata.rs b/src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/trait_superkinds_in_metadata.rs
rename to src/test/ui/builtin-superkinds/auxiliary/trait_superkinds_in_metadata.rs
diff --git a/src/test/compile-fail/builtin-superkinds-double-superkind.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs
similarity index 100%
rename from src/test/compile-fail/builtin-superkinds-double-superkind.rs
rename to src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.rs
diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr
new file mode 100644
index 0000000..a462fcf
--- /dev/null
+++ b/src/test/ui/builtin-superkinds/builtin-superkinds-double-superkind.stderr
@@ -0,0 +1,23 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/builtin-superkinds-double-superkind.rs:16:24
+ |
+LL | impl <T: Sync+'static> Foo for (T,) { }
+ | ^^^ `T` cannot be sent between threads safely
+ |
+ = help: within `(T,)`, the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+ = note: required because it appears within the type `(T,)`
+
+error[E0277]: `T` cannot be shared between threads safely
+ --> $DIR/builtin-superkinds-double-superkind.rs:19:16
+ |
+LL | impl <T: Send> Foo for (T,T) { }
+ | ^^^ `T` cannot be shared between threads safely
+ |
+ = help: within `(T, T)`, the trait `std::marker::Sync` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Sync` bound
+ = note: required because it appears within the type `(T, T)`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/builtin-superkinds-in-metadata.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs
similarity index 100%
rename from src/test/compile-fail/builtin-superkinds-in-metadata.rs
rename to src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.rs
diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr
new file mode 100644
index 0000000..dcc7e3c
--- /dev/null
+++ b/src/test/ui/builtin-superkinds/builtin-superkinds-in-metadata.stderr
@@ -0,0 +1,13 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/builtin-superkinds-in-metadata.rs:24:23
+ |
+LL | impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `T` cannot be sent between threads safely
+ |
+ = help: within `X<T>`, the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+ = note: required because it appears within the type `X<T>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/builtin-superkinds-self-type.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs
similarity index 100%
rename from src/test/compile-fail/builtin-superkinds-self-type.rs
rename to src/test/ui/builtin-superkinds/builtin-superkinds-self-type.rs
diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
new file mode 100644
index 0000000..f96393d
--- /dev/null
+++ b/src/test/ui/builtin-superkinds/builtin-superkinds-self-type.stderr
@@ -0,0 +1,17 @@
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/builtin-superkinds-self-type.rs:20:16
+ |
+LL | impl <T: Sync> Foo for T { }
+ | -- ^^^
+ | |
+ | help: consider adding an explicit lifetime bound `T: 'static`...
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/builtin-superkinds-self-type.rs:20:16
+ |
+LL | impl <T: Sync> Foo for T { }
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs
similarity index 100%
rename from src/test/compile-fail/builtin-superkinds-simple.rs
rename to src/test/ui/builtin-superkinds/builtin-superkinds-simple.rs
diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr
new file mode 100644
index 0000000..043953e
--- /dev/null
+++ b/src/test/ui/builtin-superkinds/builtin-superkinds-simple.stderr
@@ -0,0 +1,11 @@
+error[E0277]: `std::rc::Rc<i8>` cannot be sent between threads safely
+ --> $DIR/builtin-superkinds-simple.rs:16:6
+ |
+LL | impl Foo for std::rc::Rc<i8> { }
+ | ^^^ `std::rc::Rc<i8>` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc<i8>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs
similarity index 100%
rename from src/test/compile-fail/builtin-superkinds-typaram-not-send.rs
rename to src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.rs
diff --git a/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr
new file mode 100644
index 0000000..00bad2e
--- /dev/null
+++ b/src/test/ui/builtin-superkinds/builtin-superkinds-typaram-not-send.stderr
@@ -0,0 +1,12 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/builtin-superkinds-typaram-not-send.rs:15:24
+ |
+LL | impl <T: Sync+'static> Foo for T { }
+ | ^^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr
new file mode 100644
index 0000000..491b5b5
--- /dev/null
+++ b/src/test/ui/by-move-pattern-binding.nll.stderr
@@ -0,0 +1,21 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/by-move-pattern-binding.rs:24:11
+ |
+LL | match &s.x {
+ | ^^^^ cannot move out of borrowed content
+LL | &E::Foo => {}
+LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
+ | -------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `E::Bar(identifier)`
+ |
+note: move occurs because `identifier` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/by-move-pattern-binding.rs:26:17
+ |
+LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/by-move-pattern-binding.rs b/src/test/ui/by-move-pattern-binding.rs
similarity index 100%
rename from src/test/compile-fail/by-move-pattern-binding.rs
rename to src/test/ui/by-move-pattern-binding.rs
diff --git a/src/test/ui/by-move-pattern-binding.stderr b/src/test/ui/by-move-pattern-binding.stderr
new file mode 100644
index 0000000..a20de4b
--- /dev/null
+++ b/src/test/ui/by-move-pattern-binding.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/by-move-pattern-binding.rs:26:9
+ |
+LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move
+ | ^^^^^^^^----------^
+ | | |
+ | | hint: to prevent move, use `ref identifier` or `ref mut identifier`
+ | cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/call-fn-never-arg-wrong-type.rs b/src/test/ui/call-fn-never-arg-wrong-type.rs
similarity index 100%
rename from src/test/compile-fail/call-fn-never-arg-wrong-type.rs
rename to src/test/ui/call-fn-never-arg-wrong-type.rs
diff --git a/src/test/ui/call-fn-never-arg-wrong-type.stderr b/src/test/ui/call-fn-never-arg-wrong-type.stderr
new file mode 100644
index 0000000..84ed8d1
--- /dev/null
+++ b/src/test/ui/call-fn-never-arg-wrong-type.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/call-fn-never-arg-wrong-type.rs:20:9
+ |
+LL | foo("wow"); //~ ERROR mismatched types
+ | ^^^^^ expected !, found reference
+ |
+ = note: expected type `!`
+ found type `&'static str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/can-begin-expr-check.rs b/src/test/ui/can-begin-expr-check.rs
similarity index 100%
rename from src/test/compile-fail/can-begin-expr-check.rs
rename to src/test/ui/can-begin-expr-check.rs
diff --git a/src/test/ui/can-begin-expr-check.stderr b/src/test/ui/can-begin-expr-check.stderr
new file mode 100644
index 0000000..ddcb69c
--- /dev/null
+++ b/src/test/ui/can-begin-expr-check.stderr
@@ -0,0 +1,8 @@
+error: expected one of `.`, `;`, `?`, `}`, or an operator, found `enum`
+ --> $DIR/can-begin-expr-check.rs:29:12
+ |
+LL | return enum; //~ ERROR expected one of `.`, `;`, `?`, `}`, or an operator, found `enum`
+ | ^^^^ expected one of `.`, `;`, `?`, `}`, or an operator here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr
new file mode 100644
index 0000000..a7ffc06
--- /dev/null
+++ b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.nll.stderr
@@ -0,0 +1,20 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:23:25
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+LL | to_fn_once(move|| { x = 2; });
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:28:25
+ |
+LL | let s = std::io::stdin();
+ | - help: consider changing this to be mutable: `mut s`
+LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
+ | ^ cannot borrow as mutable
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr
new file mode 100644
index 0000000..02d57ca
--- /dev/null
+++ b/src/test/ui/cannot-mutate-captured-non-mut-var.ast.stderr
@@ -0,0 +1,16 @@
+error[E0594]: cannot assign to immutable captured outer variable in an `FnOnce` closure `x`
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:23:25
+ |
+LL | to_fn_once(move|| { x = 2; });
+ | ^^^^^
+
+error[E0596]: cannot borrow immutable captured outer variable in an `FnOnce` closure `s` as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:28:25
+ |
+LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
+ | ^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr b/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr
new file mode 100644
index 0000000..a7ffc06
--- /dev/null
+++ b/src/test/ui/cannot-mutate-captured-non-mut-var.mir.stderr
@@ -0,0 +1,20 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:23:25
+ |
+LL | let x = 1;
+ | - help: consider changing this to be mutable: `mut x`
+LL | to_fn_once(move|| { x = 2; });
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `s` as mutable, as it is not declared as mutable
+ --> $DIR/cannot-mutate-captured-non-mut-var.rs:28:25
+ |
+LL | let s = std::io::stdin();
+ | - help: consider changing this to be mutable: `mut s`
+LL | to_fn_once(move|| { s.read_to_end(&mut Vec::new()); });
+ | ^ cannot borrow as mutable
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs b/src/test/ui/cannot-mutate-captured-non-mut-var.rs
similarity index 100%
rename from src/test/compile-fail/cannot-mutate-captured-non-mut-var.rs
rename to src/test/ui/cannot-mutate-captured-non-mut-var.rs
diff --git a/src/test/compile-fail/capture1.rs b/src/test/ui/capture1.rs
similarity index 100%
rename from src/test/compile-fail/capture1.rs
rename to src/test/ui/capture1.rs
diff --git a/src/test/ui/capture1.stderr b/src/test/ui/capture1.stderr
new file mode 100644
index 0000000..82eb1b6
--- /dev/null
+++ b/src/test/ui/capture1.stderr
@@ -0,0 +1,11 @@
+error[E0434]: can't capture dynamic environment in a fn item
+ --> $DIR/capture1.rs:16:32
+ |
+LL | fn foo() -> isize { return bar; }
+ | ^^^
+ |
+ = help: use the `|| { ... }` closure form instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0434`.
diff --git a/src/test/ui/cast-as-bool.rs b/src/test/ui/cast/cast-as-bool.rs
similarity index 100%
rename from src/test/ui/cast-as-bool.rs
rename to src/test/ui/cast/cast-as-bool.rs
diff --git a/src/test/ui/cast-as-bool.stderr b/src/test/ui/cast/cast-as-bool.stderr
similarity index 100%
rename from src/test/ui/cast-as-bool.stderr
rename to src/test/ui/cast/cast-as-bool.stderr
diff --git a/src/test/ui/cast-errors-issue-43825.rs b/src/test/ui/cast/cast-errors-issue-43825.rs
similarity index 100%
rename from src/test/ui/cast-errors-issue-43825.rs
rename to src/test/ui/cast/cast-errors-issue-43825.rs
diff --git a/src/test/ui/cast-errors-issue-43825.stderr b/src/test/ui/cast/cast-errors-issue-43825.stderr
similarity index 100%
rename from src/test/ui/cast-errors-issue-43825.stderr
rename to src/test/ui/cast/cast-errors-issue-43825.stderr
diff --git a/src/test/compile-fail/cast-from-nil.rs b/src/test/ui/cast/cast-from-nil.rs
similarity index 100%
rename from src/test/compile-fail/cast-from-nil.rs
rename to src/test/ui/cast/cast-from-nil.rs
diff --git a/src/test/ui/cast/cast-from-nil.stderr b/src/test/ui/cast/cast-from-nil.stderr
new file mode 100644
index 0000000..4400007
--- /dev/null
+++ b/src/test/ui/cast/cast-from-nil.stderr
@@ -0,0 +1,11 @@
+error[E0605]: non-primitive cast: `()` as `u32`
+ --> $DIR/cast-from-nil.rs:12:21
+ |
+LL | fn main() { let u = (assert!(true) as u32); }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/cast-ptr-to-int-const.rs b/src/test/ui/cast/cast-ptr-to-int-const.rs
similarity index 100%
rename from src/test/compile-fail/cast-ptr-to-int-const.rs
rename to src/test/ui/cast/cast-ptr-to-int-const.rs
diff --git a/src/test/ui/cast/cast-ptr-to-int-const.stderr b/src/test/ui/cast/cast-ptr-to-int-const.stderr
new file mode 100644
index 0000000..7c3b4e4
--- /dev/null
+++ b/src/test/ui/cast/cast-ptr-to-int-const.stderr
@@ -0,0 +1,19 @@
+error[E0658]: casting pointers to integers in constants is unstable (see issue #51910)
+ --> $DIR/cast-ptr-to-int-const.rs:14:20
+ |
+LL | const X: u32 = main as u32; //~ ERROR casting pointers to integers in constants is unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
+
+error[E0658]: casting pointers to integers in constants is unstable (see issue #51910)
+ --> $DIR/cast-ptr-to-int-const.rs:16:20
+ |
+LL | const Z: u32 = &Y as *const u32 as u32; //~ ERROR is unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/cast-rfc0401-2.rs b/src/test/ui/cast/cast-rfc0401-2.rs
similarity index 100%
rename from src/test/ui/cast-rfc0401-2.rs
rename to src/test/ui/cast/cast-rfc0401-2.rs
diff --git a/src/test/ui/cast-rfc0401-2.stderr b/src/test/ui/cast/cast-rfc0401-2.stderr
similarity index 100%
rename from src/test/ui/cast-rfc0401-2.stderr
rename to src/test/ui/cast/cast-rfc0401-2.stderr
diff --git a/src/test/compile-fail/cast-to-bare-fn.rs b/src/test/ui/cast/cast-to-bare-fn.rs
similarity index 100%
rename from src/test/compile-fail/cast-to-bare-fn.rs
rename to src/test/ui/cast/cast-to-bare-fn.rs
diff --git a/src/test/ui/cast/cast-to-bare-fn.stderr b/src/test/ui/cast/cast-to-bare-fn.stderr
new file mode 100644
index 0000000..ed07f37
--- /dev/null
+++ b/src/test/ui/cast/cast-to-bare-fn.stderr
@@ -0,0 +1,19 @@
+error[E0605]: non-primitive cast: `fn(isize) {foo}` as `extern "C" fn() -> isize`
+ --> $DIR/cast-to-bare-fn.rs:15:13
+ |
+LL | let x = foo as extern "C" fn() -> isize;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error[E0605]: non-primitive cast: `u64` as `fn(isize) -> (isize, isize)`
+ --> $DIR/cast-to-bare-fn.rs:17:13
+ |
+LL | let y = v as extern "Rust" fn(isize) -> (isize, isize);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/cast-to-nil.rs b/src/test/ui/cast/cast-to-nil.rs
similarity index 100%
rename from src/test/compile-fail/cast-to-nil.rs
rename to src/test/ui/cast/cast-to-nil.rs
diff --git a/src/test/ui/cast/cast-to-nil.stderr b/src/test/ui/cast/cast-to-nil.stderr
new file mode 100644
index 0000000..f7ee68e
--- /dev/null
+++ b/src/test/ui/cast/cast-to-nil.stderr
@@ -0,0 +1,11 @@
+error[E0605]: non-primitive cast: `u32` as `()`
+ --> $DIR/cast-to-nil.rs:12:21
+ |
+LL | fn main() { let u = 0u32 as (); }
+ | ^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.rs b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs
similarity index 100%
rename from src/test/ui/cast-to-unsized-trait-object-suggestion.rs
rename to src/test/ui/cast/cast-to-unsized-trait-object-suggestion.rs
diff --git a/src/test/ui/cast-to-unsized-trait-object-suggestion.stderr b/src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr
similarity index 100%
rename from src/test/ui/cast-to-unsized-trait-object-suggestion.stderr
rename to src/test/ui/cast/cast-to-unsized-trait-object-suggestion.stderr
diff --git a/src/test/ui/catch-block-type-error.stderr b/src/test/ui/catch-block-type-error.stderr
deleted file mode 100644
index 0ae8d48..0000000
--- a/src/test/ui/catch-block-type-error.stderr
+++ /dev/null
@@ -1,21 +0,0 @@
-error[E0271]: type mismatch resolving `<std::option::Option<f32> as std::ops::Try>::Ok == {integer}`
- --> $DIR/catch-block-type-error.rs:18:9
- |
-LL | 42
- | ^^ expected f32, found integral variable
- |
- = note: expected type `f32`
- found type `{integer}`
-
-error[E0271]: type mismatch resolving `<std::option::Option<i32> as std::ops::Try>::Ok == ()`
- --> $DIR/catch-block-type-error.rs:24:5
- |
-LL | };
- | ^ expected i32, found ()
- |
- = note: expected type `i32`
- found type `()`
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/ui/catch/catch-bad-lifetime.nll.stderr b/src/test/ui/catch/catch-bad-lifetime.nll.stderr
new file mode 100644
index 0000000..dd1595f
--- /dev/null
+++ b/src/test/ui/catch/catch-bad-lifetime.nll.stderr
@@ -0,0 +1,39 @@
+error[E0506]: cannot assign to `i` because it is borrowed
+ --> $DIR/catch-bad-lifetime.rs:33:13
+ |
+LL | let k = &mut i;
+ | ------ borrow of `i` occurs here
+...
+LL | i = 10; //~ ERROR cannot assign to `i` because it is borrowed
+ | ^^^^^^ assignment to borrowed `i` occurs here
+LL | };
+LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k`
+ | - borrow later used here
+
+error[E0382]: use of moved value: `k`
+ --> $DIR/catch-bad-lifetime.rs:35:26
+ |
+LL | Err(k) ?;
+ | - value moved here
+...
+LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k`
+ | ^ value used here after move
+ |
+ = note: move occurs because `k` has type `&mut i32`, which does not implement the `Copy` trait
+
+error[E0506]: cannot assign to `i` because it is borrowed
+ --> $DIR/catch-bad-lifetime.rs:36:9
+ |
+LL | let k = &mut i;
+ | ------ borrow of `i` occurs here
+...
+LL | i = 40; //~ ERROR cannot assign to `i` because it is borrowed
+ | ^^^^^^ assignment to borrowed `i` occurs here
+LL |
+LL | let i_ptr = if let Err(i_ptr) = j { i_ptr } else { panic ! ("") };
+ | - borrow later used here
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0382, E0506.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/catch-bad-lifetime.rs b/src/test/ui/catch/catch-bad-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/catch-bad-lifetime.rs
rename to src/test/ui/catch/catch-bad-lifetime.rs
diff --git a/src/test/ui/catch/catch-bad-lifetime.stderr b/src/test/ui/catch/catch-bad-lifetime.stderr
new file mode 100644
index 0000000..2ea54d1
--- /dev/null
+++ b/src/test/ui/catch/catch-bad-lifetime.stderr
@@ -0,0 +1,44 @@
+error[E0597]: `my_string` does not live long enough
+ --> $DIR/catch-bad-lifetime.rs:20:35
+ |
+LL | let my_str: & str = & my_string;
+ | ^^^^^^^^^ borrowed value does not live long enough
+...
+LL | };
+ | - `my_string` dropped here while still borrowed
+LL | }
+ | - borrowed value needs to live until here
+
+error[E0506]: cannot assign to `i` because it is borrowed
+ --> $DIR/catch-bad-lifetime.rs:33:13
+ |
+LL | let k = &mut i;
+ | - borrow of `i` occurs here
+...
+LL | i = 10; //~ ERROR cannot assign to `i` because it is borrowed
+ | ^^^^^^ assignment to borrowed `i` occurs here
+
+error[E0382]: use of moved value: `k`
+ --> $DIR/catch-bad-lifetime.rs:35:26
+ |
+LL | Err(k) ?;
+ | - value moved here
+...
+LL | ::std::mem::drop(k); //~ ERROR use of moved value: `k`
+ | ^ value used here after move
+ |
+ = note: move occurs because `k` has type `&mut i32`, which does not implement the `Copy` trait
+
+error[E0506]: cannot assign to `i` because it is borrowed
+ --> $DIR/catch-bad-lifetime.rs:36:9
+ |
+LL | let k = &mut i;
+ | - borrow of `i` occurs here
+...
+LL | i = 40; //~ ERROR cannot assign to `i` because it is borrowed
+ | ^^^^^^ assignment to borrowed `i` occurs here
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0382, E0506, E0597.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/catch-bad-type.rs b/src/test/ui/catch/catch-bad-type.rs
similarity index 100%
rename from src/test/compile-fail/catch-bad-type.rs
rename to src/test/ui/catch/catch-bad-type.rs
diff --git a/src/test/ui/catch/catch-bad-type.stderr b/src/test/ui/catch/catch-bad-type.stderr
new file mode 100644
index 0000000..2ab5b3e
--- /dev/null
+++ b/src/test/ui/catch/catch-bad-type.stderr
@@ -0,0 +1,52 @@
+error[E0277]: the trait bound `i32: std::convert::From<&str>` is not satisfied
+ --> $DIR/catch-bad-type.rs:15:9
+ |
+LL | Err("")?; //~ ERROR the trait bound `i32: std::convert::From<&str>` is not satisfied
+ | ^^^^^^^^ the trait `std::convert::From<&str>` is not implemented for `i32`
+ |
+ = help: the following implementations were found:
+ <i32 as std::convert::From<bool>>
+ <i32 as std::convert::From<i16>>
+ <i32 as std::convert::From<i8>>
+ <i32 as std::convert::From<u16>>
+ <i32 as std::convert::From<u8>>
+ = note: required by `std::convert::From::from`
+
+error[E0271]: type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == &str`
+ --> $DIR/catch-bad-type.rs:20:9
+ |
+LL | "" //~ ERROR type mismatch
+ | ^^ expected i32, found &str
+ |
+ = note: expected type `i32`
+ found type `&str`
+
+error[E0271]: type mismatch resolving `<std::result::Result<i32, i32> as std::ops::Try>::Ok == ()`
+ --> $DIR/catch-bad-type.rs:23:44
+ |
+LL | let res: Result<i32, i32> = do catch { }; //~ ERROR type mismatch
+ | ^ expected i32, found ()
+ |
+ = note: expected type `i32`
+ found type `()`
+
+error[E0277]: the trait bound `(): std::ops::Try` is not satisfied
+ --> $DIR/catch-bad-type.rs:25:28
+ |
+LL | let res: () = do catch { }; //~ the trait bound `(): std::ops::Try` is not satisfied
+ | ^^^ the trait `std::ops::Try` is not implemented for `()`
+ |
+ = note: required by `std::ops::Try::from_ok`
+
+error[E0277]: the trait bound `i32: std::ops::Try` is not satisfied
+ --> $DIR/catch-bad-type.rs:27:29
+ |
+LL | let res: i32 = do catch { 5 }; //~ ERROR the trait bound `i32: std::ops::Try` is not satisfied
+ | ^^^^^ the trait `std::ops::Try` is not implemented for `i32`
+ |
+ = note: required by `std::ops::Try::from_ok`
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0271, E0277.
+For more information about an error, try `rustc --explain E0271`.
diff --git a/src/test/ui/catch-block-type-error.rs b/src/test/ui/catch/catch-block-type-error.rs
similarity index 100%
rename from src/test/ui/catch-block-type-error.rs
rename to src/test/ui/catch/catch-block-type-error.rs
diff --git a/src/test/ui/catch/catch-block-type-error.stderr b/src/test/ui/catch/catch-block-type-error.stderr
new file mode 100644
index 0000000..288168c
--- /dev/null
+++ b/src/test/ui/catch/catch-block-type-error.stderr
@@ -0,0 +1,24 @@
+error[E0271]: type mismatch resolving `<std::option::Option<f32> as std::ops::Try>::Ok == {integer}`
+ --> $DIR/catch-block-type-error.rs:18:9
+ |
+LL | 42
+ | ^^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `42.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0271]: type mismatch resolving `<std::option::Option<i32> as std::ops::Try>::Ok == ()`
+ --> $DIR/catch-block-type-error.rs:24:5
+ |
+LL | };
+ | ^ expected i32, found ()
+ |
+ = note: expected type `i32`
+ found type `()`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/catch-in-match.rs b/src/test/ui/catch/catch-in-match.rs
similarity index 100%
rename from src/test/compile-fail/catch-in-match.rs
rename to src/test/ui/catch/catch-in-match.rs
diff --git a/src/test/ui/catch/catch-in-match.stderr b/src/test/ui/catch/catch-in-match.stderr
new file mode 100644
index 0000000..1542989
--- /dev/null
+++ b/src/test/ui/catch/catch-in-match.stderr
@@ -0,0 +1,8 @@
+error: expected expression, found reserved keyword `do`
+ --> $DIR/catch-in-match.rs:14:11
+ |
+LL | match do catch { false } { _ => {} } //~ ERROR expected expression, found reserved keyword `do`
+ | ^^ expected expression
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/catch-in-while.rs b/src/test/ui/catch/catch-in-while.rs
similarity index 100%
rename from src/test/compile-fail/catch-in-while.rs
rename to src/test/ui/catch/catch-in-while.rs
diff --git a/src/test/ui/catch/catch-in-while.stderr b/src/test/ui/catch/catch-in-while.stderr
new file mode 100644
index 0000000..9316bbc
--- /dev/null
+++ b/src/test/ui/catch/catch-in-while.stderr
@@ -0,0 +1,8 @@
+error: expected expression, found reserved keyword `do`
+ --> $DIR/catch-in-while.rs:14:11
+ |
+LL | while do catch { false } {} //~ ERROR expected expression, found reserved keyword `do`
+ | ^^ expected expression
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/catch/catch-maybe-bad-lifetime.nll.stderr b/src/test/ui/catch/catch-maybe-bad-lifetime.nll.stderr
new file mode 100644
index 0000000..1577931
--- /dev/null
+++ b/src/test/ui/catch/catch-maybe-bad-lifetime.nll.stderr
@@ -0,0 +1,14 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/catch-maybe-bad-lifetime.rs:33:24
+ |
+LL | ::std::mem::drop(x);
+ | - value moved here
+LL | };
+LL | println!("{}", x); //~ ERROR use of moved value: `x`
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/catch-maybe-bad-lifetime.rs b/src/test/ui/catch/catch-maybe-bad-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/catch-maybe-bad-lifetime.rs
rename to src/test/ui/catch/catch-maybe-bad-lifetime.rs
diff --git a/src/test/ui/catch/catch-maybe-bad-lifetime.stderr b/src/test/ui/catch/catch-maybe-bad-lifetime.stderr
new file mode 100644
index 0000000..21fe104
--- /dev/null
+++ b/src/test/ui/catch/catch-maybe-bad-lifetime.stderr
@@ -0,0 +1,33 @@
+error[E0506]: cannot assign to `i` because it is borrowed
+ --> $DIR/catch-maybe-bad-lifetime.rs:23:9
+ |
+LL | &i
+ | - borrow of `i` occurs here
+...
+LL | i = 0; //~ ERROR cannot assign to `i` because it is borrowed
+ | ^^^^^ assignment to borrowed `i` occurs here
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/catch-maybe-bad-lifetime.rs:33:24
+ |
+LL | ::std::mem::drop(x);
+ | - value moved here
+LL | };
+LL | println!("{}", x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0506]: cannot assign to `i` because it is borrowed
+ --> $DIR/catch-maybe-bad-lifetime.rs:45:9
+ |
+LL | j = &i;
+ | - borrow of `i` occurs here
+LL | };
+LL | i = 0; //~ ERROR cannot assign to `i` because it is borrowed
+ | ^^^^^ assignment to borrowed `i` occurs here
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0382, E0506.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/catch/catch-opt-init.nll.stderr b/src/test/ui/catch/catch-opt-init.nll.stderr
new file mode 100644
index 0000000..ea8c8eb
--- /dev/null
+++ b/src/test/ui/catch/catch-opt-init.nll.stderr
@@ -0,0 +1,11 @@
+error[E0381]: borrow of possibly uninitialized variable: `cfg_res`
+ --> $DIR/catch-opt-init.rs:23:5
+ |
+LL | assert_eq!(cfg_res, 5); //~ ERROR use of possibly uninitialized variable
+ | ^^^^^^^^^^^^^^^^^^^^^^^ use of possibly uninitialized `cfg_res`
+ |
+ = 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: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/catch-opt-init.rs b/src/test/ui/catch/catch-opt-init.rs
similarity index 100%
rename from src/test/compile-fail/catch-opt-init.rs
rename to src/test/ui/catch/catch-opt-init.rs
diff --git a/src/test/ui/catch/catch-opt-init.stderr b/src/test/ui/catch/catch-opt-init.stderr
new file mode 100644
index 0000000..6a14ba1
--- /dev/null
+++ b/src/test/ui/catch/catch-opt-init.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `cfg_res`
+ --> $DIR/catch-opt-init.rs:23:16
+ |
+LL | assert_eq!(cfg_res, 5); //~ ERROR use of possibly uninitialized variable
+ | ^^^^^^^ use of possibly uninitialized `cfg_res`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/cdylib-deps-must-be-static.rs b/src/test/ui/cdylib-deps-must-be-static.rs
similarity index 100%
rename from src/test/compile-fail/cdylib-deps-must-be-static.rs
rename to src/test/ui/cdylib-deps-must-be-static.rs
diff --git a/src/test/ui/cdylib-deps-must-be-static.stderr b/src/test/ui/cdylib-deps-must-be-static.stderr
new file mode 100644
index 0000000..a1dc8e9
--- /dev/null
+++ b/src/test/ui/cdylib-deps-must-be-static.stderr
@@ -0,0 +1,4 @@
+error: crate `cdylib_dep` required to be available in rlib format, but was not found in this form
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/cfg-arg-invalid.rs b/src/test/ui/cfg-arg-invalid.rs
similarity index 100%
rename from src/test/compile-fail/cfg-arg-invalid.rs
rename to src/test/ui/cfg-arg-invalid.rs
diff --git a/src/test/compile-fail/cfg-attr-cfg-2.rs b/src/test/ui/cfg-attr-cfg-2.rs
similarity index 100%
rename from src/test/compile-fail/cfg-attr-cfg-2.rs
rename to src/test/ui/cfg-attr-cfg-2.rs
diff --git a/src/test/ui/cfg-attr-cfg-2.stderr b/src/test/ui/cfg-attr-cfg-2.stderr
new file mode 100644
index 0000000..db3c7ac
--- /dev/null
+++ b/src/test/ui/cfg-attr-cfg-2.stderr
@@ -0,0 +1,7 @@
+error[E0601]: `main` function not found in crate `cfg_attr_cfg_2`
+ |
+ = note: consider adding a `main` function to `$DIR/cfg-attr-cfg-2.rs`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/cfg-attr-crate-2.rs b/src/test/ui/cfg-attr-crate-2.rs
similarity index 100%
rename from src/test/compile-fail/cfg-attr-crate-2.rs
rename to src/test/ui/cfg-attr-crate-2.rs
diff --git a/src/test/ui/cfg-attr-crate-2.stderr b/src/test/ui/cfg-attr-crate-2.stderr
new file mode 100644
index 0000000..7b66c8f
--- /dev/null
+++ b/src/test/ui/cfg-attr-crate-2.stderr
@@ -0,0 +1,11 @@
+error[E0658]: no_core is experimental (see issue #29639)
+ --> $DIR/cfg-attr-crate-2.rs:15:21
+ |
+LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental
+ | ^^^^^^^^
+ |
+ = help: add #![feature(no_core)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/cfg-attr-invalid-predicate.rs b/src/test/ui/cfg-attr-invalid-predicate.rs
similarity index 100%
rename from src/test/compile-fail/cfg-attr-invalid-predicate.rs
rename to src/test/ui/cfg-attr-invalid-predicate.rs
diff --git a/src/test/ui/cfg-attr-invalid-predicate.stderr b/src/test/ui/cfg-attr-invalid-predicate.stderr
new file mode 100644
index 0000000..5a89f97
--- /dev/null
+++ b/src/test/ui/cfg-attr-invalid-predicate.stderr
@@ -0,0 +1,9 @@
+error[E0537]: invalid predicate `foo`
+ --> $DIR/cfg-attr-invalid-predicate.rs:11:7
+ |
+LL | #[cfg(foo(bar))] //~ ERROR invalid predicate `foo`
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0537`.
diff --git a/src/test/compile-fail/cfg-attr-unknown-attribute-macro-expansion.rs b/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.rs
similarity index 100%
rename from src/test/compile-fail/cfg-attr-unknown-attribute-macro-expansion.rs
rename to src/test/ui/cfg-attr-unknown-attribute-macro-expansion.rs
diff --git a/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr
new file mode 100644
index 0000000..33fe523
--- /dev/null
+++ b/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr
@@ -0,0 +1,14 @@
+error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:13:27
+ |
+LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown
+ | ^^^^^^^^
+...
+LL | foo!();
+ | ------- in this macro invocation
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/cfg-empty-codemap.rs b/src/test/ui/cfg-empty-codemap.rs
new file mode 100644
index 0000000..f06d22d
--- /dev/null
+++ b/src/test/ui/cfg-empty-codemap.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 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.
+
+// Tests that empty source_maps don't ICE (#23301)
+
+// compile-flags: --cfg ""
+
+// error-pattern: expected identifier, found
+
+pub fn main() {
+}
diff --git a/src/test/compile-fail/cfg-in-crate-1.rs b/src/test/ui/cfg-in-crate-1.rs
similarity index 100%
rename from src/test/compile-fail/cfg-in-crate-1.rs
rename to src/test/ui/cfg-in-crate-1.rs
diff --git a/src/test/ui/cfg-in-crate-1.stderr b/src/test/ui/cfg-in-crate-1.stderr
new file mode 100644
index 0000000..c6d42c7
--- /dev/null
+++ b/src/test/ui/cfg-in-crate-1.stderr
@@ -0,0 +1,7 @@
+error[E0601]: `main` function not found in crate `cfg_in_crate_1`
+ |
+ = note: consider adding a `main` function to `$DIR/cfg-in-crate-1.rs`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/cfg-non-opt-expr.rs b/src/test/ui/cfg-non-opt-expr.rs
similarity index 100%
rename from src/test/compile-fail/cfg-non-opt-expr.rs
rename to src/test/ui/cfg-non-opt-expr.rs
diff --git a/src/test/ui/cfg-non-opt-expr.stderr b/src/test/ui/cfg-non-opt-expr.stderr
new file mode 100644
index 0000000..0511c57
--- /dev/null
+++ b/src/test/ui/cfg-non-opt-expr.stderr
@@ -0,0 +1,26 @@
+error: removing an expression is not supported in this position
+ --> $DIR/cfg-non-opt-expr.rs:14:13
+ |
+LL | let _ = #[cfg(unset)] ();
+ | ^^^^^^^^^^^^^
+
+error: removing an expression is not supported in this position
+ --> $DIR/cfg-non-opt-expr.rs:16:21
+ |
+LL | let _ = 1 + 2 + #[cfg(unset)] 3;
+ | ^^^^^^^^^^^^^
+
+error: removing an expression is not supported in this position
+ --> $DIR/cfg-non-opt-expr.rs:18:23
+ |
+LL | let _ = [1, 2, 3][#[cfg(unset)] 1];
+ | ^^^^^^^^^^^^^
+
+error: removing an expression is not supported in this position
+ --> $DIR/cfg-non-opt-expr.rs:20:13
+ |
+LL | let _ = #[test] ();
+ | ^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/cfg_attr_path.rs b/src/test/ui/cfg_attr_path.rs
similarity index 100%
rename from src/test/compile-fail/cfg_attr_path.rs
rename to src/test/ui/cfg_attr_path.rs
diff --git a/src/test/ui/cfg_attr_path.stderr b/src/test/ui/cfg_attr_path.stderr
new file mode 100644
index 0000000..67e59d0
--- /dev/null
+++ b/src/test/ui/cfg_attr_path.stderr
@@ -0,0 +1,11 @@
+error: compilation successful
+ --> $DIR/cfg_attr_path.rs:21:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let _ = auxiliary::namespaced_enums::Foo::A;
+LL | | let _ = auxiliary::nonexistent_file::Foo::A;
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/check-static-immutable-mut-slices.rs b/src/test/ui/check-static-immutable-mut-slices.rs
similarity index 100%
rename from src/test/compile-fail/check-static-immutable-mut-slices.rs
rename to src/test/ui/check-static-immutable-mut-slices.rs
diff --git a/src/test/ui/check-static-immutable-mut-slices.stderr b/src/test/ui/check-static-immutable-mut-slices.stderr
new file mode 100644
index 0000000..b0a7cd1
--- /dev/null
+++ b/src/test/ui/check-static-immutable-mut-slices.stderr
@@ -0,0 +1,9 @@
+error[E0017]: references in statics may only refer to immutable values
+ --> $DIR/check-static-immutable-mut-slices.rs:13:37
+ |
+LL | static TEST: &'static mut [isize] = &mut [];
+ | ^^^^^^^ statics require immutable values
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0017`.
diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr
new file mode 100644
index 0000000..5522e22
--- /dev/null
+++ b/src/test/ui/check-static-values-constraints.nll.stderr
@@ -0,0 +1,70 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/check-static-values-constraints.rs:75:43
+ |
+LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor),
+ | ___________________________________________^
+LL | | //~^ ERROR destructors cannot be evaluated at compile-time
+LL | | field2: SafeEnum::Variant1}};
+ | |________________________________________________________________________________^ statics cannot evaluate destructors
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:89:33
+ |
+LL | static STATIC11: Box<MyOwned> = box MyOwned;
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/check-static-values-constraints.rs:99:32
+ |
+LL | field2: SafeEnum::Variant4("str".to_string())
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:104:5
+ |
+LL | box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:105:5
+ |
+LL | box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:109:6
+ |
+LL | &box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:110:6
+ |
+LL | &box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:116:5
+ |
+LL | box 3;
+ | ^^^^^ allocation not allowed in statics
+
+error[E0507]: cannot move out of static item
+ --> $DIR/check-static-values-constraints.rs:120:45
+ |
+LL | let y = { static x: Box<isize> = box 3; x };
+ | ^
+ | |
+ | cannot move out of static item
+ | help: consider borrowing here: `&x`
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:120:38
+ |
+LL | let y = { static x: Box<isize> = box 3; x };
+ | ^^^^^ allocation not allowed in statics
+
+error: aborting due to 10 previous errors
+
+Some errors occurred: E0010, E0015, E0493, E0507.
+For more information about an error, try `rustc --explain E0010`.
diff --git a/src/test/compile-fail/check-static-values-constraints.rs b/src/test/ui/check-static-values-constraints.rs
similarity index 100%
rename from src/test/compile-fail/check-static-values-constraints.rs
rename to src/test/ui/check-static-values-constraints.rs
diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr
new file mode 100644
index 0000000..ac979a3
--- /dev/null
+++ b/src/test/ui/check-static-values-constraints.stderr
@@ -0,0 +1,67 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/check-static-values-constraints.rs:75:43
+ |
+LL | ..SafeStruct{field1: SafeEnum::Variant3(WithDtor),
+ | ___________________________________________^
+LL | | //~^ ERROR destructors cannot be evaluated at compile-time
+LL | | field2: SafeEnum::Variant1}};
+ | |________________________________________________________________________________^ statics cannot evaluate destructors
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:89:33
+ |
+LL | static STATIC11: Box<MyOwned> = box MyOwned;
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/check-static-values-constraints.rs:99:32
+ |
+LL | field2: SafeEnum::Variant4("str".to_string())
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:104:5
+ |
+LL | box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:105:5
+ |
+LL | box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:109:6
+ |
+LL | &box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:110:6
+ |
+LL | &box MyOwned, //~ ERROR allocations are not allowed in statics
+ | ^^^^^^^^^^^ allocation not allowed in statics
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:116:5
+ |
+LL | box 3;
+ | ^^^^^ allocation not allowed in statics
+
+error[E0507]: cannot move out of static item
+ --> $DIR/check-static-values-constraints.rs:120:45
+ |
+LL | let y = { static x: Box<isize> = box 3; x };
+ | ^ cannot move out of static item
+
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/check-static-values-constraints.rs:120:38
+ |
+LL | let y = { static x: Box<isize> = box 3; x };
+ | ^^^^^ allocation not allowed in statics
+
+error: aborting due to 10 previous errors
+
+Some errors occurred: E0010, E0015, E0493, E0507.
+For more information about an error, try `rustc --explain E0010`.
diff --git a/src/test/compile-fail/class-cast-to-trait.rs b/src/test/ui/class-cast-to-trait.rs
similarity index 100%
rename from src/test/compile-fail/class-cast-to-trait.rs
rename to src/test/ui/class-cast-to-trait.rs
diff --git a/src/test/ui/class-cast-to-trait.stderr b/src/test/ui/class-cast-to-trait.stderr
new file mode 100644
index 0000000..c1e0880
--- /dev/null
+++ b/src/test/ui/class-cast-to-trait.stderr
@@ -0,0 +1,9 @@
+error[E0599]: no method named `eat` found for type `std::boxed::Box<dyn noisy>` in the current scope
+ --> $DIR/class-cast-to-trait.rs:63:8
+ |
+LL | nyan.eat(); //~ ERROR no method named `eat` found
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/class-method-missing.rs b/src/test/ui/class-method-missing.rs
similarity index 100%
rename from src/test/compile-fail/class-method-missing.rs
rename to src/test/ui/class-method-missing.rs
diff --git a/src/test/ui/class-method-missing.stderr b/src/test/ui/class-method-missing.stderr
new file mode 100644
index 0000000..c1da06e
--- /dev/null
+++ b/src/test/ui/class-method-missing.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `eat`
+ --> $DIR/class-method-missing.rs:19:1
+ |
+LL | fn eat(&self);
+ | -------------- `eat` from trait
+...
+LL | impl animal for cat {
+ | ^^^^^^^^^^^^^^^^^^^ missing `eat` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/src/test/compile-fail/class-missing-self.rs b/src/test/ui/class-missing-self.rs
similarity index 100%
rename from src/test/compile-fail/class-missing-self.rs
rename to src/test/ui/class-missing-self.rs
diff --git a/src/test/ui/class-missing-self.stderr b/src/test/ui/class-missing-self.stderr
new file mode 100644
index 0000000..33bf62e
--- /dev/null
+++ b/src/test/ui/class-missing-self.stderr
@@ -0,0 +1,19 @@
+error[E0425]: cannot find value `meows` in this scope
+ --> $DIR/class-missing-self.rs:19:7
+ |
+LL | meows += 1; //~ ERROR cannot find value `meows` in this scope
+ | ^^^^^ help: try: `self.meows`
+
+error[E0425]: cannot find function `sleep` in this scope
+ --> $DIR/class-missing-self.rs:20:7
+ |
+LL | sleep(); //~ ERROR cannot find function `sleep` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use std::thread::sleep;
+ |
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.rs b/src/test/ui/cleanup-rvalue-scopes-cf.rs
new file mode 100644
index 0000000..0f83bf8
--- /dev/null
+++ b/src/test/ui/cleanup-rvalue-scopes-cf.rs
@@ -0,0 +1,45 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-compare-mode-nll
+
+// Test that the borrow checker prevents pointers to temporaries
+// with statement lifetimes from escaping.
+
+use std::ops::Drop;
+
+static mut FLAGS: u64 = 0;
+
+struct Box<T> { f: T }
+struct AddFlags { bits: u64 }
+
+fn AddFlags(bits: u64) -> AddFlags {
+ AddFlags { bits: bits }
+}
+
+fn arg(x: &AddFlags) -> &AddFlags {
+ x
+}
+
+impl AddFlags {
+ fn get(&self) -> &AddFlags {
+ self
+ }
+}
+
+pub fn main() {
+ let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
+ let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
+ let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough
+}
diff --git a/src/test/ui/cleanup-rvalue-scopes-cf.stderr b/src/test/ui/cleanup-rvalue-scopes-cf.stderr
new file mode 100644
index 0000000..e1de4a2
--- /dev/null
+++ b/src/test/ui/cleanup-rvalue-scopes-cf.stderr
@@ -0,0 +1,93 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:38:19
+ |
+LL | let _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:39:14
+ |
+LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:40:21
+ |
+LL | let _x = &*arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:41:24
+ |
+LL | let ref _x = *arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:42:24
+ |
+LL | let &ref _x = arg(&AddFlags(1)); //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:43:14
+ |
+LL | let _x = AddFlags(1).get(); //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/cleanup-rvalue-scopes-cf.rs:44:34
+ |
+LL | let Box { f: _x } = Box { f: AddFlags(1).get() }; //~ ERROR value does not live long enough
+ | ^^^^^^^^^^^ - temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/closure-expected-type/README.md b/src/test/ui/closure-expected-type/README.md
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/README.md
rename to src/test/ui/closure-expected-type/README.md
diff --git a/src/test/compile-fail/closure-expected-type/expect-fn-supply-fn-multiple.rs b/src/test/ui/closure-expected-type/expect-fn-supply-fn-multiple.rs
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/expect-fn-supply-fn-multiple.rs
rename to src/test/ui/closure-expected-type/expect-fn-supply-fn-multiple.rs
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
new file mode 100644
index 0000000..fe85700
--- /dev/null
+++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.nll.stderr
@@ -0,0 +1,60 @@
+warning: not reporting region error due to nll
+ --> $DIR/expect-fn-supply-fn.rs:24:52
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^
+
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-fn-supply-fn.rs:40:5
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
+ | |
+ | expected signature of `for<'a, 'r> fn(fn(&'a u32), &'r i32) -> _`
+ |
+note: required by `with_closure_expecting_fn_with_free_region`
+ --> $DIR/expect-fn-supply-fn.rs:11:1
+ |
+LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
+LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32)
+LL | | {
+LL | | }
+ | |_^
+
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-fn-supply-fn.rs:47:5
+ |
+LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
+ | |
+ | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
+ |
+note: required by `with_closure_expecting_fn_with_bound_region`
+ --> $DIR/expect-fn-supply-fn.rs:16:1
+ |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | | where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+ | |_^
+
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-fn-supply-fn.rs:56:5
+ |
+LL | with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
+ | |
+ | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
+ |
+note: required by `with_closure_expecting_fn_with_bound_region`
+ --> $DIR/expect-fn-supply-fn.rs:16:1
+ |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | | where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/compile-fail/closure-expected-type/expect-fn-supply-fn.rs b/src/test/ui/closure-expected-type/expect-fn-supply-fn.rs
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/expect-fn-supply-fn.rs
rename to src/test/ui/closure-expected-type/expect-fn-supply-fn.rs
diff --git a/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
new file mode 100644
index 0000000..4dca592
--- /dev/null
+++ b/src/test/ui/closure-expected-type/expect-fn-supply-fn.stderr
@@ -0,0 +1,93 @@
+error[E0308]: mismatched types
+ --> $DIR/expect-fn-supply-fn.rs:24:52
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `fn(&u32)`
+ found type `fn(&'x u32)`
+note: the anonymous lifetime #2 defined on the body at 24:48...
+ --> $DIR/expect-fn-supply-fn.rs:24:48
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^
+note: ...does not necessarily outlive the lifetime 'x as defined on the function body at 21:36
+ --> $DIR/expect-fn-supply-fn.rs:21:36
+ |
+LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
+ | ^^
+
+error[E0308]: mismatched types
+ --> $DIR/expect-fn-supply-fn.rs:24:52
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `fn(&u32)`
+ found type `fn(&'x u32)`
+note: the lifetime 'x as defined on the function body at 21:36...
+ --> $DIR/expect-fn-supply-fn.rs:21:36
+ |
+LL | fn expect_free_supply_free_from_fn<'x>(x: &'x u32) {
+ | ^^
+note: ...does not necessarily outlive the anonymous lifetime #2 defined on the body at 24:48
+ --> $DIR/expect-fn-supply-fn.rs:24:48
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-fn-supply-fn.rs:40:5
+ |
+LL | with_closure_expecting_fn_with_free_region(|x: fn(&u32), y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `fn(for<'r> fn(&'r u32), _) -> _`
+ | |
+ | expected signature of `for<'a, 'r> fn(fn(&'a u32), &'r i32) -> _`
+ |
+note: required by `with_closure_expecting_fn_with_free_region`
+ --> $DIR/expect-fn-supply-fn.rs:11:1
+ |
+LL | / fn with_closure_expecting_fn_with_free_region<F>(_: F)
+LL | | where F: for<'a> FnOnce(fn(&'a u32), &i32)
+LL | | {
+LL | | }
+ | |_^
+
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-fn-supply-fn.rs:47:5
+ |
+LL | with_closure_expecting_fn_with_bound_region(|x: fn(&'x u32), y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------- found signature of `fn(fn(&'x u32), _) -> _`
+ | |
+ | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
+ |
+note: required by `with_closure_expecting_fn_with_bound_region`
+ --> $DIR/expect-fn-supply-fn.rs:16:1
+ |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | | where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+ | |_^
+
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-fn-supply-fn.rs:56:5
+ |
+LL | with_closure_expecting_fn_with_bound_region(|_x: Foo<'_>, y| {});
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ---------------- found signature of `for<'r> fn(fn(&'r u32), _) -> _`
+ | |
+ | expected signature of `for<'r> fn(for<'s> fn(&'s u32), &'r i32) -> _`
+ |
+note: required by `with_closure_expecting_fn_with_bound_region`
+ --> $DIR/expect-fn-supply-fn.rs:16:1
+ |
+LL | / fn with_closure_expecting_fn_with_bound_region<F>(_: F)
+LL | | where F: FnOnce(fn(&u32), &i32)
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0308, E0631.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/closure-expected-type/expect-infer-var-appearing-twice.rs b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/expect-infer-var-appearing-twice.rs
rename to src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.rs
diff --git a/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
new file mode 100644
index 0000000..51dcf5e
--- /dev/null
+++ b/src/test/ui/closure-expected-type/expect-infer-var-appearing-twice.stderr
@@ -0,0 +1,20 @@
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/expect-infer-var-appearing-twice.rs:24:5
+ |
+LL | with_closure(|x: u32, y: i32| {
+ | ^^^^^^^^^^^^ ---------------- found signature of `fn(u32, i32) -> _`
+ | |
+ | expected signature of `fn(_, _) -> _`
+ |
+note: required by `with_closure`
+ --> $DIR/expect-infer-var-appearing-twice.rs:11:1
+ |
+LL | / fn with_closure<F, A>(_: F)
+LL | | where F: FnOnce(A, A)
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0631`.
diff --git a/src/test/compile-fail/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs b/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs
rename to src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-bound-region.rs
diff --git a/src/test/compile-fail/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs b/src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs
rename to src/test/ui/closure-expected-type/expect-infer-var-supply-ty-with-free-region.rs
diff --git a/src/test/compile-fail/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs
similarity index 100%
rename from src/test/compile-fail/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs
rename to src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.rs
diff --git a/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr
new file mode 100644
index 0000000..273fb2a
--- /dev/null
+++ b/src/test/ui/closure-expected-type/expect-two-infer-vars-supply-ty-with-bound-region.stderr
@@ -0,0 +1,9 @@
+error[E0282]: type annotations needed
+ --> $DIR/expect-two-infer-vars-supply-ty-with-bound-region.rs:18:27
+ |
+LL | with_closure(|x: u32, y| {}); //~ ERROR E0282
+ | ^ consider giving this closure parameter a type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/closure_promotion.rs b/src/test/ui/closure_promotion.rs
new file mode 100644
index 0000000..8826661
--- /dev/null
+++ b/src/test/ui/closure_promotion.rs
@@ -0,0 +1,19 @@
+// 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.
+
+// ignore-compare-mode-nll
+
+#![allow(const_err)]
+
+// nll successfully compiles this. It is a bug.
+// See https://github.com/rust-lang/rust/issues/52384
+fn main() {
+ let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough
+}
diff --git a/src/test/ui/closure_promotion.stderr b/src/test/ui/closure_promotion.stderr
new file mode 100644
index 0000000..8f08796
--- /dev/null
+++ b/src/test/ui/closure_promotion.stderr
@@ -0,0 +1,13 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/closure_promotion.rs:18:26
+ |
+LL | let x: &'static _ = &|| { let z = 3; z }; //~ ERROR does not live long enough
+ | ^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/closure-array-break-length.rs b/src/test/ui/closures/closure-array-break-length.rs
similarity index 100%
rename from src/test/ui/closure-array-break-length.rs
rename to src/test/ui/closures/closure-array-break-length.rs
diff --git a/src/test/ui/closure-array-break-length.stderr b/src/test/ui/closures/closure-array-break-length.stderr
similarity index 100%
rename from src/test/ui/closure-array-break-length.stderr
rename to src/test/ui/closures/closure-array-break-length.stderr
diff --git a/src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs
similarity index 100%
rename from src/test/compile-fail/closure-bounds-cant-promote-superkind-in-struct.rs
rename to src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.rs
diff --git a/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr
new file mode 100644
index 0000000..e1b18b1
--- /dev/null
+++ b/src/test/ui/closures/closure-bounds-cant-promote-superkind-in-struct.stderr
@@ -0,0 +1,20 @@
+error[E0277]: `F` cannot be sent between threads safely
+ --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:15:1
+ |
+LL | / fn foo<F>(blk: F) -> X<F> where F: FnOnce() + 'static {
+LL | | //~^ ERROR `F` cannot be sent between threads safely
+LL | | return X { field: blk };
+LL | | }
+ | |_^ `F` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `F`
+ = help: consider adding a `where F: std::marker::Send` bound
+note: required by `X`
+ --> $DIR/closure-bounds-cant-promote-superkind-in-struct.rs:11:1
+ |
+LL | struct X<F> where F: FnOnce() + 'static + Send {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
new file mode 100644
index 0000000..ca82020
--- /dev/null
+++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
@@ -0,0 +1,39 @@
+warning: not reporting region error due to nll
+ --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:9
+ |
+LL | bar(|| {
+ | _________^
+LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
+LL | | let _ = x;
+LL | | })
+ | |_____^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:5
+ |
+LL | fn foo(x: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
+LL | / bar(|| {
+LL | | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
+LL | | let _ = x;
+LL | | })
+ | |______^ lifetime `'static` required
+
+error[E0597]: `x` does not live long enough
+ --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:17:17
+ |
+LL | bar(|| {
+ | -- value captured here
+LL | //~^ ERROR explicit lifetime required in the type of `x` [E0621]
+LL | let _ = x;
+ | ^ borrowed value does not live long enough
+LL | })
+LL | }
+ | - `x` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0597, E0621.
+For more information about an error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs
similarity index 100%
rename from src/test/compile-fail/closure-bounds-static-cant-capture-borrowed.rs
rename to src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr
new file mode 100644
index 0000000..825f469
--- /dev/null
+++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:15:5
+ |
+LL | fn foo(x: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `x`: `&'static ()`
+LL | bar(|| {
+ | ^^^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/closure-bounds-subtype.rs b/src/test/ui/closures/closure-bounds-subtype.rs
similarity index 100%
rename from src/test/compile-fail/closure-bounds-subtype.rs
rename to src/test/ui/closures/closure-bounds-subtype.rs
diff --git a/src/test/ui/closures/closure-bounds-subtype.stderr b/src/test/ui/closures/closure-bounds-subtype.stderr
new file mode 100644
index 0000000..ffe486d
--- /dev/null
+++ b/src/test/ui/closures/closure-bounds-subtype.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `F` cannot be shared between threads safely
+ --> $DIR/closure-bounds-subtype.rs:24:5
+ |
+LL | take_const_owned(f); //~ ERROR `F` cannot be shared between threads safely [E0277]
+ | ^^^^^^^^^^^^^^^^ `F` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `F`
+ = help: consider adding a `where F: std::marker::Sync` bound
+note: required by `take_const_owned`
+ --> $DIR/closure-bounds-subtype.rs:15:1
+ |
+LL | fn take_const_owned<F>(_: F) where F: FnOnce() + Sync + Send {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/closure-expected-type/expect-region-supply-region.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr
similarity index 100%
rename from src/test/ui/closure-expected-type/expect-region-supply-region.nll.stderr
rename to src/test/ui/closures/closure-expected-type/expect-region-supply-region.nll.stderr
diff --git a/src/test/ui/closure-expected-type/expect-region-supply-region.rs b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.rs
similarity index 100%
rename from src/test/ui/closure-expected-type/expect-region-supply-region.rs
rename to src/test/ui/closures/closure-expected-type/expect-region-supply-region.rs
diff --git a/src/test/ui/closure-expected-type/expect-region-supply-region.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr
similarity index 100%
rename from src/test/ui/closure-expected-type/expect-region-supply-region.stderr
rename to src/test/ui/closures/closure-expected-type/expect-region-supply-region.stderr
diff --git a/src/test/ui/closure-immutable-outer-variable.fixed b/src/test/ui/closures/closure-immutable-outer-variable.fixed
similarity index 100%
rename from src/test/ui/closure-immutable-outer-variable.fixed
rename to src/test/ui/closures/closure-immutable-outer-variable.fixed
diff --git a/src/test/ui/closure-immutable-outer-variable.nll.stderr b/src/test/ui/closures/closure-immutable-outer-variable.nll.stderr
similarity index 100%
rename from src/test/ui/closure-immutable-outer-variable.nll.stderr
rename to src/test/ui/closures/closure-immutable-outer-variable.nll.stderr
diff --git a/src/test/ui/closure-immutable-outer-variable.rs b/src/test/ui/closures/closure-immutable-outer-variable.rs
similarity index 100%
rename from src/test/ui/closure-immutable-outer-variable.rs
rename to src/test/ui/closures/closure-immutable-outer-variable.rs
diff --git a/src/test/ui/closure-immutable-outer-variable.rs.fixed b/src/test/ui/closures/closure-immutable-outer-variable.rs.fixed
similarity index 100%
rename from src/test/ui/closure-immutable-outer-variable.rs.fixed
rename to src/test/ui/closures/closure-immutable-outer-variable.rs.fixed
diff --git a/src/test/ui/closure-immutable-outer-variable.stderr b/src/test/ui/closures/closure-immutable-outer-variable.stderr
similarity index 100%
rename from src/test/ui/closure-immutable-outer-variable.stderr
rename to src/test/ui/closures/closure-immutable-outer-variable.stderr
diff --git a/src/test/ui/closure-move-sync.rs b/src/test/ui/closures/closure-move-sync.rs
similarity index 100%
rename from src/test/ui/closure-move-sync.rs
rename to src/test/ui/closures/closure-move-sync.rs
diff --git a/src/test/ui/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr
similarity index 100%
rename from src/test/ui/closure-move-sync.stderr
rename to src/test/ui/closures/closure-move-sync.stderr
diff --git a/src/test/compile-fail/closure-no-fn-1.rs b/src/test/ui/closures/closure-no-fn-1.rs
similarity index 100%
rename from src/test/compile-fail/closure-no-fn-1.rs
rename to src/test/ui/closures/closure-no-fn-1.rs
diff --git a/src/test/ui/closures/closure-no-fn-1.stderr b/src/test/ui/closures/closure-no-fn-1.stderr
new file mode 100644
index 0000000..4786a68
--- /dev/null
+++ b/src/test/ui/closures/closure-no-fn-1.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/closure-no-fn-1.rs:16:29
+ |
+LL | let foo: fn(u8) -> u8 = |v: u8| { a += v; a };
+ | ^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found closure
+ |
+ = note: expected type `fn(u8) -> u8`
+ found type `[closure@$DIR/closure-no-fn-1.rs:16:29: 16:50 a:_]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/closure-no-fn-2.rs b/src/test/ui/closures/closure-no-fn-2.rs
similarity index 100%
rename from src/test/compile-fail/closure-no-fn-2.rs
rename to src/test/ui/closures/closure-no-fn-2.rs
diff --git a/src/test/ui/closures/closure-no-fn-2.stderr b/src/test/ui/closures/closure-no-fn-2.stderr
new file mode 100644
index 0000000..1aad497
--- /dev/null
+++ b/src/test/ui/closures/closure-no-fn-2.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/closure-no-fn-2.rs:16:27
+ |
+LL | let bar: fn() -> u8 = || { b };
+ | ^^^^^^^^ expected fn pointer, found closure
+ |
+ = note: expected type `fn() -> u8`
+ found type `[closure@$DIR/closure-no-fn-2.rs:16:27: 16:35 b:_]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/closure-no-fn-3.rs b/src/test/ui/closures/closure-no-fn-3.rs
similarity index 100%
rename from src/test/compile-fail/closure-no-fn-3.rs
rename to src/test/ui/closures/closure-no-fn-3.rs
diff --git a/src/test/ui/closures/closure-no-fn-3.stderr b/src/test/ui/closures/closure-no-fn-3.stderr
new file mode 100644
index 0000000..bd28045
--- /dev/null
+++ b/src/test/ui/closures/closure-no-fn-3.stderr
@@ -0,0 +1,11 @@
+error[E0605]: non-primitive cast: `[closure@$DIR/closure-no-fn-3.rs:16:27: 16:37 b:_]` as `fn() -> u8`
+ --> $DIR/closure-no-fn-3.rs:16:27
+ |
+LL | let baz: fn() -> u8 = (|| { b }) as fn() -> u8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/closure-referencing-itself-issue-25954.rs b/src/test/ui/closures/closure-referencing-itself-issue-25954.rs
similarity index 100%
rename from src/test/compile-fail/closure-referencing-itself-issue-25954.rs
rename to src/test/ui/closures/closure-referencing-itself-issue-25954.rs
diff --git a/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr
new file mode 100644
index 0000000..fa00d9f
--- /dev/null
+++ b/src/test/ui/closures/closure-referencing-itself-issue-25954.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/closure-referencing-itself-issue-25954.rs:25:13
+ |
+LL | let q = || p.b.set(5i32); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^ cyclic type of infinite size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/closure-reform-bad.rs b/src/test/ui/closures/closure-reform-bad.rs
similarity index 100%
rename from src/test/compile-fail/closure-reform-bad.rs
rename to src/test/ui/closures/closure-reform-bad.rs
diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr
new file mode 100644
index 0000000..a4e1817
--- /dev/null
+++ b/src/test/ui/closures/closure-reform-bad.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/closure-reform-bad.rs:21:15
+ |
+LL | call_bare(f) //~ ERROR mismatched types
+ | ^ expected fn pointer, found closure
+ |
+ = note: expected type `for<'r> fn(&'r str)`
+ found type `[closure@$DIR/closure-reform-bad.rs:20:13: 20:50 string:_]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/closure-wrong-kind.rs b/src/test/ui/closures/closure-wrong-kind.rs
similarity index 100%
rename from src/test/compile-fail/closure-wrong-kind.rs
rename to src/test/ui/closures/closure-wrong-kind.rs
diff --git a/src/test/ui/closures/closure-wrong-kind.stderr b/src/test/ui/closures/closure-wrong-kind.stderr
new file mode 100644
index 0000000..636f307
--- /dev/null
+++ b/src/test/ui/closures/closure-wrong-kind.stderr
@@ -0,0 +1,14 @@
+error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
+ --> $DIR/closure-wrong-kind.rs:20:19
+ |
+LL | let closure = |_| foo(x); //~ ERROR E0525
+ | ^^^^^^^^-^
+ | | |
+ | | closure is `FnOnce` because it moves the variable `x` out of its environment
+ | this closure implements `FnOnce`, not `Fn`
+LL | bar(closure);
+ | --- the requirement to implement `Fn` derives from here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0525`.
diff --git a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr
index a1fbcf1..e334472 100644
--- a/src/test/ui/codemap_tests/overlapping_spans.nll.stderr
+++ b/src/test/ui/codemap_tests/overlapping_spans.nll.stderr
@@ -4,10 +4,13 @@
LL | match (S {f:"foo".to_string()}) {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
LL | S {f:_s} => {} //~ ERROR cannot move out
- | --
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref _s`
+ | -- data moved here
+ |
+note: move occurs because `_s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/overlapping_spans.rs:21:14
+ |
+LL | S {f:_s} => {} //~ ERROR cannot move out
+ | ^^
error: aborting due to previous error
diff --git a/src/test/compile-fail/coerce-expect-unsized-ascribed.rs b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs
similarity index 100%
rename from src/test/compile-fail/coerce-expect-unsized-ascribed.rs
rename to src/test/ui/coercion/coerce-expect-unsized-ascribed.rs
diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr
new file mode 100644
index 0000000..894fbbf
--- /dev/null
+++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr
@@ -0,0 +1,129 @@
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:19:13
+ |
+LL | let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `std::boxed::Box<[i32]>`
+ found type `std::boxed::Box<[i32; 3]>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:20:13
+ |
+LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `std::boxed::Box<[i32]>`
+ found type `std::boxed::Box<[i32; 3]>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:21:13
+ |
+LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `std::boxed::Box<[i32]>`
+ found type `std::boxed::Box<[i32; 3]>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:23:13
+ |
+LL | let _ = box { |x| (x as u8) }: Box<Fn(i32) -> _>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
+ |
+ = note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>`
+ found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:23:19: 23:32]>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:24:13
+ |
+LL | let _ = box if true { false } else { true }: Box<Debug>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
+ |
+ = note: expected type `std::boxed::Box<dyn std::fmt::Debug>`
+ found type `std::boxed::Box<bool>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:25:13
+ |
+LL | let _ = box match true { true => 'a', false => 'b' }: Box<Debug>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
+ |
+ = note: expected type `std::boxed::Box<dyn std::fmt::Debug>`
+ found type `std::boxed::Box<char>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:27:13
+ |
+LL | let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[i32]`
+ found type `&[i32; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:28:13
+ |
+LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[i32]`
+ found type `&[i32; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:29:13
+ |
+LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32];
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[i32]`
+ found type `&[i32; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:31:13
+ |
+LL | let _ = &{ |x| (x as u8) }: &Fn(i32) -> _; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
+ |
+ = note: expected type `&dyn std::ops::Fn(i32) -> u8`
+ found type `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:31:16: 31:29]`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:32:13
+ |
+LL | let _ = &if true { false } else { true }: &Debug; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found bool
+ |
+ = note: expected type `&dyn std::fmt::Debug`
+ found type `&bool`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:33:13
+ |
+LL | let _ = &match true { true => 'a', false => 'b' }: &Debug; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::fmt::Debug, found char
+ |
+ = note: expected type `&dyn std::fmt::Debug`
+ found type `&char`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:35:13
+ |
+LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `std::boxed::Box<[i32]>`
+ found type `std::boxed::Box<[i32; 3]>`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-expect-unsized-ascribed.rs:36:13
+ |
+LL | let _ = Box::new(|x| (x as u8)): Box<Fn(i32) -> _>; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait std::ops::Fn, found closure
+ |
+ = note: expected type `std::boxed::Box<dyn std::ops::Fn(i32) -> _>`
+ found type `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:36:22: 36:35]>`
+
+error: aborting due to 14 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/coerce-mut.rs b/src/test/ui/coercion/coerce-mut.rs
similarity index 100%
rename from src/test/compile-fail/coerce-mut.rs
rename to src/test/ui/coercion/coerce-mut.rs
diff --git a/src/test/ui/coercion/coerce-mut.stderr b/src/test/ui/coercion/coerce-mut.stderr
new file mode 100644
index 0000000..5e460b1
--- /dev/null
+++ b/src/test/ui/coercion/coerce-mut.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/coerce-mut.rs:15:7
+ |
+LL | f(&x);
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut i32`
+ found type `&{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr
new file mode 100644
index 0000000..29b6f05
--- /dev/null
+++ b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.nll.stderr
@@ -0,0 +1,47 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:22:24
+ |
+LL | let y = borrow_mut(x);
+ | - first mutable borrow occurs here
+LL | let z = borrow_mut(x);
+ | ^ second mutable borrow occurs here
+...
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**x` because it is borrowed
+ --> $DIR/coerce-overloaded-autoderef.rs:31:5
+ |
+LL | let y = borrow(x);
+ | - borrow of `**x` occurs here
+LL | let z = borrow(x);
+LL | **x += 1;
+ | ^^^^^^^^ assignment to borrowed `**x` occurs here
+...
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:38:20
+ |
+LL | borrow_mut2(x, x);
+ | ---------------^-
+ | | | |
+ | | | second mutable borrow occurs here
+ | | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+ --> $DIR/coerce-overloaded-autoderef.rs:44:5
+ |
+LL | borrow2(x, x);
+ | ^^^^^^^^^^^-^
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr
new file mode 100644
index 0000000..3bb5ec7
--- /dev/null
+++ b/src/test/ui/coercion/coerce-overloaded-autoderef.ast.stderr
@@ -0,0 +1,42 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:22:24
+ |
+LL | let y = borrow_mut(x);
+ | - first mutable borrow occurs here
+LL | let z = borrow_mut(x);
+ | ^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0506]: cannot assign to `**x` because it is borrowed
+ --> $DIR/coerce-overloaded-autoderef.rs:31:5
+ |
+LL | let y = borrow(x);
+ | - borrow of `**x` occurs here
+LL | let z = borrow(x);
+LL | **x += 1;
+ | ^^^^^^^^ assignment to borrowed `**x` occurs here
+
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:38:20
+ |
+LL | borrow_mut2(x, x);
+ | - ^- first borrow ends here
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+
+error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable
+ --> $DIR/coerce-overloaded-autoderef.rs:44:16
+ |
+LL | borrow2(x, x);
+ | - ^- mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr
new file mode 100644
index 0000000..29b6f05
--- /dev/null
+++ b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.nll.stderr
@@ -0,0 +1,47 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:22:24
+ |
+LL | let y = borrow_mut(x);
+ | - first mutable borrow occurs here
+LL | let z = borrow_mut(x);
+ | ^ second mutable borrow occurs here
+...
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**x` because it is borrowed
+ --> $DIR/coerce-overloaded-autoderef.rs:31:5
+ |
+LL | let y = borrow(x);
+ | - borrow of `**x` occurs here
+LL | let z = borrow(x);
+LL | **x += 1;
+ | ^^^^^^^^ assignment to borrowed `**x` occurs here
+...
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:38:20
+ |
+LL | borrow_mut2(x, x);
+ | ---------------^-
+ | | | |
+ | | | second mutable borrow occurs here
+ | | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `*x` as mutable because it is also borrowed as immutable
+ --> $DIR/coerce-overloaded-autoderef.rs:44:5
+ |
+LL | borrow2(x, x);
+ | ^^^^^^^^^^^-^
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr
new file mode 100644
index 0000000..fbc49a7
--- /dev/null
+++ b/src/test/ui/coercion/coerce-overloaded-autoderef.mir.stderr
@@ -0,0 +1,47 @@
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:22:24
+ |
+LL | let y = borrow_mut(x);
+ | - first mutable borrow occurs here
+LL | let z = borrow_mut(x);
+ | ^ second mutable borrow occurs here
+...
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0506]: cannot assign to `**x` because it is borrowed
+ --> $DIR/coerce-overloaded-autoderef.rs:31:5
+ |
+LL | let y = borrow(x);
+ | - borrow of `**x` occurs here
+LL | let z = borrow(x);
+LL | **x += 1;
+ | ^^^^^^^^ assignment to borrowed `**x` occurs here
+...
+LL | drop((y, z));
+ | - borrow later used here
+
+error[E0499]: cannot borrow `*x` as mutable more than once at a time
+ --> $DIR/coerce-overloaded-autoderef.rs:38:20
+ |
+LL | borrow_mut2(x, x);
+ | ---------------^-
+ | | | |
+ | | | second mutable borrow occurs here
+ | | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `*x` as immutable because it is also borrowed as mutable
+ --> $DIR/coerce-overloaded-autoderef.rs:44:16
+ |
+LL | borrow2(x, x);
+ | -----------^-
+ | | | |
+ | | | immutable borrow occurs here
+ | | mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0499, E0502, E0506.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/coerce-overloaded-autoderef.rs b/src/test/ui/coercion/coerce-overloaded-autoderef.rs
similarity index 100%
rename from src/test/compile-fail/coerce-overloaded-autoderef.rs
rename to src/test/ui/coercion/coerce-overloaded-autoderef.rs
diff --git a/src/test/compile-fail/coerce-to-bang-cast.rs b/src/test/ui/coercion/coerce-to-bang-cast.rs
similarity index 100%
rename from src/test/compile-fail/coerce-to-bang-cast.rs
rename to src/test/ui/coercion/coerce-to-bang-cast.rs
diff --git a/src/test/ui/coercion/coerce-to-bang-cast.stderr b/src/test/ui/coercion/coerce-to-bang-cast.stderr
new file mode 100644
index 0000000..fde9414
--- /dev/null
+++ b/src/test/ui/coercion/coerce-to-bang-cast.stderr
@@ -0,0 +1,19 @@
+error[E0605]: non-primitive cast: `i32` as `!`
+ --> $DIR/coerce-to-bang-cast.rs:16:13
+ |
+LL | let y = {return; 22} as !;
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error[E0605]: non-primitive cast: `i32` as `!`
+ --> $DIR/coerce-to-bang-cast.rs:21:13
+ |
+LL | let y = 22 as !; //~ ERROR non-primitive cast
+ | ^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/coerce-to-bang.rs b/src/test/ui/coercion/coerce-to-bang.rs
similarity index 100%
rename from src/test/compile-fail/coerce-to-bang.rs
rename to src/test/ui/coercion/coerce-to-bang.rs
diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr
new file mode 100644
index 0000000..bf490cd
--- /dev/null
+++ b/src/test/ui/coercion/coerce-to-bang.stderr
@@ -0,0 +1,93 @@
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:16:17
+ |
+LL | foo(return, 22, 44);
+ | ^^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:28:13
+ |
+LL | foo(22, 44, return); //~ ERROR mismatched types
+ | ^^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:36:12
+ |
+LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge.
+ | ^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:46:12
+ |
+LL | foo(a, b, c); //~ ERROR mismatched types
+ | ^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:55:12
+ |
+LL | foo(a, b, c); //~ ERROR mismatched types
+ | ^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:60:21
+ |
+LL | let x: [!; 2] = [return, 22]; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^ expected !, found integral variable
+ |
+ = note: expected type `[!; 2]`
+ found type `[{integer}; 2]`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:65:22
+ |
+LL | let x: [!; 2] = [22, return]; //~ ERROR mismatched types
+ | ^^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:70:37
+ |
+LL | let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types
+ | ^^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:75:41
+ |
+LL | let x: (usize, !, usize) = (return, 44, 66);
+ | ^^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/coerce-to-bang.rs:86:37
+ |
+LL | let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types
+ | ^^ expected !, found integral variable
+ |
+ = note: expected type `!`
+ found type `{integer}`
+
+error: aborting due to 10 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/coercion-missing-tail-expected-type.rs b/src/test/ui/coercion/coercion-missing-tail-expected-type.rs
similarity index 100%
rename from src/test/ui/coercion-missing-tail-expected-type.rs
rename to src/test/ui/coercion/coercion-missing-tail-expected-type.rs
diff --git a/src/test/ui/coercion-missing-tail-expected-type.stderr b/src/test/ui/coercion/coercion-missing-tail-expected-type.stderr
similarity index 100%
rename from src/test/ui/coercion-missing-tail-expected-type.stderr
rename to src/test/ui/coercion/coercion-missing-tail-expected-type.stderr
diff --git a/src/test/compile-fail/coercion-slice.rs b/src/test/ui/coercion/coercion-slice.rs
similarity index 100%
rename from src/test/compile-fail/coercion-slice.rs
rename to src/test/ui/coercion/coercion-slice.rs
diff --git a/src/test/ui/coercion/coercion-slice.stderr b/src/test/ui/coercion/coercion-slice.stderr
new file mode 100644
index 0000000..47a77d4
--- /dev/null
+++ b/src/test/ui/coercion/coercion-slice.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/coercion-slice.rs:14:21
+ |
+LL | let _: &[i32] = [0];
+ | ^^^
+ | |
+ | expected &[i32], found array of 1 elements
+ | help: consider borrowing here: `&[0]`
+ |
+ = note: expected type `&[i32]`
+ found type `[{integer}; 1]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/auxiliary/coherence_copy_like_lib.rs b/src/test/ui/coherence/auxiliary/coherence_copy_like_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/coherence_copy_like_lib.rs
rename to src/test/ui/coherence/auxiliary/coherence_copy_like_lib.rs
diff --git a/src/test/compile-fail/auxiliary/coherence_inherent_cc_lib.rs b/src/test/ui/coherence/auxiliary/coherence_inherent_cc_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/coherence_inherent_cc_lib.rs
rename to src/test/ui/coherence/auxiliary/coherence_inherent_cc_lib.rs
diff --git a/src/test/ui/auxiliary/coherence_lib.rs b/src/test/ui/coherence/auxiliary/coherence_lib.rs
similarity index 100%
rename from src/test/ui/auxiliary/coherence_lib.rs
rename to src/test/ui/coherence/auxiliary/coherence_lib.rs
diff --git a/src/test/compile-fail/auxiliary/coherence_orphan_lib.rs b/src/test/ui/coherence/auxiliary/coherence_orphan_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/coherence_orphan_lib.rs
rename to src/test/ui/coherence/auxiliary/coherence_orphan_lib.rs
diff --git a/src/test/compile-fail/auxiliary/go_trait.rs b/src/test/ui/coherence/auxiliary/go_trait.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/go_trait.rs
rename to src/test/ui/coherence/auxiliary/go_trait.rs
diff --git a/src/test/compile-fail/auxiliary/trait_impl_conflict.rs b/src/test/ui/coherence/auxiliary/trait_impl_conflict.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/trait_impl_conflict.rs
rename to src/test/ui/coherence/auxiliary/trait_impl_conflict.rs
diff --git a/src/test/compile-fail/coherence-all-remote.rs b/src/test/ui/coherence/coherence-all-remote.rs
similarity index 100%
rename from src/test/compile-fail/coherence-all-remote.rs
rename to src/test/ui/coherence/coherence-all-remote.rs
diff --git a/src/test/ui/coherence/coherence-all-remote.stderr b/src/test/ui/coherence/coherence-all-remote.stderr
new file mode 100644
index 0000000..1f71969
--- /dev/null
+++ b/src/test/ui/coherence/coherence-all-remote.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-all-remote.rs:16:1
+ |
+LL | impl<T> Remote1<T> for isize { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-bigint-param.rs b/src/test/ui/coherence/coherence-bigint-param.rs
similarity index 100%
rename from src/test/compile-fail/coherence-bigint-param.rs
rename to src/test/ui/coherence/coherence-bigint-param.rs
diff --git a/src/test/ui/coherence/coherence-bigint-param.stderr b/src/test/ui/coherence/coherence-bigint-param.stderr
new file mode 100644
index 0000000..7d2796e
--- /dev/null
+++ b/src/test/ui/coherence/coherence-bigint-param.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-bigint-param.rs:18:1
+ |
+LL | impl<T> Remote1<BigInt> for T { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs
similarity index 100%
rename from src/test/compile-fail/coherence-blanket-conflicts-with-blanket-implemented.rs
rename to src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.rs
diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr
new file mode 100644
index 0000000..7dbcda0
--- /dev/null
+++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-implemented.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `MyTrait`:
+ --> $DIR/coherence-blanket-conflicts-with-blanket-implemented.rs:34:1
+ |
+LL | impl<T:Even> MyTrait for T {
+ | -------------------------- first implementation here
+...
+LL | impl<T:Odd> MyTrait for T { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs
similarity index 100%
rename from src/test/compile-fail/coherence-blanket-conflicts-with-blanket-unimplemented.rs
rename to src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.rs
diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr
new file mode 100644
index 0000000..faabfb6
--- /dev/null
+++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-blanket-unimplemented.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `MyTrait`:
+ --> $DIR/coherence-blanket-conflicts-with-blanket-unimplemented.rs:30:1
+ |
+LL | impl<T:Even> MyTrait for T {
+ | -------------------------- first implementation here
+...
+LL | impl<T:Odd> MyTrait for T { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-cross-crate.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs
similarity index 100%
rename from src/test/compile-fail/coherence-blanket-conflicts-with-specific-cross-crate.rs
rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.rs
diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr
new file mode 100644
index 0000000..38aff37
--- /dev/null
+++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-cross-crate.stderr
@@ -0,0 +1,13 @@
+error[E0119]: conflicting implementations of trait `go_trait::GoMut` for type `MyThingy`:
+ --> $DIR/coherence-blanket-conflicts-with-specific-cross-crate.rs:25:1
+ |
+LL | impl GoMut for MyThingy { //~ ERROR conflicting implementations
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: conflicting implementation in crate `go_trait`:
+ - impl<G> go_trait::GoMut for G
+ where G: go_trait::Go;
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs
similarity index 100%
rename from src/test/compile-fail/coherence-blanket-conflicts-with-specific-multidispatch.rs
rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.rs
diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr
new file mode 100644
index 0000000..a599240
--- /dev/null
+++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-multidispatch.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `MyTrait<MyType>` for type `MyType`:
+ --> $DIR/coherence-blanket-conflicts-with-specific-multidispatch.rs:32:1
+ |
+LL | impl<T> MyTrait<T> for T {
+ | ------------------------ first implementation here
+...
+LL | impl MyTrait<MyType> for MyType { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific-trait.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs
similarity index 100%
rename from src/test/compile-fail/coherence-blanket-conflicts-with-specific-trait.rs
rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.rs
diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr
new file mode 100644
index 0000000..9a6e007
--- /dev/null
+++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific-trait.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`:
+ --> $DIR/coherence-blanket-conflicts-with-specific-trait.rs:30:1
+ |
+LL | impl<T:OtherTrait> MyTrait for T {
+ | -------------------------------- first implementation here
+...
+LL | impl MyTrait for MyType { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-blanket-conflicts-with-specific.rs b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs
similarity index 100%
rename from src/test/compile-fail/coherence-blanket-conflicts-with-specific.rs
rename to src/test/ui/coherence/coherence-blanket-conflicts-with-specific.rs
diff --git a/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr
new file mode 100644
index 0000000..955cd3b
--- /dev/null
+++ b/src/test/ui/coherence/coherence-blanket-conflicts-with-specific.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `MyType`:
+ --> $DIR/coherence-blanket-conflicts-with-specific.rs:29:1
+ |
+LL | impl<T> MyTrait for T {
+ | --------------------- first implementation here
+...
+LL | impl MyTrait for MyType { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `MyType`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/coherence-conflicting-negative-trait-impl.rs
rename to src/test/ui/coherence/coherence-conflicting-negative-trait-impl.rs
diff --git a/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr
new file mode 100644
index 0000000..a2a869d
--- /dev/null
+++ b/src/test/ui/coherence/coherence-conflicting-negative-trait-impl.stderr
@@ -0,0 +1,21 @@
+error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`:
+ --> $DIR/coherence-conflicting-negative-trait-impl.rs:20:1
+ |
+LL | unsafe impl<T: MyTrait+'static> Send for TestType<T> {}
+ | ---------------------------------------------------- first implementation here
+LL |
+LL | impl<T: MyTrait> !Send for TestType<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
+
+error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<i32>`:
+ --> $DIR/coherence-conflicting-negative-trait-impl.rs:25:1
+ |
+LL | unsafe impl<T:'static> Send for TestType<T> {}
+ | ------------------------------------------- first implementation here
+LL |
+LL | impl !Send for TestType<i32> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<i32>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/coherence/coherence-cow.a.stderr b/src/test/ui/coherence/coherence-cow.a.stderr
new file mode 100644
index 0000000..f053333
--- /dev/null
+++ b/src/test/ui/coherence/coherence-cow.a.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-cow.rs:26:1
+ |
+LL | impl<T> Remote for Pair<T,Cover<T>> { } //[a]~ ERROR E0210
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/coherence-cow.b.stderr b/src/test/ui/coherence/coherence-cow.b.stderr
new file mode 100644
index 0000000..269bcd5
--- /dev/null
+++ b/src/test/ui/coherence/coherence-cow.b.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-cow.rs:29:1
+ |
+LL | impl<T> Remote for Pair<Cover<T>,T> { } //[b]~ ERROR E0210
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/coherence-cow.c.stderr b/src/test/ui/coherence/coherence-cow.c.stderr
new file mode 100644
index 0000000..e89308d
--- /dev/null
+++ b/src/test/ui/coherence/coherence-cow.c.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-cow.rs:32:1
+ |
+LL | impl<T,U> Remote for Pair<Cover<T>,U> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-cow.rs b/src/test/ui/coherence/coherence-cow.rs
similarity index 100%
rename from src/test/compile-fail/coherence-cow.rs
rename to src/test/ui/coherence/coherence-cow.rs
diff --git a/src/test/compile-fail/coherence-cross-crate-conflict.rs b/src/test/ui/coherence/coherence-cross-crate-conflict.rs
similarity index 100%
rename from src/test/compile-fail/coherence-cross-crate-conflict.rs
rename to src/test/ui/coherence/coherence-cross-crate-conflict.rs
diff --git a/src/test/ui/coherence/coherence-cross-crate-conflict.stderr b/src/test/ui/coherence/coherence-cross-crate-conflict.stderr
new file mode 100644
index 0000000..ee11967
--- /dev/null
+++ b/src/test/ui/coherence/coherence-cross-crate-conflict.stderr
@@ -0,0 +1,21 @@
+error[E0119]: conflicting implementations of trait `trait_impl_conflict::Foo` for type `isize`:
+ --> $DIR/coherence-cross-crate-conflict.rs:18:1
+ |
+LL | impl<A> Foo for A {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: conflicting implementation in crate `trait_impl_conflict`:
+ - impl trait_impl_conflict::Foo for isize;
+
+error[E0210]: type parameter `A` must be used as the type parameter for some local type (e.g. `MyStruct<A>`)
+ --> $DIR/coherence-cross-crate-conflict.rs:18:1
+ |
+LL | impl<A> Foo for A {
+ | ^^^^^^^^^^^^^^^^^ type parameter `A` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0119, E0210.
+For more information about an error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-default-trait-impl.rs b/src/test/ui/coherence/coherence-default-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/coherence-default-trait-impl.rs
rename to src/test/ui/coherence/coherence-default-trait-impl.rs
diff --git a/src/test/ui/coherence/coherence-default-trait-impl.stderr b/src/test/ui/coherence/coherence-default-trait-impl.stderr
new file mode 100644
index 0000000..b7d9364
--- /dev/null
+++ b/src/test/ui/coherence/coherence-default-trait-impl.stderr
@@ -0,0 +1,16 @@
+error[E0199]: implementing the trait `MySafeTrait` is not unsafe
+ --> $DIR/coherence-default-trait-impl.rs:17:1
+ |
+LL | unsafe impl MySafeTrait for Foo {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0200]: the trait `MyUnsafeTrait` requires an `unsafe impl` declaration
+ --> $DIR/coherence-default-trait-impl.rs:22:1
+ |
+LL | impl MyUnsafeTrait for Foo {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0199, E0200.
+For more information about an error, try `rustc --explain E0199`.
diff --git a/src/test/ui/coherence-error-suppression.rs b/src/test/ui/coherence/coherence-error-suppression.rs
similarity index 100%
rename from src/test/ui/coherence-error-suppression.rs
rename to src/test/ui/coherence/coherence-error-suppression.rs
diff --git a/src/test/ui/coherence-error-suppression.stderr b/src/test/ui/coherence/coherence-error-suppression.stderr
similarity index 100%
rename from src/test/ui/coherence-error-suppression.stderr
rename to src/test/ui/coherence/coherence-error-suppression.stderr
diff --git a/src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
similarity index 100%
rename from src/test/compile-fail/coherence-impl-trait-for-trait-object-safe.rs
rename to src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.rs
diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
new file mode 100644
index 0000000..5d62a86
--- /dev/null
+++ b/src/test/ui/coherence/coherence-impl-trait-for-trait-object-safe.stderr
@@ -0,0 +1,11 @@
+error[E0038]: the trait `NotObjectSafe` cannot be made into an object
+ --> $DIR/coherence-impl-trait-for-trait-object-safe.rs:17:6
+ |
+LL | impl NotObjectSafe for NotObjectSafe { } //~ ERROR E0038
+ | ^^^^^^^^^^^^^ the trait `NotObjectSafe` cannot be made into an object
+ |
+ = note: method `eq` references the `Self` type in its arguments or return type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/coherence-impl-trait-for-trait.rs b/src/test/ui/coherence/coherence-impl-trait-for-trait.rs
similarity index 100%
rename from src/test/compile-fail/coherence-impl-trait-for-trait.rs
rename to src/test/ui/coherence/coherence-impl-trait-for-trait.rs
diff --git a/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr b/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr
new file mode 100644
index 0000000..26e702d
--- /dev/null
+++ b/src/test/ui/coherence/coherence-impl-trait-for-trait.stderr
@@ -0,0 +1,21 @@
+error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Foo`
+ --> $DIR/coherence-impl-trait-for-trait.rs:19:1
+ |
+LL | impl Foo for Baz { } //~ ERROR E0371
+ | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Foo`
+
+error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Bar`
+ --> $DIR/coherence-impl-trait-for-trait.rs:20:1
+ |
+LL | impl Bar for Baz { } //~ ERROR E0371
+ | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Bar`
+
+error[E0371]: the object type `(dyn Baz + 'static)` automatically implements the trait `Baz`
+ --> $DIR/coherence-impl-trait-for-trait.rs:21:1
+ |
+LL | impl Baz for Baz { } //~ ERROR E0371
+ | ^^^^^^^^^^^^^^^^ `(dyn Baz + 'static)` automatically implements trait `Baz`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0371`.
diff --git a/src/test/ui/coherence-impls-copy.rs b/src/test/ui/coherence/coherence-impls-copy.rs
similarity index 100%
rename from src/test/ui/coherence-impls-copy.rs
rename to src/test/ui/coherence/coherence-impls-copy.rs
diff --git a/src/test/ui/coherence-impls-copy.stderr b/src/test/ui/coherence/coherence-impls-copy.stderr
similarity index 100%
rename from src/test/ui/coherence-impls-copy.stderr
rename to src/test/ui/coherence/coherence-impls-copy.stderr
diff --git a/src/test/compile-fail/coherence-impls-send.rs b/src/test/ui/coherence/coherence-impls-send.rs
similarity index 100%
rename from src/test/compile-fail/coherence-impls-send.rs
rename to src/test/ui/coherence/coherence-impls-send.rs
diff --git a/src/test/ui/coherence/coherence-impls-send.stderr b/src/test/ui/coherence/coherence-impls-send.stderr
new file mode 100644
index 0000000..4e7e228
--- /dev/null
+++ b/src/test/ui/coherence/coherence-impls-send.stderr
@@ -0,0 +1,37 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-impls-send.rs:27:1
+ |
+LL | unsafe impl Send for (MyType, MyType) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0321]: cross-crate traits with a default impl, like `std::marker::Send`, can only be implemented for a struct/enum type, not `&'static NotSync`
+ --> $DIR/coherence-impls-send.rs:30:1
+ |
+LL | unsafe impl Send for &'static NotSync {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait with a default impl for non-struct/enum type
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-impls-send.rs:33:1
+ |
+LL | unsafe impl Send for [MyType] {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-impls-send.rs:36:1
+ |
+LL | unsafe impl Send for &'static [NotSync] {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0117, E0321.
+For more information about an error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/coherence-impls-sized.rs b/src/test/ui/coherence/coherence-impls-sized.rs
similarity index 100%
rename from src/test/compile-fail/coherence-impls-sized.rs
rename to src/test/ui/coherence/coherence-impls-sized.rs
diff --git a/src/test/ui/coherence/coherence-impls-sized.stderr b/src/test/ui/coherence/coherence-impls-sized.stderr
new file mode 100644
index 0000000..683fb0a
--- /dev/null
+++ b/src/test/ui/coherence/coherence-impls-sized.stderr
@@ -0,0 +1,67 @@
+error[E0322]: explicit impls for the `Sized` trait are not permitted
+ --> $DIR/coherence-impls-sized.rs:24:1
+ |
+LL | impl Sized for TestE {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
+
+error[E0322]: explicit impls for the `Sized` trait are not permitted
+ --> $DIR/coherence-impls-sized.rs:27:1
+ |
+LL | impl Sized for MyType {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
+
+error[E0322]: explicit impls for the `Sized` trait are not permitted
+ --> $DIR/coherence-impls-sized.rs:30:1
+ |
+LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
+
+error[E0322]: explicit impls for the `Sized` trait are not permitted
+ --> $DIR/coherence-impls-sized.rs:34:1
+ |
+LL | impl Sized for &'static NotSync {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
+
+error[E0322]: explicit impls for the `Sized` trait are not permitted
+ --> $DIR/coherence-impls-sized.rs:37:1
+ |
+LL | impl Sized for [MyType] {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
+
+error[E0322]: explicit impls for the `Sized` trait are not permitted
+ --> $DIR/coherence-impls-sized.rs:41:1
+ |
+LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl of 'Sized' not allowed
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-impls-sized.rs:30:1
+ |
+LL | impl Sized for (MyType, MyType) {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-impls-sized.rs:37:1
+ |
+LL | impl Sized for [MyType] {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-impls-sized.rs:41:1
+ |
+LL | impl Sized for &'static [NotSync] {} //~ ERROR E0322
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0117, E0322.
+For more information about an error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/coherence-inherited-assoc-ty-cycle-err.rs b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs
similarity index 100%
rename from src/test/compile-fail/coherence-inherited-assoc-ty-cycle-err.rs
rename to src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.rs
diff --git a/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr
new file mode 100644
index 0000000..5dba448
--- /dev/null
+++ b/src/test/ui/coherence/coherence-inherited-assoc-ty-cycle-err.stderr
@@ -0,0 +1,16 @@
+error[E0391]: cycle detected when processing `Trait`
+ --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:19:1
+ |
+LL | trait Trait<T> { type Assoc; }
+ | ^^^^^^^^^^^^^^
+ |
+ = note: ...which again requires processing `Trait`, completing the cycle
+note: cycle used when coherence checking all impls of trait `Trait`
+ --> $DIR/coherence-inherited-assoc-ty-cycle-err.rs:19:1
+ |
+LL | trait Trait<T> { type Assoc; }
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/coherence-lone-type-parameter.rs b/src/test/ui/coherence/coherence-lone-type-parameter.rs
similarity index 100%
rename from src/test/compile-fail/coherence-lone-type-parameter.rs
rename to src/test/ui/coherence/coherence-lone-type-parameter.rs
diff --git a/src/test/ui/coherence/coherence-lone-type-parameter.stderr b/src/test/ui/coherence/coherence-lone-type-parameter.stderr
new file mode 100644
index 0000000..6389bc0
--- /dev/null
+++ b/src/test/ui/coherence/coherence-lone-type-parameter.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-lone-type-parameter.rs:16:1
+ |
+LL | impl<T> Remote for T { }
+ | ^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-negative-impls-safe.rs b/src/test/ui/coherence/coherence-negative-impls-safe.rs
similarity index 100%
rename from src/test/compile-fail/coherence-negative-impls-safe.rs
rename to src/test/ui/coherence/coherence-negative-impls-safe.rs
diff --git a/src/test/ui/coherence/coherence-negative-impls-safe.stderr b/src/test/ui/coherence/coherence-negative-impls-safe.stderr
new file mode 100644
index 0000000..7373f79
--- /dev/null
+++ b/src/test/ui/coherence/coherence-negative-impls-safe.stderr
@@ -0,0 +1,9 @@
+error[E0198]: negative impls cannot be unsafe
+ --> $DIR/coherence-negative-impls-safe.rs:17:1
+ |
+LL | unsafe impl !Send for TestType {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0198`.
diff --git a/src/test/compile-fail/coherence-no-direct-lifetime-dispatch.rs b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs
similarity index 100%
rename from src/test/compile-fail/coherence-no-direct-lifetime-dispatch.rs
rename to src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.rs
diff --git a/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr
new file mode 100644
index 0000000..669c5e3
--- /dev/null
+++ b/src/test/ui/coherence/coherence-no-direct-lifetime-dispatch.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `MyTrait`:
+ --> $DIR/coherence-no-direct-lifetime-dispatch.rs:16:1
+ |
+LL | impl<T> MyTrait for T {}
+ | --------------------- first implementation here
+LL | impl<T: 'static> MyTrait for T {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-orphan.rs b/src/test/ui/coherence/coherence-orphan.rs
similarity index 100%
rename from src/test/compile-fail/coherence-orphan.rs
rename to src/test/ui/coherence/coherence-orphan.rs
diff --git a/src/test/ui/coherence/coherence-orphan.stderr b/src/test/ui/coherence/coherence-orphan.stderr
new file mode 100644
index 0000000..ee86353
--- /dev/null
+++ b/src/test/ui/coherence/coherence-orphan.stderr
@@ -0,0 +1,21 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-orphan.rs:21:1
+ |
+LL | impl TheTrait<usize> for isize { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-orphan.rs:28:1
+ |
+LL | impl !Send for Vec<isize> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/coherence-overlap-all-t-and-tuple.rs b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs
similarity index 100%
rename from src/test/compile-fail/coherence-overlap-all-t-and-tuple.rs
rename to src/test/ui/coherence/coherence-overlap-all-t-and-tuple.rs
diff --git a/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr
new file mode 100644
index 0000000..993de78
--- /dev/null
+++ b/src/test/ui/coherence/coherence-overlap-all-t-and-tuple.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `From<(_,)>` for type `(_,)`:
+ --> $DIR/coherence-overlap-all-t-and-tuple.rs:26:1
+ |
+LL | impl <T> From<T> for T {
+ | ---------------------- first implementation here
+...
+LL | impl <T11, U11> From<(U11,)> for (T11,) { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_,)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/coherence-overlap-downstream-inherent.rs b/src/test/ui/coherence/coherence-overlap-downstream-inherent.rs
similarity index 100%
rename from src/test/ui/coherence-overlap-downstream-inherent.rs
rename to src/test/ui/coherence/coherence-overlap-downstream-inherent.rs
diff --git a/src/test/ui/coherence-overlap-downstream-inherent.stderr b/src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr
similarity index 100%
rename from src/test/ui/coherence-overlap-downstream-inherent.stderr
rename to src/test/ui/coherence/coherence-overlap-downstream-inherent.stderr
diff --git a/src/test/ui/coherence-overlap-downstream.rs b/src/test/ui/coherence/coherence-overlap-downstream.rs
similarity index 100%
rename from src/test/ui/coherence-overlap-downstream.rs
rename to src/test/ui/coherence/coherence-overlap-downstream.rs
diff --git a/src/test/ui/coherence-overlap-downstream.stderr b/src/test/ui/coherence/coherence-overlap-downstream.stderr
similarity index 100%
rename from src/test/ui/coherence-overlap-downstream.stderr
rename to src/test/ui/coherence/coherence-overlap-downstream.stderr
diff --git a/src/test/ui/coherence-overlap-issue-23516-inherent.rs b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs
similarity index 100%
rename from src/test/ui/coherence-overlap-issue-23516-inherent.rs
rename to src/test/ui/coherence/coherence-overlap-issue-23516-inherent.rs
diff --git a/src/test/ui/coherence-overlap-issue-23516-inherent.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr
similarity index 100%
rename from src/test/ui/coherence-overlap-issue-23516-inherent.stderr
rename to src/test/ui/coherence/coherence-overlap-issue-23516-inherent.stderr
diff --git a/src/test/ui/coherence-overlap-issue-23516.rs b/src/test/ui/coherence/coherence-overlap-issue-23516.rs
similarity index 100%
rename from src/test/ui/coherence-overlap-issue-23516.rs
rename to src/test/ui/coherence/coherence-overlap-issue-23516.rs
diff --git a/src/test/ui/coherence-overlap-issue-23516.stderr b/src/test/ui/coherence/coherence-overlap-issue-23516.stderr
similarity index 100%
rename from src/test/ui/coherence-overlap-issue-23516.stderr
rename to src/test/ui/coherence/coherence-overlap-issue-23516.stderr
diff --git a/src/test/compile-fail/coherence-overlap-messages.rs b/src/test/ui/coherence/coherence-overlap-messages.rs
similarity index 100%
rename from src/test/compile-fail/coherence-overlap-messages.rs
rename to src/test/ui/coherence/coherence-overlap-messages.rs
diff --git a/src/test/ui/coherence/coherence-overlap-messages.stderr b/src/test/ui/coherence/coherence-overlap-messages.stderr
new file mode 100644
index 0000000..60023c6
--- /dev/null
+++ b/src/test/ui/coherence/coherence-overlap-messages.stderr
@@ -0,0 +1,44 @@
+error[E0119]: conflicting implementations of trait `Foo`:
+ --> $DIR/coherence-overlap-messages.rs:14:1
+ |
+LL | impl<T> Foo for T {}
+ | ----------------- first implementation here
+LL | impl<U> Foo for U {} //~ ERROR conflicting implementations of trait `Foo`:
+ | ^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`:
+ --> $DIR/coherence-overlap-messages.rs:19:1
+ |
+LL | impl<T> Bar for (T, u8) {}
+ | ----------------------- first implementation here
+LL | impl<T> Bar for (u8, T) {} //~ ERROR conflicting implementations of trait `Bar` for type `(u8, u8)`:
+ | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)`
+
+error[E0119]: conflicting implementations of trait `Baz<u8>` for type `u8`:
+ --> $DIR/coherence-overlap-messages.rs:24:1
+ |
+LL | impl<T> Baz<u8> for T {}
+ | --------------------- first implementation here
+LL | impl<T> Baz<T> for u8 {} //~ ERROR conflicting implementations of trait `Baz<u8>` for type `u8`:
+ | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8`
+
+error[E0119]: conflicting implementations of trait `Quux<_, _>`:
+ --> $DIR/coherence-overlap-messages.rs:29:1
+ |
+LL | impl<T, U, V> Quux<U, V> for T {}
+ | ------------------------------ first implementation here
+LL | impl<T, U> Quux<U, U> for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`:
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error[E0119]: conflicting implementations of trait `Quux<_, _>`:
+ --> $DIR/coherence-overlap-messages.rs:30:1
+ |
+LL | impl<T, U, V> Quux<U, V> for T {}
+ | ------------------------------ first implementation here
+LL | impl<T, U> Quux<U, U> for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`:
+LL | impl<T, V> Quux<T, V> for T {} //~ ERROR conflicting implementations of trait `Quux<_, _>`:
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/ui/coherence-overlap-upstream-inherent.rs b/src/test/ui/coherence/coherence-overlap-upstream-inherent.rs
similarity index 100%
rename from src/test/ui/coherence-overlap-upstream-inherent.rs
rename to src/test/ui/coherence/coherence-overlap-upstream-inherent.rs
diff --git a/src/test/ui/coherence-overlap-upstream-inherent.stderr b/src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr
similarity index 100%
rename from src/test/ui/coherence-overlap-upstream-inherent.stderr
rename to src/test/ui/coherence/coherence-overlap-upstream-inherent.stderr
diff --git a/src/test/ui/coherence-overlap-upstream.rs b/src/test/ui/coherence/coherence-overlap-upstream.rs
similarity index 100%
rename from src/test/ui/coherence-overlap-upstream.rs
rename to src/test/ui/coherence/coherence-overlap-upstream.rs
diff --git a/src/test/ui/coherence-overlap-upstream.stderr b/src/test/ui/coherence/coherence-overlap-upstream.stderr
similarity index 100%
rename from src/test/ui/coherence-overlap-upstream.stderr
rename to src/test/ui/coherence/coherence-overlap-upstream.stderr
diff --git a/src/test/compile-fail/coherence-overlapping-pairs.rs b/src/test/ui/coherence/coherence-overlapping-pairs.rs
similarity index 100%
rename from src/test/compile-fail/coherence-overlapping-pairs.rs
rename to src/test/ui/coherence/coherence-overlapping-pairs.rs
diff --git a/src/test/ui/coherence/coherence-overlapping-pairs.stderr b/src/test/ui/coherence/coherence-overlapping-pairs.stderr
new file mode 100644
index 0000000..41d4788
--- /dev/null
+++ b/src/test/ui/coherence/coherence-overlapping-pairs.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-overlapping-pairs.rs:18:1
+ |
+LL | impl<T> Remote for lib::Pair<T,Foo> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-pair-covered-uncovered-1.rs b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs
similarity index 100%
rename from src/test/compile-fail/coherence-pair-covered-uncovered-1.rs
rename to src/test/ui/coherence/coherence-pair-covered-uncovered-1.rs
diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr
new file mode 100644
index 0000000..3545593
--- /dev/null
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered-1.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-pair-covered-uncovered-1.rs:21:1
+ |
+LL | impl<T, U> Remote1<Pair<T, Local<U>>> for i32 { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-pair-covered-uncovered.rs b/src/test/ui/coherence/coherence-pair-covered-uncovered.rs
similarity index 100%
rename from src/test/compile-fail/coherence-pair-covered-uncovered.rs
rename to src/test/ui/coherence/coherence-pair-covered-uncovered.rs
diff --git a/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr b/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr
new file mode 100644
index 0000000..f58cb46
--- /dev/null
+++ b/src/test/ui/coherence/coherence-pair-covered-uncovered.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-pair-covered-uncovered.rs:18:1
+ |
+LL | impl<T,U> Remote for Pair<T,Local<U>> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-projection-conflict-orphan.rs b/src/test/ui/coherence/coherence-projection-conflict-orphan.rs
similarity index 100%
rename from src/test/compile-fail/coherence-projection-conflict-orphan.rs
rename to src/test/ui/coherence/coherence-projection-conflict-orphan.rs
diff --git a/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr
new file mode 100644
index 0000000..a0fcf07
--- /dev/null
+++ b/src/test/ui/coherence/coherence-projection-conflict-orphan.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `Foo<i32>` for type `i32`:
+ --> $DIR/coherence-projection-conflict-orphan.rs:26:1
+ |
+LL | impl Foo<i32> for i32 { }
+ | --------------------- first implementation here
+LL |
+LL | impl<A:Iterator> Foo<A::Item> for A { } //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
+ |
+ = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `i32` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-projection-conflict-ty-param.rs b/src/test/ui/coherence/coherence-projection-conflict-ty-param.rs
similarity index 100%
rename from src/test/compile-fail/coherence-projection-conflict-ty-param.rs
rename to src/test/ui/coherence/coherence-projection-conflict-ty-param.rs
diff --git a/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr
new file mode 100644
index 0000000..cfbf96b
--- /dev/null
+++ b/src/test/ui/coherence/coherence-projection-conflict-ty-param.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Foo<_>` for type `std::option::Option<_>`:
+ --> $DIR/coherence-projection-conflict-ty-param.rs:20:1
+ |
+LL | impl <P, T: Foo<P>> Foo<P> for Option<T> {}
+ | ---------------------------------------- first implementation here
+LL |
+LL | impl<T, U> Foo<T> for Option<U> { } //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::option::Option<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-projection-conflict.rs b/src/test/ui/coherence/coherence-projection-conflict.rs
similarity index 100%
rename from src/test/compile-fail/coherence-projection-conflict.rs
rename to src/test/ui/coherence/coherence-projection-conflict.rs
diff --git a/src/test/ui/coherence/coherence-projection-conflict.stderr b/src/test/ui/coherence/coherence-projection-conflict.stderr
new file mode 100644
index 0000000..3832faf
--- /dev/null
+++ b/src/test/ui/coherence/coherence-projection-conflict.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `Foo<i32>` for type `i32`:
+ --> $DIR/coherence-projection-conflict.rs:21:1
+ |
+LL | impl Foo<i32> for i32 { }
+ | --------------------- first implementation here
+LL |
+LL | impl<A:Bar> Foo<A::Output> for A { } //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `i32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-projection-ok-orphan.rs b/src/test/ui/coherence/coherence-projection-ok-orphan.rs
similarity index 100%
rename from src/test/compile-fail/coherence-projection-ok-orphan.rs
rename to src/test/ui/coherence/coherence-projection-ok-orphan.rs
diff --git a/src/test/ui/coherence/coherence-projection-ok-orphan.stderr b/src/test/ui/coherence/coherence-projection-ok-orphan.stderr
new file mode 100644
index 0000000..1b9a325
--- /dev/null
+++ b/src/test/ui/coherence/coherence-projection-ok-orphan.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/coherence-projection-ok-orphan.rs:29:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/coherence-projection-ok.rs b/src/test/ui/coherence/coherence-projection-ok.rs
similarity index 100%
rename from src/test/compile-fail/coherence-projection-ok.rs
rename to src/test/ui/coherence/coherence-projection-ok.rs
diff --git a/src/test/ui/coherence/coherence-projection-ok.stderr b/src/test/ui/coherence/coherence-projection-ok.stderr
new file mode 100644
index 0000000..945f3b3
--- /dev/null
+++ b/src/test/ui/coherence/coherence-projection-ok.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/coherence-projection-ok.rs:28:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/coherence-tuple-conflict.rs b/src/test/ui/coherence/coherence-tuple-conflict.rs
similarity index 100%
rename from src/test/compile-fail/coherence-tuple-conflict.rs
rename to src/test/ui/coherence/coherence-tuple-conflict.rs
diff --git a/src/test/ui/coherence/coherence-tuple-conflict.stderr b/src/test/ui/coherence/coherence-tuple-conflict.stderr
new file mode 100644
index 0000000..4ceafea
--- /dev/null
+++ b/src/test/ui/coherence/coherence-tuple-conflict.stderr
@@ -0,0 +1,12 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `(_, _)`:
+ --> $DIR/coherence-tuple-conflict.rs:25:1
+ |
+LL | impl<T> MyTrait for (T,T) {
+ | ------------------------- first implementation here
+...
+LL | impl<A,B> MyTrait for (A,B) { //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(_, _)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence-vec-local-2.rs b/src/test/ui/coherence/coherence-vec-local-2.rs
similarity index 100%
rename from src/test/compile-fail/coherence-vec-local-2.rs
rename to src/test/ui/coherence/coherence-vec-local-2.rs
diff --git a/src/test/ui/coherence/coherence-vec-local-2.stderr b/src/test/ui/coherence/coherence-vec-local-2.stderr
new file mode 100644
index 0000000..2980d4a
--- /dev/null
+++ b/src/test/ui/coherence/coherence-vec-local-2.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/coherence-vec-local-2.rs:21:1
+ |
+LL | impl<T> Remote for Vec<Local<T>> { } //~ ERROR E0210
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/coherence-vec-local.rs b/src/test/ui/coherence/coherence-vec-local.rs
similarity index 100%
rename from src/test/compile-fail/coherence-vec-local.rs
rename to src/test/ui/coherence/coherence-vec-local.rs
diff --git a/src/test/ui/coherence/coherence-vec-local.stderr b/src/test/ui/coherence/coherence-vec-local.stderr
new file mode 100644
index 0000000..b3c2616
--- /dev/null
+++ b/src/test/ui/coherence/coherence-vec-local.stderr
@@ -0,0 +1,12 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence-vec-local.rs:21:1
+ |
+LL | impl Remote for Vec<Local> { } //~ ERROR E0117
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/coherence_copy_like_err_fundamental_struct.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs
similarity index 100%
rename from src/test/compile-fail/coherence_copy_like_err_fundamental_struct.rs
rename to src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.rs
diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.stderr
new file mode 100644
index 0000000..675dc1b
--- /dev/null
+++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/coherence_copy_like_err_fundamental_struct.rs:34:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/coherence_copy_like_err_fundamental_struct_ref.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs
similarity index 100%
rename from src/test/compile-fail/coherence_copy_like_err_fundamental_struct_ref.rs
rename to src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.rs
diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.stderr
new file mode 100644
index 0000000..5143d4e
--- /dev/null
+++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_ref.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/coherence_copy_like_err_fundamental_struct_ref.rs:34:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/coherence_copy_like_err_fundamental_struct_tuple.rs b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs
similarity index 100%
rename from src/test/compile-fail/coherence_copy_like_err_fundamental_struct_tuple.rs
rename to src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.rs
diff --git a/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr
new file mode 100644
index 0000000..c7c49fe
--- /dev/null
+++ b/src/test/ui/coherence/coherence_copy_like_err_fundamental_struct_tuple.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyFundamentalStruct<(MyType,)>`:
+ --> $DIR/coherence_copy_like_err_fundamental_struct_tuple.rs:27:1
+ |
+LL | impl<T: lib::MyCopy> MyTrait for T { }
+ | ---------------------------------- first implementation here
+...
+LL | impl MyTrait for lib::MyFundamentalStruct<(MyType,)> { } //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyFundamentalStruct<(MyType,)>`
+ |
+ = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyFundamentalStruct<(MyType,)>` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence_copy_like_err_struct.rs b/src/test/ui/coherence/coherence_copy_like_err_struct.rs
similarity index 100%
rename from src/test/compile-fail/coherence_copy_like_err_struct.rs
rename to src/test/ui/coherence/coherence_copy_like_err_struct.rs
diff --git a/src/test/ui/coherence/coherence_copy_like_err_struct.stderr b/src/test/ui/coherence/coherence_copy_like_err_struct.stderr
new file mode 100644
index 0000000..786a3df
--- /dev/null
+++ b/src/test/ui/coherence/coherence_copy_like_err_struct.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `lib::MyStruct<MyType>`:
+ --> $DIR/coherence_copy_like_err_struct.rs:29:1
+ |
+LL | impl<T: lib::MyCopy> MyTrait for T { }
+ | ---------------------------------- first implementation here
+...
+LL | impl MyTrait for lib::MyStruct<MyType> { } //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `lib::MyStruct<MyType>`
+ |
+ = note: upstream crates may add new impl of trait `lib::MyCopy` for type `lib::MyStruct<MyType>` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence_copy_like_err_tuple.rs b/src/test/ui/coherence/coherence_copy_like_err_tuple.rs
similarity index 100%
rename from src/test/compile-fail/coherence_copy_like_err_tuple.rs
rename to src/test/ui/coherence/coherence_copy_like_err_tuple.rs
diff --git a/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr b/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr
new file mode 100644
index 0000000..3708a38
--- /dev/null
+++ b/src/test/ui/coherence/coherence_copy_like_err_tuple.stderr
@@ -0,0 +1,14 @@
+error[E0119]: conflicting implementations of trait `MyTrait` for type `(MyType,)`:
+ --> $DIR/coherence_copy_like_err_tuple.rs:28:1
+ |
+LL | impl<T: lib::MyCopy> MyTrait for T { }
+ | ---------------------------------- first implementation here
+...
+LL | impl MyTrait for (MyType,) { } //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(MyType,)`
+ |
+ = note: upstream crates may add new impl of trait `lib::MyCopy` for type `(MyType,)` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/coherence_inherent.rs b/src/test/ui/coherence/coherence_inherent.rs
similarity index 100%
rename from src/test/compile-fail/coherence_inherent.rs
rename to src/test/ui/coherence/coherence_inherent.rs
diff --git a/src/test/ui/coherence/coherence_inherent.stderr b/src/test/ui/coherence/coherence_inherent.stderr
new file mode 100644
index 0000000..1708979
--- /dev/null
+++ b/src/test/ui/coherence/coherence_inherent.stderr
@@ -0,0 +1,13 @@
+error[E0599]: no method named `the_fn` found for type `&Lib::TheStruct` in the current scope
+ --> $DIR/coherence_inherent.rs:41:11
+ |
+LL | s.the_fn(); //~ ERROR no method named `the_fn` found
+ | ^^^^^^
+ |
+ = help: items from traits can only be used if the trait is in scope
+ = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ `use Lib::TheTrait;`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/coherence_inherent_cc.rs b/src/test/ui/coherence/coherence_inherent_cc.rs
similarity index 100%
rename from src/test/compile-fail/coherence_inherent_cc.rs
rename to src/test/ui/coherence/coherence_inherent_cc.rs
diff --git a/src/test/ui/coherence/coherence_inherent_cc.stderr b/src/test/ui/coherence/coherence_inherent_cc.stderr
new file mode 100644
index 0000000..a3c1b60
--- /dev/null
+++ b/src/test/ui/coherence/coherence_inherent_cc.stderr
@@ -0,0 +1,13 @@
+error[E0599]: no method named `the_fn` found for type `&coherence_inherent_cc_lib::TheStruct` in the current scope
+ --> $DIR/coherence_inherent_cc.rs:33:11
+ |
+LL | s.the_fn(); //~ ERROR no method named `the_fn` found
+ | ^^^^^^
+ |
+ = help: items from traits can only be used if the trait is in scope
+ = note: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ `use coherence_inherent_cc_lib::TheTrait;`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/coherence_local.rs b/src/test/ui/coherence/coherence_local.rs
similarity index 100%
rename from src/test/compile-fail/coherence_local.rs
rename to src/test/ui/coherence/coherence_local.rs
diff --git a/src/test/ui/coherence/coherence_local.stderr b/src/test/ui/coherence/coherence_local.stderr
new file mode 100644
index 0000000..c4340e8
--- /dev/null
+++ b/src/test/ui/coherence/coherence_local.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/coherence_local.rs:33:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/coherence_local_err_struct.rs b/src/test/ui/coherence/coherence_local_err_struct.rs
similarity index 100%
rename from src/test/compile-fail/coherence_local_err_struct.rs
rename to src/test/ui/coherence/coherence_local_err_struct.rs
diff --git a/src/test/ui/coherence/coherence_local_err_struct.stderr b/src/test/ui/coherence/coherence_local_err_struct.stderr
new file mode 100644
index 0000000..c35e950
--- /dev/null
+++ b/src/test/ui/coherence/coherence_local_err_struct.stderr
@@ -0,0 +1,12 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence_local_err_struct.rs:26:1
+ |
+LL | impl lib::MyCopy for lib::MyStruct<MyType> { } //~ ERROR E0117
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/coherence_local_err_tuple.rs b/src/test/ui/coherence/coherence_local_err_tuple.rs
similarity index 100%
rename from src/test/compile-fail/coherence_local_err_tuple.rs
rename to src/test/ui/coherence/coherence_local_err_tuple.rs
diff --git a/src/test/ui/coherence/coherence_local_err_tuple.stderr b/src/test/ui/coherence/coherence_local_err_tuple.stderr
new file mode 100644
index 0000000..a3f9f2d
--- /dev/null
+++ b/src/test/ui/coherence/coherence_local_err_tuple.stderr
@@ -0,0 +1,12 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/coherence_local_err_tuple.rs:26:1
+ |
+LL | impl lib::MyCopy for (MyType,) { } //~ ERROR E0117
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/coherence_local_ref.rs b/src/test/ui/coherence/coherence_local_ref.rs
similarity index 100%
rename from src/test/compile-fail/coherence_local_ref.rs
rename to src/test/ui/coherence/coherence_local_ref.rs
diff --git a/src/test/ui/coherence/coherence_local_ref.stderr b/src/test/ui/coherence/coherence_local_ref.stderr
new file mode 100644
index 0000000..13d6fdd
--- /dev/null
+++ b/src/test/ui/coherence/coherence_local_ref.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/coherence_local_ref.rs:27:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/compile_error_macro.rs b/src/test/ui/compile_error_macro.rs
similarity index 100%
rename from src/test/compile-fail/compile_error_macro.rs
rename to src/test/ui/compile_error_macro.rs
diff --git a/src/test/ui/compile_error_macro.stderr b/src/test/ui/compile_error_macro.stderr
new file mode 100644
index 0000000..1abf5ac
--- /dev/null
+++ b/src/test/ui/compile_error_macro.stderr
@@ -0,0 +1,8 @@
+error: a very descriptive error message
+ --> $DIR/compile_error_macro.rs:12:5
+ |
+LL | compile_error!("a very descriptive error message"); //~ ERROR: a very descriptive error message
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/concat.rs b/src/test/ui/concat.rs
similarity index 100%
rename from src/test/compile-fail/concat.rs
rename to src/test/ui/concat.rs
diff --git a/src/test/ui/concat.stderr b/src/test/ui/concat.stderr
new file mode 100644
index 0000000..0128811
--- /dev/null
+++ b/src/test/ui/concat.stderr
@@ -0,0 +1,30 @@
+error: cannot concatenate a byte string literal
+ --> $DIR/concat.rs:12:13
+ |
+LL | concat!(b'f'); //~ ERROR: cannot concatenate a byte string literal
+ | ^^^^
+
+error: cannot concatenate a byte string literal
+ --> $DIR/concat.rs:13:13
+ |
+LL | concat!(b"foo"); //~ ERROR: cannot concatenate a byte string literal
+ | ^^^^^^
+
+error: expected a literal
+ --> $DIR/concat.rs:14:13
+ |
+LL | concat!(foo); //~ ERROR: expected a literal
+ | ^^^
+ |
+ = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()`
+
+error: expected a literal
+ --> $DIR/concat.rs:15:13
+ |
+LL | concat!(foo()); //~ ERROR: expected a literal
+ | ^^^^^
+ |
+ = note: only literals (like `"foo"`, `42` and `3.14`) can be passed to `concat!()`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/conflicting-repr-hints.rs b/src/test/ui/conflicting-repr-hints.rs
similarity index 100%
rename from src/test/compile-fail/conflicting-repr-hints.rs
rename to src/test/ui/conflicting-repr-hints.rs
diff --git a/src/test/ui/conflicting-repr-hints.stderr b/src/test/ui/conflicting-repr-hints.stderr
new file mode 100644
index 0000000..7a4e5a5
--- /dev/null
+++ b/src/test/ui/conflicting-repr-hints.stderr
@@ -0,0 +1,70 @@
+warning[E0566]: conflicting representation hints
+ --> $DIR/conflicting-repr-hints.rs:20:8
+ |
+LL | #[repr(C, u64)] //~ WARNING conflicting representation hints
+ | ^ ^^^
+
+warning[E0566]: conflicting representation hints
+ --> $DIR/conflicting-repr-hints.rs:23:8
+ |
+LL | #[repr(u32, u64)] //~ WARNING conflicting representation hints
+ | ^^^ ^^^
+
+error[E0587]: type has conflicting packed and align representation hints
+ --> $DIR/conflicting-repr-hints.rs:30:1
+ |
+LL | struct F(i32); //~ ERROR type has conflicting packed and align representation hints
+ | ^^^^^^^^^^^^^^
+
+error[E0587]: type has conflicting packed and align representation hints
+ --> $DIR/conflicting-repr-hints.rs:34:1
+ |
+LL | struct G(i32); //~ ERROR type has conflicting packed and align representation hints
+ | ^^^^^^^^^^^^^^
+
+error[E0587]: type has conflicting packed and align representation hints
+ --> $DIR/conflicting-repr-hints.rs:38:1
+ |
+LL | struct H(i32); //~ ERROR type has conflicting packed and align representation hints
+ | ^^^^^^^^^^^^^^
+
+error[E0634]: type has conflicting packed representation hints
+ --> $DIR/conflicting-repr-hints.rs:41:1
+ |
+LL | struct I(i32); //~ ERROR type has conflicting packed representation hints
+ | ^^^^^^^^^^^^^^
+
+error[E0634]: type has conflicting packed representation hints
+ --> $DIR/conflicting-repr-hints.rs:45:1
+ |
+LL | struct J(i32); //~ ERROR type has conflicting packed representation hints
+ | ^^^^^^^^^^^^^^
+
+error[E0587]: type has conflicting packed and align representation hints
+ --> $DIR/conflicting-repr-hints.rs:51:1
+ |
+LL | / union X { //~ ERROR type has conflicting packed and align representation hints
+LL | | i: i32
+LL | | }
+ | |_^
+
+error[E0587]: type has conflicting packed and align representation hints
+ --> $DIR/conflicting-repr-hints.rs:57:1
+ |
+LL | / union Y { //~ ERROR type has conflicting packed and align representation hints
+LL | | i: i32
+LL | | }
+ | |_^
+
+error[E0587]: type has conflicting packed and align representation hints
+ --> $DIR/conflicting-repr-hints.rs:63:1
+ |
+LL | / union Z { //~ ERROR type has conflicting packed and align representation hints
+LL | | i: i32
+LL | | }
+ | |_^
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0566, E0587, E0634.
+For more information about an error, try `rustc --explain E0566`.
diff --git a/src/test/compile-fail/conservative_impl_trait.rs b/src/test/ui/conservative_impl_trait.rs
similarity index 100%
rename from src/test/compile-fail/conservative_impl_trait.rs
rename to src/test/ui/conservative_impl_trait.rs
diff --git a/src/test/ui/conservative_impl_trait.stderr b/src/test/ui/conservative_impl_trait.stderr
new file mode 100644
index 0000000..6fcd384
--- /dev/null
+++ b/src/test/ui/conservative_impl_trait.stderr
@@ -0,0 +1,12 @@
+error[E0277]: the trait bound `(): std::iter::Iterator` is not satisfied
+ --> $DIR/conservative_impl_trait.rs:13:33
+ |
+LL | fn will_ice(something: &u32) -> impl Iterator<Item = &u32> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `()`
+ = note: the return type of a function must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/const-unsized.stderr b/src/test/ui/const-unsized.stderr
deleted file mode 100644
index 4103ea0..0000000
--- a/src/test/ui/const-unsized.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
- --> $DIR/const-unsized.rs:13:29
- |
-LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
- | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: constant expressions must have a statically known size
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/const-unsized.rs:16:24
- |
-LL | const CONST_FOO: str = *"foo";
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: constant expressions must have a statically known size
-
-error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
- --> $DIR/const-unsized.rs:19:31
- |
-LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync));
- | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: constant expressions must have a statically known size
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/const-unsized.rs:22:26
- |
-LL | static STATIC_BAR: str = *"bar";
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: constant expressions must have a statically known size
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/constructor-lifetime-args.rs b/src/test/ui/constructor-lifetime-args.rs
similarity index 100%
rename from src/test/compile-fail/constructor-lifetime-args.rs
rename to src/test/ui/constructor-lifetime-args.rs
diff --git a/src/test/ui/constructor-lifetime-args.stderr b/src/test/ui/constructor-lifetime-args.stderr
new file mode 100644
index 0000000..1710594
--- /dev/null
+++ b/src/test/ui/constructor-lifetime-args.stderr
@@ -0,0 +1,28 @@
+error[E0090]: too few lifetime parameters provided: expected 2 lifetime parameters, found 1 lifetime parameter
+ --> $DIR/constructor-lifetime-args.rs:27:5
+ |
+LL | S::<'static>(&0, &0);
+ | ^^^^^^^^^^^^ expected 2 lifetime parameters
+
+error[E0088]: too many lifetime parameters provided: expected at most 2 lifetime parameters, found 3 lifetime parameters
+ --> $DIR/constructor-lifetime-args.rs:29:27
+ |
+LL | S::<'static, 'static, 'static>(&0, &0);
+ | ^^^^^^^ expected 2 lifetime parameters
+
+error[E0090]: too few lifetime parameters provided: expected 2 lifetime parameters, found 1 lifetime parameter
+ --> $DIR/constructor-lifetime-args.rs:32:5
+ |
+LL | E::V::<'static>(&0);
+ | ^^^^^^^^^^^^^^^ expected 2 lifetime parameters
+
+error[E0088]: too many lifetime parameters provided: expected at most 2 lifetime parameters, found 3 lifetime parameters
+ --> $DIR/constructor-lifetime-args.rs:34:30
+ |
+LL | E::V::<'static, 'static, 'static>(&0);
+ | ^^^^^^^ expected 2 lifetime parameters
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0088, E0090.
+For more information about an error, try `rustc --explain E0088`.
diff --git a/src/test/compile-fail/auxiliary/const_fn_lib.rs b/src/test/ui/consts/auxiliary/const_fn_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/const_fn_lib.rs
rename to src/test/ui/consts/auxiliary/const_fn_lib.rs
diff --git a/src/test/compile-fail/const-array-oob-arith.rs b/src/test/ui/consts/const-array-oob-arith.rs
similarity index 100%
rename from src/test/compile-fail/const-array-oob-arith.rs
rename to src/test/ui/consts/const-array-oob-arith.rs
diff --git a/src/test/ui/consts/const-array-oob-arith.stderr b/src/test/ui/consts/const-array-oob-arith.stderr
new file mode 100644
index 0000000..5b5f942
--- /dev/null
+++ b/src/test/ui/consts/const-array-oob-arith.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/const-array-oob-arith.rs:17:45
+ |
+LL | const BLUB: [i32; (ARR[0] - 40) as usize] = [5]; //~ ERROR: mismatched types
+ | ^^^ expected an array with a fixed size of 2 elements, found one with 1 elements
+ |
+ = note: expected type `[i32; 2]`
+ found type `[i32; 1]`
+
+error[E0308]: mismatched types
+ --> $DIR/const-array-oob-arith.rs:18:44
+ |
+LL | const BOO: [i32; (ARR[0] - 41) as usize] = [5, 99]; //~ ERROR: mismatched types
+ | ^^^^^^^ expected an array with a fixed size of 1 elements, found one with 2 elements
+ |
+ = note: expected type `[i32; 1]`
+ found type `[i32; 2]`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/const-array-oob.rs b/src/test/ui/consts/const-array-oob.rs
similarity index 100%
rename from src/test/compile-fail/const-array-oob.rs
rename to src/test/ui/consts/const-array-oob.rs
diff --git a/src/test/ui/consts/const-array-oob.stderr b/src/test/ui/consts/const-array-oob.stderr
new file mode 100644
index 0000000..09e4918
--- /dev/null
+++ b/src/test/ui/consts/const-array-oob.stderr
@@ -0,0 +1,19 @@
+error: index out of bounds: the len is 3 but the index is 4
+ --> $DIR/const-array-oob.rs:18:19
+ |
+LL | const BLUB: [u32; FOO[4]] = [5, 6];
+ | ^^^^^^
+ |
+ = note: #[deny(const_err)] on by default
+
+error[E0080]: could not evaluate constant expression
+ --> $DIR/const-array-oob.rs:18:1
+ |
+LL | const BLUB: [u32; FOO[4]] = [5, 6];
+ | ^^^^^^^^^^^^^^^^^^------^^^^^^^^^^^
+ | |
+ | index out of bounds: the len is 3 but the index is 4
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/compile-fail/const-block-non-item-statement-2.rs b/src/test/ui/consts/const-block-non-item-statement-2.rs
similarity index 100%
rename from src/test/compile-fail/const-block-non-item-statement-2.rs
rename to src/test/ui/consts/const-block-non-item-statement-2.rs
diff --git a/src/test/ui/consts/const-block-non-item-statement-2.stderr b/src/test/ui/consts/const-block-non-item-statement-2.stderr
new file mode 100644
index 0000000..580f7e0
--- /dev/null
+++ b/src/test/ui/consts/const-block-non-item-statement-2.stderr
@@ -0,0 +1,62 @@
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:11:20
+ |
+LL | const A: usize = { 1; 2 };
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:14:20
+ |
+LL | const B: usize = { { } 2 };
+ | ^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:18:12
+ |
+LL | () => (()) //~ ERROR statements in constants are unstable
+ | ^^
+LL | }
+LL | const C: usize = { foo!(); 2 };
+ | ------- in this macro invocation
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:22:28
+ |
+LL | const D: usize = { let x = 4; 2 };
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:22:28
+ |
+LL | const D: usize = { let x = 4; 2 };
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:22:1
+ |
+LL | const D: usize = { let x = 4; 2 };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-2.rs:22:1
+ |
+LL | const D: usize = { let x = 4; 2 };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/const-block-non-item-statement-3.rs b/src/test/ui/consts/const-block-non-item-statement-3.rs
similarity index 100%
rename from src/test/compile-fail/const-block-non-item-statement-3.rs
rename to src/test/ui/consts/const-block-non-item-statement-3.rs
diff --git a/src/test/ui/consts/const-block-non-item-statement-3.stderr b/src/test/ui/consts/const-block-non-item-statement-3.stderr
new file mode 100644
index 0000000..0124288
--- /dev/null
+++ b/src/test/ui/consts/const-block-non-item-statement-3.stderr
@@ -0,0 +1,35 @@
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-3.rs:11:31
+ |
+LL | type Array = [u32; { let x = 2; 5 }];
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-3.rs:11:31
+ |
+LL | type Array = [u32; { let x = 2; 5 }];
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-3.rs:11:20
+ |
+LL | type Array = [u32; { let x = 2; 5 }];
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement-3.rs:11:20
+ |
+LL | type Array = [u32; { let x = 2; 5 }];
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/const-block-non-item-statement.rs b/src/test/ui/consts/const-block-non-item-statement.rs
similarity index 100%
rename from src/test/compile-fail/const-block-non-item-statement.rs
rename to src/test/ui/consts/const-block-non-item-statement.rs
diff --git a/src/test/ui/consts/const-block-non-item-statement.stderr b/src/test/ui/consts/const-block-non-item-statement.stderr
new file mode 100644
index 0000000..b367a9d
--- /dev/null
+++ b/src/test/ui/consts/const-block-non-item-statement.stderr
@@ -0,0 +1,35 @@
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement.rs:12:21
+ |
+LL | Bar = { let x = 1; 3 }
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement.rs:12:21
+ |
+LL | Bar = { let x = 1; 3 }
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement.rs:12:11
+ |
+LL | Bar = { let x = 1; 3 }
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/const-block-non-item-statement.rs:12:11
+ |
+LL | Bar = { let x = 1; 3 }
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/const-call.rs b/src/test/ui/consts/const-call.rs
similarity index 100%
rename from src/test/compile-fail/const-call.rs
rename to src/test/ui/consts/const-call.rs
diff --git a/src/test/ui/consts/const-call.stderr b/src/test/ui/consts/const-call.stderr
new file mode 100644
index 0000000..efc3c58
--- /dev/null
+++ b/src/test/ui/consts/const-call.stderr
@@ -0,0 +1,16 @@
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/const-call.rs:16:17
+ |
+LL | let _ = [0; f(2)];
+ | ^^^^
+
+error[E0080]: could not evaluate repeat length
+ --> $DIR/const-call.rs:16:17
+ |
+LL | let _ = [0; f(2)];
+ | ^^^^ calling non-const fn `f`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0015, E0080.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/src/test/compile-fail/const-cast-different-types.rs b/src/test/ui/consts/const-cast-different-types.rs
similarity index 100%
rename from src/test/compile-fail/const-cast-different-types.rs
rename to src/test/ui/consts/const-cast-different-types.rs
diff --git a/src/test/ui/consts/const-cast-different-types.stderr b/src/test/ui/consts/const-cast-different-types.stderr
new file mode 100644
index 0000000..bc4d135
--- /dev/null
+++ b/src/test/ui/consts/const-cast-different-types.stderr
@@ -0,0 +1,15 @@
+error[E0606]: casting `&'static str` as `*const u8` is invalid
+ --> $DIR/const-cast-different-types.rs:12:23
+ |
+LL | static b: *const u8 = a as *const u8; //~ ERROR casting
+ | ^^^^^^^^^^^^^^
+
+error[E0606]: casting `&&'static str` as `*const u8` is invalid
+ --> $DIR/const-cast-different-types.rs:13:23
+ |
+LL | static c: *const u8 = &a as *const u8; //~ ERROR casting
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/src/test/compile-fail/const-cast-wrong-type.rs b/src/test/ui/consts/const-cast-wrong-type.rs
similarity index 100%
rename from src/test/compile-fail/const-cast-wrong-type.rs
rename to src/test/ui/consts/const-cast-wrong-type.rs
diff --git a/src/test/ui/consts/const-cast-wrong-type.stderr b/src/test/ui/consts/const-cast-wrong-type.stderr
new file mode 100644
index 0000000..d7ac89c
--- /dev/null
+++ b/src/test/ui/consts/const-cast-wrong-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/const-cast-wrong-type.rs:12:23
+ |
+LL | static b: *const i8 = &a as *const i8; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^ expected u8, found i8
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/const-deref-ptr.rs b/src/test/ui/consts/const-deref-ptr.rs
similarity index 100%
rename from src/test/ui/const-deref-ptr.rs
rename to src/test/ui/consts/const-deref-ptr.rs
diff --git a/src/test/ui/const-deref-ptr.stderr b/src/test/ui/consts/const-deref-ptr.stderr
similarity index 100%
rename from src/test/ui/const-deref-ptr.stderr
rename to src/test/ui/consts/const-deref-ptr.stderr
diff --git a/src/test/compile-fail/const-err-early.rs b/src/test/ui/consts/const-err-early.rs
similarity index 100%
rename from src/test/compile-fail/const-err-early.rs
rename to src/test/ui/consts/const-err-early.rs
diff --git a/src/test/ui/consts/const-err-early.stderr b/src/test/ui/consts/const-err-early.stderr
new file mode 100644
index 0000000..36f3ac1
--- /dev/null
+++ b/src/test/ui/consts/const-err-early.stderr
@@ -0,0 +1,48 @@
+error: this constant cannot be used
+ --> $DIR/const-err-early.rs:13:1
+ |
+LL | pub const A: i8 = -std::i8::MIN; //~ ERROR const_err
+ | ^^^^^^^^^^^^^^^^^^-------------^
+ | |
+ | attempt to negate with overflow
+ |
+note: lint level defined here
+ --> $DIR/const-err-early.rs:11:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-err-early.rs:14:1
+ |
+LL | pub const B: u8 = 200u8 + 200u8; //~ ERROR const_err
+ | ^^^^^^^^^^^^^^^^^^-------------^
+ | |
+ | attempt to add with overflow
+
+error: this constant cannot be used
+ --> $DIR/const-err-early.rs:15:1
+ |
+LL | pub const C: u8 = 200u8 * 4; //~ ERROR const_err
+ | ^^^^^^^^^^^^^^^^^^---------^
+ | |
+ | attempt to multiply with overflow
+
+error: this constant cannot be used
+ --> $DIR/const-err-early.rs:16:1
+ |
+LL | pub const D: u8 = 42u8 - (42u8 + 1); //~ ERROR const_err
+ | ^^^^^^^^^^^^^^^^^^-----------------^
+ | |
+ | attempt to subtract with overflow
+
+error: this constant cannot be used
+ --> $DIR/const-err-early.rs:17:1
+ |
+LL | pub const E: u8 = [5u8][1]; //~ ERROR const_err
+ | ^^^^^^^^^^^^^^^^^^--------^
+ | |
+ | index out of bounds: the len is 1 but the index is 1
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/const-err-multi.rs b/src/test/ui/consts/const-err-multi.rs
similarity index 100%
rename from src/test/compile-fail/const-err-multi.rs
rename to src/test/ui/consts/const-err-multi.rs
diff --git a/src/test/ui/consts/const-err-multi.stderr b/src/test/ui/consts/const-err-multi.stderr
new file mode 100644
index 0000000..dd3eaa4
--- /dev/null
+++ b/src/test/ui/consts/const-err-multi.stderr
@@ -0,0 +1,67 @@
+error: this constant cannot be used
+ --> $DIR/const-err-multi.rs:13:1
+ |
+LL | pub const A: i8 = -std::i8::MIN;
+ | ^^^^^^^^^^^^^^^^^^-------------^
+ | |
+ | attempt to negate with overflow
+ |
+note: lint level defined here
+ --> $DIR/const-err-multi.rs:11:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: referenced constant has errors
+ --> $DIR/const-err-multi.rs:15:1
+ |
+LL | pub const A: i8 = -std::i8::MIN;
+ | ------------- attempt to negate with overflow
+LL | //~^ ERROR this constant cannot be used
+LL | pub const B: i8 = A;
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-err-multi.rs:15:1
+ |
+LL | pub const B: i8 = A;
+ | ^^^^^^^^^^^^^^^^^^-^
+ | |
+ | referenced constant has errors
+
+error: referenced constant has errors
+ --> $DIR/const-err-multi.rs:18:1
+ |
+LL | pub const A: i8 = -std::i8::MIN;
+ | ------------- attempt to negate with overflow
+...
+LL | pub const C: u8 = A as u8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-err-multi.rs:18:1
+ |
+LL | pub const C: u8 = A as u8;
+ | ^^^^^^^^^^^^^^^^^^-------^
+ | |
+ | referenced constant has errors
+
+error: referenced constant has errors
+ --> $DIR/const-err-multi.rs:21:1
+ |
+LL | pub const A: i8 = -std::i8::MIN;
+ | ------------- attempt to negate with overflow
+...
+LL | pub const D: i8 = 50 - A;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-err-multi.rs:21:1
+ |
+LL | pub const D: i8 = 50 - A;
+ | ^^^^^^^^^^^^^^^^^^------^
+ | |
+ | referenced constant has errors
+
+error: aborting due to 7 previous errors
+
diff --git a/src/test/compile-fail/const-err.rs b/src/test/ui/consts/const-err.rs
similarity index 100%
rename from src/test/compile-fail/const-err.rs
rename to src/test/ui/consts/const-err.rs
diff --git a/src/test/ui/consts/const-err.stderr b/src/test/ui/consts/const-err.stderr
new file mode 100644
index 0000000..1674f99
--- /dev/null
+++ b/src/test/ui/consts/const-err.stderr
@@ -0,0 +1,26 @@
+error[E0080]: referenced constant has errors
+ --> $DIR/const-err.rs:29:15
+ |
+LL | const FOO: u8 = [5u8][1];
+ | -------- index out of bounds: the len is 1 but the index is 1
+...
+LL | black_box((FOO, FOO));
+ | ^^^^^^^^^^
+
+error[E0080]: could not evaluate constant
+ --> $DIR/const-err.rs:29:15
+ |
+LL | black_box((FOO, FOO));
+ | ^^^^^^^^^^ referenced constant has errors
+
+error[E0080]: constant evaluation error
+ --> $DIR/const-err.rs:24:1
+ |
+LL | const FOO: u8 = [5u8][1];
+ | ^^^^^^^^^^^^^^^^--------^
+ | |
+ | index out of bounds: the len is 1 but the index is 1
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/compile-fail/const-err2.rs b/src/test/ui/consts/const-err2.rs
similarity index 100%
rename from src/test/compile-fail/const-err2.rs
rename to src/test/ui/consts/const-err2.rs
diff --git a/src/test/ui/consts/const-err2.stderr b/src/test/ui/consts/const-err2.stderr
new file mode 100644
index 0000000..7201ecb
--- /dev/null
+++ b/src/test/ui/consts/const-err2.stderr
@@ -0,0 +1,38 @@
+error: this expression will panic at runtime
+ --> $DIR/const-err2.rs:25:13
+ |
+LL | let a = -std::i8::MIN;
+ | ^^^^^^^^^^^^^ attempt to negate with overflow
+ |
+note: lint level defined here
+ --> $DIR/const-err2.rs:18:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: this expression will panic at runtime
+ --> $DIR/const-err2.rs:27:13
+ |
+LL | let b = 200u8 + 200u8 + 200u8;
+ | ^^^^^^^^^^^^^ attempt to add with overflow
+
+error: this expression will panic at runtime
+ --> $DIR/const-err2.rs:29:13
+ |
+LL | let c = 200u8 * 4;
+ | ^^^^^^^^^ attempt to multiply with overflow
+
+error: this expression will panic at runtime
+ --> $DIR/const-err2.rs:31:13
+ |
+LL | let d = 42u8 - (42u8 + 1);
+ | ^^^^^^^^^^^^^^^^^ attempt to subtract with overflow
+
+error: index out of bounds: the len is 1 but the index is 1
+ --> $DIR/const-err2.rs:33:14
+ |
+LL | let _e = [5u8][1];
+ | ^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/const-err4.rs b/src/test/ui/consts/const-err4.rs
similarity index 100%
rename from src/test/compile-fail/const-err4.rs
rename to src/test/ui/consts/const-err4.rs
diff --git a/src/test/ui/consts/const-err4.stderr b/src/test/ui/consts/const-err4.stderr
new file mode 100644
index 0000000..dc64737
--- /dev/null
+++ b/src/test/ui/consts/const-err4.stderr
@@ -0,0 +1,9 @@
+error[E0080]: could not evaluate enum discriminant
+ --> $DIR/const-err4.rs:18:11
+ |
+LL | Boo = [unsafe { Foo { b: () }.a }; 4][3],
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempted to read undefined bytes
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/const-eval/conditional_array_execution.nll.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.nll.stderr
similarity index 100%
rename from src/test/ui/const-eval/conditional_array_execution.nll.stderr
rename to src/test/ui/consts/const-eval/conditional_array_execution.nll.stderr
diff --git a/src/test/ui/const-eval/conditional_array_execution.rs b/src/test/ui/consts/const-eval/conditional_array_execution.rs
similarity index 100%
rename from src/test/ui/const-eval/conditional_array_execution.rs
rename to src/test/ui/consts/const-eval/conditional_array_execution.rs
diff --git a/src/test/ui/const-eval/conditional_array_execution.stderr b/src/test/ui/consts/const-eval/conditional_array_execution.stderr
similarity index 100%
rename from src/test/ui/const-eval/conditional_array_execution.stderr
rename to src/test/ui/consts/const-eval/conditional_array_execution.stderr
diff --git a/src/test/ui/const-eval-overflow-2.rs b/src/test/ui/consts/const-eval/const-eval-overflow-2.rs
similarity index 100%
rename from src/test/ui/const-eval-overflow-2.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow-2.rs
diff --git a/src/test/ui/const-eval-overflow-2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-2.stderr
similarity index 100%
rename from src/test/ui/const-eval-overflow-2.stderr
rename to src/test/ui/consts/const-eval/const-eval-overflow-2.stderr
diff --git a/src/test/compile-fail/const-eval-overflow-3.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3.rs
similarity index 100%
rename from src/test/compile-fail/const-eval-overflow-3.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow-3.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr
new file mode 100644
index 0000000..f2b4e6b
--- /dev/null
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3.stderr
@@ -0,0 +1,19 @@
+error: attempt to add with overflow
+ --> $DIR/const-eval-overflow-3.rs:30:11
+ |
+LL | = [0; (i8::MAX + 1) as usize];
+ | ^^^^^^^^^^^^^
+ |
+ = note: #[deny(const_err)] on by default
+
+error[E0080]: could not evaluate repeat length
+ --> $DIR/const-eval-overflow-3.rs:30:11
+ |
+LL | = [0; (i8::MAX + 1) as usize];
+ | -------------^^^^^^^^^
+ | |
+ | attempt to add with overflow
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/compile-fail/const-eval-overflow-3b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
similarity index 100%
rename from src/test/compile-fail/const-eval-overflow-3b.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow-3b.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
new file mode 100644
index 0000000..4f1163b
--- /dev/null
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-3b.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/const-eval-overflow-3b.rs:34:22
+ |
+LL | = [0; (i8::MAX + 1u8) as usize];
+ | ^^^ expected i8, found u8
+
+error[E0277]: cannot add `u8` to `i8`
+ --> $DIR/const-eval-overflow-3b.rs:34:20
+ |
+LL | = [0; (i8::MAX + 1u8) as usize];
+ | ^ no implementation for `i8 + u8`
+ |
+ = help: the trait `std::ops::Add<u8>` is not implemented for `i8`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/const-eval-overflow-4.rs b/src/test/ui/consts/const-eval/const-eval-overflow-4.rs
similarity index 100%
rename from src/test/ui/const-eval-overflow-4.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow-4.rs
diff --git a/src/test/ui/const-eval-overflow-4.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4.stderr
similarity index 100%
rename from src/test/ui/const-eval-overflow-4.stderr
rename to src/test/ui/consts/const-eval/const-eval-overflow-4.stderr
diff --git a/src/test/compile-fail/const-eval-overflow-4b.rs b/src/test/ui/consts/const-eval/const-eval-overflow-4b.rs
similarity index 100%
rename from src/test/compile-fail/const-eval-overflow-4b.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow-4b.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
new file mode 100644
index 0000000..d171e7f
--- /dev/null
+++ b/src/test/ui/consts/const-eval/const-eval-overflow-4b.stderr
@@ -0,0 +1,24 @@
+error[E0308]: mismatched types
+ --> $DIR/const-eval-overflow-4b.rs:22:30
+ |
+LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
+ | ^^^ expected i8, found u8
+
+error[E0277]: cannot add `u8` to `i8`
+ --> $DIR/const-eval-overflow-4b.rs:22:28
+ |
+LL | : [u32; (i8::MAX as i8 + 1u8) as usize]
+ | ^ no implementation for `i8 + u8`
+ |
+ = help: the trait `std::ops::Add<u8>` is not implemented for `i8`
+
+error[E0604]: only `u8` can be cast as `char`, not `i8`
+ --> $DIR/const-eval-overflow-4b.rs:35:13
+ |
+LL | : [u32; 5i8 as char as usize]
+ | ^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0277, E0308, E0604.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/const-eval-overflow2.rs b/src/test/ui/consts/const-eval/const-eval-overflow2.rs
similarity index 100%
rename from src/test/compile-fail/const-eval-overflow2.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow2.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr
new file mode 100644
index 0000000..5cf5ce3
--- /dev/null
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2.stderr
@@ -0,0 +1,94 @@
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:24:1
+ |
+LL | / const VALS_I8: (i8,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i8::MIN - 1,
+ | | ----------- attempt to subtract with overflow
+LL | | );
+ | |_______^
+ |
+note: lint level defined here
+ --> $DIR/const-eval-overflow2.rs:18:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:30:1
+ |
+LL | / const VALS_I16: (i16,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i16::MIN - 1,
+ | | ------------ attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:36:1
+ |
+LL | / const VALS_I32: (i32,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i32::MIN - 1,
+ | | ------------ attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:42:1
+ |
+LL | / const VALS_I64: (i64,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i64::MIN - 1,
+ | | ------------ attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:48:1
+ |
+LL | / const VALS_U8: (u8,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | u8::MIN - 1,
+ | | ----------- attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:54:1
+ |
+LL | / const VALS_U16: (u16,) = (
+LL | | //~^ ERROR this constant cannot be used
+LL | | u16::MIN - 1,
+ | | ------------ attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:59:1
+ |
+LL | / const VALS_U32: (u32,) = (
+LL | | //~^ ERROR this constant cannot be used
+LL | | u32::MIN - 1,
+ | | ------------ attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2.rs:64:1
+ |
+LL | / const VALS_U64: (u64,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | u64::MIN - 1,
+ | | ------------ attempt to subtract with overflow
+LL | | );
+ | |_______^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/compile-fail/const-eval-overflow2b.rs b/src/test/ui/consts/const-eval/const-eval-overflow2b.rs
similarity index 100%
rename from src/test/compile-fail/const-eval-overflow2b.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow2b.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr
new file mode 100644
index 0000000..458a9e1
--- /dev/null
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2b.stderr
@@ -0,0 +1,94 @@
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:24:1
+ |
+LL | / const VALS_I8: (i8,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i8::MAX + 1,
+ | | ----------- attempt to add with overflow
+LL | | );
+ | |_______^
+ |
+note: lint level defined here
+ --> $DIR/const-eval-overflow2b.rs:18:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:30:1
+ |
+LL | / const VALS_I16: (i16,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i16::MAX + 1,
+ | | ------------ attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:36:1
+ |
+LL | / const VALS_I32: (i32,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i32::MAX + 1,
+ | | ------------ attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:42:1
+ |
+LL | / const VALS_I64: (i64,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i64::MAX + 1,
+ | | ------------ attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:48:1
+ |
+LL | / const VALS_U8: (u8,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | u8::MAX + 1,
+ | | ----------- attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:54:1
+ |
+LL | / const VALS_U16: (u16,) = (
+LL | | //~^ ERROR this constant cannot be used
+LL | | u16::MAX + 1,
+ | | ------------ attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:59:1
+ |
+LL | / const VALS_U32: (u32,) = (
+LL | | //~^ ERROR this constant cannot be used
+LL | | u32::MAX + 1,
+ | | ------------ attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2b.rs:64:1
+ |
+LL | / const VALS_U64: (u64,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | u64::MAX + 1,
+ | | ------------ attempt to add with overflow
+LL | | );
+ | |_______^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/compile-fail/const-eval-overflow2c.rs b/src/test/ui/consts/const-eval/const-eval-overflow2c.rs
similarity index 100%
rename from src/test/compile-fail/const-eval-overflow2c.rs
rename to src/test/ui/consts/const-eval/const-eval-overflow2c.rs
diff --git a/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr
new file mode 100644
index 0000000..8668602
--- /dev/null
+++ b/src/test/ui/consts/const-eval/const-eval-overflow2c.stderr
@@ -0,0 +1,94 @@
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:24:1
+ |
+LL | / const VALS_I8: (i8,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i8::MIN * 2,
+ | | ----------- attempt to multiply with overflow
+LL | | );
+ | |_______^
+ |
+note: lint level defined here
+ --> $DIR/const-eval-overflow2c.rs:18:9
+ |
+LL | #![deny(const_err)]
+ | ^^^^^^^^^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:30:1
+ |
+LL | / const VALS_I16: (i16,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i16::MIN * 2,
+ | | ------------ attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:36:1
+ |
+LL | / const VALS_I32: (i32,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i32::MIN * 2,
+ | | ------------ attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:42:1
+ |
+LL | / const VALS_I64: (i64,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | i64::MIN * 2,
+ | | ------------ attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:48:1
+ |
+LL | / const VALS_U8: (u8,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | u8::MAX * 2,
+ | | ----------- attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:54:1
+ |
+LL | / const VALS_U16: (u16,) = (
+LL | | //~^ ERROR this constant cannot be used
+LL | | u16::MAX * 2,
+ | | ------------ attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:59:1
+ |
+LL | / const VALS_U32: (u32,) = (
+LL | | //~^ ERROR this constant cannot be used
+LL | | u32::MAX * 2,
+ | | ------------ attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: this constant cannot be used
+ --> $DIR/const-eval-overflow2c.rs:64:1
+ |
+LL | / const VALS_U64: (u64,) =
+LL | | //~^ ERROR this constant cannot be used
+LL | | (
+LL | | u64::MAX * 2,
+ | | ------------ attempt to multiply with overflow
+LL | | );
+ | |_______^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/ui/const-eval-span.rs b/src/test/ui/consts/const-eval/const-eval-span.rs
similarity index 100%
rename from src/test/ui/const-eval-span.rs
rename to src/test/ui/consts/const-eval/const-eval-span.rs
diff --git a/src/test/ui/const-eval-span.stderr b/src/test/ui/consts/const-eval/const-eval-span.stderr
similarity index 100%
rename from src/test/ui/const-eval-span.stderr
rename to src/test/ui/consts/const-eval/const-eval-span.stderr
diff --git a/src/test/ui/const-eval/const_let.rs b/src/test/ui/consts/const-eval/const_let.rs
similarity index 100%
rename from src/test/ui/const-eval/const_let.rs
rename to src/test/ui/consts/const-eval/const_let.rs
diff --git a/src/test/ui/const-eval/const_let.stderr b/src/test/ui/consts/const-eval/const_let.stderr
similarity index 100%
rename from src/test/ui/const-eval/const_let.stderr
rename to src/test/ui/consts/const-eval/const_let.stderr
diff --git a/src/test/ui/const-eval/const_prop_errors.rs b/src/test/ui/consts/const-eval/const_prop_errors.rs
similarity index 100%
rename from src/test/ui/const-eval/const_prop_errors.rs
rename to src/test/ui/consts/const-eval/const_prop_errors.rs
diff --git a/src/test/ui/const-eval/const_raw_ptr_ops.rs b/src/test/ui/consts/const-eval/const_raw_ptr_ops.rs
similarity index 100%
rename from src/test/ui/const-eval/const_raw_ptr_ops.rs
rename to src/test/ui/consts/const-eval/const_raw_ptr_ops.rs
diff --git a/src/test/ui/const-eval/const_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr
similarity index 100%
rename from src/test/ui/const-eval/const_raw_ptr_ops.stderr
rename to src/test/ui/consts/const-eval/const_raw_ptr_ops.stderr
diff --git a/src/test/ui/const-eval/const_signed_pat.rs b/src/test/ui/consts/const-eval/const_signed_pat.rs
similarity index 100%
rename from src/test/ui/const-eval/const_signed_pat.rs
rename to src/test/ui/consts/const-eval/const_signed_pat.rs
diff --git a/src/test/ui/const-eval/const_transmute.rs b/src/test/ui/consts/const-eval/const_transmute.rs
similarity index 100%
rename from src/test/ui/const-eval/const_transmute.rs
rename to src/test/ui/consts/const-eval/const_transmute.rs
diff --git a/src/test/ui/const-eval/dont_promote_unstable_const_fn.nll.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr
similarity index 100%
rename from src/test/ui/const-eval/dont_promote_unstable_const_fn.nll.stderr
rename to src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.nll.stderr
diff --git a/src/test/ui/const-eval/dont_promote_unstable_const_fn.rs b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
similarity index 100%
rename from src/test/ui/const-eval/dont_promote_unstable_const_fn.rs
rename to src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.rs
diff --git a/src/test/ui/const-eval/dont_promote_unstable_const_fn.stderr b/src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
similarity index 100%
rename from src/test/ui/const-eval/dont_promote_unstable_const_fn.stderr
rename to src/test/ui/consts/const-eval/dont_promote_unstable_const_fn.stderr
diff --git a/src/test/ui/const-eval/double_check.rs b/src/test/ui/consts/const-eval/double_check.rs
similarity index 100%
rename from src/test/ui/const-eval/double_check.rs
rename to src/test/ui/consts/const-eval/double_check.rs
diff --git a/src/test/ui/const-eval/double_check2.rs b/src/test/ui/consts/const-eval/double_check2.rs
similarity index 100%
rename from src/test/ui/const-eval/double_check2.rs
rename to src/test/ui/consts/const-eval/double_check2.rs
diff --git a/src/test/ui/const-eval/double_check2.stderr b/src/test/ui/consts/const-eval/double_check2.stderr
similarity index 100%
rename from src/test/ui/const-eval/double_check2.stderr
rename to src/test/ui/consts/const-eval/double_check2.stderr
diff --git a/src/test/ui/const-eval/duration_conversion.rs b/src/test/ui/consts/const-eval/duration_conversion.rs
similarity index 100%
rename from src/test/ui/const-eval/duration_conversion.rs
rename to src/test/ui/consts/const-eval/duration_conversion.rs
diff --git a/src/test/ui/const-eval/enum_discr.rs b/src/test/ui/consts/const-eval/enum_discr.rs
similarity index 100%
rename from src/test/ui/const-eval/enum_discr.rs
rename to src/test/ui/consts/const-eval/enum_discr.rs
diff --git a/src/test/ui/const-eval/extern_fat_pointer.rs b/src/test/ui/consts/const-eval/extern_fat_pointer.rs
similarity index 100%
rename from src/test/ui/const-eval/extern_fat_pointer.rs
rename to src/test/ui/consts/const-eval/extern_fat_pointer.rs
diff --git a/src/test/ui/const-eval/feature-gate-const_fn_union.rs b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs
similarity index 100%
rename from src/test/ui/const-eval/feature-gate-const_fn_union.rs
rename to src/test/ui/consts/const-eval/feature-gate-const_fn_union.rs
diff --git a/src/test/ui/const-eval/feature-gate-const_fn_union.stderr b/src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr
similarity index 100%
rename from src/test/ui/const-eval/feature-gate-const_fn_union.stderr
rename to src/test/ui/consts/const-eval/feature-gate-const_fn_union.stderr
diff --git a/src/test/ui/const-eval/ice-generic-assoc-const.rs b/src/test/ui/consts/const-eval/ice-generic-assoc-const.rs
similarity index 100%
rename from src/test/ui/const-eval/ice-generic-assoc-const.rs
rename to src/test/ui/consts/const-eval/ice-generic-assoc-const.rs
diff --git a/src/test/ui/const-eval/ice-packed.rs b/src/test/ui/consts/const-eval/ice-packed.rs
similarity index 100%
rename from src/test/ui/const-eval/ice-packed.rs
rename to src/test/ui/consts/const-eval/ice-packed.rs
diff --git a/src/test/ui/const-eval/index_out_of_bounds.rs b/src/test/ui/consts/const-eval/index_out_of_bounds.rs
similarity index 100%
rename from src/test/ui/const-eval/index_out_of_bounds.rs
rename to src/test/ui/consts/const-eval/index_out_of_bounds.rs
diff --git a/src/test/ui/const-eval/index_out_of_bounds.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds.stderr
similarity index 100%
rename from src/test/ui/const-eval/index_out_of_bounds.stderr
rename to src/test/ui/consts/const-eval/index_out_of_bounds.stderr
diff --git a/src/test/ui/const-eval/index_out_of_bounds_propagated.rs b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs
similarity index 100%
rename from src/test/ui/const-eval/index_out_of_bounds_propagated.rs
rename to src/test/ui/consts/const-eval/index_out_of_bounds_propagated.rs
diff --git a/src/test/ui/const-eval/index_out_of_bounds_propagated.stderr b/src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
similarity index 100%
rename from src/test/ui/const-eval/index_out_of_bounds_propagated.stderr
rename to src/test/ui/consts/const-eval/index_out_of_bounds_propagated.stderr
diff --git a/src/test/ui/const-eval/infinite_loop.rs b/src/test/ui/consts/const-eval/infinite_loop.rs
similarity index 100%
rename from src/test/ui/const-eval/infinite_loop.rs
rename to src/test/ui/consts/const-eval/infinite_loop.rs
diff --git a/src/test/ui/const-eval/infinite_loop.stderr b/src/test/ui/consts/const-eval/infinite_loop.stderr
similarity index 100%
rename from src/test/ui/const-eval/infinite_loop.stderr
rename to src/test/ui/consts/const-eval/infinite_loop.stderr
diff --git a/src/test/ui/const-eval/issue-43197.nll.stderr b/src/test/ui/consts/const-eval/issue-43197.nll.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-43197.nll.stderr
rename to src/test/ui/consts/const-eval/issue-43197.nll.stderr
diff --git a/src/test/ui/const-eval/issue-43197.rs b/src/test/ui/consts/const-eval/issue-43197.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-43197.rs
rename to src/test/ui/consts/const-eval/issue-43197.rs
diff --git a/src/test/ui/const-eval/issue-43197.stderr b/src/test/ui/consts/const-eval/issue-43197.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-43197.stderr
rename to src/test/ui/consts/const-eval/issue-43197.stderr
diff --git a/src/test/ui/const-eval/issue-44578.nll.stderr b/src/test/ui/consts/const-eval/issue-44578.nll.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-44578.nll.stderr
rename to src/test/ui/consts/const-eval/issue-44578.nll.stderr
diff --git a/src/test/ui/const-eval/issue-44578.rs b/src/test/ui/consts/const-eval/issue-44578.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-44578.rs
rename to src/test/ui/consts/const-eval/issue-44578.rs
diff --git a/src/test/ui/const-eval/issue-44578.stderr b/src/test/ui/consts/const-eval/issue-44578.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-44578.stderr
rename to src/test/ui/consts/const-eval/issue-44578.stderr
diff --git a/src/test/ui/const-eval/issue-47971.rs b/src/test/ui/consts/const-eval/issue-47971.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-47971.rs
rename to src/test/ui/consts/const-eval/issue-47971.rs
diff --git a/src/test/ui/const-eval/issue-50706.rs b/src/test/ui/consts/const-eval/issue-50706.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-50706.rs
rename to src/test/ui/consts/const-eval/issue-50706.rs
diff --git a/src/test/ui/const-eval/issue-50814-2.rs b/src/test/ui/consts/const-eval/issue-50814-2.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-50814-2.rs
rename to src/test/ui/consts/const-eval/issue-50814-2.rs
diff --git a/src/test/ui/const-eval/issue-50814-2.stderr b/src/test/ui/consts/const-eval/issue-50814-2.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-50814-2.stderr
rename to src/test/ui/consts/const-eval/issue-50814-2.stderr
diff --git a/src/test/ui/const-eval/issue-50814.rs b/src/test/ui/consts/const-eval/issue-50814.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-50814.rs
rename to src/test/ui/consts/const-eval/issue-50814.rs
diff --git a/src/test/ui/const-eval/issue-50814.stderr b/src/test/ui/consts/const-eval/issue-50814.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-50814.stderr
rename to src/test/ui/consts/const-eval/issue-50814.stderr
diff --git a/src/test/ui/const-eval/issue-51300.rs b/src/test/ui/consts/const-eval/issue-51300.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-51300.rs
rename to src/test/ui/consts/const-eval/issue-51300.rs
diff --git a/src/test/ui/const-eval/issue-52442.rs b/src/test/ui/consts/const-eval/issue-52442.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-52442.rs
rename to src/test/ui/consts/const-eval/issue-52442.rs
diff --git a/src/test/ui/const-eval/issue-52442.stderr b/src/test/ui/consts/const-eval/issue-52442.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-52442.stderr
rename to src/test/ui/consts/const-eval/issue-52442.stderr
diff --git a/src/test/ui/const-eval/issue-52443.rs b/src/test/ui/consts/const-eval/issue-52443.rs
similarity index 100%
rename from src/test/ui/const-eval/issue-52443.rs
rename to src/test/ui/consts/const-eval/issue-52443.rs
diff --git a/src/test/ui/const-eval/issue-52443.stderr b/src/test/ui/consts/const-eval/issue-52443.stderr
similarity index 100%
rename from src/test/ui/const-eval/issue-52443.stderr
rename to src/test/ui/consts/const-eval/issue-52443.stderr
diff --git a/src/test/ui/const-eval/match-test-ptr-null.rs b/src/test/ui/consts/const-eval/match-test-ptr-null.rs
similarity index 100%
rename from src/test/ui/const-eval/match-test-ptr-null.rs
rename to src/test/ui/consts/const-eval/match-test-ptr-null.rs
diff --git a/src/test/ui/const-eval/match-test-ptr-null.stderr b/src/test/ui/consts/const-eval/match-test-ptr-null.stderr
similarity index 100%
rename from src/test/ui/const-eval/match-test-ptr-null.stderr
rename to src/test/ui/consts/const-eval/match-test-ptr-null.stderr
diff --git a/src/test/ui/const-eval/no_lint_for_statically_known_error.rs b/src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs
similarity index 100%
rename from src/test/ui/const-eval/no_lint_for_statically_known_error.rs
rename to src/test/ui/consts/const-eval/no_lint_for_statically_known_error.rs
diff --git a/src/test/ui/const-eval/promote_mutable_zst_mir_borrowck.rs b/src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs
similarity index 100%
rename from src/test/ui/const-eval/promote_mutable_zst_mir_borrowck.rs
rename to src/test/ui/consts/const-eval/promote_mutable_zst_mir_borrowck.rs
diff --git a/src/test/ui/const-eval/promoted_const_fn_fail.rs b/src/test/ui/consts/const-eval/promoted_const_fn_fail.rs
similarity index 100%
rename from src/test/ui/const-eval/promoted_const_fn_fail.rs
rename to src/test/ui/consts/const-eval/promoted_const_fn_fail.rs
diff --git a/src/test/ui/const-eval/promoted_errors.rs b/src/test/ui/consts/const-eval/promoted_errors.rs
similarity index 100%
rename from src/test/ui/const-eval/promoted_errors.rs
rename to src/test/ui/consts/const-eval/promoted_errors.rs
diff --git a/src/test/ui/const-eval/promoted_errors.stderr b/src/test/ui/consts/const-eval/promoted_errors.stderr
similarity index 100%
rename from src/test/ui/const-eval/promoted_errors.stderr
rename to src/test/ui/consts/const-eval/promoted_errors.stderr
diff --git a/src/test/ui/const-eval/promoted_raw_ptr_ops.rs b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
similarity index 100%
rename from src/test/ui/const-eval/promoted_raw_ptr_ops.rs
rename to src/test/ui/consts/const-eval/promoted_raw_ptr_ops.rs
diff --git a/src/test/ui/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
similarity index 100%
rename from src/test/ui/const-eval/promoted_raw_ptr_ops.stderr
rename to src/test/ui/consts/const-eval/promoted_raw_ptr_ops.stderr
diff --git a/src/test/ui/const-eval/pub_const_err.rs b/src/test/ui/consts/const-eval/pub_const_err.rs
similarity index 100%
rename from src/test/ui/const-eval/pub_const_err.rs
rename to src/test/ui/consts/const-eval/pub_const_err.rs
diff --git a/src/test/ui/const-eval/pub_const_err.stderr b/src/test/ui/consts/const-eval/pub_const_err.stderr
similarity index 100%
rename from src/test/ui/const-eval/pub_const_err.stderr
rename to src/test/ui/consts/const-eval/pub_const_err.stderr
diff --git a/src/test/ui/const-eval/pub_const_err_bin.rs b/src/test/ui/consts/const-eval/pub_const_err_bin.rs
similarity index 100%
rename from src/test/ui/const-eval/pub_const_err_bin.rs
rename to src/test/ui/consts/const-eval/pub_const_err_bin.rs
diff --git a/src/test/ui/const-eval/pub_const_err_bin.stderr b/src/test/ui/consts/const-eval/pub_const_err_bin.stderr
similarity index 100%
rename from src/test/ui/const-eval/pub_const_err_bin.stderr
rename to src/test/ui/consts/const-eval/pub_const_err_bin.stderr
diff --git a/src/test/ui/const-eval/ref_to_float_transmute.rs b/src/test/ui/consts/const-eval/ref_to_float_transmute.rs
similarity index 100%
rename from src/test/ui/const-eval/ref_to_float_transmute.rs
rename to src/test/ui/consts/const-eval/ref_to_float_transmute.rs
diff --git a/src/test/ui/const-eval/ref_to_int_match.rs b/src/test/ui/consts/const-eval/ref_to_int_match.rs
similarity index 100%
rename from src/test/ui/const-eval/ref_to_int_match.rs
rename to src/test/ui/consts/const-eval/ref_to_int_match.rs
diff --git a/src/test/ui/const-eval/ref_to_int_match.stderr b/src/test/ui/consts/const-eval/ref_to_int_match.stderr
similarity index 100%
rename from src/test/ui/const-eval/ref_to_int_match.stderr
rename to src/test/ui/consts/const-eval/ref_to_int_match.stderr
diff --git a/src/test/ui/const-eval/shift_overflow.rs b/src/test/ui/consts/const-eval/shift_overflow.rs
similarity index 100%
rename from src/test/ui/const-eval/shift_overflow.rs
rename to src/test/ui/consts/const-eval/shift_overflow.rs
diff --git a/src/test/ui/const-eval/shift_overflow.stderr b/src/test/ui/consts/const-eval/shift_overflow.stderr
similarity index 100%
rename from src/test/ui/const-eval/shift_overflow.stderr
rename to src/test/ui/consts/const-eval/shift_overflow.stderr
diff --git a/src/test/ui/const-eval/simple_with_undef.rs b/src/test/ui/consts/const-eval/simple_with_undef.rs
similarity index 100%
rename from src/test/ui/const-eval/simple_with_undef.rs
rename to src/test/ui/consts/const-eval/simple_with_undef.rs
diff --git a/src/test/ui/const-eval/strlen.rs b/src/test/ui/consts/const-eval/strlen.rs
similarity index 100%
rename from src/test/ui/const-eval/strlen.rs
rename to src/test/ui/consts/const-eval/strlen.rs
diff --git a/src/test/ui/const-eval/ub-enum-ptr.rs b/src/test/ui/consts/const-eval/ub-enum-ptr.rs
similarity index 100%
rename from src/test/ui/const-eval/ub-enum-ptr.rs
rename to src/test/ui/consts/const-eval/ub-enum-ptr.rs
diff --git a/src/test/ui/const-eval/ub-enum-ptr.stderr b/src/test/ui/consts/const-eval/ub-enum-ptr.stderr
similarity index 100%
rename from src/test/ui/const-eval/ub-enum-ptr.stderr
rename to src/test/ui/consts/const-eval/ub-enum-ptr.stderr
diff --git a/src/test/ui/const-eval/ub-ptr-in-usize.rs b/src/test/ui/consts/const-eval/ub-ptr-in-usize.rs
similarity index 100%
rename from src/test/ui/const-eval/ub-ptr-in-usize.rs
rename to src/test/ui/consts/const-eval/ub-ptr-in-usize.rs
diff --git a/src/test/ui/const-eval/ub-uninhabit.rs b/src/test/ui/consts/const-eval/ub-uninhabit.rs
similarity index 100%
rename from src/test/ui/const-eval/ub-uninhabit.rs
rename to src/test/ui/consts/const-eval/ub-uninhabit.rs
diff --git a/src/test/ui/const-eval/ub-uninhabit.stderr b/src/test/ui/consts/const-eval/ub-uninhabit.stderr
similarity index 100%
rename from src/test/ui/const-eval/ub-uninhabit.stderr
rename to src/test/ui/consts/const-eval/ub-uninhabit.stderr
diff --git a/src/test/ui/const-eval/ub-usize-in-ref.rs b/src/test/ui/consts/const-eval/ub-usize-in-ref.rs
similarity index 100%
rename from src/test/ui/const-eval/ub-usize-in-ref.rs
rename to src/test/ui/consts/const-eval/ub-usize-in-ref.rs
diff --git a/src/test/ui/const-eval/union-const-eval-field.rs b/src/test/ui/consts/const-eval/union-const-eval-field.rs
similarity index 100%
rename from src/test/ui/const-eval/union-const-eval-field.rs
rename to src/test/ui/consts/const-eval/union-const-eval-field.rs
diff --git a/src/test/ui/const-eval/union-const-eval-field.stderr b/src/test/ui/consts/const-eval/union-const-eval-field.stderr
similarity index 100%
rename from src/test/ui/const-eval/union-const-eval-field.stderr
rename to src/test/ui/consts/const-eval/union-const-eval-field.stderr
diff --git a/src/test/ui/const-eval/union-ice.rs b/src/test/ui/consts/const-eval/union-ice.rs
similarity index 100%
rename from src/test/ui/const-eval/union-ice.rs
rename to src/test/ui/consts/const-eval/union-ice.rs
diff --git a/src/test/ui/const-eval/union-ice.stderr b/src/test/ui/consts/const-eval/union-ice.stderr
similarity index 100%
rename from src/test/ui/const-eval/union-ice.stderr
rename to src/test/ui/consts/const-eval/union-ice.stderr
diff --git a/src/test/ui/const-eval/union-ub.rs b/src/test/ui/consts/const-eval/union-ub.rs
similarity index 100%
rename from src/test/ui/const-eval/union-ub.rs
rename to src/test/ui/consts/const-eval/union-ub.rs
diff --git a/src/test/ui/const-eval/union-ub.stderr b/src/test/ui/consts/const-eval/union-ub.stderr
similarity index 100%
rename from src/test/ui/const-eval/union-ub.stderr
rename to src/test/ui/consts/const-eval/union-ub.stderr
diff --git a/src/test/ui/const-eval/union_promotion.rs b/src/test/ui/consts/const-eval/union_promotion.rs
similarity index 100%
rename from src/test/ui/const-eval/union_promotion.rs
rename to src/test/ui/consts/const-eval/union_promotion.rs
diff --git a/src/test/ui/const-eval/union_promotion.stderr b/src/test/ui/consts/const-eval/union_promotion.stderr
similarity index 100%
rename from src/test/ui/const-eval/union_promotion.stderr
rename to src/test/ui/consts/const-eval/union_promotion.stderr
diff --git a/src/test/ui/const-expr-addr-operator.rs b/src/test/ui/consts/const-expr-addr-operator.rs
similarity index 100%
rename from src/test/ui/const-expr-addr-operator.rs
rename to src/test/ui/consts/const-expr-addr-operator.rs
diff --git a/src/test/compile-fail/const-fn-destructuring-arg.rs b/src/test/ui/consts/const-fn-destructuring-arg.rs
similarity index 100%
rename from src/test/compile-fail/const-fn-destructuring-arg.rs
rename to src/test/ui/consts/const-fn-destructuring-arg.rs
diff --git a/src/test/ui/consts/const-fn-destructuring-arg.stderr b/src/test/ui/consts/const-fn-destructuring-arg.stderr
new file mode 100644
index 0000000..029d63a
--- /dev/null
+++ b/src/test/ui/consts/const-fn-destructuring-arg.stderr
@@ -0,0 +1,35 @@
+error[E0658]: arguments of constant functions can only be immutable by-value bindings (see issue #48821)
+ --> $DIR/const-fn-destructuring-arg.rs:17:13
+ |
+LL | a,
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: arguments of constant functions can only be immutable by-value bindings (see issue #48821)
+ --> $DIR/const-fn-destructuring-arg.rs:19:13
+ |
+LL | b
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-destructuring-arg.rs:22:5
+ |
+LL | a + b
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-destructuring-arg.rs:22:9
+ |
+LL | a + b
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/const-fn-error.rs b/src/test/ui/consts/const-fn-error.rs
similarity index 100%
rename from src/test/ui/const-fn-error.rs
rename to src/test/ui/consts/const-fn-error.rs
diff --git a/src/test/ui/const-fn-error.stderr b/src/test/ui/consts/const-fn-error.stderr
similarity index 100%
rename from src/test/ui/const-fn-error.stderr
rename to src/test/ui/consts/const-fn-error.stderr
diff --git a/src/test/ui/const-fn-mismatch.rs b/src/test/ui/consts/const-fn-mismatch.rs
similarity index 100%
rename from src/test/ui/const-fn-mismatch.rs
rename to src/test/ui/consts/const-fn-mismatch.rs
diff --git a/src/test/ui/const-fn-mismatch.stderr b/src/test/ui/consts/const-fn-mismatch.stderr
similarity index 100%
rename from src/test/ui/const-fn-mismatch.stderr
rename to src/test/ui/consts/const-fn-mismatch.stderr
diff --git a/src/test/ui/const-fn-not-in-trait.rs b/src/test/ui/consts/const-fn-not-in-trait.rs
similarity index 100%
rename from src/test/ui/const-fn-not-in-trait.rs
rename to src/test/ui/consts/const-fn-not-in-trait.rs
diff --git a/src/test/ui/const-fn-not-in-trait.stderr b/src/test/ui/consts/const-fn-not-in-trait.stderr
similarity index 100%
rename from src/test/ui/const-fn-not-in-trait.stderr
rename to src/test/ui/consts/const-fn-not-in-trait.stderr
diff --git a/src/test/compile-fail/const-fn-not-safe-for-const.rs b/src/test/ui/consts/const-fn-not-safe-for-const.rs
similarity index 100%
rename from src/test/compile-fail/const-fn-not-safe-for-const.rs
rename to src/test/ui/consts/const-fn-not-safe-for-const.rs
diff --git a/src/test/ui/consts/const-fn-not-safe-for-const.stderr b/src/test/ui/consts/const-fn-not-safe-for-const.stderr
new file mode 100644
index 0000000..1e99a43
--- /dev/null
+++ b/src/test/ui/consts/const-fn-not-safe-for-const.stderr
@@ -0,0 +1,76 @@
+error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/const-fn-not-safe-for-const.rs:20:14
+ |
+LL | unsafe { transmute(x) } //~ ERROR E0015
+ | ^^^^^^^^^^^^
+
+error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/const-fn-not-safe-for-const.rs:24:5
+ |
+LL | random() //~ ERROR E0015
+ | ^^^^^^^^
+
+error[E0013]: constant functions cannot refer to statics, use a constant instead
+ --> $DIR/const-fn-not-safe-for-const.rs:30:5
+ |
+LL | Y
+ | ^
+
+error[E0013]: constant functions cannot refer to statics, use a constant instead
+ --> $DIR/const-fn-not-safe-for-const.rs:35:5
+ |
+LL | &Y
+ | ^^
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-not-safe-for-const.rs:40:13
+ |
+LL | let x = 22;
+ | ^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-not-safe-for-const.rs:40:13
+ |
+LL | let x = 22;
+ | ^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-not-safe-for-const.rs:43:13
+ |
+LL | let y = 44;
+ | ^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-not-safe-for-const.rs:43:13
+ |
+LL | let y = 44;
+ | ^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-not-safe-for-const.rs:46:5
+ |
+LL | x + y
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: let bindings in constant functions are unstable (see issue #48821)
+ --> $DIR/const-fn-not-safe-for-const.rs:46:9
+ |
+LL | x + y
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 10 previous errors
+
+Some errors occurred: E0013, E0015, E0658.
+For more information about an error, try `rustc --explain E0013`.
diff --git a/src/test/compile-fail/const-fn-stability-calls-3.rs b/src/test/ui/consts/const-fn-stability-calls-3.rs
similarity index 100%
rename from src/test/compile-fail/const-fn-stability-calls-3.rs
rename to src/test/ui/consts/const-fn-stability-calls-3.rs
diff --git a/src/test/ui/consts/const-fn-stability-calls-3.stderr b/src/test/ui/consts/const-fn-stability-calls-3.stderr
new file mode 100644
index 0000000..50c959d
--- /dev/null
+++ b/src/test/ui/consts/const-fn-stability-calls-3.stderr
@@ -0,0 +1,10 @@
+error: compilation successful
+ --> $DIR/const-fn-stability-calls-3.rs:23:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let x = foo(); // use outside a constant is ok
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/const-integer-bool-ops.rs b/src/test/ui/consts/const-integer-bool-ops.rs
similarity index 100%
rename from src/test/compile-fail/const-integer-bool-ops.rs
rename to src/test/ui/consts/const-integer-bool-ops.rs
diff --git a/src/test/ui/consts/const-integer-bool-ops.stderr b/src/test/ui/consts/const-integer-bool-ops.stderr
new file mode 100644
index 0000000..8075a3f
--- /dev/null
+++ b/src/test/ui/consts/const-integer-bool-ops.stderr
@@ -0,0 +1,135 @@
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:11:18
+ |
+LL | const X: usize = 42 && 39;
+ | ^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:11:24
+ |
+LL | const X: usize = 42 && 39;
+ | ^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:11:18
+ |
+LL | const X: usize = 42 && 39;
+ | ^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:20:19
+ |
+LL | const X1: usize = 42 || 39;
+ | ^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:20:25
+ |
+LL | const X1: usize = 42 || 39;
+ | ^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:20:19
+ |
+LL | const X1: usize = 42 || 39;
+ | ^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:29:19
+ |
+LL | const X2: usize = -42 || -39;
+ | ^^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:29:26
+ |
+LL | const X2: usize = -42 || -39;
+ | ^^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:29:19
+ |
+LL | const X2: usize = -42 || -39;
+ | ^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:38:19
+ |
+LL | const X3: usize = -42 && -39;
+ | ^^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:38:26
+ |
+LL | const X3: usize = -42 && -39;
+ | ^^^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:38:19
+ |
+LL | const X3: usize = -42 && -39;
+ | ^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:47:18
+ |
+LL | const Y: usize = 42.0 == 42.0;
+ | ^^^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:52:19
+ |
+LL | const Y1: usize = 42.0 >= 42.0;
+ | ^^^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:57:19
+ |
+LL | const Y2: usize = 42.0 <= 42.0;
+ | ^^^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:62:19
+ |
+LL | const Y3: usize = 42.0 > 42.0;
+ | ^^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:67:19
+ |
+LL | const Y4: usize = 42.0 < 42.0;
+ | ^^^^^^^^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/const-integer-bool-ops.rs:72:19
+ |
+LL | const Y5: usize = 42.0 != 42.0;
+ | ^^^^^^^^^^^^ expected usize, found bool
+
+error: aborting due to 18 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/const-len-underflow-separate-spans.rs b/src/test/ui/consts/const-len-underflow-separate-spans.rs
similarity index 100%
rename from src/test/ui/const-len-underflow-separate-spans.rs
rename to src/test/ui/consts/const-len-underflow-separate-spans.rs
diff --git a/src/test/ui/const-len-underflow-separate-spans.stderr b/src/test/ui/consts/const-len-underflow-separate-spans.stderr
similarity index 100%
rename from src/test/ui/const-len-underflow-separate-spans.stderr
rename to src/test/ui/consts/const-len-underflow-separate-spans.stderr
diff --git a/src/test/compile-fail/const-len-underflow-subspans.rs b/src/test/ui/consts/const-len-underflow-subspans.rs
similarity index 100%
rename from src/test/compile-fail/const-len-underflow-subspans.rs
rename to src/test/ui/consts/const-len-underflow-subspans.rs
diff --git a/src/test/ui/consts/const-len-underflow-subspans.stderr b/src/test/ui/consts/const-len-underflow-subspans.stderr
new file mode 100644
index 0000000..860716c
--- /dev/null
+++ b/src/test/ui/consts/const-len-underflow-subspans.stderr
@@ -0,0 +1,19 @@
+error: attempt to subtract with overflow
+ --> $DIR/const-len-underflow-subspans.rs:18:17
+ |
+LL | let a: [i8; ONE - TWO] = unimplemented!();
+ | ^^^^^^^^^
+ |
+ = note: #[deny(const_err)] on by default
+
+error[E0080]: could not evaluate constant expression
+ --> $DIR/const-len-underflow-subspans.rs:18:12
+ |
+LL | let a: [i8; ONE - TWO] = unimplemented!();
+ | ^^^^^---------^
+ | |
+ | attempt to subtract with overflow
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/consts/const-match-check.eval1.stderr b/src/test/ui/consts/const-match-check.eval1.stderr
new file mode 100644
index 0000000..3caf149
--- /dev/null
+++ b/src/test/ui/consts/const-match-check.eval1.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in local binding: `_` not covered
+ --> $DIR/const-match-check.rs:35:15
+ |
+LL | A = { let 0 = 0; 0 },
+ | ^ pattern `_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/ui/consts/const-match-check.eval2.stderr b/src/test/ui/consts/const-match-check.eval2.stderr
new file mode 100644
index 0000000..de85d4d
--- /dev/null
+++ b/src/test/ui/consts/const-match-check.eval2.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in local binding: `_` not covered
+ --> $DIR/const-match-check.rs:41:24
+ |
+LL | let x: [i32; { let 0 = 0; 0 }] = [];
+ | ^ pattern `_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/ui/consts/const-match-check.matchck.stderr b/src/test/ui/consts/const-match-check.matchck.stderr
new file mode 100644
index 0000000..bbf1169
--- /dev/null
+++ b/src/test/ui/consts/const-match-check.matchck.stderr
@@ -0,0 +1,27 @@
+error[E0005]: refutable pattern in local binding: `_` not covered
+ --> $DIR/const-match-check.rs:14:22
+ |
+LL | const X: i32 = { let 0 = 0; 0 };
+ | ^ pattern `_` not covered
+
+error[E0005]: refutable pattern in local binding: `_` not covered
+ --> $DIR/const-match-check.rs:18:23
+ |
+LL | static Y: i32 = { let 0 = 0; 0 };
+ | ^ pattern `_` not covered
+
+error[E0005]: refutable pattern in local binding: `_` not covered
+ --> $DIR/const-match-check.rs:23:26
+ |
+LL | const X: i32 = { let 0 = 0; 0 };
+ | ^ pattern `_` not covered
+
+error[E0005]: refutable pattern in local binding: `_` not covered
+ --> $DIR/const-match-check.rs:29:26
+ |
+LL | const X: i32 = { let 0 = 0; 0 };
+ | ^ pattern `_` not covered
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/compile-fail/const-match-check.rs b/src/test/ui/consts/const-match-check.rs
similarity index 100%
rename from src/test/compile-fail/const-match-check.rs
rename to src/test/ui/consts/const-match-check.rs
diff --git a/src/test/compile-fail/const-match-pattern-arm.rs b/src/test/ui/consts/const-match-pattern-arm.rs
similarity index 100%
rename from src/test/compile-fail/const-match-pattern-arm.rs
rename to src/test/ui/consts/const-match-pattern-arm.rs
diff --git a/src/test/ui/consts/const-match-pattern-arm.stderr b/src/test/ui/consts/const-match-pattern-arm.stderr
new file mode 100644
index 0000000..201aa7c
--- /dev/null
+++ b/src/test/ui/consts/const-match-pattern-arm.stderr
@@ -0,0 +1,15 @@
+error[E0019]: constant contains unimplemented expression type
+ --> $DIR/const-match-pattern-arm.rs:14:5
+ |
+LL | Some(value) => true,
+ | ^^^^^^^^^^^
+
+error[E0019]: constant contains unimplemented expression type
+ --> $DIR/const-match-pattern-arm.rs:21:9
+ |
+LL | Some(value) => true,
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0019`.
diff --git a/src/test/ui/const-pattern-irrefutable.rs b/src/test/ui/consts/const-pattern-irrefutable.rs
similarity index 100%
rename from src/test/ui/const-pattern-irrefutable.rs
rename to src/test/ui/consts/const-pattern-irrefutable.rs
diff --git a/src/test/ui/const-pattern-irrefutable.stderr b/src/test/ui/consts/const-pattern-irrefutable.stderr
similarity index 100%
rename from src/test/ui/const-pattern-irrefutable.stderr
rename to src/test/ui/consts/const-pattern-irrefutable.stderr
diff --git a/src/test/ui/const-pattern-not-const-evaluable.rs b/src/test/ui/consts/const-pattern-not-const-evaluable.rs
similarity index 100%
rename from src/test/ui/const-pattern-not-const-evaluable.rs
rename to src/test/ui/consts/const-pattern-not-const-evaluable.rs
diff --git a/src/test/compile-fail/const-size_of-cycle.rs b/src/test/ui/consts/const-size_of-cycle.rs
similarity index 100%
rename from src/test/compile-fail/const-size_of-cycle.rs
rename to src/test/ui/consts/const-size_of-cycle.rs
diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr
new file mode 100644
index 0000000..b10dd50
--- /dev/null
+++ b/src/test/ui/consts/const-size_of-cycle.stderr
@@ -0,0 +1,18 @@
+error[E0391]: cycle detected when computing layout of `Foo`
+ |
+note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: [u8; _] }`...
+note: ...which requires const-evaluating `Foo::bytes::{{constant}}`...
+ --> $SRC_DIR/libcore/mem.rs:323:14
+ |
+LL | unsafe { intrinsics::size_of::<T>() }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = note: ...which again requires computing layout of `Foo`, completing the cycle
+note: cycle used when const-evaluating `Foo::bytes::{{constant}}`
+ --> $SRC_DIR/libcore/mem.rs:323:14
+ |
+LL | unsafe { intrinsics::size_of::<T>() }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/const-slice-oob.rs b/src/test/ui/consts/const-slice-oob.rs
similarity index 100%
rename from src/test/compile-fail/const-slice-oob.rs
rename to src/test/ui/consts/const-slice-oob.rs
diff --git a/src/test/ui/consts/const-slice-oob.stderr b/src/test/ui/consts/const-slice-oob.stderr
new file mode 100644
index 0000000..30260c3
--- /dev/null
+++ b/src/test/ui/consts/const-slice-oob.stderr
@@ -0,0 +1,12 @@
+error: this constant cannot be used
+ --> $DIR/const-slice-oob.rs:14:1
+ |
+LL | const BAR: u32 = FOO[5];
+ | ^^^^^^^^^^^^^^^^^------^
+ | |
+ | index out of bounds: the len is 3 but the index is 5
+ |
+ = note: #[deny(const_err)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/const-tup-index-span.rs b/src/test/ui/consts/const-tup-index-span.rs
similarity index 100%
rename from src/test/compile-fail/const-tup-index-span.rs
rename to src/test/ui/consts/const-tup-index-span.rs
diff --git a/src/test/ui/consts/const-tup-index-span.stderr b/src/test/ui/consts/const-tup-index-span.stderr
new file mode 100644
index 0000000..e924862
--- /dev/null
+++ b/src/test/ui/consts/const-tup-index-span.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/const-tup-index-span.rs:13:23
+ |
+LL | const TUP: (usize,) = 5usize << 64;
+ | ^^^^^^^^^^^^ expected tuple, found usize
+ |
+ = note: expected type `(usize,)`
+ found type `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/const-type-mismatch.rs b/src/test/ui/consts/const-type-mismatch.rs
similarity index 100%
rename from src/test/ui/const-type-mismatch.rs
rename to src/test/ui/consts/const-type-mismatch.rs
diff --git a/src/test/ui/const-type-mismatch.stderr b/src/test/ui/consts/const-type-mismatch.stderr
similarity index 100%
rename from src/test/ui/const-type-mismatch.stderr
rename to src/test/ui/consts/const-type-mismatch.stderr
diff --git a/src/test/compile-fail/const-typeid-of.rs b/src/test/ui/consts/const-typeid-of.rs
similarity index 100%
rename from src/test/compile-fail/const-typeid-of.rs
rename to src/test/ui/consts/const-typeid-of.rs
diff --git a/src/test/ui/consts/const-typeid-of.stderr b/src/test/ui/consts/const-typeid-of.stderr
new file mode 100644
index 0000000..d13ced9
--- /dev/null
+++ b/src/test/ui/consts/const-typeid-of.stderr
@@ -0,0 +1,10 @@
+error: `std::any::TypeId::of` is not yet stable as a const fn
+ --> $DIR/const-typeid-of.rs:16:26
+ |
+LL | const A_ID: TypeId = TypeId::of::<A>();
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: in Nightly builds, add `#![feature(const_type_id)]` to the crate attributes to enable
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/const-unsized.rs b/src/test/ui/consts/const-unsized.rs
similarity index 100%
rename from src/test/ui/const-unsized.rs
rename to src/test/ui/consts/const-unsized.rs
diff --git a/src/test/ui/consts/const-unsized.stderr b/src/test/ui/consts/const-unsized.stderr
new file mode 100644
index 0000000..83d23bc
--- /dev/null
+++ b/src/test/ui/consts/const-unsized.stderr
@@ -0,0 +1,43 @@
+error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:13:29
+ |
+LL | const CONST_0: Debug+Sync = *(&0 as &(Debug+Sync));
+ | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:16:24
+ |
+LL | const CONST_FOO: str = *"foo";
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `(dyn std::fmt::Debug + std::marker::Sync + 'static)` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:19:31
+ |
+LL | static STATIC_1: Debug+Sync = *(&1 as &(Debug+Sync));
+ | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::fmt::Debug + std::marker::Sync + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: constant expressions must have a statically known size
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/const-unsized.rs:22:26
+ |
+LL | static STATIC_BAR: str = *"bar";
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: constant expressions must have a statically known size
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/copy-a-resource.rs b/src/test/ui/copy-a-resource.rs
similarity index 100%
rename from src/test/compile-fail/copy-a-resource.rs
rename to src/test/ui/copy-a-resource.rs
diff --git a/src/test/ui/copy-a-resource.stderr b/src/test/ui/copy-a-resource.stderr
new file mode 100644
index 0000000..6d8d488
--- /dev/null
+++ b/src/test/ui/copy-a-resource.stderr
@@ -0,0 +1,16 @@
+error[E0599]: no method named `clone` found for type `foo` in the current scope
+ --> $DIR/copy-a-resource.rs:28:16
+ |
+LL | struct foo {
+ | ---------- method `clone` not found for this
+...
+LL | let _y = x.clone();
+ | ^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/crate-name-mismatch.rs b/src/test/ui/crate-name-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/crate-name-mismatch.rs
rename to src/test/ui/crate-name-mismatch.rs
diff --git a/src/test/ui/crate-name-mismatch.stderr b/src/test/ui/crate-name-mismatch.stderr
new file mode 100644
index 0000000..26ef91b
--- /dev/null
+++ b/src/test/ui/crate-name-mismatch.stderr
@@ -0,0 +1,8 @@
+error: --crate-name and #[crate_name] are required to match, but `foo` != `bar`
+ --> $DIR/crate-name-mismatch.rs:13:1
+ |
+LL | #![crate_name = "bar"]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/cross-borrow-trait.rs b/src/test/ui/cross/cross-borrow-trait.rs
similarity index 100%
rename from src/test/compile-fail/cross-borrow-trait.rs
rename to src/test/ui/cross/cross-borrow-trait.rs
diff --git a/src/test/ui/cross/cross-borrow-trait.stderr b/src/test/ui/cross/cross-borrow-trait.stderr
new file mode 100644
index 0000000..d25316d
--- /dev/null
+++ b/src/test/ui/cross/cross-borrow-trait.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/cross-borrow-trait.rs:20:22
+ |
+LL | let _y: &Trait = x; //~ ERROR E0308
+ | ^
+ | |
+ | expected &dyn Trait, found struct `std::boxed::Box`
+ | help: consider borrowing here: `&x`
+ |
+ = note: expected type `&dyn Trait`
+ found type `std::boxed::Box<dyn Trait>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs b/src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
similarity index 100%
rename from src/test/ui/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
rename to src/test/ui/cross/cross-crate-macro-backtrace/auxiliary/extern_macro_crate.rs
diff --git a/src/test/ui/cross-crate-macro-backtrace/main.rs b/src/test/ui/cross/cross-crate-macro-backtrace/main.rs
similarity index 100%
rename from src/test/ui/cross-crate-macro-backtrace/main.rs
rename to src/test/ui/cross/cross-crate-macro-backtrace/main.rs
diff --git a/src/test/ui/cross-crate-macro-backtrace/main.stderr b/src/test/ui/cross/cross-crate-macro-backtrace/main.stderr
similarity index 100%
rename from src/test/ui/cross-crate-macro-backtrace/main.stderr
rename to src/test/ui/cross/cross-crate-macro-backtrace/main.stderr
diff --git a/src/test/ui/cross-file-errors/main.rs b/src/test/ui/cross/cross-file-errors/main.rs
similarity index 100%
rename from src/test/ui/cross-file-errors/main.rs
rename to src/test/ui/cross/cross-file-errors/main.rs
diff --git a/src/test/ui/cross-file-errors/main.stderr b/src/test/ui/cross/cross-file-errors/main.stderr
similarity index 100%
rename from src/test/ui/cross-file-errors/main.stderr
rename to src/test/ui/cross/cross-file-errors/main.stderr
diff --git a/src/test/ui/cross-file-errors/underscore.rs b/src/test/ui/cross/cross-file-errors/underscore.rs
similarity index 100%
rename from src/test/ui/cross-file-errors/underscore.rs
rename to src/test/ui/cross/cross-file-errors/underscore.rs
diff --git a/src/test/compile-fail/cross-fn-cache-hole.rs b/src/test/ui/cross/cross-fn-cache-hole.rs
similarity index 100%
rename from src/test/compile-fail/cross-fn-cache-hole.rs
rename to src/test/ui/cross/cross-fn-cache-hole.rs
diff --git a/src/test/ui/cross/cross-fn-cache-hole.stderr b/src/test/ui/cross/cross-fn-cache-hole.stderr
new file mode 100644
index 0000000..bfcb832
--- /dev/null
+++ b/src/test/ui/cross/cross-fn-cache-hole.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `i32: Bar<u32>` is not satisfied
+ --> $DIR/cross-fn-cache-hole.rs:25:1
+ |
+LL | / fn vacuous<A>() //~ ERROR the trait bound `i32: Bar<u32>` is not satisfied
+LL | | where i32: Foo<u32, A>
+LL | | {
+LL | | // ... the original intention was to check that we don't use that
+... |
+LL | | require::<i32, u32>();
+LL | | }
+ | |_^ the trait `Bar<u32>` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/custom_attribute.rs b/src/test/ui/custom_attribute.rs
similarity index 100%
rename from src/test/compile-fail/custom_attribute.rs
rename to src/test/ui/custom_attribute.rs
diff --git a/src/test/ui/custom_attribute.stderr b/src/test/ui/custom_attribute.stderr
new file mode 100644
index 0000000..4adfe1e
--- /dev/null
+++ b/src/test/ui/custom_attribute.stderr
@@ -0,0 +1,27 @@
+error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/custom_attribute.rs:13:1
+ |
+LL | #[foo] //~ ERROR The attribute `foo`
+ | ^^^^^^
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/custom_attribute.rs:15:5
+ |
+LL | #[foo] //~ ERROR The attribute `foo`
+ | ^^^^^^
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error[E0658]: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/custom_attribute.rs:17:5
+ |
+LL | #[foo] //~ ERROR The attribute `foo`
+ | ^^^^^^
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/cycle-projection-based-on-where-clause.rs b/src/test/ui/cycle-projection-based-on-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/cycle-projection-based-on-where-clause.rs
rename to src/test/ui/cycle-projection-based-on-where-clause.rs
diff --git a/src/test/ui/cycle-projection-based-on-where-clause.stderr b/src/test/ui/cycle-projection-based-on-where-clause.stderr
new file mode 100644
index 0000000..c7147bc
--- /dev/null
+++ b/src/test/ui/cycle-projection-based-on-where-clause.stderr
@@ -0,0 +1,23 @@
+error[E0391]: cycle detected when computing the bounds for type parameter `T`
+ --> $DIR/cycle-projection-based-on-where-clause.rs:27:19
+ |
+LL | T : Add<T::Item>
+ | ^^^^^^^
+ |
+ = note: ...which again requires computing the bounds for type parameter `T`, completing the cycle
+note: cycle used when processing `A`
+ --> $DIR/cycle-projection-based-on-where-clause.rs:27:19
+ |
+LL | T : Add<T::Item>
+ | ^^^^^^^
+
+error[E0220]: associated type `Item` not found for `T`
+ --> $DIR/cycle-projection-based-on-where-clause.rs:27:19
+ |
+LL | T : Add<T::Item>
+ | ^^^^^^^ associated type `Item` not found
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0220, E0391.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/src/test/compile-fail/cycle-trait-default-type-trait.rs b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs
similarity index 100%
rename from src/test/compile-fail/cycle-trait-default-type-trait.rs
rename to src/test/ui/cycle-trait/cycle-trait-default-type-trait.rs
diff --git a/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr
new file mode 100644
index 0000000..767a99a
--- /dev/null
+++ b/src/test/ui/cycle-trait/cycle-trait-default-type-trait.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when processing `Foo::X`
+ --> $DIR/cycle-trait-default-type-trait.rs:14:19
+ |
+LL | trait Foo<X = Box<Foo>> {
+ | ^^^
+ |
+ = note: ...which again requires processing `Foo::X`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/cycle-trait-supertrait-direct.rs b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.rs
similarity index 100%
rename from src/test/compile-fail/cycle-trait-supertrait-direct.rs
rename to src/test/ui/cycle-trait/cycle-trait-supertrait-direct.rs
diff --git a/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
new file mode 100644
index 0000000..724d4b1
--- /dev/null
+++ b/src/test/ui/cycle-trait/cycle-trait-supertrait-direct.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when computing the supertraits of `Chromosome`
+ --> $DIR/cycle-trait-supertrait-direct.rs:13:1
+ |
+LL | trait Chromosome: Chromosome {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: ...which again requires computing the supertraits of `Chromosome`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/ui/cycle-trait-supertrait-indirect.rs b/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.rs
similarity index 100%
rename from src/test/ui/cycle-trait-supertrait-indirect.rs
rename to src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.rs
diff --git a/src/test/ui/cycle-trait-supertrait-indirect.stderr b/src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr
similarity index 100%
rename from src/test/ui/cycle-trait-supertrait-indirect.stderr
rename to src/test/ui/cycle-trait/cycle-trait-supertrait-indirect.stderr
diff --git a/src/test/compile-fail/dead-code-closure-bang.rs b/src/test/ui/dead-code-closure-bang.rs
similarity index 100%
rename from src/test/compile-fail/dead-code-closure-bang.rs
rename to src/test/ui/dead-code-closure-bang.rs
diff --git a/src/test/compile-fail/dead-code-ret.rs b/src/test/ui/dead-code-ret.rs
similarity index 100%
rename from src/test/compile-fail/dead-code-ret.rs
rename to src/test/ui/dead-code-ret.rs
diff --git a/src/test/ui/dead-code-ret.stderr b/src/test/ui/dead-code-ret.stderr
new file mode 100644
index 0000000..9f94016
--- /dev/null
+++ b/src/test/ui/dead-code-ret.stderr
@@ -0,0 +1,15 @@
+error: unreachable statement
+ --> $DIR/dead-code-ret.rs:17:5
+ |
+LL | println!("Paul is dead");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/dead-code-ret.rs:13:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+ = 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: aborting due to previous error
+
diff --git a/src/test/compile-fail/defaulted-never-note.rs b/src/test/ui/defaulted-never-note.rs
similarity index 100%
rename from src/test/compile-fail/defaulted-never-note.rs
rename to src/test/ui/defaulted-never-note.rs
diff --git a/src/test/ui/defaulted-never-note.stderr b/src/test/ui/defaulted-never-note.stderr
new file mode 100644
index 0000000..32922354
--- /dev/null
+++ b/src/test/ui/defaulted-never-note.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `!: ImplementedForUnitButNotNever` is not satisfied
+ --> $DIR/defaulted-never-note.rs:36:5
+ |
+LL | foo(_x);
+ | ^^^ the trait `ImplementedForUnitButNotNever` is not implemented for `!`
+ |
+ = note: the trait is implemented for `()`. Possibly this error has been caused by changes to Rust's type-inference algorithm (see: https://github.com/rust-lang/rust/issues/48950 for more info). Consider whether you meant to use the type `()` here instead.
+note: required by `foo`
+ --> $DIR/defaulted-never-note.rs:31:1
+ |
+LL | fn foo<T: ImplementedForUnitButNotNever>(_t: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/dep-graph-assoc-type-codegen.rs b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-assoc-type-codegen.rs
rename to src/test/ui/dep-graph/dep-graph-assoc-type-codegen.rs
diff --git a/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr
new file mode 100644
index 0000000..e00b3cc
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-assoc-type-codegen.stderr
@@ -0,0 +1,8 @@
+error: OK
+ --> $DIR/dep-graph-assoc-type-codegen.rs:38:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dep-graph-caller-callee.rs b/src/test/ui/dep-graph/dep-graph-caller-callee.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-caller-callee.rs
rename to src/test/ui/dep-graph/dep-graph-caller-callee.rs
diff --git a/src/test/ui/dep-graph/dep-graph-caller-callee.stderr b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr
new file mode 100644
index 0000000..8943b05
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-caller-callee.stderr
@@ -0,0 +1,14 @@
+error: OK
+ --> $DIR/dep-graph-caller-callee.rs:30:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `x::x` to `TypeckTables`
+ --> $DIR/dep-graph-caller-callee.rs:41:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/dep-graph-struct-signature.rs b/src/test/ui/dep-graph/dep-graph-struct-signature.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-struct-signature.rs
rename to src/test/ui/dep-graph/dep-graph-struct-signature.rs
diff --git a/src/test/ui/dep-graph/dep-graph-struct-signature.stderr b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr
new file mode 100644
index 0000000..cbb695d
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-struct-signature.stderr
@@ -0,0 +1,140 @@
+error: no path from `WillChange` to `TypeOfItem`
+ --> $DIR/dep-graph-struct-signature.rs:37:5
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `AssociatedItems`
+ --> $DIR/dep-graph-struct-signature.rs:38:5
+ |
+LL | #[rustc_then_this_would_need(AssociatedItems)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `TraitDefOfItem`
+ --> $DIR/dep-graph-struct-signature.rs:39:5
+ |
+LL | #[rustc_then_this_would_need(TraitDefOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:45:5
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:46:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:49:5
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:50:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:55:5
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:62:5
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:70:9
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:72:9
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `TypeOfItem`
+ --> $DIR/dep-graph-struct-signature.rs:77:5
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `TypeOfItem`
+ --> $DIR/dep-graph-struct-signature.rs:84:5
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `FnSignature`
+ --> $DIR/dep-graph-struct-signature.rs:90:5
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `TypeckTables`
+ --> $DIR/dep-graph-struct-signature.rs:91:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `FnSignature`
+ --> $DIR/dep-graph-struct-signature.rs:94:5
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path from `WillChange`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `TypeckTables`
+ --> $DIR/dep-graph-struct-signature.rs:95:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path from `WillChange`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:41:9
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `WillChange` to `FnSignature`
+ --> $DIR/dep-graph-struct-signature.rs:86:9
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:57:9
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:58:9
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:64:9
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-struct-signature.rs:65:9
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 23 previous errors
+
diff --git a/src/test/compile-fail/dep-graph-trait-impl-two-traits-same-method.rs b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-trait-impl-two-traits-same-method.rs
rename to src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.rs
diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr
new file mode 100644
index 0000000..877a056
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits-same-method.stderr
@@ -0,0 +1,14 @@
+error: OK
+ --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:42:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `x::<impl Foo for u32>` to `TypeckTables`
+ --> $DIR/dep-graph-trait-impl-two-traits-same-method.rs:51:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/dep-graph-trait-impl-two-traits.rs b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-trait-impl-two-traits.rs
rename to src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.rs
diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr
new file mode 100644
index 0000000..f939fac
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-trait-impl-two-traits.stderr
@@ -0,0 +1,14 @@
+error: no path from `x::<impl Foo for char>` to `TypeckTables`
+ --> $DIR/dep-graph-trait-impl-two-traits.rs:41:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `x::<impl Foo for char>` to `TypeckTables`
+ --> $DIR/dep-graph-trait-impl-two-traits.rs:50:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/dep-graph-trait-impl.rs b/src/test/ui/dep-graph/dep-graph-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-trait-impl.rs
rename to src/test/ui/dep-graph/dep-graph-trait-impl.rs
diff --git a/src/test/ui/dep-graph/dep-graph-trait-impl.stderr b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr
new file mode 100644
index 0000000..c569e85
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-trait-impl.stderr
@@ -0,0 +1,32 @@
+error: OK
+ --> $DIR/dep-graph-trait-impl.rs:37:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-trait-impl.rs:42:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-trait-impl.rs:47:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-trait-impl.rs:52:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `x::<impl Foo for char>` to `TypeckTables`
+ --> $DIR/dep-graph-trait-impl.rs:65:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/dep-graph-type-alias.rs b/src/test/ui/dep-graph/dep-graph-type-alias.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-type-alias.rs
rename to src/test/ui/dep-graph/dep-graph-type-alias.rs
diff --git a/src/test/ui/dep-graph/dep-graph-type-alias.stderr b/src/test/ui/dep-graph/dep-graph-type-alias.stderr
new file mode 100644
index 0000000..b018c25
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-type-alias.stderr
@@ -0,0 +1,74 @@
+error: no path from `TypeAlias` to `TypeOfItem`
+ --> $DIR/dep-graph-type-alias.rs:28:1
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:30:5
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `TypeAlias` to `TypeOfItem`
+ --> $DIR/dep-graph-type-alias.rs:35:1
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:38:9
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `TypeAlias` to `TypeOfItem`
+ --> $DIR/dep-graph-type-alias.rs:44:1
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: no path from `TypeAlias` to `TypeOfItem`
+ --> $DIR/dep-graph-type-alias.rs:52:1
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR no path
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:59:1
+ |
+LL | #[rustc_then_this_would_need(TypeOfItem)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:62:1
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:63:1
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:46:5
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:54:5
+ |
+LL | #[rustc_then_this_would_need(FnSignature)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: OK
+ --> $DIR/dep-graph-type-alias.rs:55:5
+ |
+LL | #[rustc_then_this_would_need(TypeckTables)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/compile-fail/dep-graph-variance-alias.rs b/src/test/ui/dep-graph/dep-graph-variance-alias.rs
similarity index 100%
rename from src/test/compile-fail/dep-graph-variance-alias.rs
rename to src/test/ui/dep-graph/dep-graph-variance-alias.rs
diff --git a/src/test/ui/dep-graph/dep-graph-variance-alias.stderr b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr
new file mode 100644
index 0000000..a3b1201
--- /dev/null
+++ b/src/test/ui/dep-graph/dep-graph-variance-alias.stderr
@@ -0,0 +1,8 @@
+error: OK
+ --> $DIR/dep-graph-variance-alias.rs:29:1
+ |
+LL | #[rustc_then_this_would_need(ItemVariances)] //~ ERROR OK
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/auxiliary/deprecation-lint.rs b/src/test/ui/deprecation/auxiliary/deprecation-lint.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/deprecation-lint.rs
rename to src/test/ui/deprecation/auxiliary/deprecation-lint.rs
diff --git a/src/test/ui/deprecated-macro_escape-inner.rs b/src/test/ui/deprecation/deprecated-macro_escape-inner.rs
similarity index 100%
rename from src/test/ui/deprecated-macro_escape-inner.rs
rename to src/test/ui/deprecation/deprecated-macro_escape-inner.rs
diff --git a/src/test/ui/deprecated-macro_escape-inner.stderr b/src/test/ui/deprecation/deprecated-macro_escape-inner.stderr
similarity index 100%
rename from src/test/ui/deprecated-macro_escape-inner.stderr
rename to src/test/ui/deprecation/deprecated-macro_escape-inner.stderr
diff --git a/src/test/ui/deprecated-macro_escape.rs b/src/test/ui/deprecation/deprecated-macro_escape.rs
similarity index 100%
rename from src/test/ui/deprecated-macro_escape.rs
rename to src/test/ui/deprecation/deprecated-macro_escape.rs
diff --git a/src/test/ui/deprecated-macro_escape.stderr b/src/test/ui/deprecation/deprecated-macro_escape.stderr
similarity index 100%
rename from src/test/ui/deprecated-macro_escape.stderr
rename to src/test/ui/deprecation/deprecated-macro_escape.stderr
diff --git a/src/test/compile-fail/deprecated_no_stack_check.rs b/src/test/ui/deprecation/deprecated_no_stack_check.rs
similarity index 100%
rename from src/test/compile-fail/deprecated_no_stack_check.rs
rename to src/test/ui/deprecation/deprecated_no_stack_check.rs
diff --git a/src/test/ui/deprecation/deprecated_no_stack_check.stderr b/src/test/ui/deprecation/deprecated_no_stack_check.stderr
new file mode 100644
index 0000000..2f847a2
--- /dev/null
+++ b/src/test/ui/deprecation/deprecated_no_stack_check.stderr
@@ -0,0 +1,9 @@
+error[E0557]: feature has been removed
+ --> $DIR/deprecated_no_stack_check.rs:12:12
+ |
+LL | #![feature(no_stack_check)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0557`.
diff --git a/src/test/compile-fail/deprecation-in-staged-api.rs b/src/test/ui/deprecation/deprecation-in-staged-api.rs
similarity index 100%
rename from src/test/compile-fail/deprecation-in-staged-api.rs
rename to src/test/ui/deprecation/deprecation-in-staged-api.rs
diff --git a/src/test/ui/deprecation/deprecation-in-staged-api.stderr b/src/test/ui/deprecation/deprecation-in-staged-api.stderr
new file mode 100644
index 0000000..9ad5658
--- /dev/null
+++ b/src/test/ui/deprecation/deprecation-in-staged-api.stderr
@@ -0,0 +1,8 @@
+error: `#[deprecated]` cannot be used in staged api, use `#[rustc_deprecated]` instead
+ --> $DIR/deprecation-in-staged-api.rs:18:1
+ |
+LL | fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/deprecation-lint-2.rs b/src/test/ui/deprecation/deprecation-lint-2.rs
similarity index 100%
rename from src/test/compile-fail/deprecation-lint-2.rs
rename to src/test/ui/deprecation/deprecation-lint-2.rs
diff --git a/src/test/ui/deprecation/deprecation-lint-2.stderr b/src/test/ui/deprecation/deprecation-lint-2.stderr
new file mode 100644
index 0000000..fedc6b2
--- /dev/null
+++ b/src/test/ui/deprecation/deprecation-lint-2.stderr
@@ -0,0 +1,15 @@
+error: use of deprecated item 'deprecation_lint::deprecated': text
+ --> $DIR/deprecation-lint-2.rs:22:5
+ |
+LL | macro_test!();
+ | ^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/deprecation-lint-2.rs:14:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+ = 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: aborting due to previous error
+
diff --git a/src/test/compile-fail/deprecation-lint-3.rs b/src/test/ui/deprecation/deprecation-lint-3.rs
similarity index 100%
rename from src/test/compile-fail/deprecation-lint-3.rs
rename to src/test/ui/deprecation/deprecation-lint-3.rs
diff --git a/src/test/ui/deprecation/deprecation-lint-3.stderr b/src/test/ui/deprecation/deprecation-lint-3.stderr
new file mode 100644
index 0000000..9dfc44e
--- /dev/null
+++ b/src/test/ui/deprecation/deprecation-lint-3.stderr
@@ -0,0 +1,15 @@
+error: use of deprecated item 'deprecation_lint::deprecated_text': text
+ --> $DIR/deprecation-lint-3.rs:23:5
+ |
+LL | macro_test_arg_nested!(deprecated_text);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/deprecation-lint-3.rs:14:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+ = 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: aborting due to previous error
+
diff --git a/src/test/compile-fail/deprecation-lint-nested.rs b/src/test/ui/deprecation/deprecation-lint-nested.rs
similarity index 100%
rename from src/test/compile-fail/deprecation-lint-nested.rs
rename to src/test/ui/deprecation/deprecation-lint-nested.rs
diff --git a/src/test/ui/deprecation/deprecation-lint-nested.stderr b/src/test/ui/deprecation/deprecation-lint-nested.stderr
new file mode 100644
index 0000000..4e2b462
--- /dev/null
+++ b/src/test/ui/deprecation/deprecation-lint-nested.stderr
@@ -0,0 +1,44 @@
+error: use of deprecated item 'loud::DeprecatedType'
+ --> $DIR/deprecation-lint-nested.rs:65:16
+ |
+LL | struct Foo(DeprecatedType); //~ ERROR use of deprecated item
+ | ^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/deprecation-lint-nested.rs:11:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'loud::DeprecatedTrait'
+ --> $DIR/deprecation-lint-nested.rs:67:10
+ |
+LL | impl DeprecatedTrait for Foo {} //~ ERROR use of deprecated item
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'loud::DEPRECATED_STATIC'
+ --> $DIR/deprecation-lint-nested.rs:76:9
+ |
+LL | DEPRECATED_STATIC + //~ ERROR use of deprecated item
+ | ^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'loud::DEPRECATED_CONST'
+ --> $DIR/deprecation-lint-nested.rs:77:9
+ |
+LL | DEPRECATED_CONST //~ ERROR use of deprecated item
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'loud::DeprecatedTrait'
+ --> $DIR/deprecation-lint-nested.rs:70:19
+ |
+LL | fn bar<T: DeprecatedTrait>() { //~ ERROR use of deprecated item
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'loud::deprecated_fn'
+ --> $DIR/deprecation-lint-nested.rs:71:13
+ |
+LL | deprecated_fn(); //~ ERROR use of deprecated item
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/compile-fail/deprecation-lint.rs b/src/test/ui/deprecation/deprecation-lint.rs
similarity index 100%
rename from src/test/compile-fail/deprecation-lint.rs
rename to src/test/ui/deprecation/deprecation-lint.rs
diff --git a/src/test/ui/deprecation/deprecation-lint.stderr b/src/test/ui/deprecation/deprecation-lint.stderr
new file mode 100644
index 0000000..addca66
--- /dev/null
+++ b/src/test/ui/deprecation/deprecation-lint.stderr
@@ -0,0 +1,728 @@
+error: use of deprecated item 'deprecation_lint::deprecated': text
+ --> $DIR/deprecation-lint.rs:27:9
+ |
+LL | deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated'
+ | ^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/deprecation-lint.rs:14:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:32:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:34:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::deprecated_text': text
+ --> $DIR/deprecation-lint.rs:36:9
+ |
+LL | deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:41:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:43:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::DeprecatedStruct': text
+ --> $DIR/deprecation-lint.rs:45:17
+ |
+LL | let _ = DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct': text
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text
+ --> $DIR/deprecation-lint.rs:49:17
+ |
+LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedUnitStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text
+ --> $DIR/deprecation-lint.rs:51:17
+ |
+LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::Enum::DeprecatedVariant': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text
+ --> $DIR/deprecation-lint.rs:53:17
+ |
+LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTupleStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text
+ --> $DIR/deprecation-lint.rs:55:17
+ |
+LL | let _ = nested::DeprecatedStruct { //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text
+ --> $DIR/deprecation-lint.rs:59:17
+ |
+LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedUnitStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text
+ --> $DIR/deprecation-lint.rs:61:17
+ |
+LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'deprecation_lint::nested::Enum::DeprecatedVariant': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text
+ --> $DIR/deprecation-lint.rs:63:17
+ |
+LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedTupleStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::deprecated_text': text
+ --> $DIR/deprecation-lint.rs:70:25
+ |
+LL | macro_test_arg!(deprecated_text()); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::deprecated_text': text
+ --> $DIR/deprecation-lint.rs:71:41
+ |
+LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:76:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:78:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:80:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:82:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text
+ --> $DIR/deprecation-lint.rs:92:10
+ |
+LL | impl DeprecatedTrait for S {} //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::DeprecatedTrait': text
+ --> $DIR/deprecation-lint.rs:93:24
+ |
+LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedTrait': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated': text
+ --> $DIR/deprecation-lint.rs:124:17
+ |
+LL | let x = Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated': text
+ --> $DIR/deprecation-lint.rs:133:13
+ |
+LL | let Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated': text
+ --> $DIR/deprecation-lint.rs:139:13
+ |
+LL | let Deprecated
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2': text
+ --> $DIR/deprecation-lint.rs:143:17
+ |
+LL | let x = Deprecated2(1, 2, 3);
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2': text
+ --> $DIR/deprecation-lint.rs:153:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2': text
+ --> $DIR/deprecation-lint.rs:162:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text
+ --> $DIR/deprecation-lint.rs:173:9
+ |
+LL | deprecated_mod::deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::deprecated_mod::deprecated': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::deprecated': text
+ --> $DIR/deprecation-lint.rs:256:9
+ |
+LL | deprecated(); //~ ERROR use of deprecated item 'this_crate::deprecated'
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:261:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:263:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::deprecated_text': text
+ --> $DIR/deprecation-lint.rs:265:9
+ |
+LL | deprecated_text(); //~ ERROR use of deprecated item 'this_crate::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:270:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:272:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::DeprecatedStruct': text
+ --> $DIR/deprecation-lint.rs:277:17
+ |
+LL | let _ = DeprecatedStruct {
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::DeprecatedUnitStruct': text
+ --> $DIR/deprecation-lint.rs:282:17
+ |
+LL | let _ = DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::DeprecatedUnitStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text
+ --> $DIR/deprecation-lint.rs:284:17
+ |
+LL | let _ = Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::Enum::DeprecatedVariant': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::DeprecatedTupleStruct': text
+ --> $DIR/deprecation-lint.rs:286:17
+ |
+LL | let _ = DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::DeprecatedTupleStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::nested::DeprecatedStruct': text
+ --> $DIR/deprecation-lint.rs:288:17
+ |
+LL | let _ = nested::DeprecatedStruct {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text
+ --> $DIR/deprecation-lint.rs:293:17
+ |
+LL | let _ = nested::DeprecatedUnitStruct; //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedUnitStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text
+ --> $DIR/deprecation-lint.rs:295:17
+ |
+LL | let _ = nested::Enum::DeprecatedVariant; //~ ERROR use of deprecated item 'this_crate::nested::Enum::DeprecatedVariant': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text
+ --> $DIR/deprecation-lint.rs:297:17
+ |
+LL | let _ = nested::DeprecatedTupleStruct (1); //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedTupleStruct': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:302:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:304:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:306:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:308:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar'
+ --> $DIR/deprecation-lint.rs:326:13
+ |
+LL | bar(); //~ ERROR use of deprecated item 'this_crate::test_fn_closure_body::{{closure}}::bar'
+ | ^^^
+
+error: use of deprecated item 'this_crate::DeprecatedTrait': text
+ --> $DIR/deprecation-lint.rs:345:10
+ |
+LL | impl DeprecatedTrait for S { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::DeprecatedTrait': text
+ --> $DIR/deprecation-lint.rs:347:24
+ |
+LL | trait LocalTrait : DeprecatedTrait { } //~ ERROR use of deprecated item 'this_crate::DeprecatedTrait': text
+ | ^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated': text
+ --> $DIR/deprecation-lint.rs:399:17
+ |
+LL | let x = Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated': text
+ --> $DIR/deprecation-lint.rs:408:13
+ |
+LL | let Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated': text
+ --> $DIR/deprecation-lint.rs:414:13
+ |
+LL | let Deprecated
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2': text
+ --> $DIR/deprecation-lint.rs:419:17
+ |
+LL | let x = Deprecated2(1, 2, 3);
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2': text
+ --> $DIR/deprecation-lint.rs:429:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2': text
+ --> $DIR/deprecation-lint.rs:438:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text
+ --> $DIR/deprecation-lint.rs:28:13
+ |
+LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text
+ --> $DIR/deprecation-lint.rs:29:9
+ |
+LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated': text
+ --> $DIR/deprecation-lint.rs:30:9
+ |
+LL | <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:31:13
+ |
+LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:33:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:37:13
+ |
+LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:38:9
+ |
+LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:39:9
+ |
+LL | <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:40:13
+ |
+LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:42:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text
+ --> $DIR/deprecation-lint.rs:46:13
+ |
+LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::DeprecatedStruct::i': text
+ | ^^^^
+
+error: use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text
+ --> $DIR/deprecation-lint.rs:56:13
+ |
+LL | i: 0 //~ ERROR use of deprecated item 'deprecation_lint::nested::DeprecatedStruct::i': text
+ | ^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:75:13
+ |
+LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:77:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:79:13
+ |
+LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:81:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:86:13
+ |
+LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:87:13
+ |
+LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'deprecation_lint::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Stable::override2': text
+ --> $DIR/deprecation-lint.rs:97:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Stable::override2': text
+ --> $DIR/deprecation-lint.rs:101:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Stable::override2': text
+ --> $DIR/deprecation-lint.rs:105:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Stable2::2': text
+ --> $DIR/deprecation-lint.rs:113:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'deprecation_lint::Stable2::2': text
+ --> $DIR/deprecation-lint.rs:118:20
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'deprecation_lint::Deprecated::inherit': text
+ --> $DIR/deprecation-lint.rs:126:13
+ |
+LL | inherit: 1,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated::inherit': text
+ --> $DIR/deprecation-lint.rs:130:17
+ |
+LL | let _ = x.inherit;
+ | ^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated::inherit': text
+ --> $DIR/deprecation-lint.rs:135:13
+ |
+LL | inherit: _,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2::0': text
+ --> $DIR/deprecation-lint.rs:146:17
+ |
+LL | let _ = x.0;
+ | ^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2::1': text
+ --> $DIR/deprecation-lint.rs:148:17
+ |
+LL | let _ = x.1;
+ | ^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2::2': text
+ --> $DIR/deprecation-lint.rs:150:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2::0': text
+ --> $DIR/deprecation-lint.rs:155:14
+ |
+LL | (_,
+ | ^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2::1': text
+ --> $DIR/deprecation-lint.rs:157:14
+ |
+LL | _,
+ | ^
+
+error: use of deprecated item 'deprecation_lint::Deprecated2::2': text
+ --> $DIR/deprecation-lint.rs:159:14
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text
+ --> $DIR/deprecation-lint.rs:257:13
+ |
+LL | foo.method_deprecated(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text
+ --> $DIR/deprecation-lint.rs:258:9
+ |
+LL | Foo::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::MethodTester::method_deprecated': text
+ --> $DIR/deprecation-lint.rs:259:9
+ |
+LL | <Foo>::method_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:260:13
+ |
+LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:262:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:266:13
+ |
+LL | foo.method_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:267:9
+ |
+LL | Foo::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:268:9
+ |
+LL | <Foo>::method_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:269:13
+ |
+LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:271:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::DeprecatedStruct::i': text
+ --> $DIR/deprecation-lint.rs:279:13
+ |
+LL | i: 0 //~ ERROR use of deprecated item 'this_crate::DeprecatedStruct::i': text
+ | ^^^^
+
+error: use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text
+ --> $DIR/deprecation-lint.rs:290:13
+ |
+LL | i: 0 //~ ERROR use of deprecated item 'this_crate::nested::DeprecatedStruct::i': text
+ | ^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:301:13
+ |
+LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:303:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:305:13
+ |
+LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:307:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/deprecation-lint.rs:312:13
+ |
+LL | foo.trait_deprecated(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/deprecation-lint.rs:313:13
+ |
+LL | foo.trait_deprecated_text(); //~ ERROR use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Stable::override2': text
+ --> $DIR/deprecation-lint.rs:372:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Stable::override2': text
+ --> $DIR/deprecation-lint.rs:376:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Stable::override2': text
+ --> $DIR/deprecation-lint.rs:380:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Stable2::2': text
+ --> $DIR/deprecation-lint.rs:388:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'this_crate2::Stable2::2': text
+ --> $DIR/deprecation-lint.rs:393:20
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'this_crate2::Deprecated::inherit': text
+ --> $DIR/deprecation-lint.rs:401:13
+ |
+LL | inherit: 1,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated::inherit': text
+ --> $DIR/deprecation-lint.rs:405:17
+ |
+LL | let _ = x.inherit;
+ | ^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated::inherit': text
+ --> $DIR/deprecation-lint.rs:410:13
+ |
+LL | inherit: _,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2::0': text
+ --> $DIR/deprecation-lint.rs:422:17
+ |
+LL | let _ = x.0;
+ | ^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2::1': text
+ --> $DIR/deprecation-lint.rs:424:17
+ |
+LL | let _ = x.1;
+ | ^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2::2': text
+ --> $DIR/deprecation-lint.rs:426:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'this_crate2::Deprecated2::0': text
+ --> $DIR/deprecation-lint.rs:431:14
+ |
+LL | (_,
+ | ^
+
+error: use of deprecated item 'this_crate2::Deprecated2::1': text
+ --> $DIR/deprecation-lint.rs:433:14
+ |
+LL | _,
+ | ^
+
+error: use of deprecated item 'this_crate2::Deprecated2::2': text
+ --> $DIR/deprecation-lint.rs:435:14
+ |
+LL | _)
+ | ^
+
+error: aborting due to 120 previous errors
+
diff --git a/src/test/ui/deprecation-sanity.rs b/src/test/ui/deprecation/deprecation-sanity.rs
similarity index 100%
rename from src/test/ui/deprecation-sanity.rs
rename to src/test/ui/deprecation/deprecation-sanity.rs
diff --git a/src/test/ui/deprecation-sanity.stderr b/src/test/ui/deprecation/deprecation-sanity.stderr
similarity index 100%
rename from src/test/ui/deprecation-sanity.stderr
rename to src/test/ui/deprecation/deprecation-sanity.stderr
diff --git a/src/test/compile-fail/deref-non-pointer.rs b/src/test/ui/deref-non-pointer.rs
similarity index 100%
rename from src/test/compile-fail/deref-non-pointer.rs
rename to src/test/ui/deref-non-pointer.rs
diff --git a/src/test/ui/deref-non-pointer.stderr b/src/test/ui/deref-non-pointer.stderr
new file mode 100644
index 0000000..3e0ea06
--- /dev/null
+++ b/src/test/ui/deref-non-pointer.stderr
@@ -0,0 +1,9 @@
+error[E0614]: type `{integer}` cannot be dereferenced
+ --> $DIR/deref-non-pointer.rs:12:9
+ |
+LL | match *1 { //~ ERROR: cannot be dereferenced
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0614`.
diff --git a/src/test/compile-fail/derived-errors/issue-30580.rs b/src/test/ui/derived-errors/issue-30580.rs
similarity index 100%
rename from src/test/compile-fail/derived-errors/issue-30580.rs
rename to src/test/ui/derived-errors/issue-30580.rs
diff --git a/src/test/ui/derived-errors/issue-30580.stderr b/src/test/ui/derived-errors/issue-30580.stderr
new file mode 100644
index 0000000..bf9a5a2
--- /dev/null
+++ b/src/test/ui/derived-errors/issue-30580.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `c` on type `&Foo`
+ --> $DIR/issue-30580.rs:22:11
+ |
+LL | b.c; //~ ERROR no field `c` on type `&Foo`
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/compile-fail/derived-errors/issue-31997.rs b/src/test/ui/derived-errors/issue-31997.rs
similarity index 100%
rename from src/test/compile-fail/derived-errors/issue-31997.rs
rename to src/test/ui/derived-errors/issue-31997.rs
diff --git a/src/test/ui/derived-errors/issue-31997.stderr b/src/test/ui/derived-errors/issue-31997.stderr
new file mode 100644
index 0000000..25088e8
--- /dev/null
+++ b/src/test/ui/derived-errors/issue-31997.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find function `bar` in this scope
+ --> $DIR/issue-31997.rs:23:21
+ |
+LL | try!(closure(|| bar(0 as *mut _))); //~ ERROR cannot find function `bar` in this scope
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/derive-assoc-type-not-impl.rs b/src/test/ui/derives/derive-assoc-type-not-impl.rs
similarity index 100%
rename from src/test/compile-fail/derive-assoc-type-not-impl.rs
rename to src/test/ui/derives/derive-assoc-type-not-impl.rs
diff --git a/src/test/ui/derives/derive-assoc-type-not-impl.stderr b/src/test/ui/derives/derive-assoc-type-not-impl.stderr
new file mode 100644
index 0000000..c49e338
--- /dev/null
+++ b/src/test/ui/derives/derive-assoc-type-not-impl.stderr
@@ -0,0 +1,18 @@
+error[E0599]: no method named `clone` found for type `Bar<NotClone>` in the current scope
+ --> $DIR/derive-assoc-type-not-impl.rs:28:30
+ |
+LL | struct Bar<T: Foo> {
+ | ------------------ method `clone` not found for this
+...
+LL | Bar::<NotClone> { x: 1 }.clone(); //~ ERROR
+ | ^^^^^
+ |
+ = note: the method `clone` exists but the following trait bounds were not satisfied:
+ `Bar<NotClone> : std::clone::Clone`
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/derive-on-trait-item-or-impl-item.rs b/src/test/ui/derives/derive-on-trait-item-or-impl-item.rs
similarity index 100%
rename from src/test/compile-fail/derive-on-trait-item-or-impl-item.rs
rename to src/test/ui/derives/derive-on-trait-item-or-impl-item.rs
diff --git a/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr b/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr
new file mode 100644
index 0000000..8246889
--- /dev/null
+++ b/src/test/ui/derives/derive-on-trait-item-or-impl-item.stderr
@@ -0,0 +1,14 @@
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/derive-on-trait-item-or-impl-item.rs:12:5
+ |
+LL | #[derive(Clone)]
+ | ^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/derive-on-trait-item-or-impl-item.rs:18:5
+ |
+LL | #[derive(Clone)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Clone-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr
new file mode 100644
index 0000000..fbe9d3f
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied
+ --> $DIR/derives-span-Clone-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
+ |
+ = note: required by `std::clone::Clone::clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Clone-enum.rs b/src/test/ui/derives/derives-span-Clone-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Clone-enum.rs
rename to src/test/ui/derives/derives-span-Clone-enum.rs
diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr
new file mode 100644
index 0000000..b5b3c8b
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Clone-enum.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied
+ --> $DIR/derives-span-Clone-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
+ |
+ = note: required by `std::clone::Clone::clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Clone-struct.rs b/src/test/ui/derives/derives-span-Clone-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Clone-struct.rs
rename to src/test/ui/derives/derives-span-Clone-struct.rs
diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr
new file mode 100644
index 0000000..ebd1e66
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Clone-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied
+ --> $DIR/derives-span-Clone-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
+ |
+ = note: required by `std::clone::Clone::clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Clone-tuple-struct.rs b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Clone-tuple-struct.rs
rename to src/test/ui/derives/derives-span-Clone-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr
new file mode 100644
index 0000000..6867baa
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied
+ --> $DIR/derives-span-Clone-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error`
+ |
+ = note: required by `std::clone::Clone::clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Debug-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr
new file mode 100644
index 0000000..f5939a2
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr
@@ -0,0 +1,14 @@
+error[E0277]: `Error` doesn't implement `std::fmt::Debug`
+ --> $DIR/derives-span-Debug-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ `Error` cannot be formatted using `{:?}`
+ |
+ = help: the trait `std::fmt::Debug` is not implemented for `Error`
+ = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
+ = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
+ = note: required for the cast to the object type `dyn std::fmt::Debug`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Debug-enum.rs b/src/test/ui/derives/derives-span-Debug-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Debug-enum.rs
rename to src/test/ui/derives/derives-span-Debug-enum.rs
diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr
new file mode 100644
index 0000000..566a578
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Debug-enum.stderr
@@ -0,0 +1,14 @@
+error[E0277]: `Error` doesn't implement `std::fmt::Debug`
+ --> $DIR/derives-span-Debug-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^ `Error` cannot be formatted using `{:?}`
+ |
+ = help: the trait `std::fmt::Debug` is not implemented for `Error`
+ = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
+ = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
+ = note: required for the cast to the object type `dyn std::fmt::Debug`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Debug-struct.rs b/src/test/ui/derives/derives-span-Debug-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Debug-struct.rs
rename to src/test/ui/derives/derives-span-Debug-struct.rs
diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr
new file mode 100644
index 0000000..30145a7
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Debug-struct.stderr
@@ -0,0 +1,14 @@
+error[E0277]: `Error` doesn't implement `std::fmt::Debug`
+ --> $DIR/derives-span-Debug-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ `Error` cannot be formatted using `{:?}`
+ |
+ = help: the trait `std::fmt::Debug` is not implemented for `Error`
+ = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
+ = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
+ = note: required for the cast to the object type `dyn std::fmt::Debug`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Debug-tuple-struct.rs b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Debug-tuple-struct.rs
rename to src/test/ui/derives/derives-span-Debug-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr
new file mode 100644
index 0000000..963fc8a
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr
@@ -0,0 +1,14 @@
+error[E0277]: `Error` doesn't implement `std::fmt::Debug`
+ --> $DIR/derives-span-Debug-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ `Error` cannot be formatted using `{:?}`
+ |
+ = help: the trait `std::fmt::Debug` is not implemented for `Error`
+ = note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
+ = note: required because of the requirements on the impl of `std::fmt::Debug` for `&Error`
+ = note: required for the cast to the object type `dyn std::fmt::Debug`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Default-struct.rs b/src/test/ui/derives/derives-span-Default-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Default-struct.rs
rename to src/test/ui/derives/derives-span-Default-struct.rs
diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr
new file mode 100644
index 0000000..a9634e6
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Default-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::default::Default` is not satisfied
+ --> $DIR/derives-span-Default-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error`
+ |
+ = note: required by `std::default::Default::default`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Default-tuple-struct.rs b/src/test/ui/derives/derives-span-Default-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Default-tuple-struct.rs
rename to src/test/ui/derives/derives-span-Default-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr
new file mode 100644
index 0000000..eb0ef61
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::default::Default` is not satisfied
+ --> $DIR/derives-span-Default-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::default::Default` is not implemented for `Error`
+ |
+ = note: required by `std::default::Default::default`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Eq-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr
new file mode 100644
index 0000000..b230c01
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
+ --> $DIR/derives-span-Eq-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::AssertParamIsEq`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Eq-enum.rs b/src/test/ui/derives/derives-span-Eq-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Eq-enum.rs
rename to src/test/ui/derives/derives-span-Eq-enum.rs
diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr
new file mode 100644
index 0000000..7f6d27a
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Eq-enum.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
+ --> $DIR/derives-span-Eq-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::AssertParamIsEq`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Eq-struct.rs b/src/test/ui/derives/derives-span-Eq-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Eq-struct.rs
rename to src/test/ui/derives/derives-span-Eq-struct.rs
diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr
new file mode 100644
index 0000000..a9db040
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Eq-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
+ --> $DIR/derives-span-Eq-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::AssertParamIsEq`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Eq-tuple-struct.rs b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Eq-tuple-struct.rs
rename to src/test/ui/derives/derives-span-Eq-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr
new file mode 100644
index 0000000..70f39f3
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied
+ --> $DIR/derives-span-Eq-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::AssertParamIsEq`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Hash-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr
new file mode 100644
index 0000000..bde7556
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied
+ --> $DIR/derives-span-Hash-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error`
+ |
+ = note: required by `std::hash::Hash::hash`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Hash-enum.rs b/src/test/ui/derives/derives-span-Hash-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Hash-enum.rs
rename to src/test/ui/derives/derives-span-Hash-enum.rs
diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr
new file mode 100644
index 0000000..72b8f3a
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Hash-enum.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied
+ --> $DIR/derives-span-Hash-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error`
+ |
+ = note: required by `std::hash::Hash::hash`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Hash-struct.rs b/src/test/ui/derives/derives-span-Hash-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Hash-struct.rs
rename to src/test/ui/derives/derives-span-Hash-struct.rs
diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr
new file mode 100644
index 0000000..3068bcf
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Hash-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied
+ --> $DIR/derives-span-Hash-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error`
+ |
+ = note: required by `std::hash::Hash::hash`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Hash-tuple-struct.rs b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Hash-tuple-struct.rs
rename to src/test/ui/derives/derives-span-Hash-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr
new file mode 100644
index 0000000..a65fbd8
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied
+ --> $DIR/derives-span-Hash-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error`
+ |
+ = note: required by `std::hash::Hash::hash`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Ord-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr
new file mode 100644
index 0000000..5968efd
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied
+ --> $DIR/derives-span-Ord-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Ord-enum.rs b/src/test/ui/derives/derives-span-Ord-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Ord-enum.rs
rename to src/test/ui/derives/derives-span-Ord-enum.rs
diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr
new file mode 100644
index 0000000..074a8f8
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Ord-enum.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied
+ --> $DIR/derives-span-Ord-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Ord-struct.rs b/src/test/ui/derives/derives-span-Ord-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Ord-struct.rs
rename to src/test/ui/derives/derives-span-Ord-struct.rs
diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr
new file mode 100644
index 0000000..2e584e6
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Ord-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied
+ --> $DIR/derives-span-Ord-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-Ord-tuple-struct.rs b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-Ord-tuple-struct.rs
rename to src/test/ui/derives/derives-span-Ord-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr
new file mode 100644
index 0000000..0da452f
--- /dev/null
+++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied
+ --> $DIR/derives-span-Ord-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialEq-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
new file mode 100644
index 0000000..cad446f
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `==` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error[E0369]: binary operation `!=` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/derives-span-PartialEq-enum.rs b/src/test/ui/derives/derives-span-PartialEq-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialEq-enum.rs
rename to src/test/ui/derives/derives-span-PartialEq-enum.rs
diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr
new file mode 100644
index 0000000..e75d069
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `==` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error[E0369]: binary operation `!=` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/derives-span-PartialEq-struct.rs b/src/test/ui/derives/derives-span-PartialEq-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialEq-struct.rs
rename to src/test/ui/derives/derives-span-PartialEq-struct.rs
diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr
new file mode 100644
index 0000000..c8cd509
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `==` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error[E0369]: binary operation `!=` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialEq-tuple-struct.rs
rename to src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr
new file mode 100644
index 0000000..b66189f
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr
@@ -0,0 +1,19 @@
+error[E0369]: binary operation `==` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error[E0369]: binary operation `!=` cannot be applied to type `Error`
+ --> $DIR/derives-span-PartialEq-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `Error`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialOrd-enum-struct-variant.rs
rename to src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs
diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
new file mode 100644
index 0000000..7e55ba7
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
@@ -0,0 +1,12 @@
+error[E0277]: can't compare `Error` with `Error`
+ --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:19:6
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-PartialOrd-enum.rs b/src/test/ui/derives/derives-span-PartialOrd-enum.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialOrd-enum.rs
rename to src/test/ui/derives/derives-span-PartialOrd-enum.rs
diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr
new file mode 100644
index 0000000..d8b3bd9
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr
@@ -0,0 +1,12 @@
+error[E0277]: can't compare `Error` with `Error`
+ --> $DIR/derives-span-PartialOrd-enum.rs:19:6
+ |
+LL | Error //~ ERROR
+ | ^^^^^ no implementation for `Error < Error` and `Error > Error`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-PartialOrd-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialOrd-struct.rs
rename to src/test/ui/derives/derives-span-PartialOrd-struct.rs
diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr
new file mode 100644
index 0000000..afd93dc
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr
@@ -0,0 +1,12 @@
+error[E0277]: can't compare `Error` with `Error`
+ --> $DIR/derives-span-PartialOrd-struct.rs:18:5
+ |
+LL | x: Error //~ ERROR
+ | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs
similarity index 100%
rename from src/test/compile-fail/derives-span-PartialOrd-tuple-struct.rs
rename to src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs
diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
new file mode 100644
index 0000000..a65ee40
--- /dev/null
+++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
@@ -0,0 +1,12 @@
+error[E0277]: can't compare `Error` with `Error`
+ --> $DIR/derives-span-PartialOrd-tuple-struct.rs:18:5
+ |
+LL | Error //~ ERROR
+ | ^^^^^ no implementation for `Error < Error` and `Error > Error`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `Error`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/deriving-bounds.rs b/src/test/ui/derives/deriving-bounds.rs
similarity index 100%
rename from src/test/compile-fail/deriving-bounds.rs
rename to src/test/ui/derives/deriving-bounds.rs
diff --git a/src/test/ui/derives/deriving-bounds.stderr b/src/test/ui/derives/deriving-bounds.stderr
new file mode 100644
index 0000000..2c42fd1
--- /dev/null
+++ b/src/test/ui/derives/deriving-bounds.stderr
@@ -0,0 +1,14 @@
+error: this unsafe trait should be implemented explicitly
+ --> $DIR/deriving-bounds.rs:11:10
+ |
+LL | #[derive(Send)]
+ | ^^^^
+
+error: this unsafe trait should be implemented explicitly
+ --> $DIR/deriving-bounds.rs:15:10
+ |
+LL | #[derive(Sync)]
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/deriving-copyclone.rs b/src/test/ui/derives/deriving-copyclone.rs
similarity index 100%
rename from src/test/compile-fail/deriving-copyclone.rs
rename to src/test/ui/derives/deriving-copyclone.rs
diff --git a/src/test/ui/derives/deriving-copyclone.stderr b/src/test/ui/derives/deriving-copyclone.stderr
new file mode 100644
index 0000000..2d0dc66
--- /dev/null
+++ b/src/test/ui/derives/deriving-copyclone.stderr
@@ -0,0 +1,42 @@
+error[E0277]: the trait bound `C: std::marker::Copy` is not satisfied
+ --> $DIR/deriving-copyclone.rs:41:5
+ |
+LL | is_copy(B { a: 1, b: C }); //~ERROR Copy
+ | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `C`
+ |
+ = note: required because of the requirements on the impl of `std::marker::Copy` for `B<C>`
+note: required by `is_copy`
+ --> $DIR/deriving-copyclone.rs:28:1
+ |
+LL | fn is_copy<T: Copy>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `C: std::clone::Clone` is not satisfied
+ --> $DIR/deriving-copyclone.rs:42:5
+ |
+LL | is_clone(B { a: 1, b: C }); //~ERROR Clone
+ | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `C`
+ |
+ = note: required because of the requirements on the impl of `std::clone::Clone` for `B<C>`
+note: required by `is_clone`
+ --> $DIR/deriving-copyclone.rs:29:1
+ |
+LL | fn is_clone<T: Clone>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `D: std::marker::Copy` is not satisfied
+ --> $DIR/deriving-copyclone.rs:45:5
+ |
+LL | is_copy(B { a: 1, b: D }); //~ERROR Copy
+ | ^^^^^^^ the trait `std::marker::Copy` is not implemented for `D`
+ |
+ = note: required because of the requirements on the impl of `std::marker::Copy` for `B<D>`
+note: required by `is_copy`
+ --> $DIR/deriving-copyclone.rs:28:1
+ |
+LL | fn is_copy<T: Copy>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/deriving-meta-empty-trait-list.rs b/src/test/ui/derives/deriving-meta-empty-trait-list.rs
similarity index 100%
rename from src/test/ui/deriving-meta-empty-trait-list.rs
rename to src/test/ui/derives/deriving-meta-empty-trait-list.rs
diff --git a/src/test/ui/deriving-meta-empty-trait-list.stderr b/src/test/ui/derives/deriving-meta-empty-trait-list.stderr
similarity index 100%
rename from src/test/ui/deriving-meta-empty-trait-list.stderr
rename to src/test/ui/derives/deriving-meta-empty-trait-list.stderr
diff --git a/src/test/compile-fail/deriving-meta-unknown-trait.rs b/src/test/ui/derives/deriving-meta-unknown-trait.rs
similarity index 100%
rename from src/test/compile-fail/deriving-meta-unknown-trait.rs
rename to src/test/ui/derives/deriving-meta-unknown-trait.rs
diff --git a/src/test/ui/derives/deriving-meta-unknown-trait.stderr b/src/test/ui/derives/deriving-meta-unknown-trait.stderr
new file mode 100644
index 0000000..aa0f1e2
--- /dev/null
+++ b/src/test/ui/derives/deriving-meta-unknown-trait.stderr
@@ -0,0 +1,8 @@
+error: cannot find derive macro `Eqr` in this scope
+ --> $DIR/deriving-meta-unknown-trait.rs:13:10
+ |
+LL | #[derive(Eqr)]
+ | ^^^ help: try: `Eq`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/deriving-no-inner-impl-error-message.rs b/src/test/ui/derives/deriving-no-inner-impl-error-message.rs
similarity index 100%
rename from src/test/compile-fail/deriving-no-inner-impl-error-message.rs
rename to src/test/ui/derives/deriving-no-inner-impl-error-message.rs
diff --git a/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr
new file mode 100644
index 0000000..48d27ae
--- /dev/null
+++ b/src/test/ui/derives/deriving-no-inner-impl-error-message.stderr
@@ -0,0 +1,28 @@
+error[E0369]: binary operation `==` cannot be applied to type `NoCloneOrEq`
+ --> $DIR/deriving-no-inner-impl-error-message.rs:15:5
+ |
+LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq`
+ | ^^^^^^^^^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq`
+
+error[E0369]: binary operation `!=` cannot be applied to type `NoCloneOrEq`
+ --> $DIR/deriving-no-inner-impl-error-message.rs:15:5
+ |
+LL | x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq`
+ | ^^^^^^^^^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `NoCloneOrEq`
+
+error[E0277]: the trait bound `NoCloneOrEq: std::clone::Clone` is not satisfied
+ --> $DIR/deriving-no-inner-impl-error-message.rs:20:5
+ |
+LL | x: NoCloneOrEq
+ | ^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `NoCloneOrEq`
+ |
+ = note: required by `std::clone::Clone::clone`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0277, E0369.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/deriving-non-type.rs b/src/test/ui/derives/deriving-non-type.rs
similarity index 100%
rename from src/test/compile-fail/deriving-non-type.rs
rename to src/test/ui/derives/deriving-non-type.rs
diff --git a/src/test/ui/derives/deriving-non-type.stderr b/src/test/ui/derives/deriving-non-type.stderr
new file mode 100644
index 0000000..d9da03a
--- /dev/null
+++ b/src/test/ui/derives/deriving-non-type.stderr
@@ -0,0 +1,56 @@
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:15:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:18:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:21:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:24:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:27:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:30:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:33:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:36:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: `derive` may only be applied to structs, enums and unions
+ --> $DIR/deriving-non-type.rs:39:1
+ |
+LL | #[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs, enums and unions
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/src/test/compile-fail/deriving-primitive.rs b/src/test/ui/derives/deriving-primitive.rs
similarity index 100%
rename from src/test/compile-fail/deriving-primitive.rs
rename to src/test/ui/derives/deriving-primitive.rs
diff --git a/src/test/ui/derives/deriving-primitive.stderr b/src/test/ui/derives/deriving-primitive.stderr
new file mode 100644
index 0000000..bc2d339
--- /dev/null
+++ b/src/test/ui/derives/deriving-primitive.stderr
@@ -0,0 +1,8 @@
+error: cannot find derive macro `FromPrimitive` in this scope
+ --> $DIR/deriving-primitive.rs:11:10
+ |
+LL | #[derive(FromPrimitive)] //~ ERROR cannot find derive macro `FromPrimitive` in this scope
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/deriving-with-repr-packed.rs b/src/test/ui/derives/deriving-with-repr-packed.rs
similarity index 100%
rename from src/test/ui/deriving-with-repr-packed.rs
rename to src/test/ui/derives/deriving-with-repr-packed.rs
diff --git a/src/test/ui/deriving-with-repr-packed.stderr b/src/test/ui/derives/deriving-with-repr-packed.stderr
similarity index 100%
rename from src/test/ui/deriving-with-repr-packed.stderr
rename to src/test/ui/derives/deriving-with-repr-packed.stderr
diff --git a/src/test/compile-fail/destructure-trait-ref.rs b/src/test/ui/destructure-trait-ref.rs
similarity index 100%
rename from src/test/compile-fail/destructure-trait-ref.rs
rename to src/test/ui/destructure-trait-ref.rs
diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr
new file mode 100644
index 0000000..0335fff
--- /dev/null
+++ b/src/test/ui/destructure-trait-ref.stderr
@@ -0,0 +1,51 @@
+error[E0033]: type `&dyn T` cannot be dereferenced
+ --> $DIR/destructure-trait-ref.rs:36:9
+ |
+LL | let &x = &1isize as &T; //~ ERROR type `&dyn T` cannot be dereferenced
+ | ^^ type `&dyn T` cannot be dereferenced
+
+error[E0033]: type `&dyn T` cannot be dereferenced
+ --> $DIR/destructure-trait-ref.rs:37:10
+ |
+LL | let &&x = &(&1isize as &T); //~ ERROR type `&dyn T` cannot be dereferenced
+ | ^^ type `&dyn T` cannot be dereferenced
+
+error[E0033]: type `std::boxed::Box<dyn T>` cannot be dereferenced
+ --> $DIR/destructure-trait-ref.rs:38:9
+ |
+LL | let box x = box 1isize as Box<T>; //~ ERROR type `std::boxed::Box<dyn T>` cannot be dereferenced
+ | ^^^^^ type `std::boxed::Box<dyn T>` cannot be dereferenced
+
+error[E0308]: mismatched types
+ --> $DIR/destructure-trait-ref.rs:41:10
+ |
+LL | let &&x = &1isize as &T;
+ | ^^ expected trait T, found reference
+ |
+ = note: expected type `dyn T`
+ found type `&_`
+ = help: did you mean `x: &dyn T`?
+
+error[E0308]: mismatched types
+ --> $DIR/destructure-trait-ref.rs:46:11
+ |
+LL | let &&&x = &(&1isize as &T);
+ | ^^ expected trait T, found reference
+ |
+ = note: expected type `dyn T`
+ found type `&_`
+ = help: did you mean `x: &dyn T`?
+
+error[E0308]: mismatched types
+ --> $DIR/destructure-trait-ref.rs:51:13
+ |
+LL | let box box x = box 1isize as Box<T>;
+ | ^^^^^ expected trait T, found struct `std::boxed::Box`
+ |
+ = note: expected type `dyn T`
+ found type `std::boxed::Box<_>`
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0033, E0308.
+For more information about an error, try `rustc --explain E0033`.
diff --git a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr
index eee7f32..3380455 100644
--- a/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr
+++ b/src/test/ui/did_you_mean/issue-21659-show-relevant-trait-impls-2.stderr
@@ -5,9 +5,9 @@
| ^^^ the trait `Foo<usize>` is not implemented for `Bar`
|
= help: the following implementations were found:
- <Bar as Foo<i8>>
<Bar as Foo<i16>>
<Bar as Foo<i32>>
+ <Bar as Foo<i8>>
<Bar as Foo<u8>>
and 2 others
diff --git a/src/test/ui/did_you_mean/issue-35937.nll.stderr b/src/test/ui/did_you_mean/issue-35937.nll.stderr
index 804e5f0..34bdf48 100644
--- a/src/test/ui/did_you_mean/issue-35937.nll.stderr
+++ b/src/test/ui/did_you_mean/issue-35937.nll.stderr
@@ -6,26 +6,23 @@
LL | f.v.push("cat".to_string()); //~ ERROR cannot borrow
| ^^^ cannot borrow as mutable
-error[E0384]: cannot assign twice to immutable variable `s`
+error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
--> $DIR/issue-35937.rs:26:5
|
LL | let s = S { x: 42 };
- | -
- | |
- | first assignment to `s`
- | consider changing this to `mut s`
+ | - help: consider changing this to be mutable: `mut s`
LL | s.x += 1; //~ ERROR cannot assign
- | ^^^^^^^^ cannot assign twice to immutable variable
+ | ^^^^^^^^ cannot assign
-error[E0384]: cannot assign to immutable argument `s`
+error[E0594]: cannot assign to `s.x`, as `s` is not declared as mutable
--> $DIR/issue-35937.rs:30:5
|
LL | fn bar(s: S) {
- | - consider changing this to `mut s`
+ | - help: consider changing this to be mutable: `mut s`
LL | s.x += 1; //~ ERROR cannot assign
- | ^^^^^^^^ cannot assign to immutable argument
+ | ^^^^^^^^ cannot assign
error: aborting due to 3 previous errors
-Some errors occurred: E0384, E0596.
-For more information about an error, try `rustc --explain E0384`.
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr
index 3f955da..3b08fcf 100644
--- a/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr
+++ b/src/test/ui/did_you_mean/issue-39802-show-5-trait-impls.stderr
@@ -5,11 +5,11 @@
| ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `i8`
|
= help: the following implementations were found:
- <i8 as Foo<u8>>
+ <i8 as Foo<bool>>
<i8 as Foo<u16>>
<i8 as Foo<u32>>
<i8 as Foo<u64>>
- <i8 as Foo<bool>>
+ <i8 as Foo<u8>>
note: required by `Foo::bar`
--> $DIR/issue-39802-show-5-trait-impls.rs:12:5
|
@@ -23,10 +23,10 @@
| ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `u8`
|
= help: the following implementations were found:
+ <u8 as Foo<bool>>
<u8 as Foo<u16>>
<u8 as Foo<u32>>
<u8 as Foo<u64>>
- <u8 as Foo<bool>>
note: required by `Foo::bar`
--> $DIR/issue-39802-show-5-trait-impls.rs:12:5
|
@@ -40,10 +40,10 @@
| ^^^^^^^^^^^^^^^ the trait `Foo<i32>` is not implemented for `bool`
|
= help: the following implementations were found:
- <bool as Foo<u8>>
<bool as Foo<u16>>
<bool as Foo<u32>>
<bool as Foo<u64>>
+ <bool as Foo<u8>>
and 2 others
note: required by `Foo::bar`
--> $DIR/issue-39802-show-5-trait-impls.rs:12:5
diff --git a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs
new file mode 100644
index 0000000..243e3a6
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.rs
@@ -0,0 +1,29 @@
+// 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.
+
+fn main() {
+ let sixteen: f32 = 16;
+ //~^ ERROR mismatched types
+ //~| HELP use a float literal
+ let a_million_and_seventy: f64 = 1_000_070;
+ //~^ ERROR mismatched types
+ //~| HELP use a float literal
+ let negative_nine: f32 = -9;
+ //~^ ERROR mismatched types
+ //~| HELP use a float literal
+
+
+ // only base-10 literals get the suggestion
+
+ let sixteen_again: f64 = 0x10;
+ //~^ ERROR mismatched types
+ let and_once_more: f32 = 0o20;
+ //~^ ERROR mismatched types
+}
diff --git a/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr
new file mode 100644
index 0000000..caaa954
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-53280-expected-float-found-integer-literal.stderr
@@ -0,0 +1,57 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-53280-expected-float-found-integer-literal.rs:12:24
+ |
+LL | let sixteen: f32 = 16;
+ | ^^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `16.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-53280-expected-float-found-integer-literal.rs:15:38
+ |
+LL | let a_million_and_seventy: f64 = 1_000_070;
+ | ^^^^^^^^^
+ | |
+ | expected f64, found integral variable
+ | help: use a float literal: `1_000_070.0`
+ |
+ = note: expected type `f64`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-53280-expected-float-found-integer-literal.rs:18:30
+ |
+LL | let negative_nine: f32 = -9;
+ | ^^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `-9.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-53280-expected-float-found-integer-literal.rs:25:30
+ |
+LL | let sixteen_again: f64 = 0x10;
+ | ^^^^ expected f64, found integral variable
+ |
+ = note: expected type `f64`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/issue-53280-expected-float-found-integer-literal.rs:27:30
+ |
+LL | let and_once_more: f32 = 0o20;
+ | ^^^^ expected f32, found integral variable
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/directory_ownership/foo/compiletest-ignore-dir b/src/test/ui/directory_ownership/foo/compiletest-ignore-dir
similarity index 100%
rename from src/test/compile-fail/directory_ownership/foo/compiletest-ignore-dir
rename to src/test/ui/directory_ownership/foo/compiletest-ignore-dir
diff --git a/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning/aux2.rs b/src/test/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/foo/mod_file_not_owning/aux2.rs
rename to src/test/ui/directory_ownership/foo/mod_file_not_owning/aux2.rs
diff --git a/src/test/compile-fail/directory_ownership/foo/mod_file_not_owning_aux2.rs b/src/test/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/foo/mod_file_not_owning_aux2.rs
rename to src/test/ui/directory_ownership/foo/mod_file_not_owning_aux2.rs
diff --git a/src/test/compile-fail/directory_ownership/macro-expanded-mod.rs b/src/test/ui/directory_ownership/macro-expanded-mod.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/macro-expanded-mod.rs
rename to src/test/ui/directory_ownership/macro-expanded-mod.rs
diff --git a/src/test/ui/directory_ownership/macro-expanded-mod.stderr b/src/test/ui/directory_ownership/macro-expanded-mod.stderr
new file mode 100644
index 0000000..a9efcd8
--- /dev/null
+++ b/src/test/ui/directory_ownership/macro-expanded-mod.stderr
@@ -0,0 +1,8 @@
+error: Cannot declare a non-inline module inside a block unless it has a path attribute
+ --> $DIR/macro-expanded-mod.rs:22:15
+ |
+LL | mod_decl!(foo); //~ ERROR Cannot declare a non-inline module inside a block
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/directory_ownership/macro_expanded_mod_helper/foo/bar.rs b/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/macro_expanded_mod_helper/foo/bar.rs
rename to src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/bar.rs
diff --git a/src/test/compile-fail/directory_ownership/macro_expanded_mod_helper/foo/mod.rs b/src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/macro_expanded_mod_helper/foo/mod.rs
rename to src/test/ui/directory_ownership/macro_expanded_mod_helper/foo/mod.rs
diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning.rs b/src/test/ui/directory_ownership/mod_file_not_owning.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/mod_file_not_owning.rs
rename to src/test/ui/directory_ownership/mod_file_not_owning.rs
diff --git a/src/test/ui/directory_ownership/mod_file_not_owning.stderr b/src/test/ui/directory_ownership/mod_file_not_owning.stderr
new file mode 100644
index 0000000..e293757
--- /dev/null
+++ b/src/test/ui/directory_ownership/mod_file_not_owning.stderr
@@ -0,0 +1,15 @@
+error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660)
+ --> $DIR/mod_file_not_owning_aux1.rs:14:17
+ |
+LL | () => { mod mod_file_not_owning_aux2; }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+LL | }
+LL | m!();
+ | ----- in this macro invocation
+ |
+ = help: add #![feature(non_modrs_mods)] to the crate attributes to enable
+ = help: on stable builds, rename this file to mod_file_not_owning_aux1/mod.rs
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux1.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1.rs
rename to src/test/ui/directory_ownership/mod_file_not_owning_aux1.rs
diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir b/src/test/ui/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir
similarity index 100%
rename from src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir
rename to src/test/ui/directory_ownership/mod_file_not_owning_aux1/compiletest-ignore-dir
diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs
rename to src/test/ui/directory_ownership/mod_file_not_owning_aux1/mod_file_not_owning_aux2.rs
diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux2.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux2.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/mod_file_not_owning_aux2.rs
rename to src/test/ui/directory_ownership/mod_file_not_owning_aux2.rs
diff --git a/src/test/compile-fail/directory_ownership/mod_file_not_owning_aux3.rs b/src/test/ui/directory_ownership/mod_file_not_owning_aux3.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/mod_file_not_owning_aux3.rs
rename to src/test/ui/directory_ownership/mod_file_not_owning_aux3.rs
diff --git a/src/test/compile-fail/directory_ownership/non-inline-mod-restriction.rs b/src/test/ui/directory_ownership/non-inline-mod-restriction.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/non-inline-mod-restriction.rs
rename to src/test/ui/directory_ownership/non-inline-mod-restriction.rs
diff --git a/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr
new file mode 100644
index 0000000..93debdd
--- /dev/null
+++ b/src/test/ui/directory_ownership/non-inline-mod-restriction.stderr
@@ -0,0 +1,8 @@
+error: Cannot declare a non-inline module inside a block unless it has a path attribute
+ --> $DIR/non-inline-mod-restriction.rs:14:9
+ |
+LL | mod foo; //~ ERROR Cannot declare a non-inline module inside a block
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/directory_ownership/unowned_mod_with_path.rs b/src/test/ui/directory_ownership/unowned_mod_with_path.rs
similarity index 100%
rename from src/test/compile-fail/directory_ownership/unowned_mod_with_path.rs
rename to src/test/ui/directory_ownership/unowned_mod_with_path.rs
diff --git a/src/test/ui/directory_ownership/unowned_mod_with_path.stderr b/src/test/ui/directory_ownership/unowned_mod_with_path.stderr
new file mode 100644
index 0000000..0c0b428
--- /dev/null
+++ b/src/test/ui/directory_ownership/unowned_mod_with_path.stderr
@@ -0,0 +1,15 @@
+error[E0658]: mod statements in non-mod.rs files are unstable (see issue #44660)
+ --> $DIR/mod_file_not_owning_aux1.rs:14:17
+ |
+LL | () => { mod mod_file_not_owning_aux2; }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+LL | }
+LL | m!();
+ | ----- in this macro invocation
+ |
+ = help: add #![feature(non_modrs_mods)] to the crate attributes to enable
+ = help: on stable builds, rename this file to foo/mod.rs
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr
new file mode 100644
index 0000000..8e05993
--- /dev/null
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.nll.stderr
@@ -0,0 +1,17 @@
+error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:22
+ |
+LL | let X { x: y } = x; //~ ERROR cannot move out of type
+ | - ^ cannot move out of here
+ | |
+ | data moved here
+ |
+note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:16
+ |
+LL | let X { x: y } = x; //~ ERROR cannot move out of type
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs
similarity index 100%
rename from src/test/compile-fail/disallowed-deconstructing-destructing-struct-let.rs
rename to src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.rs
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr
new file mode 100644
index 0000000..cbf5fc6
--- /dev/null
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-let.stderr
@@ -0,0 +1,12 @@
+error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-let.rs:22:9
+ |
+LL | let X { x: y } = x; //~ ERROR cannot move out of type
+ | ^^^^^^^-^^
+ | | |
+ | | hint: to prevent move, use `ref y` or `ref mut y`
+ | cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr
new file mode 100644
index 0000000..dd1a3ef
--- /dev/null
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.nll.stderr
@@ -0,0 +1,17 @@
+error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:24:11
+ |
+LL | match x {
+ | ^ cannot move out of here
+LL | X { x: y } => println!("contents: {}", y)
+ | - data moved here
+ |
+note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:25:16
+ |
+LL | X { x: y } => println!("contents: {}", y)
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs
similarity index 100%
rename from src/test/compile-fail/disallowed-deconstructing-destructing-struct-match.rs
rename to src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.rs
diff --git a/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr
new file mode 100644
index 0000000..af2a1a0
--- /dev/null
+++ b/src/test/ui/disallowed-deconstructing/disallowed-deconstructing-destructing-struct-match.stderr
@@ -0,0 +1,12 @@
+error[E0509]: cannot move out of type `X`, which implements the `Drop` trait
+ --> $DIR/disallowed-deconstructing-destructing-struct-match.rs:25:9
+ |
+LL | X { x: y } => println!("contents: {}", y)
+ | ^^^^^^^-^^
+ | | |
+ | | hint: to prevent move, use `ref y` or `ref mut y`
+ | cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/discrim-ill-typed.rs b/src/test/ui/discrim/discrim-ill-typed.rs
similarity index 100%
rename from src/test/compile-fail/discrim-ill-typed.rs
rename to src/test/ui/discrim/discrim-ill-typed.rs
diff --git a/src/test/ui/discrim/discrim-ill-typed.stderr b/src/test/ui/discrim/discrim-ill-typed.stderr
new file mode 100644
index 0000000..5091103
--- /dev/null
+++ b/src/test/ui/discrim/discrim-ill-typed.stderr
@@ -0,0 +1,51 @@
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:27:16
+ |
+LL | OhNo = 0_u8,
+ | ^^^^ expected i8, found u8
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:40:16
+ |
+LL | OhNo = 0_i8,
+ | ^^^^ expected u8, found i8
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:53:16
+ |
+LL | OhNo = 0_u16,
+ | ^^^^^ expected i16, found u16
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:66:16
+ |
+LL | OhNo = 0_i16,
+ | ^^^^^ expected u16, found i16
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:79:16
+ |
+LL | OhNo = 0_u32,
+ | ^^^^^ expected i32, found u32
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:92:16
+ |
+LL | OhNo = 0_i32,
+ | ^^^^^ expected u32, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:105:16
+ |
+LL | OhNo = 0_u64,
+ | ^^^^^ expected i64, found u64
+
+error[E0308]: mismatched types
+ --> $DIR/discrim-ill-typed.rs:118:16
+ |
+LL | OhNo = 0_i64,
+ | ^^^^^ expected u64, found i64
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/discrim-overflow-2.rs b/src/test/ui/discrim/discrim-overflow-2.rs
similarity index 100%
rename from src/test/ui/discrim-overflow-2.rs
rename to src/test/ui/discrim/discrim-overflow-2.rs
diff --git a/src/test/ui/discrim-overflow-2.stderr b/src/test/ui/discrim/discrim-overflow-2.stderr
similarity index 100%
rename from src/test/ui/discrim-overflow-2.stderr
rename to src/test/ui/discrim/discrim-overflow-2.stderr
diff --git a/src/test/ui/discrim-overflow.rs b/src/test/ui/discrim/discrim-overflow.rs
similarity index 100%
rename from src/test/ui/discrim-overflow.rs
rename to src/test/ui/discrim/discrim-overflow.rs
diff --git a/src/test/ui/discrim-overflow.stderr b/src/test/ui/discrim/discrim-overflow.stderr
similarity index 100%
rename from src/test/ui/discrim-overflow.stderr
rename to src/test/ui/discrim/discrim-overflow.stderr
diff --git a/src/test/compile-fail/diverging-fn-tail-35849.rs b/src/test/ui/diverging-fn-tail-35849.rs
similarity index 100%
rename from src/test/compile-fail/diverging-fn-tail-35849.rs
rename to src/test/ui/diverging-fn-tail-35849.rs
diff --git a/src/test/ui/diverging-fn-tail-35849.stderr b/src/test/ui/diverging-fn-tail-35849.stderr
new file mode 100644
index 0000000..8f8ab79
--- /dev/null
+++ b/src/test/ui/diverging-fn-tail-35849.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/diverging-fn-tail-35849.rs:13:9
+ |
+LL | fn assert_sizeof() -> ! {
+ | - expected `!` because of return type
+LL | unsafe {
+LL | ::std::mem::transmute::<f64, [u8; 8]>(panic!())
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected !, found array of 8 elements
+ |
+ = note: expected type `!`
+ found type `[u8; 8]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/diverging-tuple-parts-39485.rs b/src/test/ui/diverging-tuple-parts-39485.rs
similarity index 100%
rename from src/test/compile-fail/diverging-tuple-parts-39485.rs
rename to src/test/ui/diverging-tuple-parts-39485.rs
diff --git a/src/test/ui/diverging-tuple-parts-39485.stderr b/src/test/ui/diverging-tuple-parts-39485.stderr
new file mode 100644
index 0000000..603f870
--- /dev/null
+++ b/src/test/ui/diverging-tuple-parts-39485.stderr
@@ -0,0 +1,25 @@
+error[E0308]: mismatched types
+ --> $DIR/diverging-tuple-parts-39485.rs:18:5
+ |
+LL | fn g() {
+ | - help: try adding a return type: `-> &_`
+LL | &panic!() //~ ERROR mismatched types
+ | ^^^^^^^^^ expected (), found reference
+ |
+ = note: expected type `()`
+ found type `&_`
+
+error[E0308]: mismatched types
+ --> $DIR/diverging-tuple-parts-39485.rs:22:5
+ |
+LL | fn f() -> isize {
+ | ----- expected `isize` because of return type
+LL | (return 1, return 2) //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ expected isize, found tuple
+ |
+ = note: expected type `isize`
+ found type `(!, !)`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/does-nothing.rs b/src/test/ui/does-nothing.rs
similarity index 100%
rename from src/test/compile-fail/does-nothing.rs
rename to src/test/ui/does-nothing.rs
diff --git a/src/test/ui/does-nothing.stderr b/src/test/ui/does-nothing.stderr
new file mode 100644
index 0000000..fa4b1f2
--- /dev/null
+++ b/src/test/ui/does-nothing.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `this_does_nothing_what_the` in this scope
+ --> $DIR/does-nothing.rs:11:32
+ |
+LL | fn main() { println!("doing"); this_does_nothing_what_the; println!("boing"); }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/dollar-crate-is-keyword-2.rs b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.rs
similarity index 100%
rename from src/test/compile-fail/dollar-crate-is-keyword-2.rs
rename to src/test/ui/dollar-crate/dollar-crate-is-keyword-2.rs
diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr
new file mode 100644
index 0000000..c9b4f89
--- /dev/null
+++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword-2.stderr
@@ -0,0 +1,31 @@
+error[E0432]: unresolved import `a::$crate`
+ --> $DIR/dollar-crate-is-keyword-2.rs:15:13
+ |
+LL | use a::$crate; //~ ERROR unresolved import `a::$crate`
+ | ^^^^^^^^^ no `$crate` in `a`
+...
+LL | m!();
+ | ----- in this macro invocation
+
+error[E0433]: failed to resolve. `$crate` in paths can only be used in start position
+ --> $DIR/dollar-crate-is-keyword-2.rs:16:16
+ |
+LL | use a::$crate::b; //~ ERROR `$crate` in paths can only be used in start position
+ | ^^^^^^ `$crate` in paths can only be used in start position
+...
+LL | m!();
+ | ----- in this macro invocation
+
+error[E0433]: failed to resolve. `$crate` in paths can only be used in start position
+ --> $DIR/dollar-crate-is-keyword-2.rs:17:21
+ |
+LL | type A = a::$crate; //~ ERROR `$crate` in paths can only be used in start position
+ | ^^^^^^ `$crate` in paths can only be used in start position
+...
+LL | m!();
+ | ----- in this macro invocation
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0432, E0433.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs
new file mode 100644
index 0000000..4a667f0
--- /dev/null
+++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs
@@ -0,0 +1,28 @@
+// 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.
+
+macro_rules! m {
+ () => {
+ // Avoid having more than one `$crate`-named item in the same module,
+ // as even though they error, they still parse as `$crate` and conflict.
+ mod foo {
+ struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate`
+ }
+
+ use $crate; // OK
+ //~^ WARN `$crate` may not be imported
+ use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate`
+ //~^ WARN `$crate` may not be imported
+ }
+}
+
+m!();
+
+fn main() {}
diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr
new file mode 100644
index 0000000..77f4ef3
--- /dev/null
+++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.stderr
@@ -0,0 +1,42 @@
+error: expected identifier, found reserved identifier `$crate`
+ --> $DIR/dollar-crate-is-keyword.rs:16:20
+ |
+LL | struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate`
+ | ^^^^^^ expected identifier, found reserved identifier
+...
+LL | m!();
+ | ----- in this macro invocation
+
+error: expected identifier, found reserved identifier `$crate`
+ --> $DIR/dollar-crate-is-keyword.rs:21:23
+ |
+LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate`
+ | ^^^^^^ expected identifier, found reserved identifier
+...
+LL | m!();
+ | ----- in this macro invocation
+
+warning: `$crate` may not be imported
+ --> $DIR/dollar-crate-is-keyword.rs:19:9
+ |
+LL | use $crate; // OK
+ | ^^^^^^^^^^^
+...
+LL | m!();
+ | ----- in this macro invocation
+ |
+ = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
+
+warning: `$crate` may not be imported
+ --> $DIR/dollar-crate-is-keyword.rs:21:9
+ |
+LL | use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate`
+ | ^^^^^^^^^^^^^^^^^^^^^
+...
+LL | m!();
+ | ----- in this macro invocation
+ |
+ = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/double-type-import.rs b/src/test/ui/double-type-import.rs
similarity index 100%
rename from src/test/compile-fail/double-type-import.rs
rename to src/test/ui/double-type-import.rs
diff --git a/src/test/ui/double-type-import.stderr b/src/test/ui/double-type-import.stderr
new file mode 100644
index 0000000..d5d977d
--- /dev/null
+++ b/src/test/ui/double-type-import.stderr
@@ -0,0 +1,17 @@
+error[E0252]: the name `X` is defined multiple times
+ --> $DIR/double-type-import.rs:13:9
+ |
+LL | pub use self::bar::X;
+ | ------------ previous import of the type `X` here
+LL | use self::bar::X;
+ | ^^^^^^^^^^^^ `X` reimported here
+ |
+ = note: `X` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use self::bar::X as OtherX;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0252`.
diff --git a/src/test/compile-fail/drop-on-non-struct.rs b/src/test/ui/dropck/drop-on-non-struct.rs
similarity index 100%
rename from src/test/compile-fail/drop-on-non-struct.rs
rename to src/test/ui/dropck/drop-on-non-struct.rs
diff --git a/src/test/ui/dropck/drop-on-non-struct.stderr b/src/test/ui/dropck/drop-on-non-struct.stderr
new file mode 100644
index 0000000..6582df6
--- /dev/null
+++ b/src/test/ui/dropck/drop-on-non-struct.stderr
@@ -0,0 +1,19 @@
+error[E0120]: the Drop trait may only be implemented on structures
+ --> $DIR/drop-on-non-struct.rs:11:19
+ |
+LL | impl<'a> Drop for &'a mut isize {
+ | ^^^^^^^^^^^^^ implementing Drop requires a struct
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/drop-on-non-struct.rs:11:1
+ |
+LL | impl<'a> Drop for &'a mut isize {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0117, E0120.
+For more information about an error, try `rustc --explain E0117`.
diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr
new file mode 100644
index 0000000..30f9907
--- /dev/null
+++ b/src/test/ui/dropck/drop-with-active-borrows-1.nll.stderr
@@ -0,0 +1,13 @@
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/drop-with-active-borrows-1.rs:14:10
+ |
+LL | let b: Vec<&str> = a.lines().collect();
+ | - borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed
+ | ^ move out of `a` occurs here
+LL | for s in &b {
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/drop-with-active-borrows-1.rs b/src/test/ui/dropck/drop-with-active-borrows-1.rs
similarity index 100%
rename from src/test/compile-fail/drop-with-active-borrows-1.rs
rename to src/test/ui/dropck/drop-with-active-borrows-1.rs
diff --git a/src/test/ui/dropck/drop-with-active-borrows-1.stderr b/src/test/ui/dropck/drop-with-active-borrows-1.stderr
new file mode 100644
index 0000000..6010742
--- /dev/null
+++ b/src/test/ui/dropck/drop-with-active-borrows-1.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/drop-with-active-borrows-1.rs:14:10
+ |
+LL | let b: Vec<&str> = a.lines().collect();
+ | - borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a` because it is borrowed
+ | ^ move out of `a` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr
new file mode 100644
index 0000000..4f792a9
--- /dev/null
+++ b/src/test/ui/dropck/drop-with-active-borrows-2.nll.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `raw_lines` does not live long enough
+ --> $DIR/drop-with-active-borrows-2.rs:13:5
+ |
+LL | raw_lines.iter().map(|l| l.trim()).collect()
+ | ^^^^^^^^^ borrowed value does not live long enough
+LL | //~^ ERROR `raw_lines` does not live long enough
+LL | }
+ | - `raw_lines` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:24...
+ --> $DIR/drop-with-active-borrows-2.rs:11:24
+ |
+LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/drop-with-active-borrows-2.rs b/src/test/ui/dropck/drop-with-active-borrows-2.rs
similarity index 100%
rename from src/test/compile-fail/drop-with-active-borrows-2.rs
rename to src/test/ui/dropck/drop-with-active-borrows-2.rs
diff --git a/src/test/ui/dropck/drop-with-active-borrows-2.stderr b/src/test/ui/dropck/drop-with-active-borrows-2.stderr
new file mode 100644
index 0000000..0fd4bf8
--- /dev/null
+++ b/src/test/ui/dropck/drop-with-active-borrows-2.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `raw_lines` does not live long enough
+ --> $DIR/drop-with-active-borrows-2.rs:13:5
+ |
+LL | raw_lines.iter().map(|l| l.trim()).collect()
+ | ^^^^^^^^^ borrowed value does not live long enough
+LL | //~^ ERROR `raw_lines` does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 11:24...
+ --> $DIR/drop-with-active-borrows-2.rs:11:24
+ |
+LL | fn read_lines_borrowed<'a>() -> Vec<&'a str> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-union.nll.stderr b/src/test/ui/dropck/dropck-union.nll.stderr
new file mode 100644
index 0000000..35d7ffc
--- /dev/null
+++ b/src/test/ui/dropck/dropck-union.nll.stderr
@@ -0,0 +1,16 @@
+error[E0597]: `v` does not live long enough
+ --> $DIR/dropck-union.rs:49:18
+ |
+LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | -
+ | |
+ | `v` dropped here while still borrowed
+ | borrow later used here, when `v` is dropped
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/dropck/dropck-union.rs b/src/test/ui/dropck/dropck-union.rs
new file mode 100644
index 0000000..f16d761
--- /dev/null
+++ b/src/test/ui/dropck/dropck-union.rs
@@ -0,0 +1,50 @@
+// 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.
+
+#![feature(untagged_unions)]
+
+use std::cell::Cell;
+use std::ops::Deref;
+use std::mem::ManuallyDrop;
+
+union Wrap<T> { x: ManuallyDrop<T> }
+
+impl<T> Drop for Wrap<T> {
+ fn drop(&mut self) {
+ unsafe { std::ptr::drop_in_place(&mut *self.x as *mut T); }
+ }
+}
+
+impl<T> Wrap<T> {
+ fn new(x: T) -> Self {
+ Wrap { x: ManuallyDrop::new(x) }
+ }
+}
+
+impl<T> Deref for Wrap<T> {
+ type Target = T;
+ #[inline]
+ fn deref(&self) -> &Self::Target {
+ unsafe {
+ &self.x
+ }
+ }
+}
+
+struct C<'a>(Cell<Option<&'a C<'a>>>);
+
+impl<'a> Drop for C<'a> {
+ fn drop(&mut self) {}
+}
+
+fn main() {
+ let v : Wrap<C> = Wrap::new(C(Cell::new(None)));
+ v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough
+}
diff --git a/src/test/ui/dropck/dropck-union.stderr b/src/test/ui/dropck/dropck-union.stderr
new file mode 100644
index 0000000..a383ca5
--- /dev/null
+++ b/src/test/ui/dropck/dropck-union.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `v` does not live long enough
+ --> $DIR/dropck-union.rs:49:19
+ |
+LL | v.0.set(Some(&v)); //~ ERROR: `v` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - `v` dropped here while still borrowed
+ |
+ = note: values in a scope are dropped in the opposite order they are created
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/dropck_no_diverge_on_nonregular_1.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs
similarity index 100%
rename from src/test/compile-fail/dropck_no_diverge_on_nonregular_1.rs
rename to src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.rs
diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr
new file mode 100644
index 0000000..f4dd867
--- /dev/null
+++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_1.stderr
@@ -0,0 +1,19 @@
+error[E0320]: overflow while adding drop-check rules for FingerTree<i32>
+ --> $DIR/dropck_no_diverge_on_nonregular_1.rs:34:9
+ |
+LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree
+ | ^^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error[E0320]: overflow while adding drop-check rules for FingerTree<i32>
+ --> $DIR/dropck_no_diverge_on_nonregular_1.rs:35:9
+ |
+LL | FingerTree::Single(1);
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0320`.
diff --git a/src/test/compile-fail/dropck_no_diverge_on_nonregular_2.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs
similarity index 100%
rename from src/test/compile-fail/dropck_no_diverge_on_nonregular_2.rs
rename to src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.rs
diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr
new file mode 100644
index 0000000..ae9c50a
--- /dev/null
+++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_2.stderr
@@ -0,0 +1,19 @@
+error[E0320]: overflow while adding drop-check rules for FingerTree<i32>
+ --> $DIR/dropck_no_diverge_on_nonregular_2.rs:33:9
+ |
+LL | let ft = //~ ERROR overflow while adding drop-check rules for FingerTree
+ | ^^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error[E0320]: overflow while adding drop-check rules for FingerTree<i32>
+ --> $DIR/dropck_no_diverge_on_nonregular_2.rs:34:9
+ |
+LL | FingerTree::Single(1);
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<i32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0320`.
diff --git a/src/test/compile-fail/dropck_no_diverge_on_nonregular_3.rs b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs
similarity index 100%
rename from src/test/compile-fail/dropck_no_diverge_on_nonregular_3.rs
rename to src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.rs
diff --git a/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr
new file mode 100644
index 0000000..e0089f8
--- /dev/null
+++ b/src/test/ui/dropck/dropck_no_diverge_on_nonregular_3.stderr
@@ -0,0 +1,27 @@
+error[E0320]: overflow while adding drop-check rules for std::option::Option<Wrapper<u32>>
+ --> $DIR/dropck_no_diverge_on_nonregular_3.rs:42:9
+ |
+LL | let w = //~ ERROR overflow while adding drop-check rules for std::option
+ | ^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error[E0320]: overflow while adding drop-check rules for std::option::Option<Wrapper<u32>>
+ --> $DIR/dropck_no_diverge_on_nonregular_3.rs:43:9
+ |
+LL | Some(Wrapper::Simple::<u32>);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error[E0320]: overflow while adding drop-check rules for Wrapper<u32>
+ --> $DIR/dropck_no_diverge_on_nonregular_3.rs:43:14
+ |
+LL | Some(Wrapper::Simple::<u32>);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: overflowed on FingerTree<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<Node<u32>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0320`.
diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr
new file mode 100644
index 0000000..a47229c
--- /dev/null
+++ b/src/test/ui/dropck/dropck_trait_cycle_checked.nll.stderr
@@ -0,0 +1,68 @@
+error[E0597]: `o2` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:121:13
+ |
+LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `o2` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o3` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:122:13
+ |
+LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `o3` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o2` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:123:13
+ |
+LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `o2` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o3` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:124:13
+ |
+LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `o3` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o1` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:125:13
+ |
+LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough
+LL | }
+ | - `o1` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o2` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:126:13
+ |
+LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | }
+ | - `o2` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/dropck_trait_cycle_checked.rs b/src/test/ui/dropck/dropck_trait_cycle_checked.rs
similarity index 100%
rename from src/test/compile-fail/dropck_trait_cycle_checked.rs
rename to src/test/ui/dropck/dropck_trait_cycle_checked.rs
diff --git a/src/test/ui/dropck/dropck_trait_cycle_checked.stderr b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr
new file mode 100644
index 0000000..ab255cf
--- /dev/null
+++ b/src/test/ui/dropck/dropck_trait_cycle_checked.stderr
@@ -0,0 +1,68 @@
+error[E0597]: `o2` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:121:14
+ |
+LL | o1.set0(&o2); //~ ERROR `o2` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o3` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:122:14
+ |
+LL | o1.set1(&o3); //~ ERROR `o3` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o2` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:123:14
+ |
+LL | o2.set0(&o2); //~ ERROR `o2` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o3` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:124:14
+ |
+LL | o2.set1(&o3); //~ ERROR `o3` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o1` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:125:14
+ |
+LL | o3.set0(&o1); //~ ERROR `o1` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `o2` does not live long enough
+ --> $DIR/dropck_trait_cycle_checked.rs:126:14
+ |
+LL | o3.set1(&o2); //~ ERROR `o2` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/ui/dst/dst-bad-assign-2.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-assign-2.rs
rename to src/test/ui/dst/dst-bad-assign-2.rs
diff --git a/src/test/ui/dst/dst-bad-assign-2.stderr b/src/test/ui/dst/dst-bad-assign-2.stderr
new file mode 100644
index 0000000..ead973d
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-assign-2.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time
+ --> $DIR/dst-bad-assign-2.rs:45:5
+ |
+LL | f5.ptr = *z;
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: the left-hand-side of an assignment must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/dst-bad-assign-3.rs b/src/test/ui/dst/dst-bad-assign-3.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-assign-3.rs
rename to src/test/ui/dst/dst-bad-assign-3.rs
diff --git a/src/test/ui/dst/dst-bad-assign-3.stderr b/src/test/ui/dst/dst-bad-assign-3.stderr
new file mode 100644
index 0000000..ec172fa
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-assign-3.stderr
@@ -0,0 +1,23 @@
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-assign-3.rs:43:12
+ |
+LL | f5.2 = Bar1 {f: 36};
+ | ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
+ |
+ = note: expected type `dyn ToBar`
+ found type `Bar1`
+
+error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time
+ --> $DIR/dst-bad-assign-3.rs:43:5
+ |
+LL | f5.2 = Bar1 {f: 36};
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: the left-hand-side of an assignment must have a statically known size
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/ui/dst/dst-bad-assign.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-assign.rs
rename to src/test/ui/dst/dst-bad-assign.rs
diff --git a/src/test/ui/dst/dst-bad-assign.stderr b/src/test/ui/dst/dst-bad-assign.stderr
new file mode 100644
index 0000000..72f28af
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-assign.stderr
@@ -0,0 +1,23 @@
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-assign.rs:45:14
+ |
+LL | f5.ptr = Bar1 {f: 36};
+ | ^^^^^^^^^^^^ expected trait ToBar, found struct `Bar1`
+ |
+ = note: expected type `dyn ToBar`
+ found type `Bar1`
+
+error[E0277]: the size for values of type `dyn ToBar` cannot be known at compilation time
+ --> $DIR/dst-bad-assign.rs:45:5
+ |
+LL | f5.ptr = Bar1 {f: 36};
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn ToBar`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: the left-hand-side of an assignment must have a statically known size
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/dst-bad-coerce1.rs b/src/test/ui/dst/dst-bad-coerce1.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-coerce1.rs
rename to src/test/ui/dst/dst-bad-coerce1.rs
diff --git a/src/test/ui/dst/dst-bad-coerce1.stderr b/src/test/ui/dst/dst-bad-coerce1.stderr
new file mode 100644
index 0000000..bb59c4d
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-coerce1.stderr
@@ -0,0 +1,38 @@
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce1.rs:26:29
+ |
+LL | let f3: &Fat<[usize]> = f2;
+ | ^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&Fat<[usize]>`
+ found type `&Fat<[isize; 3]>`
+
+error[E0277]: the trait bound `Foo: Bar` is not satisfied
+ --> $DIR/dst-bad-coerce1.rs:32:25
+ |
+LL | let f3: &Fat<Bar> = f2;
+ | ^^ the trait `Bar` is not implemented for `Foo`
+ |
+ = note: required for the cast to the object type `dyn Bar`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce1.rs:38:27
+ |
+LL | let f3: &([usize],) = f2;
+ | ^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&([usize],)`
+ found type `&([isize; 3],)`
+
+error[E0277]: the trait bound `Foo: Bar` is not satisfied
+ --> $DIR/dst-bad-coerce1.rs:44:23
+ |
+LL | let f3: &(Bar,) = f2;
+ | ^^ the trait `Bar` is not implemented for `Foo`
+ |
+ = note: required for the cast to the object type `dyn Bar`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/dst-bad-coerce2.rs b/src/test/ui/dst/dst-bad-coerce2.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-coerce2.rs
rename to src/test/ui/dst/dst-bad-coerce2.rs
diff --git a/src/test/ui/dst/dst-bad-coerce2.stderr b/src/test/ui/dst/dst-bad-coerce2.stderr
new file mode 100644
index 0000000..5199154
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-coerce2.stderr
@@ -0,0 +1,39 @@
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce2.rs:25:33
+ |
+LL | let f3: &mut Fat<[isize]> = f2; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut Fat<[isize]>`
+ found type `&Fat<[isize; 3]>`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce2.rs:30:29
+ |
+LL | let f3: &mut Fat<Bar> = f2; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut Fat<dyn Bar>`
+ found type `&Fat<Foo>`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce2.rs:35:31
+ |
+LL | let f3: &mut ([isize],) = f2; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut ([isize],)`
+ found type `&([isize; 3],)`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce2.rs:40:27
+ |
+LL | let f3: &mut (Bar,) = f2; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut (dyn Bar,)`
+ found type `&(Foo,)`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/dst/dst-bad-coerce3.nll.stderr b/src/test/ui/dst/dst-bad-coerce3.nll.stderr
new file mode 100644
index 0000000..bc5b4ca
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-coerce3.nll.stderr
@@ -0,0 +1,63 @@
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:26:32
+ |
+LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `f1` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:31:25
+ |
+LL | let f2: &Fat<Foo> = &f1; //~ ERROR `f1` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `f1` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:36:30
+ |
+LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `f1` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:41:23
+ |
+LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | let f3: &'a (Bar,) = f2;
+LL | }
+ | - `f1` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/dst-bad-coerce3.rs b/src/test/ui/dst/dst-bad-coerce3.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-coerce3.rs
rename to src/test/ui/dst/dst-bad-coerce3.rs
diff --git a/src/test/ui/dst/dst-bad-coerce3.stderr b/src/test/ui/dst/dst-bad-coerce3.stderr
new file mode 100644
index 0000000..3c4eb27
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-coerce3.stderr
@@ -0,0 +1,63 @@
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:26:33
+ |
+LL | let f2: &Fat<[isize; 3]> = &f1; //~ ERROR `f1` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:31:26
+ |
+LL | let f2: &Fat<Foo> = &f1; //~ ERROR `f1` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:36:31
+ |
+LL | let f2: &([isize; 3],) = &f1; //~ ERROR `f1` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error[E0597]: `f1` does not live long enough
+ --> $DIR/dst-bad-coerce3.rs:41:24
+ |
+LL | let f2: &(Foo,) = &f1; //~ ERROR `f1` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | let f3: &'a (Bar,) = f2;
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:8...
+ --> $DIR/dst-bad-coerce3.rs:23:8
+ |
+LL | fn baz<'a>() {
+ | ^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/dst-bad-coerce4.rs b/src/test/ui/dst/dst-bad-coerce4.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-coerce4.rs
rename to src/test/ui/dst/dst-bad-coerce4.rs
diff --git a/src/test/ui/dst/dst-bad-coerce4.stderr b/src/test/ui/dst/dst-bad-coerce4.stderr
new file mode 100644
index 0000000..279de13
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-coerce4.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce4.rs:22:32
+ |
+LL | let f2: &Fat<[isize; 3]> = f1;
+ | ^^ expected array of 3 elements, found slice
+ |
+ = note: expected type `&Fat<[isize; 3]>`
+ found type `&Fat<[isize]>`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coerce4.rs:30:30
+ |
+LL | let f2: &([isize; 3],) = f1;
+ | ^^ expected array of 3 elements, found slice
+ |
+ = note: expected type `&([isize; 3],)`
+ found type `&([isize],)`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/dst-bad-coercions.rs b/src/test/ui/dst/dst-bad-coercions.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-coercions.rs
rename to src/test/ui/dst/dst-bad-coercions.rs
diff --git a/src/test/ui/dst/dst-bad-coercions.stderr b/src/test/ui/dst/dst-bad-coercions.stderr
new file mode 100644
index 0000000..8901ef1
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-coercions.stderr
@@ -0,0 +1,72 @@
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:24:17
+ |
+LL | let y: &S = x; //~ ERROR mismatched types
+ | ^ expected &S, found *-ptr
+ |
+ = note: expected type `&S`
+ found type `*const S`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:25:17
+ |
+LL | let y: &T = x; //~ ERROR mismatched types
+ | ^
+ | |
+ | expected &dyn T, found *-ptr
+ | help: consider borrowing here: `&x`
+ |
+ = note: expected type `&dyn T`
+ found type `*const S`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:29:17
+ |
+LL | let y: &S = x; //~ ERROR mismatched types
+ | ^ expected &S, found *-ptr
+ |
+ = note: expected type `&S`
+ found type `*mut S`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:30:17
+ |
+LL | let y: &T = x; //~ ERROR mismatched types
+ | ^
+ | |
+ | expected &dyn T, found *-ptr
+ | help: consider borrowing here: `&x`
+ |
+ = note: expected type `&dyn T`
+ found type `*mut S`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:33:21
+ |
+LL | let x: &mut T = &S; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut dyn T`
+ found type `&S`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:34:21
+ |
+LL | let x: *mut T = &S; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `*mut dyn T`
+ found type `&S`
+
+error[E0308]: mismatched types
+ --> $DIR/dst-bad-coercions.rs:35:21
+ |
+LL | let x: *mut S = &S; //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `*mut S`
+ found type `&S`
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/dst-bad-deep-2.rs b/src/test/ui/dst/dst-bad-deep-2.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-deep-2.rs
rename to src/test/ui/dst/dst-bad-deep-2.rs
diff --git a/src/test/ui/dst/dst-bad-deep-2.stderr b/src/test/ui/dst/dst-bad-deep-2.stderr
new file mode 100644
index 0000000..2c0a540
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-deep-2.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the size for values of type `[isize]` cannot be known at compilation time
+ --> $DIR/dst-bad-deep-2.rs:21:30
+ |
+LL | let h: &(([isize],),) = &(*g,);
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `(([isize],),)`, the trait `std::marker::Sized` is not implemented for `[isize]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `([isize],)`
+ = note: required because it appears within the type `(([isize],),)`
+ = note: tuples must have a statically known size to be initialized
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/ui/dst/dst-bad-deep.rs
similarity index 100%
rename from src/test/compile-fail/dst-bad-deep.rs
rename to src/test/ui/dst/dst-bad-deep.rs
diff --git a/src/test/ui/dst/dst-bad-deep.stderr b/src/test/ui/dst/dst-bad-deep.stderr
new file mode 100644
index 0000000..2ac8cb3
--- /dev/null
+++ b/src/test/ui/dst/dst-bad-deep.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the size for values of type `[isize]` cannot be known at compilation time
+ --> $DIR/dst-bad-deep.rs:23:34
+ |
+LL | let h: &Fat<Fat<[isize]>> = &Fat { ptr: *g };
+ | ^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Fat<Fat<[isize]>>`, the trait `std::marker::Sized` is not implemented for `[isize]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Fat<[isize]>`
+ = note: required because it appears within the type `Fat<Fat<[isize]>>`
+ = note: structs must have a statically known size to be initialized
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/dst/dst-index.nll.stderr b/src/test/ui/dst/dst-index.nll.stderr
new file mode 100644
index 0000000..767d8a8
--- /dev/null
+++ b/src/test/ui/dst/dst-index.nll.stderr
@@ -0,0 +1,28 @@
+error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
+ --> $DIR/dst-index.rs:41:5
+ |
+LL | S[0];
+ | ^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/dst-index.rs:41:5
+ |
+LL | S[0];
+ | ^^^^ cannot move out of borrowed content
+
+error[E0161]: cannot move a value of type dyn std::fmt::Debug: the size of dyn std::fmt::Debug cannot be statically determined
+ --> $DIR/dst-index.rs:44:5
+ |
+LL | T[0];
+ | ^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/dst-index.rs:44:5
+ |
+LL | T[0];
+ | ^^^^ cannot move out of borrowed content
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0161, E0507.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/dst-index.rs b/src/test/ui/dst/dst-index.rs
similarity index 100%
rename from src/test/compile-fail/dst-index.rs
rename to src/test/ui/dst/dst-index.rs
diff --git a/src/test/ui/dst/dst-index.stderr b/src/test/ui/dst/dst-index.stderr
new file mode 100644
index 0000000..7c5e79d
--- /dev/null
+++ b/src/test/ui/dst/dst-index.stderr
@@ -0,0 +1,28 @@
+error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
+ --> $DIR/dst-index.rs:41:5
+ |
+LL | S[0];
+ | ^^^^
+
+error[E0161]: cannot move a value of type (dyn std::fmt::Debug + 'static): the size of (dyn std::fmt::Debug + 'static) cannot be statically determined
+ --> $DIR/dst-index.rs:44:5
+ |
+LL | T[0];
+ | ^^^^
+
+error[E0507]: cannot move out of indexed content
+ --> $DIR/dst-index.rs:41:5
+ |
+LL | S[0];
+ | ^^^^ cannot move out of indexed content
+
+error[E0507]: cannot move out of indexed content
+ --> $DIR/dst-index.rs:44:5
+ |
+LL | T[0];
+ | ^^^^ cannot move out of indexed content
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0161, E0507.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/dst-object-from-unsized-type.rs b/src/test/ui/dst/dst-object-from-unsized-type.rs
similarity index 100%
rename from src/test/compile-fail/dst-object-from-unsized-type.rs
rename to src/test/ui/dst/dst-object-from-unsized-type.rs
diff --git a/src/test/ui/dst/dst-object-from-unsized-type.stderr b/src/test/ui/dst/dst-object-from-unsized-type.stderr
new file mode 100644
index 0000000..862c52e
--- /dev/null
+++ b/src/test/ui/dst/dst-object-from-unsized-type.stderr
@@ -0,0 +1,45 @@
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/dst-object-from-unsized-type.rs:18:19
+ |
+LL | let u: &Foo = t;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+ = note: required for the cast to the object type `dyn Foo`
+
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/dst-object-from-unsized-type.rs:23:19
+ |
+LL | let v: &Foo = t as &Foo;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+ = note: required for the cast to the object type `dyn Foo`
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/dst-object-from-unsized-type.rs:28:24
+ |
+LL | let _: &[&Foo] = &["hi"];
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required for the cast to the object type `dyn Foo`
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/dst-object-from-unsized-type.rs:33:19
+ |
+LL | let _: &Foo = x as &Foo;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[u8]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required for the cast to the object type `dyn Foo`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/dst/dst-rvalue.nll.stderr b/src/test/ui/dst/dst-rvalue.nll.stderr
new file mode 100644
index 0000000..5eadcc3
--- /dev/null
+++ b/src/test/ui/dst/dst-rvalue.nll.stderr
@@ -0,0 +1,28 @@
+error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
+ --> $DIR/dst-rvalue.rs:16:28
+ |
+LL | let _x: Box<str> = box *"hello world";
+ | ^^^^^^^^^^^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/dst-rvalue.rs:16:28
+ |
+LL | let _x: Box<str> = box *"hello world";
+ | ^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined
+ --> $DIR/dst-rvalue.rs:21:32
+ |
+LL | let _x: Box<[isize]> = box *array;
+ | ^^^^^^
+
+error[E0508]: cannot move out of type `[isize]`, a non-copy slice
+ --> $DIR/dst-rvalue.rs:21:32
+ |
+LL | let _x: Box<[isize]> = box *array;
+ | ^^^^^^ cannot move out of here
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0161, E0507, E0508.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/dst-rvalue.rs b/src/test/ui/dst/dst-rvalue.rs
similarity index 100%
rename from src/test/compile-fail/dst-rvalue.rs
rename to src/test/ui/dst/dst-rvalue.rs
diff --git a/src/test/ui/dst/dst-rvalue.stderr b/src/test/ui/dst/dst-rvalue.stderr
new file mode 100644
index 0000000..0957105
--- /dev/null
+++ b/src/test/ui/dst/dst-rvalue.stderr
@@ -0,0 +1,28 @@
+error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
+ --> $DIR/dst-rvalue.rs:16:28
+ |
+LL | let _x: Box<str> = box *"hello world";
+ | ^^^^^^^^^^^^^^
+
+error[E0161]: cannot move a value of type [isize]: the size of [isize] cannot be statically determined
+ --> $DIR/dst-rvalue.rs:21:32
+ |
+LL | let _x: Box<[isize]> = box *array;
+ | ^^^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/dst-rvalue.rs:16:28
+ |
+LL | let _x: Box<str> = box *"hello world";
+ | ^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/dst-rvalue.rs:21:32
+ |
+LL | let _x: Box<[isize]> = box *array;
+ | ^^^^^^ cannot move out of borrowed content
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0161, E0507.
+For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/ui/dst/dst-sized-trait-param.rs
similarity index 100%
rename from src/test/compile-fail/dst-sized-trait-param.rs
rename to src/test/ui/dst/dst-sized-trait-param.rs
diff --git a/src/test/ui/dst/dst-sized-trait-param.stderr b/src/test/ui/dst/dst-sized-trait-param.stderr
new file mode 100644
index 0000000..47f8215
--- /dev/null
+++ b/src/test/ui/dst/dst-sized-trait-param.stderr
@@ -0,0 +1,21 @@
+error[E0277]: the size for values of type `[isize]` cannot be known at compilation time
+ --> $DIR/dst-sized-trait-param.rs:17:6
+ |
+LL | impl Foo<[isize]> for usize { }
+ | ^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[isize]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+
+error[E0277]: the size for values of type `[usize]` cannot be known at compilation time
+ --> $DIR/dst-sized-trait-param.rs:20:6
+ |
+LL | impl Foo<isize> for [usize] { }
+ | ^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[usize]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/duplicate-check-macro-exports.rs b/src/test/ui/duplicate-check-macro-exports.rs
deleted file mode 100644
index d8159bf..0000000
--- a/src/test/ui/duplicate-check-macro-exports.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-#![feature(use_extern_macros)]
-
-pub use std::panic;
-
-#[macro_export]
-macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multiple times
-
-fn main() {}
diff --git a/src/test/ui/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate-check-macro-exports.stderr
deleted file mode 100644
index 651e984..0000000
--- a/src/test/ui/duplicate-check-macro-exports.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-error[E0255]: the name `panic` is defined multiple times
- --> $DIR/duplicate-check-macro-exports.rs:16:1
- |
-LL | pub use std::panic;
- | ---------- previous import of the macro `panic` here
-...
-LL | macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multiple times
- | ^^^^^^^^^^^^^^^^^^ `panic` redefined here
- |
- = note: `panic` must be defined only once in the macro namespace of this module
-help: You can use `as` to change the binding name of the import
- |
-LL | pub use std::panic as other_panic;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0255`.
diff --git a/src/test/compile-fail/dupe-symbols-1.rs b/src/test/ui/duplicate/dupe-symbols-1.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-1.rs
rename to src/test/ui/duplicate/dupe-symbols-1.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-1.stderr b/src/test/ui/duplicate/dupe-symbols-1.stderr
new file mode 100644
index 0000000..c702a0f
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-1.stderr
@@ -0,0 +1,10 @@
+error: symbol `fail` is already defined
+ --> $DIR/dupe-symbols-1.rs:19:1
+ |
+LL | / pub fn b() {
+LL | | //~^ symbol `fail` is already defined
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dupe-symbols-2.rs b/src/test/ui/duplicate/dupe-symbols-2.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-2.rs
rename to src/test/ui/duplicate/dupe-symbols-2.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-2.stderr b/src/test/ui/duplicate/dupe-symbols-2.stderr
new file mode 100644
index 0000000..5d5e9d7
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-2.stderr
@@ -0,0 +1,10 @@
+error: symbol `fail` is already defined
+ --> $DIR/dupe-symbols-2.rs:22:5
+ |
+LL | / pub extern fn fail() {
+LL | | //~^ symbol `fail` is already defined
+LL | | }
+ | |_____^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dupe-symbols-3.rs b/src/test/ui/duplicate/dupe-symbols-3.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-3.rs
rename to src/test/ui/duplicate/dupe-symbols-3.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-3.stderr b/src/test/ui/duplicate/dupe-symbols-3.stderr
new file mode 100644
index 0000000..6801016
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-3.stderr
@@ -0,0 +1,10 @@
+error: symbol `fail` is already defined
+ --> $DIR/dupe-symbols-3.rs:19:1
+ |
+LL | / pub fn fail() {
+LL | | //~^ symbol `fail` is already defined
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dupe-symbols-4.rs b/src/test/ui/duplicate/dupe-symbols-4.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-4.rs
rename to src/test/ui/duplicate/dupe-symbols-4.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-4.stderr b/src/test/ui/duplicate/dupe-symbols-4.stderr
new file mode 100644
index 0000000..fdbb5ce
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-4.stderr
@@ -0,0 +1,8 @@
+error: symbol `fail` is already defined
+ --> $DIR/dupe-symbols-4.rs:30:5
+ |
+LL | fn fail(self) {}
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dupe-symbols-5.rs b/src/test/ui/duplicate/dupe-symbols-5.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-5.rs
rename to src/test/ui/duplicate/dupe-symbols-5.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-5.stderr b/src/test/ui/duplicate/dupe-symbols-5.stderr
new file mode 100644
index 0000000..8ded374
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-5.stderr
@@ -0,0 +1,10 @@
+error: symbol `fail` is already defined
+ --> $DIR/dupe-symbols-5.rs:18:1
+ |
+LL | / pub fn b() {
+LL | | //~^ symbol `fail` is already defined
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dupe-symbols-6.rs b/src/test/ui/duplicate/dupe-symbols-6.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-6.rs
rename to src/test/ui/duplicate/dupe-symbols-6.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-6.stderr b/src/test/ui/duplicate/dupe-symbols-6.stderr
new file mode 100644
index 0000000..6dbb831
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-6.stderr
@@ -0,0 +1,8 @@
+error: symbol `fail` is already defined
+ --> $DIR/dupe-symbols-6.rs:17:1
+ |
+LL | static HELLO_TWICE: u16 = 0;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/dupe-symbols-7.rs b/src/test/ui/duplicate/dupe-symbols-7.rs
similarity index 100%
rename from src/test/compile-fail/dupe-symbols-7.rs
rename to src/test/ui/duplicate/dupe-symbols-7.rs
diff --git a/src/test/ui/duplicate/dupe-symbols-7.stderr b/src/test/ui/duplicate/dupe-symbols-7.stderr
new file mode 100644
index 0000000..5fadbd5
--- /dev/null
+++ b/src/test/ui/duplicate/dupe-symbols-7.stderr
@@ -0,0 +1,10 @@
+error: entry symbol `main` defined multiple times
+ --> $DIR/dupe-symbols-7.rs:15:1
+ |
+LL | fn main(){}
+ | ^^^^^^^^^^^
+ |
+ = help: did you use #[no_mangle] on `fn main`? Use #[start] instead
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/duplicate/duplicate-check-macro-exports.rs b/src/test/ui/duplicate/duplicate-check-macro-exports.rs
new file mode 100644
index 0000000..42b2b1d
--- /dev/null
+++ b/src/test/ui/duplicate/duplicate-check-macro-exports.rs
@@ -0,0 +1,16 @@
+// 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.
+
+pub use std::panic;
+
+#[macro_export]
+macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multiple times
+
+fn main() {}
diff --git a/src/test/ui/duplicate/duplicate-check-macro-exports.stderr b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr
new file mode 100644
index 0000000..e2119ef
--- /dev/null
+++ b/src/test/ui/duplicate/duplicate-check-macro-exports.stderr
@@ -0,0 +1,18 @@
+error[E0255]: the name `panic` is defined multiple times
+ --> $DIR/duplicate-check-macro-exports.rs:14:1
+ |
+LL | pub use std::panic;
+ | ---------- previous import of the macro `panic` here
+...
+LL | macro_rules! panic { () => {} } //~ ERROR the name `panic` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^ `panic` redefined here
+ |
+ = note: `panic` must be defined only once in the macro namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use std::panic as other_panic;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0255`.
diff --git a/src/test/compile-fail/duplicate-parameter.rs b/src/test/ui/duplicate/duplicate-parameter.rs
similarity index 100%
rename from src/test/compile-fail/duplicate-parameter.rs
rename to src/test/ui/duplicate/duplicate-parameter.rs
diff --git a/src/test/ui/duplicate/duplicate-parameter.stderr b/src/test/ui/duplicate/duplicate-parameter.stderr
new file mode 100644
index 0000000..6cc7244
--- /dev/null
+++ b/src/test/ui/duplicate/duplicate-parameter.stderr
@@ -0,0 +1,9 @@
+error[E0415]: identifier `a` is bound more than once in this parameter list
+ --> $DIR/duplicate-parameter.rs:11:16
+ |
+LL | fn f(a: isize, a: isize) {}
+ | ^ used as parameter more than once
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0415`.
diff --git a/src/test/compile-fail/duplicate-type-parameter.rs b/src/test/ui/duplicate/duplicate-type-parameter.rs
similarity index 100%
rename from src/test/compile-fail/duplicate-type-parameter.rs
rename to src/test/ui/duplicate/duplicate-type-parameter.rs
diff --git a/src/test/ui/duplicate/duplicate-type-parameter.stderr b/src/test/ui/duplicate/duplicate-type-parameter.stderr
new file mode 100644
index 0000000..186a1e5
--- /dev/null
+++ b/src/test/ui/duplicate/duplicate-type-parameter.stderr
@@ -0,0 +1,66 @@
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:11:12
+ |
+LL | type Foo<T,T> = Option<T>;
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:14:14
+ |
+LL | struct Bar<T,T>(T);
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:17:14
+ |
+LL | struct Baz<T,T> {
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:22:12
+ |
+LL | enum Boo<T,T> {
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:28:11
+ |
+LL | fn quux<T,T>(x: T) {}
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:31:13
+ |
+LL | trait Qux<T,T> {}
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0403]: the name `T` is already used for a type parameter in this type parameter list
+ --> $DIR/duplicate-type-parameter.rs:34:8
+ |
+LL | impl<T,T> Qux<T,T> for Option<T> {}
+ | - ^ already used
+ | |
+ | first use of `T`
+
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/duplicate-type-parameter.rs:34:6
+ |
+LL | impl<T,T> Qux<T,T> for Option<T> {}
+ | ^ unconstrained type parameter
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0207, E0403.
+For more information about an error, try `rustc --explain E0207`.
diff --git a/src/test/compile-fail/duplicate_entry_error.rs b/src/test/ui/duplicate_entry_error.rs
similarity index 100%
rename from src/test/compile-fail/duplicate_entry_error.rs
rename to src/test/ui/duplicate_entry_error.rs
diff --git a/src/test/ui/duplicate_entry_error.stderr b/src/test/ui/duplicate_entry_error.stderr
new file mode 100644
index 0000000..b330d2f
--- /dev/null
+++ b/src/test/ui/duplicate_entry_error.stderr
@@ -0,0 +1,14 @@
+error[E0152]: duplicate lang item found: `panic_impl`.
+ --> $DIR/duplicate_entry_error.rs:20:1
+ |
+LL | / fn panic_impl(info: &PanicInfo) -> ! {
+LL | | //~^ ERROR: duplicate lang item found: `panic_impl`.
+LL | | loop {}
+LL | | }
+ | |_^
+ |
+ = note: first defined in crate `std`.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0152`.
diff --git a/src/test/compile-fail/dyn-trait-compatibility.rs b/src/test/ui/dyn-trait-compatibility.rs
similarity index 100%
rename from src/test/compile-fail/dyn-trait-compatibility.rs
rename to src/test/ui/dyn-trait-compatibility.rs
diff --git a/src/test/ui/dyn-trait-compatibility.stderr b/src/test/ui/dyn-trait-compatibility.stderr
new file mode 100644
index 0000000..1ff3249
--- /dev/null
+++ b/src/test/ui/dyn-trait-compatibility.stderr
@@ -0,0 +1,52 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `dyn`
+ --> $DIR/dyn-trait-compatibility.rs:13:11
+ |
+LL | type A1 = dyn::dyn;
+ | ^^^ Use of undeclared type or module `dyn`
+
+error[E0433]: failed to resolve. Use of undeclared type or module `dyn`
+ --> $DIR/dyn-trait-compatibility.rs:19:23
+ |
+LL | type A3 = dyn<<dyn as dyn>::dyn>;
+ | ^^^ Use of undeclared type or module `dyn`
+
+error[E0412]: cannot find type `dyn` in this scope
+ --> $DIR/dyn-trait-compatibility.rs:11:11
+ |
+LL | type A0 = dyn;
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+ --> $DIR/dyn-trait-compatibility.rs:15:11
+ |
+LL | type A2 = dyn<dyn, dyn>;
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+ --> $DIR/dyn-trait-compatibility.rs:15:15
+ |
+LL | type A2 = dyn<dyn, dyn>;
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+ --> $DIR/dyn-trait-compatibility.rs:15:20
+ |
+LL | type A2 = dyn<dyn, dyn>;
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+ --> $DIR/dyn-trait-compatibility.rs:19:11
+ |
+LL | type A3 = dyn<<dyn as dyn>::dyn>;
+ | ^^^ not found in this scope
+
+error[E0412]: cannot find type `dyn` in this scope
+ --> $DIR/dyn-trait-compatibility.rs:19:16
+ |
+LL | type A3 = dyn<<dyn as dyn>::dyn>;
+ | ^^^ not found in this scope
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0412, E0433.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/compile-fail/auxiliary/edition-extern-crate-allowed.rs b/src/test/ui/editions/auxiliary/edition-extern-crate-allowed.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/edition-extern-crate-allowed.rs
rename to src/test/ui/editions/auxiliary/edition-extern-crate-allowed.rs
diff --git a/src/test/ui/auxiliary/edition-kw-macro-2015.rs b/src/test/ui/editions/auxiliary/edition-kw-macro-2015.rs
similarity index 100%
rename from src/test/ui/auxiliary/edition-kw-macro-2015.rs
rename to src/test/ui/editions/auxiliary/edition-kw-macro-2015.rs
diff --git a/src/test/ui/auxiliary/edition-kw-macro-2018.rs b/src/test/ui/editions/auxiliary/edition-kw-macro-2018.rs
similarity index 100%
rename from src/test/ui/auxiliary/edition-kw-macro-2018.rs
rename to src/test/ui/editions/auxiliary/edition-kw-macro-2018.rs
diff --git a/src/test/ui/editions/edition-extern-crate-allowed.rs b/src/test/ui/editions/edition-extern-crate-allowed.rs
new file mode 100644
index 0000000..75761a0
--- /dev/null
+++ b/src/test/ui/editions/edition-extern-crate-allowed.rs
@@ -0,0 +1,20 @@
+// 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.
+
+// aux-build:edition-extern-crate-allowed.rs
+// edition:2015
+// compile-pass
+
+#![warn(rust_2018_idioms)]
+
+extern crate edition_extern_crate_allowed;
+//~^ WARNING unused extern crate
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-extern-crate-allowed.stderr b/src/test/ui/editions/edition-extern-crate-allowed.stderr
new file mode 100644
index 0000000..7c1ccc5
--- /dev/null
+++ b/src/test/ui/editions/edition-extern-crate-allowed.stderr
@@ -0,0 +1,13 @@
+warning: unused extern crate
+ --> $DIR/edition-extern-crate-allowed.rs:17:1
+ |
+LL | extern crate edition_extern_crate_allowed;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+ |
+note: lint level defined here
+ --> $DIR/edition-extern-crate-allowed.rs:15:9
+ |
+LL | #![warn(rust_2018_idioms)]
+ | ^^^^^^^^^^^^^^^^
+ = note: #[warn(unused_extern_crates)] implied by #[warn(rust_2018_idioms)]
+
diff --git a/src/test/ui/editions/edition-feature-ok.rs b/src/test/ui/editions/edition-feature-ok.rs
new file mode 100644
index 0000000..5896e9a
--- /dev/null
+++ b/src/test/ui/editions/edition-feature-ok.rs
@@ -0,0 +1,15 @@
+// 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.
+
+// compile-pass
+
+#![feature(rust_2018_preview)]
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-feature-redundant.rs b/src/test/ui/editions/edition-feature-redundant.rs
new file mode 100644
index 0000000..d20873f
--- /dev/null
+++ b/src/test/ui/editions/edition-feature-redundant.rs
@@ -0,0 +1,17 @@
+// 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.
+
+// edition:2018
+// compile-pass
+
+#![feature(rust_2018_preview)]
+//~^ WARN the feature `rust_2018_preview` is included in the Rust 2018 edition
+
+fn main() {}
diff --git a/src/test/ui/editions/edition-feature-redundant.stderr b/src/test/ui/editions/edition-feature-redundant.stderr
new file mode 100644
index 0000000..ccf7b21
--- /dev/null
+++ b/src/test/ui/editions/edition-feature-redundant.stderr
@@ -0,0 +1,6 @@
+warning[E0705]: the feature `rust_2018_preview` is included in the Rust 2018 edition
+ --> $DIR/edition-feature-redundant.rs:14:12
+ |
+LL | #![feature(rust_2018_preview)]
+ | ^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui/edition-keywords-2015-2015-expansion.rs b/src/test/ui/editions/edition-keywords-2015-2015-expansion.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2015-expansion.rs
rename to src/test/ui/editions/edition-keywords-2015-2015-expansion.rs
diff --git a/src/test/ui/edition-keywords-2015-2015-parsing.rs b/src/test/ui/editions/edition-keywords-2015-2015-parsing.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2015-parsing.rs
rename to src/test/ui/editions/edition-keywords-2015-2015-parsing.rs
diff --git a/src/test/ui/edition-keywords-2015-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2015-parsing.stderr
rename to src/test/ui/editions/edition-keywords-2015-2015-parsing.stderr
diff --git a/src/test/ui/edition-keywords-2015-2018-expansion.rs b/src/test/ui/editions/edition-keywords-2015-2018-expansion.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2018-expansion.rs
rename to src/test/ui/editions/edition-keywords-2015-2018-expansion.rs
diff --git a/src/test/ui/edition-keywords-2015-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2018-expansion.stderr
rename to src/test/ui/editions/edition-keywords-2015-2018-expansion.stderr
diff --git a/src/test/ui/edition-keywords-2015-2018-parsing.rs b/src/test/ui/editions/edition-keywords-2015-2018-parsing.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2018-parsing.rs
rename to src/test/ui/editions/edition-keywords-2015-2018-parsing.rs
diff --git a/src/test/ui/edition-keywords-2015-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr
similarity index 100%
rename from src/test/ui/edition-keywords-2015-2018-parsing.stderr
rename to src/test/ui/editions/edition-keywords-2015-2018-parsing.stderr
diff --git a/src/test/ui/edition-keywords-2018-2015-expansion.rs b/src/test/ui/editions/edition-keywords-2018-2015-expansion.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2015-expansion.rs
rename to src/test/ui/editions/edition-keywords-2018-2015-expansion.rs
diff --git a/src/test/ui/edition-keywords-2018-2015-parsing.rs b/src/test/ui/editions/edition-keywords-2018-2015-parsing.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2015-parsing.rs
rename to src/test/ui/editions/edition-keywords-2018-2015-parsing.rs
diff --git a/src/test/ui/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2015-parsing.stderr
rename to src/test/ui/editions/edition-keywords-2018-2015-parsing.stderr
diff --git a/src/test/ui/edition-keywords-2018-2018-expansion.rs b/src/test/ui/editions/edition-keywords-2018-2018-expansion.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2018-expansion.rs
rename to src/test/ui/editions/edition-keywords-2018-2018-expansion.rs
diff --git a/src/test/ui/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2018-expansion.stderr
rename to src/test/ui/editions/edition-keywords-2018-2018-expansion.stderr
diff --git a/src/test/ui/edition-keywords-2018-2018-parsing.rs b/src/test/ui/editions/edition-keywords-2018-2018-parsing.rs
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2018-parsing.rs
rename to src/test/ui/editions/edition-keywords-2018-2018-parsing.rs
diff --git a/src/test/ui/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
similarity index 100%
rename from src/test/ui/edition-keywords-2018-2018-parsing.stderr
rename to src/test/ui/editions/edition-keywords-2018-2018-parsing.stderr
diff --git a/src/test/compile-fail/edition-raw-pointer-method-2015.rs b/src/test/ui/editions/edition-raw-pointer-method-2015.rs
similarity index 100%
rename from src/test/compile-fail/edition-raw-pointer-method-2015.rs
rename to src/test/ui/editions/edition-raw-pointer-method-2015.rs
diff --git a/src/test/ui/editions/edition-raw-pointer-method-2015.stderr b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr
new file mode 100644
index 0000000..7fd098c
--- /dev/null
+++ b/src/test/ui/editions/edition-raw-pointer-method-2015.stderr
@@ -0,0 +1,17 @@
+error: type annotations needed
+ --> $DIR/edition-raw-pointer-method-2015.rs:20:15
+ |
+LL | let _ = y.is_null();
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/edition-raw-pointer-method-2015.rs:16:8
+ |
+LL | #[deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(tyvar_behind_raw_pointer)] implied by #[deny(warnings)]
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 edition!
+ = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/edition-raw-pointer-method-2018.rs b/src/test/ui/editions/edition-raw-pointer-method-2018.rs
similarity index 100%
rename from src/test/compile-fail/edition-raw-pointer-method-2018.rs
rename to src/test/ui/editions/edition-raw-pointer-method-2018.rs
diff --git a/src/test/ui/editions/edition-raw-pointer-method-2018.stderr b/src/test/ui/editions/edition-raw-pointer-method-2018.stderr
new file mode 100644
index 0000000..0708b4b
--- /dev/null
+++ b/src/test/ui/editions/edition-raw-pointer-method-2018.stderr
@@ -0,0 +1,9 @@
+error[E0699]: the type of this value must be known to call a method on a raw pointer on it
+ --> $DIR/edition-raw-pointer-method-2018.rs:20:15
+ |
+LL | let _ = y.is_null();
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0699`.
diff --git a/src/test/compile-fail/elided-test.rs b/src/test/ui/elided-test.rs
similarity index 100%
rename from src/test/compile-fail/elided-test.rs
rename to src/test/ui/elided-test.rs
diff --git a/src/test/ui/elided-test.stderr b/src/test/ui/elided-test.stderr
new file mode 100644
index 0000000..d22eee4
--- /dev/null
+++ b/src/test/ui/elided-test.stderr
@@ -0,0 +1,7 @@
+error[E0601]: `main` function not found in crate `elided_test`
+ |
+ = note: consider adding a `main` function to `$DIR/elided-test.rs`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/auxiliary/empty-struct.rs b/src/test/ui/empty/auxiliary/empty-struct.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/empty-struct.rs
rename to src/test/ui/empty/auxiliary/empty-struct.rs
diff --git a/src/test/ui/auxiliary/two_macros.rs b/src/test/ui/empty/auxiliary/two_macros.rs
similarity index 100%
rename from src/test/ui/auxiliary/two_macros.rs
rename to src/test/ui/empty/auxiliary/two_macros.rs
diff --git a/src/test/compile-fail/empty-comment.rs b/src/test/ui/empty/empty-comment.rs
similarity index 100%
rename from src/test/compile-fail/empty-comment.rs
rename to src/test/ui/empty/empty-comment.rs
diff --git a/src/test/ui/empty/empty-comment.stderr b/src/test/ui/empty/empty-comment.stderr
new file mode 100644
index 0000000..d6990c4
--- /dev/null
+++ b/src/test/ui/empty/empty-comment.stderr
@@ -0,0 +1,8 @@
+error: unexpected end of macro invocation
+ --> $DIR/empty-comment.rs:20:5
+ |
+LL | one_arg_macro!(/**/); //~ ERROR unexpected end
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/empty-linkname.rs b/src/test/ui/empty/empty-linkname.rs
similarity index 100%
rename from src/test/compile-fail/empty-linkname.rs
rename to src/test/ui/empty/empty-linkname.rs
diff --git a/src/test/ui/empty/empty-linkname.stderr b/src/test/ui/empty/empty-linkname.stderr
new file mode 100644
index 0000000..9a637aa
--- /dev/null
+++ b/src/test/ui/empty/empty-linkname.stderr
@@ -0,0 +1,9 @@
+error[E0454]: #[link(name = "")] given with empty name
+ --> $DIR/empty-linkname.rs:11:1
+ |
+LL | #[link(name = "")] //~ ERROR: given with empty name
+ | ^^^^^^^^^^^^^^^^^^ empty name given
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0454`.
diff --git a/src/test/compile-fail/empty-macro-use.rs b/src/test/ui/empty/empty-macro-use.rs
similarity index 100%
rename from src/test/compile-fail/empty-macro-use.rs
rename to src/test/ui/empty/empty-macro-use.rs
diff --git a/src/test/ui/empty/empty-macro-use.stderr b/src/test/ui/empty/empty-macro-use.stderr
new file mode 100644
index 0000000..8feb093
--- /dev/null
+++ b/src/test/ui/empty/empty-macro-use.stderr
@@ -0,0 +1,8 @@
+error: cannot find macro `macro_two!` in this scope
+ --> $DIR/empty-macro-use.rs:17:5
+ |
+LL | macro_two!();
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/empty-never-array.rs b/src/test/ui/empty/empty-never-array.rs
similarity index 100%
rename from src/test/compile-fail/empty-never-array.rs
rename to src/test/ui/empty/empty-never-array.rs
diff --git a/src/test/ui/empty/empty-never-array.stderr b/src/test/ui/empty/empty-never-array.stderr
new file mode 100644
index 0000000..d9ef2f3
--- /dev/null
+++ b/src/test/ui/empty/empty-never-array.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in local binding: `T(_, _)` not covered
+ --> $DIR/empty-never-array.rs:20:9
+ |
+LL | let Helper::U(u) = Helper::T(t, []);
+ | ^^^^^^^^^^^^ pattern `T(_, _)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/compile-fail/empty-struct-braces-expr.rs b/src/test/ui/empty/empty-struct-braces-expr.rs
similarity index 100%
rename from src/test/compile-fail/empty-struct-braces-expr.rs
rename to src/test/ui/empty/empty-struct-braces-expr.rs
diff --git a/src/test/ui/empty/empty-struct-braces-expr.stderr b/src/test/ui/empty/empty-struct-braces-expr.stderr
new file mode 100644
index 0000000..9b61148
--- /dev/null
+++ b/src/test/ui/empty/empty-struct-braces-expr.stderr
@@ -0,0 +1,68 @@
+error[E0423]: expected value, found struct `Empty1`
+ --> $DIR/empty-struct-braces-expr.rs:25:14
+ |
+LL | let e1 = Empty1; //~ ERROR expected value, found struct `Empty1`
+ | ^^^^^^
+ | |
+ | did you mean `XEmpty2`?
+ | did you mean `Empty1 { /* fields */ }`?
+
+error[E0423]: expected function, found struct `Empty1`
+ --> $DIR/empty-struct-braces-expr.rs:26:14
+ |
+LL | let e1 = Empty1(); //~ ERROR expected function, found struct `Empty1`
+ | ^^^^^^
+ | |
+ | did you mean `XEmpty2`?
+ | did you mean `Empty1 { /* fields */ }`?
+
+error[E0423]: expected value, found struct variant `E::Empty3`
+ --> $DIR/empty-struct-braces-expr.rs:27:14
+ |
+LL | let e3 = E::Empty3; //~ ERROR expected value, found struct variant `E::Empty3`
+ | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
+
+error[E0423]: expected function, found struct variant `E::Empty3`
+ --> $DIR/empty-struct-braces-expr.rs:28:14
+ |
+LL | let e3 = E::Empty3(); //~ ERROR expected function, found struct variant `E::Empty3`
+ | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
+
+error[E0423]: expected value, found struct `XEmpty1`
+ --> $DIR/empty-struct-braces-expr.rs:30:15
+ |
+LL | let xe1 = XEmpty1; //~ ERROR expected value, found struct `XEmpty1`
+ | ^^^^^^^
+ | |
+ | did you mean `XEmpty2`?
+ | did you mean `XEmpty1 { /* fields */ }`?
+
+error[E0423]: expected function, found struct `XEmpty1`
+ --> $DIR/empty-struct-braces-expr.rs:31:15
+ |
+LL | let xe1 = XEmpty1(); //~ ERROR expected function, found struct `XEmpty1`
+ | ^^^^^^^
+ | |
+ | did you mean `XEmpty2`?
+ | did you mean `XEmpty1 { /* fields */ }`?
+
+error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope
+ --> $DIR/empty-struct-braces-expr.rs:32:15
+ |
+LL | let xe3 = XE::Empty3; //~ ERROR no variant named `Empty3` found for type
+ | ^^^^^^^^^^ variant not found in `empty_struct::XE`
+ |
+ = note: did you mean `empty_struct::XE::XEmpty3`?
+
+error[E0599]: no variant named `Empty3` found for type `empty_struct::XE` in the current scope
+ --> $DIR/empty-struct-braces-expr.rs:33:15
+ |
+LL | let xe3 = XE::Empty3(); //~ ERROR no variant named `Empty3` found for type
+ | ^^^^^^^^^^ variant not found in `empty_struct::XE`
+ |
+ = note: did you mean `empty_struct::XE::XEmpty3`?
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0423, E0599.
+For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/compile-fail/empty-struct-braces-pat-1.rs b/src/test/ui/empty/empty-struct-braces-pat-1.rs
similarity index 100%
rename from src/test/compile-fail/empty-struct-braces-pat-1.rs
rename to src/test/ui/empty/empty-struct-braces-pat-1.rs
diff --git a/src/test/ui/empty/empty-struct-braces-pat-1.stderr b/src/test/ui/empty/empty-struct-braces-pat-1.stderr
new file mode 100644
index 0000000..aad47f4
--- /dev/null
+++ b/src/test/ui/empty/empty-struct-braces-pat-1.stderr
@@ -0,0 +1,18 @@
+error[E0532]: expected unit struct/variant or constant, found struct variant `E::Empty3`
+ --> $DIR/empty-struct-braces-pat-1.rs:34:9
+ |
+LL | E::Empty3 => ()
+ | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
+
+error[E0532]: expected unit struct/variant or constant, found struct variant `XE::XEmpty3`
+ --> $DIR/empty-struct-braces-pat-1.rs:41:9
+ |
+LL | XE::XEmpty3 => ()
+ | ^^^^-------
+ | | |
+ | | did you mean `XEmpty4`?
+ | did you mean `XE::XEmpty3 { /* fields */ }`?
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/empty-struct-braces-pat-2.rs b/src/test/ui/empty/empty-struct-braces-pat-2.rs
similarity index 100%
rename from src/test/compile-fail/empty-struct-braces-pat-2.rs
rename to src/test/ui/empty/empty-struct-braces-pat-2.rs
diff --git a/src/test/ui/empty/empty-struct-braces-pat-2.stderr b/src/test/ui/empty/empty-struct-braces-pat-2.stderr
new file mode 100644
index 0000000..26fb42c
--- /dev/null
+++ b/src/test/ui/empty/empty-struct-braces-pat-2.stderr
@@ -0,0 +1,39 @@
+error[E0532]: expected tuple struct/variant, found struct `Empty1`
+ --> $DIR/empty-struct-braces-pat-2.rs:25:9
+ |
+LL | Empty1() => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
+ | ^^^^^^
+ | |
+ | did you mean `XEmpty6`?
+ | did you mean `Empty1 { /* fields */ }`?
+
+error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
+ --> $DIR/empty-struct-braces-pat-2.rs:28:9
+ |
+LL | XEmpty1() => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
+ | ^^^^^^^
+ | |
+ | did you mean `XEmpty6`?
+ | did you mean `XEmpty1 { /* fields */ }`?
+
+error[E0532]: expected tuple struct/variant, found struct `Empty1`
+ --> $DIR/empty-struct-braces-pat-2.rs:31:9
+ |
+LL | Empty1(..) => () //~ ERROR expected tuple struct/variant, found struct `Empty1`
+ | ^^^^^^
+ | |
+ | did you mean `XEmpty6`?
+ | did you mean `Empty1 { /* fields */ }`?
+
+error[E0532]: expected tuple struct/variant, found struct `XEmpty1`
+ --> $DIR/empty-struct-braces-pat-2.rs:34:9
+ |
+LL | XEmpty1(..) => () //~ ERROR expected tuple struct/variant, found struct `XEmpty1`
+ | ^^^^^^^
+ | |
+ | did you mean `XEmpty6`?
+ | did you mean `XEmpty1 { /* fields */ }`?
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/empty-struct-braces-pat-3.rs b/src/test/ui/empty/empty-struct-braces-pat-3.rs
similarity index 100%
rename from src/test/compile-fail/empty-struct-braces-pat-3.rs
rename to src/test/ui/empty/empty-struct-braces-pat-3.rs
diff --git a/src/test/ui/empty/empty-struct-braces-pat-3.stderr b/src/test/ui/empty/empty-struct-braces-pat-3.stderr
new file mode 100644
index 0000000..389bf0a
--- /dev/null
+++ b/src/test/ui/empty/empty-struct-braces-pat-3.stderr
@@ -0,0 +1,33 @@
+error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3`
+ --> $DIR/empty-struct-braces-pat-3.rs:27:9
+ |
+LL | E::Empty3() => ()
+ | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
+
+error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3`
+ --> $DIR/empty-struct-braces-pat-3.rs:31:9
+ |
+LL | XE::XEmpty3() => ()
+ | ^^^^-------
+ | | |
+ | | did you mean `XEmpty5`?
+ | did you mean `XE::XEmpty3 { /* fields */ }`?
+
+error[E0532]: expected tuple struct/variant, found struct variant `E::Empty3`
+ --> $DIR/empty-struct-braces-pat-3.rs:35:9
+ |
+LL | E::Empty3(..) => ()
+ | ^^^^^^^^^ did you mean `E::Empty3 { /* fields */ }`?
+
+error[E0532]: expected tuple struct/variant, found struct variant `XE::XEmpty3`
+ --> $DIR/empty-struct-braces-pat-3.rs:39:9
+ |
+LL | XE::XEmpty3(..) => ()
+ | ^^^^-------
+ | | |
+ | | did you mean `XEmpty5`?
+ | did you mean `XE::XEmpty3 { /* fields */ }`?
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/empty-struct-tuple-pat.rs b/src/test/ui/empty/empty-struct-tuple-pat.rs
similarity index 100%
rename from src/test/compile-fail/empty-struct-tuple-pat.rs
rename to src/test/ui/empty/empty-struct-tuple-pat.rs
diff --git a/src/test/ui/empty/empty-struct-tuple-pat.stderr b/src/test/ui/empty/empty-struct-tuple-pat.stderr
new file mode 100644
index 0000000..3d219b1
--- /dev/null
+++ b/src/test/ui/empty/empty-struct-tuple-pat.stderr
@@ -0,0 +1,36 @@
+error[E0530]: match bindings cannot shadow tuple structs
+ --> $DIR/empty-struct-tuple-pat.rs:32:9
+ |
+LL | struct Empty2();
+ | ---------------- a tuple struct `Empty2` is defined here
+...
+LL | Empty2 => () //~ ERROR match bindings cannot shadow tuple structs
+ | ^^^^^^ cannot be named the same as a tuple struct
+
+error[E0530]: match bindings cannot shadow tuple structs
+ --> $DIR/empty-struct-tuple-pat.rs:35:9
+ |
+LL | use empty_struct::*;
+ | --------------- a tuple struct `XEmpty6` is imported here
+...
+LL | XEmpty6 => () //~ ERROR match bindings cannot shadow tuple structs
+ | ^^^^^^^ cannot be named the same as a tuple struct
+
+error[E0532]: expected unit struct/variant or constant, found tuple variant `E::Empty4`
+ --> $DIR/empty-struct-tuple-pat.rs:39:9
+ |
+LL | E::Empty4 => ()
+ | ^^^^^^^^^ not a unit struct/variant or constant
+
+error[E0532]: expected unit struct/variant or constant, found tuple variant `XE::XEmpty5`
+ --> $DIR/empty-struct-tuple-pat.rs:43:9
+ |
+LL | XE::XEmpty5 => (),
+ | ^^^^-------
+ | |
+ | did you mean `XEmpty4`?
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0530, E0532.
+For more information about an error, try `rustc --explain E0530`.
diff --git a/src/test/ui/empty-struct-unit-expr.rs b/src/test/ui/empty/empty-struct-unit-expr.rs
similarity index 100%
rename from src/test/ui/empty-struct-unit-expr.rs
rename to src/test/ui/empty/empty-struct-unit-expr.rs
diff --git a/src/test/ui/empty-struct-unit-expr.stderr b/src/test/ui/empty/empty-struct-unit-expr.stderr
similarity index 100%
rename from src/test/ui/empty-struct-unit-expr.stderr
rename to src/test/ui/empty/empty-struct-unit-expr.stderr
diff --git a/src/test/compile-fail/empty-struct-unit-pat.rs b/src/test/ui/empty/empty-struct-unit-pat.rs
similarity index 100%
rename from src/test/compile-fail/empty-struct-unit-pat.rs
rename to src/test/ui/empty/empty-struct-unit-pat.rs
diff --git a/src/test/ui/empty/empty-struct-unit-pat.stderr b/src/test/ui/empty/empty-struct-unit-pat.stderr
new file mode 100644
index 0000000..042b535
--- /dev/null
+++ b/src/test/ui/empty/empty-struct-unit-pat.stderr
@@ -0,0 +1,55 @@
+error[E0532]: expected tuple struct/variant, found unit struct `Empty2`
+ --> $DIR/empty-struct-unit-pat.rs:31:9
+ |
+LL | Empty2() => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
+ | ^^^^^^ did you mean `XEmpty6`?
+
+error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2`
+ --> $DIR/empty-struct-unit-pat.rs:34:9
+ |
+LL | XEmpty2() => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
+ | ^^^^^^^ did you mean `XEmpty6`?
+
+error[E0532]: expected tuple struct/variant, found unit struct `Empty2`
+ --> $DIR/empty-struct-unit-pat.rs:37:9
+ |
+LL | Empty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `Empty2`
+ | ^^^^^^ did you mean `XEmpty6`?
+
+error[E0532]: expected tuple struct/variant, found unit struct `XEmpty2`
+ --> $DIR/empty-struct-unit-pat.rs:40:9
+ |
+LL | XEmpty2(..) => () //~ ERROR expected tuple struct/variant, found unit struct `XEmpty2`
+ | ^^^^^^^ did you mean `XEmpty6`?
+
+error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4`
+ --> $DIR/empty-struct-unit-pat.rs:44:9
+ |
+LL | E::Empty4() => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
+ | ^^^^^^^^^ not a tuple struct/variant
+
+error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4`
+ --> $DIR/empty-struct-unit-pat.rs:47:9
+ |
+LL | XE::XEmpty4() => (),
+ | ^^^^-------
+ | |
+ | did you mean `XEmpty5`?
+
+error[E0532]: expected tuple struct/variant, found unit variant `E::Empty4`
+ --> $DIR/empty-struct-unit-pat.rs:52:9
+ |
+LL | E::Empty4(..) => () //~ ERROR expected tuple struct/variant, found unit variant `E::Empty4`
+ | ^^^^^^^^^ not a tuple struct/variant
+
+error[E0532]: expected tuple struct/variant, found unit variant `XE::XEmpty4`
+ --> $DIR/empty-struct-unit-pat.rs:55:9
+ |
+LL | XE::XEmpty4(..) => (),
+ | ^^^^-------
+ | |
+ | did you mean `XEmpty5`?
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/enable-unstable-lib-feature.rs b/src/test/ui/enable-unstable-lib-feature.rs
similarity index 100%
rename from src/test/compile-fail/enable-unstable-lib-feature.rs
rename to src/test/ui/enable-unstable-lib-feature.rs
diff --git a/src/test/ui/enable-unstable-lib-feature.stderr b/src/test/ui/enable-unstable-lib-feature.stderr
new file mode 100644
index 0000000..20b2eb5
--- /dev/null
+++ b/src/test/ui/enable-unstable-lib-feature.stderr
@@ -0,0 +1,14 @@
+error: function `BOGUS` should have a snake case name such as `bogus`
+ --> $DIR/enable-unstable-lib-feature.rs:22:1
+ |
+LL | pub fn BOGUS() { } //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/enable-unstable-lib-feature.rs:16:9
+ |
+LL | #![deny(non_snake_case)] // To trigger a hard error
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/enum-and-module-in-same-scope.rs b/src/test/ui/enum/enum-and-module-in-same-scope.rs
similarity index 100%
rename from src/test/ui/enum-and-module-in-same-scope.rs
rename to src/test/ui/enum/enum-and-module-in-same-scope.rs
diff --git a/src/test/ui/enum-and-module-in-same-scope.stderr b/src/test/ui/enum/enum-and-module-in-same-scope.stderr
similarity index 100%
rename from src/test/ui/enum-and-module-in-same-scope.stderr
rename to src/test/ui/enum/enum-and-module-in-same-scope.stderr
diff --git a/src/test/compile-fail/enum-discrim-autosizing.rs b/src/test/ui/enum/enum-discrim-autosizing.rs
similarity index 100%
rename from src/test/compile-fail/enum-discrim-autosizing.rs
rename to src/test/ui/enum/enum-discrim-autosizing.rs
diff --git a/src/test/ui/enum/enum-discrim-autosizing.stderr b/src/test/ui/enum/enum-discrim-autosizing.stderr
new file mode 100644
index 0000000..3b4ac43
--- /dev/null
+++ b/src/test/ui/enum/enum-discrim-autosizing.stderr
@@ -0,0 +1,16 @@
+error[E0601]: `main` function not found in crate `enum_discrim_autosizing`
+ |
+ = note: consider adding a `main` function to `$DIR/enum-discrim-autosizing.rs`
+
+error[E0081]: discriminant value `0` already exists
+ --> $DIR/enum-discrim-autosizing.rs:18:12
+ |
+LL | Au64 = 0,
+ | - first use of `0`
+LL | Bu64 = 0x8000_0000_0000_0000 //~ERROR already exists
+ | ^^^^^^^^^^^^^^^^^^^^^ enum already has `0`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0081, E0601.
+For more information about an error, try `rustc --explain E0081`.
diff --git a/src/test/compile-fail/enum-discrim-too-small.rs b/src/test/ui/enum/enum-discrim-too-small.rs
similarity index 100%
rename from src/test/compile-fail/enum-discrim-too-small.rs
rename to src/test/ui/enum/enum-discrim-too-small.rs
diff --git a/src/test/ui/enum/enum-discrim-too-small.stderr b/src/test/ui/enum/enum-discrim-too-small.stderr
new file mode 100644
index 0000000..4c8ff52
--- /dev/null
+++ b/src/test/ui/enum/enum-discrim-too-small.stderr
@@ -0,0 +1,35 @@
+error[E0600]: cannot apply unary operator `-` to type `u8`
+ --> $DIR/enum-discrim-too-small.rs:16:11
+ |
+LL | Cu8 = -23,
+ | ^^^ cannot apply unary operator `-`
+ |
+ = note: unsigned values cannot be negated
+
+error[E0600]: cannot apply unary operator `-` to type `u16`
+ --> $DIR/enum-discrim-too-small.rs:24:12
+ |
+LL | Cu16 = -22333,
+ | ^^^^^^ cannot apply unary operator `-`
+ |
+ = note: unsigned values cannot be negated
+
+error[E0600]: cannot apply unary operator `-` to type `u32`
+ --> $DIR/enum-discrim-too-small.rs:32:12
+ |
+LL | Cu32 = -2_000_000_000,
+ | ^^^^^^^^^^^^^^ cannot apply unary operator `-`
+ |
+ = note: unsigned values cannot be negated
+
+error[E0600]: cannot apply unary operator `-` to type `u64`
+ --> $DIR/enum-discrim-too-small.rs:40:12
+ |
+LL | Cu32 = -2_000_000_000,
+ | ^^^^^^^^^^^^^^ cannot apply unary operator `-`
+ |
+ = note: unsigned values cannot be negated
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0600`.
diff --git a/src/test/compile-fail/enum-discrim-too-small2.rs b/src/test/ui/enum/enum-discrim-too-small2.rs
similarity index 100%
rename from src/test/compile-fail/enum-discrim-too-small2.rs
rename to src/test/ui/enum/enum-discrim-too-small2.rs
diff --git a/src/test/ui/enum/enum-discrim-too-small2.stderr b/src/test/ui/enum/enum-discrim-too-small2.stderr
new file mode 100644
index 0000000..536dbf6
--- /dev/null
+++ b/src/test/ui/enum/enum-discrim-too-small2.stderr
@@ -0,0 +1,32 @@
+error: literal out of range for i8
+ --> $DIR/enum-discrim-too-small2.rs:18:11
+ |
+LL | Ci8 = 223, //~ ERROR literal out of range for i8
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/enum-discrim-too-small2.rs:11:9
+ |
+LL | #![deny(overflowing_literals)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: literal out of range for i16
+ --> $DIR/enum-discrim-too-small2.rs:25:12
+ |
+LL | Ci16 = 55555, //~ ERROR literal out of range for i16
+ | ^^^^^
+
+error: literal out of range for i32
+ --> $DIR/enum-discrim-too-small2.rs:32:12
+ |
+LL | Ci32 = 3_000_000_000, //~ ERROR literal out of range for i32
+ | ^^^^^^^^^^^^^
+
+error: literal out of range for i64
+ --> $DIR/enum-discrim-too-small2.rs:39:12
+ |
+LL | Ci64 = 9223372036854775809, //~ ERROR literal out of range for i64
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/enum-in-scope.rs b/src/test/ui/enum/enum-in-scope.rs
similarity index 100%
rename from src/test/compile-fail/enum-in-scope.rs
rename to src/test/ui/enum/enum-in-scope.rs
diff --git a/src/test/ui/enum/enum-in-scope.stderr b/src/test/ui/enum/enum-in-scope.stderr
new file mode 100644
index 0000000..1e8d594
--- /dev/null
+++ b/src/test/ui/enum/enum-in-scope.stderr
@@ -0,0 +1,12 @@
+error[E0530]: let bindings cannot shadow tuple structs
+ --> $DIR/enum-in-scope.rs:14:9
+ |
+LL | struct hello(isize);
+ | -------------------- a tuple struct `hello` is defined here
+...
+LL | let hello = 0; //~ERROR let bindings cannot shadow tuple structs
+ | ^^^^^ cannot be named the same as a tuple struct
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0530`.
diff --git a/src/test/ui/enum-size-variance.rs b/src/test/ui/enum/enum-size-variance.rs
similarity index 100%
rename from src/test/ui/enum-size-variance.rs
rename to src/test/ui/enum/enum-size-variance.rs
diff --git a/src/test/ui/enum-size-variance.stderr b/src/test/ui/enum/enum-size-variance.stderr
similarity index 100%
rename from src/test/ui/enum-size-variance.stderr
rename to src/test/ui/enum/enum-size-variance.stderr
diff --git a/src/test/compile-fail/enum-to-float-cast-2.rs b/src/test/ui/enum/enum-to-float-cast-2.rs
similarity index 100%
rename from src/test/compile-fail/enum-to-float-cast-2.rs
rename to src/test/ui/enum/enum-to-float-cast-2.rs
diff --git a/src/test/ui/enum/enum-to-float-cast-2.stderr b/src/test/ui/enum/enum-to-float-cast-2.stderr
new file mode 100644
index 0000000..e8e6d8f
--- /dev/null
+++ b/src/test/ui/enum/enum-to-float-cast-2.stderr
@@ -0,0 +1,19 @@
+error[E0606]: casting `E` as `f32` is invalid
+ --> $DIR/enum-to-float-cast-2.rs:24:13
+ |
+LL | let a = E::L0 as f32; //~ ERROR casting
+ | ^^^^^^^^^^^^
+ |
+ = help: cast through an integer first
+
+error[E0606]: casting `F` as `f32` is invalid
+ --> $DIR/enum-to-float-cast-2.rs:25:13
+ |
+LL | let c = F::H1 as f32; //~ ERROR casting
+ | ^^^^^^^^^^^^
+ |
+ = help: cast through an integer first
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/src/test/compile-fail/enum-to-float-cast.rs b/src/test/ui/enum/enum-to-float-cast.rs
similarity index 100%
rename from src/test/compile-fail/enum-to-float-cast.rs
rename to src/test/ui/enum/enum-to-float-cast.rs
diff --git a/src/test/ui/enum/enum-to-float-cast.stderr b/src/test/ui/enum/enum-to-float-cast.stderr
new file mode 100644
index 0000000..adc2015
--- /dev/null
+++ b/src/test/ui/enum/enum-to-float-cast.stderr
@@ -0,0 +1,19 @@
+error[E0606]: casting `E` as `f32` is invalid
+ --> $DIR/enum-to-float-cast.rs:23:18
+ |
+LL | static C0: f32 = E::L0 as f32; //~ ERROR casting
+ | ^^^^^^^^^^^^
+ |
+ = help: cast through an integer first
+
+error[E0606]: casting `F` as `f32` is invalid
+ --> $DIR/enum-to-float-cast.rs:24:18
+ |
+LL | static C1: f32 = F::H1 as f32; //~ ERROR casting
+ | ^^^^^^^^^^^^
+ |
+ = help: cast through an integer first
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/src/test/compile-fail/enum-variant-type-2.rs b/src/test/ui/enum/enum-variant-type-2.rs
similarity index 100%
rename from src/test/compile-fail/enum-variant-type-2.rs
rename to src/test/ui/enum/enum-variant-type-2.rs
diff --git a/src/test/ui/enum/enum-variant-type-2.stderr b/src/test/ui/enum/enum-variant-type-2.stderr
new file mode 100644
index 0000000..7a786af
--- /dev/null
+++ b/src/test/ui/enum/enum-variant-type-2.stderr
@@ -0,0 +1,12 @@
+error[E0573]: expected type, found variant `Foo::Bar`
+ --> $DIR/enum-variant-type-2.rs:17:11
+ |
+LL | fn foo(x: Foo::Bar) {} //~ ERROR expected type, found variant `Foo::Bar`
+ | ^^^^^^^^
+ | |
+ | not a type
+ | help: you can try using the variant's enum: `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0573`.
diff --git a/src/test/compile-fail/enums-pats-not-idents.rs b/src/test/ui/enums-pats-not-idents.rs
similarity index 100%
rename from src/test/compile-fail/enums-pats-not-idents.rs
rename to src/test/ui/enums-pats-not-idents.rs
diff --git a/src/test/ui/enums-pats-not-idents.stderr b/src/test/ui/enums-pats-not-idents.stderr
new file mode 100644
index 0000000..5bd1196
--- /dev/null
+++ b/src/test/ui/enums-pats-not-idents.stderr
@@ -0,0 +1,9 @@
+error[E0531]: cannot find tuple struct/variant `a` in this scope
+ --> $DIR/enums-pats-not-idents.rs:12:9
+ |
+LL | let a(1) = 13; //~ ERROR cannot find tuple struct/variant `a` in this scope
+ | ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0531`.
diff --git a/src/test/ui/error-codes/E0232.stderr b/src/test/ui/error-codes/E0232.stderr
index cb6cc44..613b359 100644
--- a/src/test/ui/error-codes/E0232.stderr
+++ b/src/test/ui/error-codes/E0232.stderr
@@ -4,7 +4,7 @@
LL | #[rustc_on_unimplemented]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error: aborting due to previous error
diff --git a/src/test/ui/error-codes/E0277.stderr b/src/test/ui/error-codes/E0277.stderr
index 3f934b6..ab90202 100644
--- a/src/test/ui/error-codes/E0277.stderr
+++ b/src/test/ui/error-codes/E0277.stderr
@@ -5,9 +5,10 @@
| ^ doesn't have a size known at compile-time
|
= help: within `std::path::Path`, the trait `std::marker::Sized` is not implemented for `[u8]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required because it appears within the type `std::path::Path`
= note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
error[E0277]: the trait bound `i32: Foo` is not satisfied
--> $DIR/E0277.rs:27:5
diff --git a/src/test/ui/error-codes/E0509.nll.stderr b/src/test/ui/error-codes/E0509.nll.stderr
new file mode 100644
index 0000000..723b083
--- /dev/null
+++ b/src/test/ui/error-codes/E0509.nll.stderr
@@ -0,0 +1,12 @@
+error[E0509]: cannot move out of type `DropStruct`, which implements the `Drop` trait
+ --> $DIR/E0509.rs:26:23
+ |
+LL | let fancy_field = drop_struct.fancy; //~ ERROR E0509
+ | ^^^^^^^^^^^^^^^^^
+ | |
+ | cannot move out of here
+ | help: consider borrowing here: `&drop_struct.fancy`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
index 3f91043..caedc79 100644
--- a/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
+++ b/src/test/ui/error-codes/E0621-does-not-trigger-for-closures.nll.stderr
@@ -5,10 +5,10 @@
| ^^^^^^
error: unsatisfied lifetime constraints
- --> $DIR/E0621-does-not-trigger-for-closures.rs:25:26
+ --> $DIR/E0621-does-not-trigger-for-closures.rs:25:45
|
LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495
- | -- ^^^^^ requires that `'1` must outlive `'2`
+ | -- ^ returning this value requires that `'1` must outlive `'2`
| ||
| |return type of closure is &'2 i32
| has type `&'1 i32`
diff --git a/src/test/compile-fail/error-should-say-copy-not-pod.rs b/src/test/ui/error-should-say-copy-not-pod.rs
similarity index 100%
rename from src/test/compile-fail/error-should-say-copy-not-pod.rs
rename to src/test/ui/error-should-say-copy-not-pod.rs
diff --git a/src/test/ui/error-should-say-copy-not-pod.stderr b/src/test/ui/error-should-say-copy-not-pod.stderr
new file mode 100644
index 0000000..704cd4f
--- /dev/null
+++ b/src/test/ui/error-should-say-copy-not-pod.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
+ --> $DIR/error-should-say-copy-not-pod.rs:16:5
+ |
+LL | check_bound("nocopy".to_string()); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String`
+ |
+note: required by `check_bound`
+ --> $DIR/error-should-say-copy-not-pod.rs:13:1
+ |
+LL | fn check_bound<T:Copy>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/estr-subtyping.rs b/src/test/ui/estr-subtyping.rs
similarity index 100%
rename from src/test/compile-fail/estr-subtyping.rs
rename to src/test/ui/estr-subtyping.rs
diff --git a/src/test/ui/estr-subtyping.stderr b/src/test/ui/estr-subtyping.stderr
new file mode 100644
index 0000000..fcff9d0
--- /dev/null
+++ b/src/test/ui/estr-subtyping.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/estr-subtyping.rs:20:15
+ |
+LL | wants_uniq(x); //~ ERROR mismatched types
+ | ^
+ | |
+ | expected struct `std::string::String`, found &str
+ | help: try using a conversion method: `x.to_string()`
+ |
+ = note: expected type `std::string::String`
+ found type `&str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/eval-enum.rs b/src/test/ui/eval-enum.rs
similarity index 100%
rename from src/test/compile-fail/eval-enum.rs
rename to src/test/ui/eval-enum.rs
diff --git a/src/test/ui/eval-enum.stderr b/src/test/ui/eval-enum.stderr
new file mode 100644
index 0000000..f26c48f
--- /dev/null
+++ b/src/test/ui/eval-enum.stderr
@@ -0,0 +1,41 @@
+error: attempt to divide by zero
+ --> $DIR/eval-enum.rs:12:15
+ |
+LL | DivZero = 1/0,
+ | ^^^
+ |
+ = note: #[deny(const_err)] on by default
+
+error: this expression will panic at runtime
+ --> $DIR/eval-enum.rs:12:15
+ |
+LL | DivZero = 1/0,
+ | ^^^ attempt to divide by zero
+
+error[E0080]: could not evaluate enum discriminant
+ --> $DIR/eval-enum.rs:12:15
+ |
+LL | DivZero = 1/0,
+ | ^^^ attempt to divide by zero
+
+error: attempt to calculate the remainder with a divisor of zero
+ --> $DIR/eval-enum.rs:16:15
+ |
+LL | RemZero = 1%0,
+ | ^^^
+
+error: this expression will panic at runtime
+ --> $DIR/eval-enum.rs:16:15
+ |
+LL | RemZero = 1%0,
+ | ^^^ attempt to calculate the remainder with a divisor of zero
+
+error[E0080]: could not evaluate enum discriminant
+ --> $DIR/eval-enum.rs:16:15
+ |
+LL | RemZero = 1%0,
+ | ^^^ attempt to calculate the remainder with a divisor of zero
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/compile-fail/exclusive-drop-and-copy.rs b/src/test/ui/exclusive-drop-and-copy.rs
similarity index 100%
rename from src/test/compile-fail/exclusive-drop-and-copy.rs
rename to src/test/ui/exclusive-drop-and-copy.rs
diff --git a/src/test/ui/exclusive-drop-and-copy.stderr b/src/test/ui/exclusive-drop-and-copy.stderr
new file mode 100644
index 0000000..1c5e62e
--- /dev/null
+++ b/src/test/ui/exclusive-drop-and-copy.stderr
@@ -0,0 +1,15 @@
+error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
+ --> $DIR/exclusive-drop-and-copy.rs:13:10
+ |
+LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented
+ | ^^^^ Copy not allowed on types with destructors
+
+error[E0184]: the trait `Copy` may not be implemented for this type; the type has a destructor
+ --> $DIR/exclusive-drop-and-copy.rs:20:10
+ |
+LL | #[derive(Copy, Clone)] //~ ERROR the trait `Copy` may not be implemented
+ | ^^^^ Copy not allowed on types with destructors
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0184`.
diff --git a/src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs
similarity index 100%
rename from src/test/compile-fail/exclusive_range_pattern_syntax_collision.rs
rename to src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.rs
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr
new file mode 100644
index 0000000..6ccf7ef
--- /dev/null
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision.stderr
@@ -0,0 +1,8 @@
+error: unexpected token: `,`
+ --> $DIR/exclusive_range_pattern_syntax_collision.rs:15:15
+ |
+LL | [_, 99.., _] => {}, //~ ERROR unexpected token: `,`
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs
similarity index 100%
rename from src/test/compile-fail/exclusive_range_pattern_syntax_collision2.rs
rename to src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.rs
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr
new file mode 100644
index 0000000..d1863cb
--- /dev/null
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision2.stderr
@@ -0,0 +1,8 @@
+error: unexpected token: `]`
+ --> $DIR/exclusive_range_pattern_syntax_collision2.rs:15:15
+ |
+LL | [_, 99..] => {}, //~ ERROR unexpected token: `]`
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs
similarity index 100%
rename from src/test/compile-fail/exclusive_range_pattern_syntax_collision3.rs
rename to src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.rs
diff --git a/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr
new file mode 100644
index 0000000..21b2d0c
--- /dev/null
+++ b/src/test/ui/exclusive-range/exclusive_range_pattern_syntax_collision3.stderr
@@ -0,0 +1,8 @@
+error: expected one of `,` or `]`, found `9`
+ --> $DIR/exclusive_range_pattern_syntax_collision3.rs:15:12
+ |
+LL | [..9, 99..100, _] => {}, //~ ERROR expected one of `,` or `]`, found `9`
+ | ^ expected one of `,` or `]` here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.rs b/src/test/ui/existential_types/no_inferrable_concrete_type.rs
new file mode 100644
index 0000000..d236503
--- /dev/null
+++ b/src/test/ui/existential_types/no_inferrable_concrete_type.rs
@@ -0,0 +1,23 @@
+// 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.
+
+// Issue 52985: Cause cycle error if user code provides no use case that allows an existential type
+// to be inferred to a concrete type. This results in an infinite cycle during type normalization.
+
+#![feature(existential_type)]
+
+existential type Foo: Copy; //~ cycle detected
+
+// make compiler happy about using 'Foo'
+fn bar(x: Foo) -> Foo { x }
+
+fn main() {
+ let _: Foo = std::mem::transmute(0u8);
+}
diff --git a/src/test/ui/existential_types/no_inferrable_concrete_type.stderr b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr
new file mode 100644
index 0000000..ffb4f4c
--- /dev/null
+++ b/src/test/ui/existential_types/no_inferrable_concrete_type.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: Foo }`
+ --> $DIR/no_inferrable_concrete_type.rs:16:1
+ |
+LL | existential type Foo: Copy; //~ cycle detected
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: ...which again requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All }, value: Foo }`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/expanded-cfg.rs b/src/test/ui/expanded-cfg.rs
similarity index 100%
rename from src/test/compile-fail/expanded-cfg.rs
rename to src/test/ui/expanded-cfg.rs
diff --git a/src/test/ui/expanded-cfg.stderr b/src/test/ui/expanded-cfg.stderr
new file mode 100644
index 0000000..d7bc47f
--- /dev/null
+++ b/src/test/ui/expanded-cfg.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/expanded-cfg.rs:32:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/explicit-call-to-dtor.rs b/src/test/ui/explicit/explicit-call-to-dtor.rs
similarity index 100%
rename from src/test/compile-fail/explicit-call-to-dtor.rs
rename to src/test/ui/explicit/explicit-call-to-dtor.rs
diff --git a/src/test/ui/explicit/explicit-call-to-dtor.stderr b/src/test/ui/explicit/explicit-call-to-dtor.stderr
new file mode 100644
index 0000000..264d820
--- /dev/null
+++ b/src/test/ui/explicit/explicit-call-to-dtor.stderr
@@ -0,0 +1,9 @@
+error[E0040]: explicit use of destructor method
+ --> $DIR/explicit-call-to-dtor.rs:23:7
+ |
+LL | x.drop(); //~ ERROR explicit use of destructor method
+ | ^^^^ explicit destructor calls not allowed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0040`.
diff --git a/src/test/compile-fail/explicit-call-to-supertrait-dtor.rs b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs
similarity index 100%
rename from src/test/compile-fail/explicit-call-to-supertrait-dtor.rs
rename to src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs
diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr
new file mode 100644
index 0000000..0d0ae62
--- /dev/null
+++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr
@@ -0,0 +1,9 @@
+error[E0040]: explicit use of destructor method
+ --> $DIR/explicit-call-to-supertrait-dtor.rs:27:14
+ |
+LL | self.drop(); //~ ERROR explicit use of destructor method
+ | ^^^^ explicit destructor calls not allowed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0040`.
diff --git a/src/test/compile-fail/explicit-self-lifetime-mismatch.rs b/src/test/ui/explicit/explicit-self-lifetime-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/explicit-self-lifetime-mismatch.rs
rename to src/test/ui/explicit/explicit-self-lifetime-mismatch.rs
diff --git a/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr b/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr
new file mode 100644
index 0000000..6a22d20
--- /dev/null
+++ b/src/test/ui/explicit/explicit-self-lifetime-mismatch.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched method receiver
+ --> $DIR/explicit-self-lifetime-mismatch.rs:18:12
+ |
+LL | Foo<'b,'a>
+ | ^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Foo<'a, 'b>`
+ found type `Foo<'b, 'a>`
+note: the lifetime 'b as defined on the impl at 16:9...
+ --> $DIR/explicit-self-lifetime-mismatch.rs:16:9
+ |
+LL | impl<'a,'b> Foo<'a,'b> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 16:6
+ --> $DIR/explicit-self-lifetime-mismatch.rs:16:6
+ |
+LL | impl<'a,'b> Foo<'a,'b> {
+ | ^^
+
+error[E0308]: mismatched method receiver
+ --> $DIR/explicit-self-lifetime-mismatch.rs:18:12
+ |
+LL | Foo<'b,'a>
+ | ^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Foo<'a, 'b>`
+ found type `Foo<'b, 'a>`
+note: the lifetime 'a as defined on the impl at 16:6...
+ --> $DIR/explicit-self-lifetime-mismatch.rs:16:6
+ |
+LL | impl<'a,'b> Foo<'a,'b> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 16:9
+ --> $DIR/explicit-self-lifetime-mismatch.rs:16:9
+ |
+LL | impl<'a,'b> Foo<'a,'b> {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/export-fully-qualified.rs b/src/test/ui/export-fully-qualified.rs
similarity index 100%
rename from src/test/compile-fail/export-fully-qualified.rs
rename to src/test/ui/export-fully-qualified.rs
diff --git a/src/test/ui/export-fully-qualified.stderr b/src/test/ui/export-fully-qualified.stderr
new file mode 100644
index 0000000..b840992
--- /dev/null
+++ b/src/test/ui/export-fully-qualified.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `foo`
+ --> $DIR/export-fully-qualified.rs:16:20
+ |
+LL | pub fn bar() { foo::baz(); } //~ ERROR failed to resolve. Use of undeclared type or module `foo`
+ | ^^^ Use of undeclared type or module `foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/export-import.rs b/src/test/ui/export-import.rs
similarity index 100%
rename from src/test/compile-fail/export-import.rs
rename to src/test/ui/export-import.rs
diff --git a/src/test/ui/export-import.stderr b/src/test/ui/export-import.stderr
new file mode 100644
index 0000000..2f12485
--- /dev/null
+++ b/src/test/ui/export-import.stderr
@@ -0,0 +1,9 @@
+error[E0603]: function `unexported` is private
+ --> $DIR/export-import.rs:11:5
+ |
+LL | use m::unexported;
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/export-tag-variant.rs b/src/test/ui/export-tag-variant.rs
similarity index 100%
rename from src/test/compile-fail/export-tag-variant.rs
rename to src/test/ui/export-tag-variant.rs
diff --git a/src/test/ui/export-tag-variant.stderr b/src/test/ui/export-tag-variant.stderr
new file mode 100644
index 0000000..da67e2c
--- /dev/null
+++ b/src/test/ui/export-tag-variant.stderr
@@ -0,0 +1,9 @@
+error[E0603]: enum `y` is private
+ --> $DIR/export-tag-variant.rs:17:21
+ |
+LL | fn main() { let z = foo::y::y1; } //~ ERROR: enum `y` is private
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/export.rs b/src/test/ui/export.rs
similarity index 100%
rename from src/test/compile-fail/export.rs
rename to src/test/ui/export.rs
diff --git a/src/test/ui/export.stderr b/src/test/ui/export.stderr
new file mode 100644
index 0000000..dd19e83
--- /dev/null
+++ b/src/test/ui/export.stderr
@@ -0,0 +1,34 @@
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/export.rs:12:26
+ |
+LL | pub fn x(y: isize) { log(debug, y); }
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/export.rs:12:30
+ |
+LL | pub fn x(y: isize) { log(debug, y); }
+ | ^^^^^ not found in this scope
+
+error[E0425]: cannot find function `log` in this scope
+ --> $DIR/export.rs:15:22
+ |
+LL | fn z(y: isize) { log(debug, y); }
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `debug` in this scope
+ --> $DIR/export.rs:15:26
+ |
+LL | fn z(y: isize) { log(debug, y); }
+ | ^^^^^ not found in this scope
+
+error[E0603]: function `z` is private
+ --> $DIR/export.rs:20:13
+ |
+LL | fn main() { foo::z(10); } //~ ERROR function `z` is private
+ | ^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0425, E0603.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/export2.rs b/src/test/ui/export2.rs
similarity index 100%
rename from src/test/compile-fail/export2.rs
rename to src/test/ui/export2.rs
diff --git a/src/test/ui/export2.stderr b/src/test/ui/export2.stderr
new file mode 100644
index 0000000..c76afb8
--- /dev/null
+++ b/src/test/ui/export2.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `bar`
+ --> $DIR/export2.rs:12:18
+ |
+LL | pub fn x() { bar::x(); } //~ ERROR failed to resolve. Use of undeclared type or module `bar`
+ | ^^^ Use of undeclared type or module `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/expr_attr_paren_order.rs b/src/test/ui/expr_attr_paren_order.rs
similarity index 100%
rename from src/test/compile-fail/expr_attr_paren_order.rs
rename to src/test/ui/expr_attr_paren_order.rs
diff --git a/src/test/ui/expr_attr_paren_order.stderr b/src/test/ui/expr_attr_paren_order.stderr
new file mode 100644
index 0000000..938ff51
--- /dev/null
+++ b/src/test/ui/expr_attr_paren_order.stderr
@@ -0,0 +1,14 @@
+error: variable `X` should have a snake case name such as `x`
+ --> $DIR/expr_attr_paren_order.rs:29:17
+ |
+LL | let X = 0; //~ ERROR snake case name
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/expr_attr_paren_order.rs:27:17
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/ext-nonexistent.rs b/src/test/ui/ext-nonexistent.rs
similarity index 100%
rename from src/test/compile-fail/ext-nonexistent.rs
rename to src/test/ui/ext-nonexistent.rs
diff --git a/src/test/ui/ext-nonexistent.stderr b/src/test/ui/ext-nonexistent.stderr
new file mode 100644
index 0000000..ff027f1
--- /dev/null
+++ b/src/test/ui/ext-nonexistent.stderr
@@ -0,0 +1,8 @@
+error: cannot find macro `iamnotanextensionthatexists!` in this scope
+ --> $DIR/ext-nonexistent.rs:12:13
+ |
+LL | fn main() { iamnotanextensionthatexists!(""); }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extenv-arg-2-not-string-literal.rs b/src/test/ui/extenv/extenv-arg-2-not-string-literal.rs
similarity index 100%
rename from src/test/compile-fail/extenv-arg-2-not-string-literal.rs
rename to src/test/ui/extenv/extenv-arg-2-not-string-literal.rs
diff --git a/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr
new file mode 100644
index 0000000..4a10deb
--- /dev/null
+++ b/src/test/ui/extenv/extenv-arg-2-not-string-literal.stderr
@@ -0,0 +1,8 @@
+error: expected string literal
+ --> $DIR/extenv-arg-2-not-string-literal.rs:11:25
+ |
+LL | fn main() { env!("one", 10); } //~ ERROR: expected string literal
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extenv-no-args.rs b/src/test/ui/extenv/extenv-no-args.rs
similarity index 100%
rename from src/test/compile-fail/extenv-no-args.rs
rename to src/test/ui/extenv/extenv-no-args.rs
diff --git a/src/test/ui/extenv/extenv-no-args.stderr b/src/test/ui/extenv/extenv-no-args.stderr
new file mode 100644
index 0000000..ebd97c0
--- /dev/null
+++ b/src/test/ui/extenv/extenv-no-args.stderr
@@ -0,0 +1,8 @@
+error: env! takes 1 or 2 arguments
+ --> $DIR/extenv-no-args.rs:11:13
+ |
+LL | fn main() { env!(); } //~ ERROR: env! takes 1 or 2 arguments
+ | ^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extenv-not-defined-custom.rs b/src/test/ui/extenv/extenv-not-defined-custom.rs
similarity index 100%
rename from src/test/compile-fail/extenv-not-defined-custom.rs
rename to src/test/ui/extenv/extenv-not-defined-custom.rs
diff --git a/src/test/ui/extenv/extenv-not-defined-custom.stderr b/src/test/ui/extenv/extenv-not-defined-custom.stderr
new file mode 100644
index 0000000..845f87d
--- /dev/null
+++ b/src/test/ui/extenv/extenv-not-defined-custom.stderr
@@ -0,0 +1,8 @@
+error: my error message
+ --> $DIR/extenv-not-defined-custom.rs:11:13
+ |
+LL | fn main() { env!("__HOPEFULLY_NOT_DEFINED__", "my error message"); } //~ ERROR: my error message
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extenv-not-defined-default.rs b/src/test/ui/extenv/extenv-not-defined-default.rs
similarity index 100%
rename from src/test/compile-fail/extenv-not-defined-default.rs
rename to src/test/ui/extenv/extenv-not-defined-default.rs
diff --git a/src/test/ui/extenv/extenv-not-defined-default.stderr b/src/test/ui/extenv/extenv-not-defined-default.stderr
new file mode 100644
index 0000000..0db6f53
--- /dev/null
+++ b/src/test/ui/extenv/extenv-not-defined-default.stderr
@@ -0,0 +1,8 @@
+error: environment variable `__HOPEFULLY_NOT_DEFINED__` not defined
+ --> $DIR/extenv-not-defined-default.rs:12:5
+ |
+LL | env!("__HOPEFULLY_NOT_DEFINED__");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extenv-not-string-literal.rs b/src/test/ui/extenv/extenv-not-string-literal.rs
similarity index 100%
rename from src/test/compile-fail/extenv-not-string-literal.rs
rename to src/test/ui/extenv/extenv-not-string-literal.rs
diff --git a/src/test/ui/extenv/extenv-not-string-literal.stderr b/src/test/ui/extenv/extenv-not-string-literal.stderr
new file mode 100644
index 0000000..1660d86
--- /dev/null
+++ b/src/test/ui/extenv/extenv-not-string-literal.stderr
@@ -0,0 +1,8 @@
+error: expected string literal
+ --> $DIR/extenv-not-string-literal.rs:11:18
+ |
+LL | fn main() { env!(10, "two"); } //~ ERROR: expected string literal
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extenv-too-many-args.rs b/src/test/ui/extenv/extenv-too-many-args.rs
similarity index 100%
rename from src/test/compile-fail/extenv-too-many-args.rs
rename to src/test/ui/extenv/extenv-too-many-args.rs
diff --git a/src/test/ui/extenv/extenv-too-many-args.stderr b/src/test/ui/extenv/extenv-too-many-args.stderr
new file mode 100644
index 0000000..e4eda9e
--- /dev/null
+++ b/src/test/ui/extenv/extenv-too-many-args.stderr
@@ -0,0 +1,8 @@
+error: env! takes 1 or 2 arguments
+ --> $DIR/extenv-too-many-args.rs:11:13
+ |
+LL | fn main() { env!("one", "two", "three"); } //~ ERROR: env! takes 1 or 2 arguments
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/auxiliary/m1.rs b/src/test/ui/extern/auxiliary/m1.rs
similarity index 100%
rename from src/test/ui/auxiliary/m1.rs
rename to src/test/ui/extern/auxiliary/m1.rs
diff --git a/src/test/ui/auxiliary/m2.rs b/src/test/ui/extern/auxiliary/m2.rs
similarity index 100%
rename from src/test/ui/auxiliary/m2.rs
rename to src/test/ui/extern/auxiliary/m2.rs
diff --git a/src/test/ui/extern-const.fixed b/src/test/ui/extern/extern-const.fixed
similarity index 100%
rename from src/test/ui/extern-const.fixed
rename to src/test/ui/extern/extern-const.fixed
diff --git a/src/test/ui/extern-const.rs b/src/test/ui/extern/extern-const.rs
similarity index 100%
rename from src/test/ui/extern-const.rs
rename to src/test/ui/extern/extern-const.rs
diff --git a/src/test/ui/extern-const.stderr b/src/test/ui/extern/extern-const.stderr
similarity index 100%
rename from src/test/ui/extern-const.stderr
rename to src/test/ui/extern/extern-const.stderr
diff --git a/src/test/ui/extern-crate-rename.rs b/src/test/ui/extern/extern-crate-rename.rs
similarity index 100%
rename from src/test/ui/extern-crate-rename.rs
rename to src/test/ui/extern/extern-crate-rename.rs
diff --git a/src/test/ui/extern-crate-rename.stderr b/src/test/ui/extern/extern-crate-rename.stderr
similarity index 100%
rename from src/test/ui/extern-crate-rename.stderr
rename to src/test/ui/extern/extern-crate-rename.stderr
diff --git a/src/test/compile-fail/extern-crate-visibility.rs b/src/test/ui/extern/extern-crate-visibility.rs
similarity index 100%
rename from src/test/compile-fail/extern-crate-visibility.rs
rename to src/test/ui/extern/extern-crate-visibility.rs
diff --git a/src/test/ui/extern/extern-crate-visibility.stderr b/src/test/ui/extern/extern-crate-visibility.stderr
new file mode 100644
index 0000000..cadb636
--- /dev/null
+++ b/src/test/ui/extern/extern-crate-visibility.stderr
@@ -0,0 +1,15 @@
+error[E0603]: extern crate `core` is private
+ --> $DIR/extern-crate-visibility.rs:16:5
+ |
+LL | use foo::core::cell; //~ ERROR extern crate `core` is private
+ | ^^^^^^^^^^^^^^^
+
+error[E0603]: extern crate `core` is private
+ --> $DIR/extern-crate-visibility.rs:19:5
+ |
+LL | foo::core::cell::Cell::new(0); //~ ERROR extern crate `core` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/extern/extern-macro.rs b/src/test/ui/extern/extern-macro.rs
new file mode 100644
index 0000000..4b1bf7d
--- /dev/null
+++ b/src/test/ui/extern/extern-macro.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// #41719
+
+fn main() {
+ enum Foo {}
+ let _ = Foo::bar!(); //~ ERROR fail to resolve non-ident macro path
+}
diff --git a/src/test/ui/extern/extern-macro.stderr b/src/test/ui/extern/extern-macro.stderr
new file mode 100644
index 0000000..b5515bf
--- /dev/null
+++ b/src/test/ui/extern/extern-macro.stderr
@@ -0,0 +1,8 @@
+error: fail to resolve non-ident macro path
+ --> $DIR/extern-macro.rs:15:13
+ |
+LL | let _ = Foo::bar!(); //~ ERROR fail to resolve non-ident macro path
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extern-main-fn.rs b/src/test/ui/extern/extern-main-fn.rs
similarity index 100%
rename from src/test/compile-fail/extern-main-fn.rs
rename to src/test/ui/extern/extern-main-fn.rs
diff --git a/src/test/ui/extern/extern-main-fn.stderr b/src/test/ui/extern/extern-main-fn.stderr
new file mode 100644
index 0000000..24e9d13
--- /dev/null
+++ b/src/test/ui/extern/extern-main-fn.stderr
@@ -0,0 +1,12 @@
+error[E0580]: main function has wrong type
+ --> $DIR/extern-main-fn.rs:11:1
+ |
+LL | extern fn main() {} //~ ERROR: main function has wrong type [E0580]
+ | ^^^^^^^^^^^^^^^^ expected "Rust" fn, found "C" fn
+ |
+ = note: expected type `fn()`
+ found type `extern "C" fn()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0580`.
diff --git a/src/test/compile-fail/extern-types-distinct-types.rs b/src/test/ui/extern/extern-types-distinct-types.rs
similarity index 100%
rename from src/test/compile-fail/extern-types-distinct-types.rs
rename to src/test/ui/extern/extern-types-distinct-types.rs
diff --git a/src/test/ui/extern/extern-types-distinct-types.stderr b/src/test/ui/extern/extern-types-distinct-types.stderr
new file mode 100644
index 0000000..6c74f63
--- /dev/null
+++ b/src/test/ui/extern/extern-types-distinct-types.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/extern-types-distinct-types.rs:19:5
+ |
+LL | r //~ ERROR mismatched types
+ | ^ expected extern type `B`, found extern type `A`
+ |
+ = note: expected type `&B`
+ found type `&A`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/extern-types-not-sync-send.rs b/src/test/ui/extern/extern-types-not-sync-send.rs
similarity index 100%
rename from src/test/compile-fail/extern-types-not-sync-send.rs
rename to src/test/ui/extern/extern-types-not-sync-send.rs
diff --git a/src/test/ui/extern/extern-types-not-sync-send.stderr b/src/test/ui/extern/extern-types-not-sync-send.stderr
new file mode 100644
index 0000000..f076aa0
--- /dev/null
+++ b/src/test/ui/extern/extern-types-not-sync-send.stderr
@@ -0,0 +1,29 @@
+error[E0277]: `A` cannot be shared between threads safely
+ --> $DIR/extern-types-not-sync-send.rs:23:5
+ |
+LL | assert_sync::<A>();
+ | ^^^^^^^^^^^^^^^^ `A` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `A`
+note: required by `assert_sync`
+ --> $DIR/extern-types-not-sync-send.rs:19:1
+ |
+LL | fn assert_sync<T: ?Sized + Sync>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `A` cannot be sent between threads safely
+ --> $DIR/extern-types-not-sync-send.rs:26:5
+ |
+LL | assert_send::<A>();
+ | ^^^^^^^^^^^^^^^^ `A` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `A`
+note: required by `assert_send`
+ --> $DIR/extern-types-not-sync-send.rs:20:1
+ |
+LL | fn assert_send<T: ?Sized + Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/extern-types-unsized.rs b/src/test/ui/extern/extern-types-unsized.rs
similarity index 100%
rename from src/test/compile-fail/extern-types-unsized.rs
rename to src/test/ui/extern/extern-types-unsized.rs
diff --git a/src/test/ui/extern/extern-types-unsized.stderr b/src/test/ui/extern/extern-types-unsized.stderr
new file mode 100644
index 0000000..19df7bd
--- /dev/null
+++ b/src/test/ui/extern/extern-types-unsized.stderr
@@ -0,0 +1,63 @@
+error[E0277]: the size for values of type `A` cannot be known at compilation time
+ --> $DIR/extern-types-unsized.rs:32:5
+ |
+LL | assert_sized::<A>();
+ | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `A`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+note: required by `assert_sized`
+ --> $DIR/extern-types-unsized.rs:29:1
+ |
+LL | fn assert_sized<T>() { }
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `A` cannot be known at compilation time
+ --> $DIR/extern-types-unsized.rs:35:5
+ |
+LL | assert_sized::<Foo>();
+ | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Foo`, the trait `std::marker::Sized` is not implemented for `A`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Foo`
+note: required by `assert_sized`
+ --> $DIR/extern-types-unsized.rs:29:1
+ |
+LL | fn assert_sized<T>() { }
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `A` cannot be known at compilation time
+ --> $DIR/extern-types-unsized.rs:38:5
+ |
+LL | assert_sized::<Bar<A>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Bar<A>`, the trait `std::marker::Sized` is not implemented for `A`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Bar<A>`
+note: required by `assert_sized`
+ --> $DIR/extern-types-unsized.rs:29:1
+ |
+LL | fn assert_sized<T>() { }
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `A` cannot be known at compilation time
+ --> $DIR/extern-types-unsized.rs:41:5
+ |
+LL | assert_sized::<Bar<Bar<A>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Bar<Bar<A>>`, the trait `std::marker::Sized` is not implemented for `A`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Bar<A>`
+ = note: required because it appears within the type `Bar<Bar<A>>`
+note: required by `assert_sized`
+ --> $DIR/extern-types-unsized.rs:29:1
+ |
+LL | fn assert_sized<T>() { }
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/extern-with-type-bounds.rs b/src/test/ui/extern/extern-with-type-bounds.rs
similarity index 100%
rename from src/test/compile-fail/extern-with-type-bounds.rs
rename to src/test/ui/extern/extern-with-type-bounds.rs
diff --git a/src/test/ui/extern/extern-with-type-bounds.stderr b/src/test/ui/extern/extern-with-type-bounds.stderr
new file mode 100644
index 0000000..4b62a12
--- /dev/null
+++ b/src/test/ui/extern/extern-with-type-bounds.stderr
@@ -0,0 +1,9 @@
+error[E0405]: cannot find trait `NoSuchTrait` in this scope
+ --> $DIR/extern-with-type-bounds.rs:26:20
+ |
+LL | fn align_of<T: NoSuchTrait>() -> usize;
+ | ^^^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0405`.
diff --git a/src/test/compile-fail/extern-wrong-value-type.rs b/src/test/ui/extern/extern-wrong-value-type.rs
similarity index 100%
rename from src/test/compile-fail/extern-wrong-value-type.rs
rename to src/test/ui/extern/extern-wrong-value-type.rs
diff --git a/src/test/ui/extern/extern-wrong-value-type.stderr b/src/test/ui/extern/extern-wrong-value-type.stderr
new file mode 100644
index 0000000..35e0d68
--- /dev/null
+++ b/src/test/ui/extern/extern-wrong-value-type.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `extern "C" fn() {f}: std::ops::Fn<()>` is not satisfied
+ --> $DIR/extern-wrong-value-type.rs:19:5
+ |
+LL | is_fn(f);
+ | ^^^^^ the trait `std::ops::Fn<()>` is not implemented for `extern "C" fn() {f}`
+ |
+note: required by `is_fn`
+ --> $DIR/extern-wrong-value-type.rs:14:1
+ |
+LL | fn is_fn<F>(_: F) where F: Fn() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/extern/external-doc-error.rs b/src/test/ui/extern/external-doc-error.rs
new file mode 100644
index 0000000..2cd1780
--- /dev/null
+++ b/src/test/ui/extern/external-doc-error.rs
@@ -0,0 +1,19 @@
+// Copyright 2012-2015 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.
+
+// normalize-stderr-test: "The system cannot find the file specified\." -> "No such file or directory"
+// ignore-tidy-linelength
+
+#![feature(external_doc)]
+
+#[doc(include = "not-a-file.md")] //~ ERROR: couldn't read
+pub struct SomeStruct;
+
+fn main() {}
diff --git a/src/test/ui/extern/external-doc-error.stderr b/src/test/ui/extern/external-doc-error.stderr
new file mode 100644
index 0000000..98ade5d
--- /dev/null
+++ b/src/test/ui/extern/external-doc-error.stderr
@@ -0,0 +1,8 @@
+error: couldn't read $DIR/not-a-file.md: No such file or directory (os error 2)
+ --> $DIR/external-doc-error.rs:16:1
+ |
+LL | #[doc(include = "not-a-file.md")] //~ ERROR: couldn't read
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extoption_env-no-args.rs b/src/test/ui/extoption_env-no-args.rs
similarity index 100%
rename from src/test/compile-fail/extoption_env-no-args.rs
rename to src/test/ui/extoption_env-no-args.rs
diff --git a/src/test/ui/extoption_env-no-args.stderr b/src/test/ui/extoption_env-no-args.stderr
new file mode 100644
index 0000000..d01aefe
--- /dev/null
+++ b/src/test/ui/extoption_env-no-args.stderr
@@ -0,0 +1,8 @@
+error: option_env! takes 1 argument
+ --> $DIR/extoption_env-no-args.rs:11:13
+ |
+LL | fn main() { option_env!(); } //~ ERROR: option_env! takes 1 argument
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extoption_env-not-string-literal.rs b/src/test/ui/extoption_env-not-string-literal.rs
similarity index 100%
rename from src/test/compile-fail/extoption_env-not-string-literal.rs
rename to src/test/ui/extoption_env-not-string-literal.rs
diff --git a/src/test/ui/extoption_env-not-string-literal.stderr b/src/test/ui/extoption_env-not-string-literal.stderr
new file mode 100644
index 0000000..af41632
--- /dev/null
+++ b/src/test/ui/extoption_env-not-string-literal.stderr
@@ -0,0 +1,8 @@
+error: argument must be a string literal
+ --> $DIR/extoption_env-not-string-literal.rs:11:25
+ |
+LL | fn main() { option_env!(10); } //~ ERROR: argument must be a string literal
+ | ^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/extoption_env-too-many-args.rs b/src/test/ui/extoption_env-too-many-args.rs
similarity index 100%
rename from src/test/compile-fail/extoption_env-too-many-args.rs
rename to src/test/ui/extoption_env-too-many-args.rs
diff --git a/src/test/ui/extoption_env-too-many-args.stderr b/src/test/ui/extoption_env-too-many-args.stderr
new file mode 100644
index 0000000..0e4569d
--- /dev/null
+++ b/src/test/ui/extoption_env-too-many-args.stderr
@@ -0,0 +1,8 @@
+error: option_env! takes 1 argument
+ --> $DIR/extoption_env-too-many-args.rs:11:13
+ |
+LL | fn main() { option_env!("one", "two"); } //~ ERROR: option_env! takes 1 argument
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/fail-no-dead-code-core.rs b/src/test/ui/fail-no-dead-code-core.rs
similarity index 100%
rename from src/test/compile-fail/fail-no-dead-code-core.rs
rename to src/test/ui/fail-no-dead-code-core.rs
diff --git a/src/test/ui/fail-no-dead-code-core.stderr b/src/test/ui/fail-no-dead-code-core.stderr
new file mode 100644
index 0000000..d2af77a
--- /dev/null
+++ b/src/test/ui/fail-no-dead-code-core.stderr
@@ -0,0 +1,14 @@
+error: function is never used: `foo`
+ --> $DIR/fail-no-dead-code-core.rs:17:1
+ |
+LL | fn foo() { //~ ERROR function is never used
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/fail-no-dead-code-core.rs:11:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/fail-no-dead-code.rs b/src/test/ui/fail-no-dead-code.rs
similarity index 100%
rename from src/test/compile-fail/fail-no-dead-code.rs
rename to src/test/ui/fail-no-dead-code.rs
diff --git a/src/test/ui/fail-no-dead-code.stderr b/src/test/ui/fail-no-dead-code.stderr
new file mode 100644
index 0000000..f355c7d
--- /dev/null
+++ b/src/test/ui/fail-no-dead-code.stderr
@@ -0,0 +1,14 @@
+error: function is never used: `foo`
+ --> $DIR/fail-no-dead-code.rs:14:1
+ |
+LL | fn foo() { //~ ERROR function is never used
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/fail-no-dead-code.rs:11:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/fail-simple.rs b/src/test/ui/fail-simple.rs
similarity index 100%
rename from src/test/compile-fail/fail-simple.rs
rename to src/test/ui/fail-simple.rs
diff --git a/src/test/ui/fail-simple.stderr b/src/test/ui/fail-simple.stderr
new file mode 100644
index 0000000..764f2c4
--- /dev/null
+++ b/src/test/ui/fail-simple.stderr
@@ -0,0 +1,8 @@
+error: no rules expected the token `@`
+ --> $DIR/fail-simple.rs:12:12
+ |
+LL | panic!(@); //~ ERROR no rules expected the token `@`
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/feature-gate-crate_in_paths.rs b/src/test/ui/feature-gate-crate_in_paths.rs
deleted file mode 100644
index 830ec59..0000000
--- a/src/test/ui/feature-gate-crate_in_paths.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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.
-
-struct S;
-
-fn main() {
- let _ = ::crate::S; //~ ERROR `crate` in paths is experimental
-}
diff --git a/src/test/ui/feature-gate-crate_in_paths.stderr b/src/test/ui/feature-gate-crate_in_paths.stderr
deleted file mode 100644
index 1d0eed5..0000000
--- a/src/test/ui/feature-gate-crate_in_paths.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: `crate` in paths is experimental (see issue #45477)
- --> $DIR/feature-gate-crate_in_paths.rs:14:15
- |
-LL | let _ = ::crate::S; //~ ERROR `crate` in paths is experimental
- | ^^^^^
- |
- = help: add #![feature(crate_in_paths)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-rustc-attrs-1.rs b/src/test/ui/feature-gate-rustc-attrs-1.rs
new file mode 100644
index 0000000..7295de8
--- /dev/null
+++ b/src/test/ui/feature-gate-rustc-attrs-1.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
+
+#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
+#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
+
+fn main() {}
diff --git a/src/test/ui/feature-gate-rustc-attrs-1.stderr b/src/test/ui/feature-gate-rustc-attrs-1.stderr
new file mode 100644
index 0000000..54a580c
--- /dev/null
+++ b/src/test/ui/feature-gate-rustc-attrs-1.stderr
@@ -0,0 +1,19 @@
+error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)
+ --> $DIR/feature-gate-rustc-attrs-1.rs:15:1
+ |
+LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)
+ --> $DIR/feature-gate-rustc-attrs-1.rs:16:1
+ |
+LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
+ | ^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gate-rustc-attrs.rs
deleted file mode 100644
index 8cfd3e0..0000000
--- a/src/test/ui/feature-gate-rustc-attrs.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// ignore-tidy-linelength
-
-// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
-
-#[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
-#[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
-#[rustc_foo]
-//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics
-
-fn main() {}
diff --git a/src/test/ui/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gate-rustc-attrs.stderr
deleted file mode 100644
index fda95a5..0000000
--- a/src/test/ui/feature-gate-rustc-attrs.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0658]: the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)
- --> $DIR/feature-gate-rustc-attrs.rs:15:1
- |
-LL | #[rustc_variance] //~ ERROR the `#[rustc_variance]` attribute is just used for rustc unit tests and will never be stable
- | ^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(rustc_attrs)] to the crate attributes to enable
-
-error[E0658]: the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable (see issue #29642)
- --> $DIR/feature-gate-rustc-attrs.rs:16:1
- |
-LL | #[rustc_error] //~ ERROR the `#[rustc_error]` attribute is just used for rustc unit tests and will never be stable
- | ^^^^^^^^^^^^^^
- |
- = help: add #![feature(rustc_attrs)] to the crate attributes to enable
-
-error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
- --> $DIR/feature-gate-rustc-attrs.rs:17:1
- |
-LL | #[rustc_foo]
- | ^^^^^^^^^^^^
- |
- = help: add #![feature(rustc_attrs)] to the crate attributes to enable
-
-error: aborting due to 3 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-tool_attributes.rs b/src/test/ui/feature-gate-tool_attributes.rs
deleted file mode 100644
index 47c6235..0000000
--- a/src/test/ui/feature-gate-tool_attributes.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// 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.
-
-#![feature(use_extern_macros)]
-
-fn main() {
- #[rustfmt::skip] //~ ERROR tool attributes are unstable
- let x = 3
- ;
-}
diff --git a/src/test/ui/feature-gate-tool_attributes.stderr b/src/test/ui/feature-gate-tool_attributes.stderr
deleted file mode 100644
index ebc266e..0000000
--- a/src/test/ui/feature-gate-tool_attributes.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: tool attributes are unstable (see issue #44690)
- --> $DIR/feature-gate-tool_attributes.rs:14:5
- |
-LL | #[rustfmt::skip] //~ ERROR tool attributes are unstable
- | ^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(tool_attributes)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gate-trivial_bounds.stderr
deleted file mode 100644
index 02b2f99..0000000
--- a/src/test/ui/feature-gate-trivial_bounds.stderr
+++ /dev/null
@@ -1,130 +0,0 @@
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:20:1
- |
-LL | enum E where i32: Foo { V } //~ ERROR
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:22:1
- |
-LL | struct S where i32: Foo; //~ ERROR
- | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:24:1
- |
-LL | trait T where i32: Foo {} //~ ERROR
- | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:26:1
- |
-LL | union U where i32: Foo { f: i32 } //~ ERROR
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:30:1
- |
-LL | / impl Foo for () where i32: Foo { //~ ERROR
-LL | | fn test(&self) {
-LL | | 3i32.test();
-LL | | Foo::test(&4i32);
-LL | | generic_function(5i32);
-LL | | }
-LL | | }
- | |_^ the trait `Foo` is not implemented for `i32`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:38:1
- |
-LL | / fn f() where i32: Foo //~ ERROR
-LL | | {
-LL | | let s = S;
-LL | | 3i32.test();
-LL | | Foo::test(&4i32);
-LL | | generic_function(5i32);
-LL | | }
- | |_^ the trait `Foo` is not implemented for `i32`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:46:1
- |
-LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> { //~ ERROR
-LL | | -s
-LL | | }
- | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String`
- |
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the trait bound `i32: std::iter::Iterator` is not satisfied
- --> $DIR/feature-gate-trivial_bounds.rs:50:1
- |
-LL | / fn use_for() where i32: Iterator { //~ ERROR
-LL | | for _ in 2i32 {}
-LL | | }
- | |_^ `i32` is not an iterator; maybe try calling `.iter()` or a similar method
- |
- = help: the trait `std::iter::Iterator` is not implemented for `i32`
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/feature-gate-trivial_bounds.rs:62:1
- |
-LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
- --> $DIR/feature-gate-trivial_bounds.rs:65:1
- |
-LL | / fn unsized_local() where Dst<A>: Sized { //~ ERROR
-LL | | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
-LL | | }
- | |_^ doesn't have a size known at compile-time
- |
- = help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required because it appears within the type `Dst<(dyn A + 'static)>`
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/feature-gate-trivial_bounds.rs:69:1
- |
-LL | / fn return_str() -> str where str: Sized { //~ ERROR
-LL | | *"Sized".to_string().into_boxed_str()
-LL | | }
- | |_^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: see issue #48214
- = help: add #![feature(trivial_bounds)] to the crate attributes to enable
-
-error: aborting due to 11 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/feature-gate-uniform-paths.rs b/src/test/ui/feature-gate-uniform-paths.rs
new file mode 100644
index 0000000..140655d
--- /dev/null
+++ b/src/test/ui/feature-gate-uniform-paths.rs
@@ -0,0 +1,22 @@
+// 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.
+
+pub mod foo {
+ pub use bar::Bar;
+ //~^ ERROR unresolved import `bar`
+
+ pub mod bar {
+ pub struct Bar;
+ }
+}
+
+fn main() {
+ let _ = foo::Bar;
+}
diff --git a/src/test/ui/feature-gate-uniform-paths.stderr b/src/test/ui/feature-gate-uniform-paths.stderr
new file mode 100644
index 0000000..68faacf
--- /dev/null
+++ b/src/test/ui/feature-gate-uniform-paths.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `bar`
+ --> $DIR/feature-gate-uniform-paths.rs:12:13
+ |
+LL | pub use bar::Bar;
+ | ^^^ Did you mean `self::bar`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/feature-gate-unrestricted-attribute-tokens.rs b/src/test/ui/feature-gate-unrestricted-attribute-tokens.rs
new file mode 100644
index 0000000..daebbe6
--- /dev/null
+++ b/src/test/ui/feature-gate-unrestricted-attribute-tokens.rs
@@ -0,0 +1,17 @@
+// 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.
+
+#![feature(custom_attribute)]
+
+#[my_attr(a b c d)]
+//~^ ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `b`
+//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `c`
+//~| ERROR expected one of `(`, `)`, `,`, `::`, or `=`, found `d`
+fn main() {}
diff --git a/src/test/ui/feature-gate-unrestricted-attribute-tokens.stderr b/src/test/ui/feature-gate-unrestricted-attribute-tokens.stderr
new file mode 100644
index 0000000..cc5694b
--- /dev/null
+++ b/src/test/ui/feature-gate-unrestricted-attribute-tokens.stderr
@@ -0,0 +1,20 @@
+error: expected one of `(`, `)`, `,`, `::`, or `=`, found `b`
+ --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:13
+ |
+LL | #[my_attr(a b c d)]
+ | ^ expected one of `(`, `)`, `,`, `::`, or `=` here
+
+error: expected one of `(`, `)`, `,`, `::`, or `=`, found `c`
+ --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:15
+ |
+LL | #[my_attr(a b c d)]
+ | ^ expected one of `(`, `)`, `,`, `::`, or `=` here
+
+error: expected one of `(`, `)`, `,`, `::`, or `=`, found `d`
+ --> $DIR/feature-gate-unrestricted-attribute-tokens.rs:13:17
+ |
+LL | #[my_attr(a b c d)]
+ | ^ expected one of `(`, `)`, `,`, `::`, or `=` here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/feature-gate-unsized_locals.rs b/src/test/ui/feature-gate-unsized_locals.rs
new file mode 100644
index 0000000..7f1f22f
--- /dev/null
+++ b/src/test/ui/feature-gate-unsized_locals.rs
@@ -0,0 +1,15 @@
+// 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.
+
+fn f(f: FnOnce()) {}
+//~^ ERROR E0277
+
+fn main() {
+}
diff --git a/src/test/ui/feature-gate-unsized_locals.stderr b/src/test/ui/feature-gate-unsized_locals.stderr
new file mode 100644
index 0000000..a0440a3
--- /dev/null
+++ b/src/test/ui/feature-gate-unsized_locals.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `(dyn std::ops::FnOnce() + 'static)` cannot be known at compilation time
+ --> $DIR/feature-gate-unsized_locals.rs:11:6
+ |
+LL | fn f(f: FnOnce()) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::FnOnce() + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/feature-gated-feature-in-macro-arg.rs b/src/test/ui/feature-gated-feature-in-macro-arg.rs
similarity index 100%
rename from src/test/compile-fail/feature-gated-feature-in-macro-arg.rs
rename to src/test/ui/feature-gated-feature-in-macro-arg.rs
diff --git a/src/test/ui/feature-gated-feature-in-macro-arg.stderr b/src/test/ui/feature-gated-feature-in-macro-arg.stderr
new file mode 100644
index 0000000..41b3e3e
--- /dev/null
+++ b/src/test/ui/feature-gated-feature-in-macro-arg.stderr
@@ -0,0 +1,13 @@
+error[E0658]: intrinsics are subject to change
+ --> $DIR/feature-gated-feature-in-macro-arg.rs:18:9
+ |
+LL | / extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change
+LL | | fn atomic_fence();
+LL | | }
+ | |_________^
+ |
+ = help: add #![feature(intrinsics)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/auxiliary/cfg-target-thread-local.rs b/src/test/ui/feature-gates/auxiliary/cfg-target-thread-local.rs
similarity index 100%
rename from src/test/ui/auxiliary/cfg-target-thread-local.rs
rename to src/test/ui/feature-gates/auxiliary/cfg-target-thread-local.rs
diff --git a/src/test/ui/feature-gate-abi-msp430-interrupt.rs b/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs
similarity index 100%
rename from src/test/ui/feature-gate-abi-msp430-interrupt.rs
rename to src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.rs
diff --git a/src/test/ui/feature-gate-abi-msp430-interrupt.stderr b/src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr
similarity index 100%
rename from src/test/ui/feature-gate-abi-msp430-interrupt.stderr
rename to src/test/ui/feature-gates/feature-gate-abi-msp430-interrupt.stderr
diff --git a/src/test/ui/feature-gate-abi.rs b/src/test/ui/feature-gates/feature-gate-abi.rs
similarity index 100%
rename from src/test/ui/feature-gate-abi.rs
rename to src/test/ui/feature-gates/feature-gate-abi.rs
diff --git a/src/test/ui/feature-gate-abi.stderr b/src/test/ui/feature-gates/feature-gate-abi.stderr
similarity index 100%
rename from src/test/ui/feature-gate-abi.stderr
rename to src/test/ui/feature-gates/feature-gate-abi.stderr
diff --git a/src/test/ui/feature-gate-abi_unadjusted.rs b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.rs
similarity index 100%
rename from src/test/ui/feature-gate-abi_unadjusted.rs
rename to src/test/ui/feature-gates/feature-gate-abi_unadjusted.rs
diff --git a/src/test/ui/feature-gate-abi_unadjusted.stderr b/src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr
similarity index 100%
rename from src/test/ui/feature-gate-abi_unadjusted.stderr
rename to src/test/ui/feature-gates/feature-gate-abi_unadjusted.stderr
diff --git a/src/test/compile-fail/feature-gate-alloc-error-handler.rs b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs
similarity index 100%
rename from src/test/compile-fail/feature-gate-alloc-error-handler.rs
rename to src/test/ui/feature-gates/feature-gate-alloc-error-handler.rs
diff --git a/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr
new file mode 100644
index 0000000..255d5b0
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-alloc-error-handler.stderr
@@ -0,0 +1,11 @@
+error[E0658]: #[alloc_error_handler] is an unstable feature (see issue #51540)
+ --> $DIR/feature-gate-alloc-error-handler.rs:18:1
+ |
+LL | #[alloc_error_handler] //~ ERROR #[alloc_error_handler] is an unstable feature (see issue #51540)
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(alloc_error_handler)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-allocator_internals.rs b/src/test/ui/feature-gates/feature-gate-allocator_internals.rs
similarity index 100%
rename from src/test/ui/feature-gate-allocator_internals.rs
rename to src/test/ui/feature-gates/feature-gate-allocator_internals.rs
diff --git a/src/test/ui/feature-gate-allocator_internals.stderr b/src/test/ui/feature-gates/feature-gate-allocator_internals.stderr
similarity index 100%
rename from src/test/ui/feature-gate-allocator_internals.stderr
rename to src/test/ui/feature-gates/feature-gate-allocator_internals.stderr
diff --git a/src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.rs
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.rs
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.rs
diff --git a/src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unsafe-nested-macro.stderr
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unsafe-nested-macro.stderr
diff --git a/src/test/ui/feature-gate-allow-internal-unstable-nested-macro.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unstable-nested-macro.rs
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.rs
diff --git a/src/test/ui/feature-gate-allow-internal-unstable-nested-macro.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unstable-nested-macro.stderr
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unstable-nested-macro.stderr
diff --git a/src/test/ui/feature-gate-allow-internal-unstable-struct.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unstable-struct.rs
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.rs
diff --git a/src/test/ui/feature-gate-allow-internal-unstable-struct.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unstable-struct.stderr
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unstable-struct.stderr
diff --git a/src/test/ui/feature-gate-allow-internal-unstable.rs b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unstable.rs
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unstable.rs
diff --git a/src/test/ui/feature-gate-allow-internal-unstable.stderr b/src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr
similarity index 100%
rename from src/test/ui/feature-gate-allow-internal-unstable.stderr
rename to src/test/ui/feature-gates/feature-gate-allow-internal-unstable.stderr
diff --git a/src/test/ui/feature-gate-allow_fail.rs b/src/test/ui/feature-gates/feature-gate-allow_fail.rs
similarity index 100%
rename from src/test/ui/feature-gate-allow_fail.rs
rename to src/test/ui/feature-gates/feature-gate-allow_fail.rs
diff --git a/src/test/ui/feature-gate-allow_fail.stderr b/src/test/ui/feature-gates/feature-gate-allow_fail.stderr
similarity index 100%
rename from src/test/ui/feature-gate-allow_fail.stderr
rename to src/test/ui/feature-gates/feature-gate-allow_fail.stderr
diff --git a/src/test/ui/feature-gate-arbitrary-self-types.rs b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs
similarity index 100%
rename from src/test/ui/feature-gate-arbitrary-self-types.rs
rename to src/test/ui/feature-gates/feature-gate-arbitrary-self-types.rs
diff --git a/src/test/ui/feature-gate-arbitrary-self-types.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr
similarity index 100%
rename from src/test/ui/feature-gate-arbitrary-self-types.stderr
rename to src/test/ui/feature-gates/feature-gate-arbitrary-self-types.stderr
diff --git a/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.rs
similarity index 100%
rename from src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.rs
rename to src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.rs
diff --git a/src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr b/src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr
similarity index 100%
rename from src/test/ui/feature-gate-arbitrary_self_types-raw-pointer.stderr
rename to src/test/ui/feature-gates/feature-gate-arbitrary_self_types-raw-pointer.stderr
diff --git a/src/test/ui/feature-gate-asm.rs b/src/test/ui/feature-gates/feature-gate-asm.rs
similarity index 100%
rename from src/test/ui/feature-gate-asm.rs
rename to src/test/ui/feature-gates/feature-gate-asm.rs
diff --git a/src/test/ui/feature-gate-asm.stderr b/src/test/ui/feature-gates/feature-gate-asm.stderr
similarity index 100%
rename from src/test/ui/feature-gate-asm.stderr
rename to src/test/ui/feature-gates/feature-gate-asm.stderr
diff --git a/src/test/ui/feature-gate-asm2.rs b/src/test/ui/feature-gates/feature-gate-asm2.rs
similarity index 100%
rename from src/test/ui/feature-gate-asm2.rs
rename to src/test/ui/feature-gates/feature-gate-asm2.rs
diff --git a/src/test/ui/feature-gate-asm2.stderr b/src/test/ui/feature-gates/feature-gate-asm2.stderr
similarity index 100%
rename from src/test/ui/feature-gate-asm2.stderr
rename to src/test/ui/feature-gates/feature-gate-asm2.stderr
diff --git a/src/test/ui/feature-gate-assoc-type-defaults.rs b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.rs
similarity index 100%
rename from src/test/ui/feature-gate-assoc-type-defaults.rs
rename to src/test/ui/feature-gates/feature-gate-assoc-type-defaults.rs
diff --git a/src/test/ui/feature-gate-assoc-type-defaults.stderr b/src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr
similarity index 100%
rename from src/test/ui/feature-gate-assoc-type-defaults.stderr
rename to src/test/ui/feature-gates/feature-gate-assoc-type-defaults.stderr
diff --git a/src/test/ui/feature-gate-async-await-2015-edition.rs b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs
similarity index 100%
rename from src/test/ui/feature-gate-async-await-2015-edition.rs
rename to src/test/ui/feature-gates/feature-gate-async-await-2015-edition.rs
diff --git a/src/test/ui/feature-gate-async-await-2015-edition.stderr b/src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr
similarity index 100%
rename from src/test/ui/feature-gate-async-await-2015-edition.stderr
rename to src/test/ui/feature-gates/feature-gate-async-await-2015-edition.stderr
diff --git a/src/test/ui/feature-gate-async-await.rs b/src/test/ui/feature-gates/feature-gate-async-await.rs
similarity index 100%
rename from src/test/ui/feature-gate-async-await.rs
rename to src/test/ui/feature-gates/feature-gate-async-await.rs
diff --git a/src/test/ui/feature-gate-async-await.stderr b/src/test/ui/feature-gates/feature-gate-async-await.stderr
similarity index 100%
rename from src/test/ui/feature-gate-async-await.stderr
rename to src/test/ui/feature-gates/feature-gate-async-await.stderr
diff --git a/src/test/ui/feature-gate-box-expr.rs b/src/test/ui/feature-gates/feature-gate-box-expr.rs
similarity index 100%
rename from src/test/ui/feature-gate-box-expr.rs
rename to src/test/ui/feature-gates/feature-gate-box-expr.rs
diff --git a/src/test/ui/feature-gate-box-expr.stderr b/src/test/ui/feature-gates/feature-gate-box-expr.stderr
similarity index 100%
rename from src/test/ui/feature-gate-box-expr.stderr
rename to src/test/ui/feature-gates/feature-gate-box-expr.stderr
diff --git a/src/test/ui/feature-gate-box_patterns.rs b/src/test/ui/feature-gates/feature-gate-box_patterns.rs
similarity index 100%
rename from src/test/ui/feature-gate-box_patterns.rs
rename to src/test/ui/feature-gates/feature-gate-box_patterns.rs
diff --git a/src/test/ui/feature-gate-box_patterns.stderr b/src/test/ui/feature-gates/feature-gate-box_patterns.stderr
similarity index 100%
rename from src/test/ui/feature-gate-box_patterns.stderr
rename to src/test/ui/feature-gates/feature-gate-box_patterns.stderr
diff --git a/src/test/ui/feature-gate-box_syntax.rs b/src/test/ui/feature-gates/feature-gate-box_syntax.rs
similarity index 100%
rename from src/test/ui/feature-gate-box_syntax.rs
rename to src/test/ui/feature-gates/feature-gate-box_syntax.rs
diff --git a/src/test/ui/feature-gate-box_syntax.stderr b/src/test/ui/feature-gates/feature-gate-box_syntax.stderr
similarity index 100%
rename from src/test/ui/feature-gate-box_syntax.stderr
rename to src/test/ui/feature-gates/feature-gate-box_syntax.stderr
diff --git a/src/test/ui/feature-gate-catch_expr.rs b/src/test/ui/feature-gates/feature-gate-catch_expr.rs
similarity index 100%
rename from src/test/ui/feature-gate-catch_expr.rs
rename to src/test/ui/feature-gates/feature-gate-catch_expr.rs
diff --git a/src/test/ui/feature-gate-catch_expr.stderr b/src/test/ui/feature-gates/feature-gate-catch_expr.stderr
similarity index 100%
rename from src/test/ui/feature-gate-catch_expr.stderr
rename to src/test/ui/feature-gates/feature-gate-catch_expr.stderr
diff --git a/src/test/ui/feature-gate-cfg-target-has-atomic.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
similarity index 100%
rename from src/test/ui/feature-gate-cfg-target-has-atomic.rs
rename to src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.rs
diff --git a/src/test/ui/feature-gate-cfg-target-has-atomic.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr
similarity index 100%
rename from src/test/ui/feature-gate-cfg-target-has-atomic.stderr
rename to src/test/ui/feature-gates/feature-gate-cfg-target-has-atomic.stderr
diff --git a/src/test/ui/feature-gate-cfg-target-thread-local.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs
similarity index 100%
rename from src/test/ui/feature-gate-cfg-target-thread-local.rs
rename to src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.rs
diff --git a/src/test/ui/feature-gate-cfg-target-thread-local.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.stderr
similarity index 100%
rename from src/test/ui/feature-gate-cfg-target-thread-local.stderr
rename to src/test/ui/feature-gates/feature-gate-cfg-target-thread-local.stderr
diff --git a/src/test/ui/feature-gate-cfg-target-vendor.rs b/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs
similarity index 100%
rename from src/test/ui/feature-gate-cfg-target-vendor.rs
rename to src/test/ui/feature-gates/feature-gate-cfg-target-vendor.rs
diff --git a/src/test/ui/feature-gate-cfg-target-vendor.stderr b/src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr
similarity index 100%
rename from src/test/ui/feature-gate-cfg-target-vendor.stderr
rename to src/test/ui/feature-gates/feature-gate-cfg-target-vendor.stderr
diff --git a/src/test/ui/feature-gate-compiler-builtins.rs b/src/test/ui/feature-gates/feature-gate-compiler-builtins.rs
similarity index 100%
rename from src/test/ui/feature-gate-compiler-builtins.rs
rename to src/test/ui/feature-gates/feature-gate-compiler-builtins.rs
diff --git a/src/test/ui/feature-gate-compiler-builtins.stderr b/src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr
similarity index 100%
rename from src/test/ui/feature-gate-compiler-builtins.stderr
rename to src/test/ui/feature-gates/feature-gate-compiler-builtins.stderr
diff --git a/src/test/ui/feature-gate-concat_idents.rs b/src/test/ui/feature-gates/feature-gate-concat_idents.rs
similarity index 100%
rename from src/test/ui/feature-gate-concat_idents.rs
rename to src/test/ui/feature-gates/feature-gate-concat_idents.rs
diff --git a/src/test/ui/feature-gate-concat_idents.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents.stderr
similarity index 100%
rename from src/test/ui/feature-gate-concat_idents.stderr
rename to src/test/ui/feature-gates/feature-gate-concat_idents.stderr
diff --git a/src/test/ui/feature-gate-concat_idents2.rs b/src/test/ui/feature-gates/feature-gate-concat_idents2.rs
similarity index 100%
rename from src/test/ui/feature-gate-concat_idents2.rs
rename to src/test/ui/feature-gates/feature-gate-concat_idents2.rs
diff --git a/src/test/ui/feature-gate-concat_idents2.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents2.stderr
similarity index 100%
rename from src/test/ui/feature-gate-concat_idents2.stderr
rename to src/test/ui/feature-gates/feature-gate-concat_idents2.stderr
diff --git a/src/test/ui/feature-gate-concat_idents3.rs b/src/test/ui/feature-gates/feature-gate-concat_idents3.rs
similarity index 100%
rename from src/test/ui/feature-gate-concat_idents3.rs
rename to src/test/ui/feature-gates/feature-gate-concat_idents3.rs
diff --git a/src/test/ui/feature-gate-concat_idents3.stderr b/src/test/ui/feature-gates/feature-gate-concat_idents3.stderr
similarity index 100%
rename from src/test/ui/feature-gate-concat_idents3.stderr
rename to src/test/ui/feature-gates/feature-gate-concat_idents3.stderr
diff --git a/src/test/ui/feature-gate-const-indexing.rs b/src/test/ui/feature-gates/feature-gate-const-indexing.rs
similarity index 100%
rename from src/test/ui/feature-gate-const-indexing.rs
rename to src/test/ui/feature-gates/feature-gate-const-indexing.rs
diff --git a/src/test/ui/feature-gate-const_fn.rs b/src/test/ui/feature-gates/feature-gate-const_fn.rs
similarity index 100%
rename from src/test/ui/feature-gate-const_fn.rs
rename to src/test/ui/feature-gates/feature-gate-const_fn.rs
diff --git a/src/test/ui/feature-gate-const_fn.stderr b/src/test/ui/feature-gates/feature-gate-const_fn.stderr
similarity index 100%
rename from src/test/ui/feature-gate-const_fn.stderr
rename to src/test/ui/feature-gates/feature-gate-const_fn.stderr
diff --git a/src/test/ui/feature-gate-const_let.rs b/src/test/ui/feature-gates/feature-gate-const_let.rs
similarity index 100%
rename from src/test/ui/feature-gate-const_let.rs
rename to src/test/ui/feature-gates/feature-gate-const_let.rs
diff --git a/src/test/ui/feature-gate-const_let.stderr b/src/test/ui/feature-gates/feature-gate-const_let.stderr
similarity index 100%
rename from src/test/ui/feature-gate-const_let.stderr
rename to src/test/ui/feature-gates/feature-gate-const_let.stderr
diff --git a/src/test/ui/feature-gates/feature-gate-crate_in_paths.rs b/src/test/ui/feature-gates/feature-gate-crate_in_paths.rs
new file mode 100644
index 0000000..e667dab
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-crate_in_paths.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 <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.
+
+struct S;
+
+fn main() {
+ let _ = crate::S; //~ ERROR `crate` in paths is experimental
+}
diff --git a/src/test/ui/feature-gates/feature-gate-crate_in_paths.stderr b/src/test/ui/feature-gates/feature-gate-crate_in_paths.stderr
new file mode 100644
index 0000000..32115ba
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-crate_in_paths.stderr
@@ -0,0 +1,11 @@
+error[E0658]: `crate` in paths is experimental (see issue #45477)
+ --> $DIR/feature-gate-crate_in_paths.rs:14:13
+ |
+LL | let _ = crate::S; //~ ERROR `crate` in paths is experimental
+ | ^^^^^
+ |
+ = help: add #![feature(crate_in_paths)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-crate_visibility_modifier.rs b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.rs
similarity index 100%
rename from src/test/ui/feature-gate-crate_visibility_modifier.rs
rename to src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.rs
diff --git a/src/test/ui/feature-gate-crate_visibility_modifier.stderr b/src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr
similarity index 100%
rename from src/test/ui/feature-gate-crate_visibility_modifier.stderr
rename to src/test/ui/feature-gates/feature-gate-crate_visibility_modifier.stderr
diff --git a/src/test/ui/feature-gate-custom_attribute.rs b/src/test/ui/feature-gates/feature-gate-custom_attribute.rs
similarity index 100%
rename from src/test/ui/feature-gate-custom_attribute.rs
rename to src/test/ui/feature-gates/feature-gate-custom_attribute.rs
diff --git a/src/test/ui/feature-gate-custom_attribute.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute.stderr
similarity index 100%
rename from src/test/ui/feature-gate-custom_attribute.stderr
rename to src/test/ui/feature-gates/feature-gate-custom_attribute.stderr
diff --git a/src/test/ui/feature-gate-custom_attribute2.rs b/src/test/ui/feature-gates/feature-gate-custom_attribute2.rs
similarity index 100%
rename from src/test/ui/feature-gate-custom_attribute2.rs
rename to src/test/ui/feature-gates/feature-gate-custom_attribute2.rs
diff --git a/src/test/ui/feature-gate-custom_attribute2.stderr b/src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr
similarity index 100%
rename from src/test/ui/feature-gate-custom_attribute2.stderr
rename to src/test/ui/feature-gates/feature-gate-custom_attribute2.stderr
diff --git a/src/test/ui/feature-gate-custom_derive.rs b/src/test/ui/feature-gates/feature-gate-custom_derive.rs
similarity index 100%
rename from src/test/ui/feature-gate-custom_derive.rs
rename to src/test/ui/feature-gates/feature-gate-custom_derive.rs
diff --git a/src/test/ui/feature-gate-custom_derive.stderr b/src/test/ui/feature-gates/feature-gate-custom_derive.stderr
similarity index 100%
rename from src/test/ui/feature-gate-custom_derive.stderr
rename to src/test/ui/feature-gates/feature-gate-custom_derive.stderr
diff --git a/src/test/ui/feature-gate-decl_macro.rs b/src/test/ui/feature-gates/feature-gate-decl_macro.rs
similarity index 100%
rename from src/test/ui/feature-gate-decl_macro.rs
rename to src/test/ui/feature-gates/feature-gate-decl_macro.rs
diff --git a/src/test/ui/feature-gate-decl_macro.stderr b/src/test/ui/feature-gates/feature-gate-decl_macro.stderr
similarity index 100%
rename from src/test/ui/feature-gate-decl_macro.stderr
rename to src/test/ui/feature-gates/feature-gate-decl_macro.stderr
diff --git a/src/test/ui/feature-gate-default_type_parameter_fallback.rs b/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.rs
similarity index 100%
rename from src/test/ui/feature-gate-default_type_parameter_fallback.rs
rename to src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.rs
diff --git a/src/test/ui/feature-gate-default_type_parameter_fallback.stderr b/src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr
similarity index 100%
rename from src/test/ui/feature-gate-default_type_parameter_fallback.stderr
rename to src/test/ui/feature-gates/feature-gate-default_type_parameter_fallback.stderr
diff --git a/src/test/ui/feature-gate-doc_alias.rs b/src/test/ui/feature-gates/feature-gate-doc_alias.rs
similarity index 100%
rename from src/test/ui/feature-gate-doc_alias.rs
rename to src/test/ui/feature-gates/feature-gate-doc_alias.rs
diff --git a/src/test/ui/feature-gate-doc_alias.stderr b/src/test/ui/feature-gates/feature-gate-doc_alias.stderr
similarity index 100%
rename from src/test/ui/feature-gate-doc_alias.stderr
rename to src/test/ui/feature-gates/feature-gate-doc_alias.stderr
diff --git a/src/test/ui/feature-gate-doc_cfg.rs b/src/test/ui/feature-gates/feature-gate-doc_cfg.rs
similarity index 100%
rename from src/test/ui/feature-gate-doc_cfg.rs
rename to src/test/ui/feature-gates/feature-gate-doc_cfg.rs
diff --git a/src/test/ui/feature-gate-doc_cfg.stderr b/src/test/ui/feature-gates/feature-gate-doc_cfg.stderr
similarity index 100%
rename from src/test/ui/feature-gate-doc_cfg.stderr
rename to src/test/ui/feature-gates/feature-gate-doc_cfg.stderr
diff --git a/src/test/ui/feature-gate-doc_keyword.rs b/src/test/ui/feature-gates/feature-gate-doc_keyword.rs
similarity index 100%
rename from src/test/ui/feature-gate-doc_keyword.rs
rename to src/test/ui/feature-gates/feature-gate-doc_keyword.rs
diff --git a/src/test/ui/feature-gate-doc_keyword.stderr b/src/test/ui/feature-gates/feature-gate-doc_keyword.stderr
similarity index 100%
rename from src/test/ui/feature-gate-doc_keyword.stderr
rename to src/test/ui/feature-gates/feature-gate-doc_keyword.stderr
diff --git a/src/test/ui/feature-gate-doc_masked.rs b/src/test/ui/feature-gates/feature-gate-doc_masked.rs
similarity index 100%
rename from src/test/ui/feature-gate-doc_masked.rs
rename to src/test/ui/feature-gates/feature-gate-doc_masked.rs
diff --git a/src/test/ui/feature-gate-doc_masked.stderr b/src/test/ui/feature-gates/feature-gate-doc_masked.stderr
similarity index 100%
rename from src/test/ui/feature-gate-doc_masked.stderr
rename to src/test/ui/feature-gates/feature-gate-doc_masked.stderr
diff --git a/src/test/ui/feature-gate-doc_spotlight.rs b/src/test/ui/feature-gates/feature-gate-doc_spotlight.rs
similarity index 100%
rename from src/test/ui/feature-gate-doc_spotlight.rs
rename to src/test/ui/feature-gates/feature-gate-doc_spotlight.rs
diff --git a/src/test/ui/feature-gate-doc_spotlight.stderr b/src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr
similarity index 100%
rename from src/test/ui/feature-gate-doc_spotlight.stderr
rename to src/test/ui/feature-gates/feature-gate-doc_spotlight.stderr
diff --git a/src/test/ui/feature-gate-dropck-ugeh-2.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs
similarity index 100%
rename from src/test/ui/feature-gate-dropck-ugeh-2.rs
rename to src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.rs
diff --git a/src/test/ui/feature-gate-dropck-ugeh-2.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr
similarity index 100%
rename from src/test/ui/feature-gate-dropck-ugeh-2.stderr
rename to src/test/ui/feature-gates/feature-gate-dropck-ugeh-2.stderr
diff --git a/src/test/ui/feature-gate-dropck-ugeh.rs b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs
similarity index 100%
rename from src/test/ui/feature-gate-dropck-ugeh.rs
rename to src/test/ui/feature-gates/feature-gate-dropck-ugeh.rs
diff --git a/src/test/ui/feature-gate-dropck-ugeh.stderr b/src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr
similarity index 100%
rename from src/test/ui/feature-gate-dropck-ugeh.stderr
rename to src/test/ui/feature-gates/feature-gate-dropck-ugeh.stderr
diff --git a/src/test/ui/feature-gate-exclusive-range-pattern.rs b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs
similarity index 100%
rename from src/test/ui/feature-gate-exclusive-range-pattern.rs
rename to src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.rs
diff --git a/src/test/ui/feature-gate-exclusive-range-pattern.stderr b/src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr
similarity index 100%
rename from src/test/ui/feature-gate-exclusive-range-pattern.stderr
rename to src/test/ui/feature-gates/feature-gate-exclusive-range-pattern.stderr
diff --git a/src/test/ui/feature-gate-exhaustive-patterns.rs b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs
similarity index 100%
rename from src/test/ui/feature-gate-exhaustive-patterns.rs
rename to src/test/ui/feature-gates/feature-gate-exhaustive-patterns.rs
diff --git a/src/test/ui/feature-gate-exhaustive-patterns.stderr b/src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
similarity index 100%
rename from src/test/ui/feature-gate-exhaustive-patterns.stderr
rename to src/test/ui/feature-gates/feature-gate-exhaustive-patterns.stderr
diff --git a/src/test/ui/feature-gate-existential-type.rs b/src/test/ui/feature-gates/feature-gate-existential-type.rs
similarity index 100%
rename from src/test/ui/feature-gate-existential-type.rs
rename to src/test/ui/feature-gates/feature-gate-existential-type.rs
diff --git a/src/test/ui/feature-gate-existential-type.stderr b/src/test/ui/feature-gates/feature-gate-existential-type.stderr
similarity index 100%
rename from src/test/ui/feature-gate-existential-type.stderr
rename to src/test/ui/feature-gates/feature-gate-existential-type.stderr
diff --git a/src/test/ui/feature-gate-extern_absolute_paths.rs b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs
similarity index 100%
rename from src/test/ui/feature-gate-extern_absolute_paths.rs
rename to src/test/ui/feature-gates/feature-gate-extern_absolute_paths.rs
diff --git a/src/test/ui/feature-gate-extern_absolute_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
similarity index 100%
rename from src/test/ui/feature-gate-extern_absolute_paths.stderr
rename to src/test/ui/feature-gates/feature-gate-extern_absolute_paths.stderr
diff --git a/src/test/ui/feature-gate-extern_in_paths.rs b/src/test/ui/feature-gates/feature-gate-extern_in_paths.rs
similarity index 100%
rename from src/test/ui/feature-gate-extern_in_paths.rs
rename to src/test/ui/feature-gates/feature-gate-extern_in_paths.rs
diff --git a/src/test/ui/feature-gate-extern_in_paths.stderr b/src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr
similarity index 100%
rename from src/test/ui/feature-gate-extern_in_paths.stderr
rename to src/test/ui/feature-gates/feature-gate-extern_in_paths.stderr
diff --git a/src/test/ui/feature-gate-extern_prelude.rs b/src/test/ui/feature-gates/feature-gate-extern_prelude.rs
similarity index 100%
rename from src/test/ui/feature-gate-extern_prelude.rs
rename to src/test/ui/feature-gates/feature-gate-extern_prelude.rs
diff --git a/src/test/ui/feature-gate-extern_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_prelude.stderr
similarity index 100%
rename from src/test/ui/feature-gate-extern_prelude.stderr
rename to src/test/ui/feature-gates/feature-gate-extern_prelude.stderr
diff --git a/src/test/ui/feature-gate-extern_types.rs b/src/test/ui/feature-gates/feature-gate-extern_types.rs
similarity index 100%
rename from src/test/ui/feature-gate-extern_types.rs
rename to src/test/ui/feature-gates/feature-gate-extern_types.rs
diff --git a/src/test/ui/feature-gate-extern_types.stderr b/src/test/ui/feature-gates/feature-gate-extern_types.stderr
similarity index 100%
rename from src/test/ui/feature-gate-extern_types.stderr
rename to src/test/ui/feature-gates/feature-gate-extern_types.stderr
diff --git a/src/test/ui/feature-gate-external_doc.rs b/src/test/ui/feature-gates/feature-gate-external_doc.rs
similarity index 100%
rename from src/test/ui/feature-gate-external_doc.rs
rename to src/test/ui/feature-gates/feature-gate-external_doc.rs
diff --git a/src/test/ui/feature-gate-external_doc.stderr b/src/test/ui/feature-gates/feature-gate-external_doc.stderr
similarity index 100%
rename from src/test/ui/feature-gate-external_doc.stderr
rename to src/test/ui/feature-gates/feature-gate-external_doc.stderr
diff --git a/src/test/ui/feature-gate-feature-gate.rs b/src/test/ui/feature-gates/feature-gate-feature-gate.rs
similarity index 100%
rename from src/test/ui/feature-gate-feature-gate.rs
rename to src/test/ui/feature-gates/feature-gate-feature-gate.rs
diff --git a/src/test/ui/feature-gate-feature-gate.stderr b/src/test/ui/feature-gates/feature-gate-feature-gate.stderr
similarity index 100%
rename from src/test/ui/feature-gate-feature-gate.stderr
rename to src/test/ui/feature-gates/feature-gate-feature-gate.stderr
diff --git a/src/test/ui/feature-gate-format_args_nl.rs b/src/test/ui/feature-gates/feature-gate-format_args_nl.rs
similarity index 100%
rename from src/test/ui/feature-gate-format_args_nl.rs
rename to src/test/ui/feature-gates/feature-gate-format_args_nl.rs
diff --git a/src/test/ui/feature-gate-format_args_nl.stderr b/src/test/ui/feature-gates/feature-gate-format_args_nl.stderr
similarity index 100%
rename from src/test/ui/feature-gate-format_args_nl.stderr
rename to src/test/ui/feature-gates/feature-gate-format_args_nl.stderr
diff --git a/src/test/ui/feature-gate-fundamental.rs b/src/test/ui/feature-gates/feature-gate-fundamental.rs
similarity index 100%
rename from src/test/ui/feature-gate-fundamental.rs
rename to src/test/ui/feature-gates/feature-gate-fundamental.rs
diff --git a/src/test/ui/feature-gate-fundamental.stderr b/src/test/ui/feature-gates/feature-gate-fundamental.stderr
similarity index 100%
rename from src/test/ui/feature-gate-fundamental.stderr
rename to src/test/ui/feature-gates/feature-gate-fundamental.stderr
diff --git a/src/test/ui/feature-gate-generators.rs b/src/test/ui/feature-gates/feature-gate-generators.rs
similarity index 100%
rename from src/test/ui/feature-gate-generators.rs
rename to src/test/ui/feature-gates/feature-gate-generators.rs
diff --git a/src/test/ui/feature-gate-generators.stderr b/src/test/ui/feature-gates/feature-gate-generators.stderr
similarity index 100%
rename from src/test/ui/feature-gate-generators.stderr
rename to src/test/ui/feature-gates/feature-gate-generators.stderr
diff --git a/src/test/ui/feature-gate-generic_associated_types.rs b/src/test/ui/feature-gates/feature-gate-generic_associated_types.rs
similarity index 100%
rename from src/test/ui/feature-gate-generic_associated_types.rs
rename to src/test/ui/feature-gates/feature-gate-generic_associated_types.rs
diff --git a/src/test/ui/feature-gate-generic_associated_types.stderr b/src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr
similarity index 100%
rename from src/test/ui/feature-gate-generic_associated_types.stderr
rename to src/test/ui/feature-gates/feature-gate-generic_associated_types.stderr
diff --git a/src/test/ui/feature-gate-global_asm.rs b/src/test/ui/feature-gates/feature-gate-global_asm.rs
similarity index 100%
rename from src/test/ui/feature-gate-global_asm.rs
rename to src/test/ui/feature-gates/feature-gate-global_asm.rs
diff --git a/src/test/ui/feature-gate-global_asm.stderr b/src/test/ui/feature-gates/feature-gate-global_asm.stderr
similarity index 100%
rename from src/test/ui/feature-gate-global_asm.stderr
rename to src/test/ui/feature-gates/feature-gate-global_asm.stderr
diff --git a/src/test/ui/feature-gate-if_while_or_patterns.rs b/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.rs
similarity index 100%
rename from src/test/ui/feature-gate-if_while_or_patterns.rs
rename to src/test/ui/feature-gates/feature-gate-if_while_or_patterns.rs
diff --git a/src/test/ui/feature-gate-if_while_or_patterns.stderr b/src/test/ui/feature-gates/feature-gate-if_while_or_patterns.stderr
similarity index 100%
rename from src/test/ui/feature-gate-if_while_or_patterns.stderr
rename to src/test/ui/feature-gates/feature-gate-if_while_or_patterns.stderr
diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.rs b/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.rs
similarity index 100%
rename from src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.rs
rename to src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.rs
diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.stderr b/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.stderr
similarity index 100%
rename from src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.stderr
rename to src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision-with-in_band.stderr
diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision.rs b/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.rs
similarity index 100%
rename from src/test/ui/feature-gate-impl_header_lifetime_elision.rs
rename to src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.rs
diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision.stderr b/src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.stderr
similarity index 100%
rename from src/test/ui/feature-gate-impl_header_lifetime_elision.stderr
rename to src/test/ui/feature-gates/feature-gate-impl_header_lifetime_elision.stderr
diff --git a/src/test/ui/feature-gate-in_band_lifetimes.rs b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs
similarity index 100%
rename from src/test/ui/feature-gate-in_band_lifetimes.rs
rename to src/test/ui/feature-gates/feature-gate-in_band_lifetimes.rs
diff --git a/src/test/ui/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr
similarity index 100%
rename from src/test/ui/feature-gate-in_band_lifetimes.stderr
rename to src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr
diff --git a/src/test/ui/feature-gate-infer_outlives_requirements.rs b/src/test/ui/feature-gates/feature-gate-infer_outlives_requirements.rs
similarity index 100%
rename from src/test/ui/feature-gate-infer_outlives_requirements.rs
rename to src/test/ui/feature-gates/feature-gate-infer_outlives_requirements.rs
diff --git a/src/test/ui/feature-gate-infer_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_outlives_requirements.stderr
similarity index 100%
rename from src/test/ui/feature-gate-infer_outlives_requirements.stderr
rename to src/test/ui/feature-gates/feature-gate-infer_outlives_requirements.stderr
diff --git a/src/test/ui/feature-gate-infer_static_outlives_requirements.rs b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.rs
similarity index 100%
rename from src/test/ui/feature-gate-infer_static_outlives_requirements.rs
rename to src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.rs
diff --git a/src/test/ui/feature-gate-infer_static_outlives_requirements.stderr b/src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr
similarity index 100%
rename from src/test/ui/feature-gate-infer_static_outlives_requirements.stderr
rename to src/test/ui/feature-gates/feature-gate-infer_static_outlives_requirements.stderr
diff --git a/src/test/ui/feature-gate-intrinsics.rs b/src/test/ui/feature-gates/feature-gate-intrinsics.rs
similarity index 100%
rename from src/test/ui/feature-gate-intrinsics.rs
rename to src/test/ui/feature-gates/feature-gate-intrinsics.rs
diff --git a/src/test/ui/feature-gate-intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-intrinsics.stderr
similarity index 100%
rename from src/test/ui/feature-gate-intrinsics.stderr
rename to src/test/ui/feature-gates/feature-gate-intrinsics.stderr
diff --git a/src/test/ui/feature-gate-label_break_value.rs b/src/test/ui/feature-gates/feature-gate-label_break_value.rs
similarity index 100%
rename from src/test/ui/feature-gate-label_break_value.rs
rename to src/test/ui/feature-gates/feature-gate-label_break_value.rs
diff --git a/src/test/ui/feature-gate-label_break_value.stderr b/src/test/ui/feature-gates/feature-gate-label_break_value.stderr
similarity index 100%
rename from src/test/ui/feature-gate-label_break_value.stderr
rename to src/test/ui/feature-gates/feature-gate-label_break_value.stderr
diff --git a/src/test/ui/feature-gate-lang-items.rs b/src/test/ui/feature-gates/feature-gate-lang-items.rs
similarity index 100%
rename from src/test/ui/feature-gate-lang-items.rs
rename to src/test/ui/feature-gates/feature-gate-lang-items.rs
diff --git a/src/test/ui/feature-gate-lang-items.stderr b/src/test/ui/feature-gates/feature-gate-lang-items.stderr
similarity index 100%
rename from src/test/ui/feature-gate-lang-items.stderr
rename to src/test/ui/feature-gates/feature-gate-lang-items.stderr
diff --git a/src/test/ui/feature-gate-link_args.rs b/src/test/ui/feature-gates/feature-gate-link_args.rs
similarity index 100%
rename from src/test/ui/feature-gate-link_args.rs
rename to src/test/ui/feature-gates/feature-gate-link_args.rs
diff --git a/src/test/ui/feature-gate-link_args.stderr b/src/test/ui/feature-gates/feature-gate-link_args.stderr
similarity index 100%
rename from src/test/ui/feature-gate-link_args.stderr
rename to src/test/ui/feature-gates/feature-gate-link_args.stderr
diff --git a/src/test/ui/feature-gate-link_cfg.rs b/src/test/ui/feature-gates/feature-gate-link_cfg.rs
similarity index 100%
rename from src/test/ui/feature-gate-link_cfg.rs
rename to src/test/ui/feature-gates/feature-gate-link_cfg.rs
diff --git a/src/test/ui/feature-gate-link_cfg.stderr b/src/test/ui/feature-gates/feature-gate-link_cfg.stderr
similarity index 100%
rename from src/test/ui/feature-gate-link_cfg.stderr
rename to src/test/ui/feature-gates/feature-gate-link_cfg.stderr
diff --git a/src/test/ui/feature-gate-link_llvm_intrinsics.rs b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs
similarity index 100%
rename from src/test/ui/feature-gate-link_llvm_intrinsics.rs
rename to src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.rs
diff --git a/src/test/ui/feature-gate-link_llvm_intrinsics.stderr b/src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.stderr
similarity index 100%
rename from src/test/ui/feature-gate-link_llvm_intrinsics.stderr
rename to src/test/ui/feature-gates/feature-gate-link_llvm_intrinsics.stderr
diff --git a/src/test/ui/feature-gate-linkage.rs b/src/test/ui/feature-gates/feature-gate-linkage.rs
similarity index 100%
rename from src/test/ui/feature-gate-linkage.rs
rename to src/test/ui/feature-gates/feature-gate-linkage.rs
diff --git a/src/test/ui/feature-gate-linkage.stderr b/src/test/ui/feature-gates/feature-gate-linkage.stderr
similarity index 100%
rename from src/test/ui/feature-gate-linkage.stderr
rename to src/test/ui/feature-gates/feature-gate-linkage.stderr
diff --git a/src/test/ui/feature-gate-linker-flavor.rs b/src/test/ui/feature-gates/feature-gate-linker-flavor.rs
similarity index 100%
rename from src/test/ui/feature-gate-linker-flavor.rs
rename to src/test/ui/feature-gates/feature-gate-linker-flavor.rs
diff --git a/src/test/ui/feature-gate-linker-flavor.stderr b/src/test/ui/feature-gates/feature-gate-linker-flavor.stderr
similarity index 100%
rename from src/test/ui/feature-gate-linker-flavor.stderr
rename to src/test/ui/feature-gates/feature-gate-linker-flavor.stderr
diff --git a/src/test/ui/feature-gate-log_syntax.rs b/src/test/ui/feature-gates/feature-gate-log_syntax.rs
similarity index 100%
rename from src/test/ui/feature-gate-log_syntax.rs
rename to src/test/ui/feature-gates/feature-gate-log_syntax.rs
diff --git a/src/test/ui/feature-gate-log_syntax.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax.stderr
similarity index 100%
rename from src/test/ui/feature-gate-log_syntax.stderr
rename to src/test/ui/feature-gates/feature-gate-log_syntax.stderr
diff --git a/src/test/ui/feature-gate-log_syntax2.rs b/src/test/ui/feature-gates/feature-gate-log_syntax2.rs
similarity index 100%
rename from src/test/ui/feature-gate-log_syntax2.rs
rename to src/test/ui/feature-gates/feature-gate-log_syntax2.rs
diff --git a/src/test/ui/feature-gate-log_syntax2.stderr b/src/test/ui/feature-gates/feature-gate-log_syntax2.stderr
similarity index 100%
rename from src/test/ui/feature-gate-log_syntax2.stderr
rename to src/test/ui/feature-gates/feature-gate-log_syntax2.stderr
diff --git a/src/test/ui/feature-gate-macro-literal-matcher.rs b/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.rs
similarity index 100%
rename from src/test/ui/feature-gate-macro-literal-matcher.rs
rename to src/test/ui/feature-gates/feature-gate-macro-literal-matcher.rs
diff --git a/src/test/ui/feature-gate-macro-literal-matcher.stderr b/src/test/ui/feature-gates/feature-gate-macro-literal-matcher.stderr
similarity index 100%
rename from src/test/ui/feature-gate-macro-literal-matcher.stderr
rename to src/test/ui/feature-gates/feature-gate-macro-literal-matcher.stderr
diff --git a/src/test/ui/feature-gate-macro-vis-matcher.rs b/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.rs
similarity index 100%
rename from src/test/ui/feature-gate-macro-vis-matcher.rs
rename to src/test/ui/feature-gates/feature-gate-macro-vis-matcher.rs
diff --git a/src/test/ui/feature-gate-macro-vis-matcher.stderr b/src/test/ui/feature-gates/feature-gate-macro-vis-matcher.stderr
similarity index 100%
rename from src/test/ui/feature-gate-macro-vis-matcher.stderr
rename to src/test/ui/feature-gates/feature-gate-macro-vis-matcher.stderr
diff --git a/src/test/ui/feature-gate-macros_in_extern.rs b/src/test/ui/feature-gates/feature-gate-macros_in_extern.rs
similarity index 100%
rename from src/test/ui/feature-gate-macros_in_extern.rs
rename to src/test/ui/feature-gates/feature-gate-macros_in_extern.rs
diff --git a/src/test/ui/feature-gate-macros_in_extern.stderr b/src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr
similarity index 100%
rename from src/test/ui/feature-gate-macros_in_extern.stderr
rename to src/test/ui/feature-gates/feature-gate-macros_in_extern.stderr
diff --git a/src/test/ui/feature-gate-main.rs b/src/test/ui/feature-gates/feature-gate-main.rs
similarity index 100%
rename from src/test/ui/feature-gate-main.rs
rename to src/test/ui/feature-gates/feature-gate-main.rs
diff --git a/src/test/ui/feature-gate-main.stderr b/src/test/ui/feature-gates/feature-gate-main.stderr
similarity index 100%
rename from src/test/ui/feature-gate-main.stderr
rename to src/test/ui/feature-gates/feature-gate-main.stderr
diff --git a/src/test/ui/feature-gate-may-dangle.rs b/src/test/ui/feature-gates/feature-gate-may-dangle.rs
similarity index 100%
rename from src/test/ui/feature-gate-may-dangle.rs
rename to src/test/ui/feature-gates/feature-gate-may-dangle.rs
diff --git a/src/test/ui/feature-gate-may-dangle.stderr b/src/test/ui/feature-gates/feature-gate-may-dangle.stderr
similarity index 100%
rename from src/test/ui/feature-gate-may-dangle.stderr
rename to src/test/ui/feature-gates/feature-gate-may-dangle.stderr
diff --git a/src/test/ui/feature-gate-naked_functions.rs b/src/test/ui/feature-gates/feature-gate-naked_functions.rs
similarity index 100%
rename from src/test/ui/feature-gate-naked_functions.rs
rename to src/test/ui/feature-gates/feature-gate-naked_functions.rs
diff --git a/src/test/ui/feature-gate-naked_functions.stderr b/src/test/ui/feature-gates/feature-gate-naked_functions.stderr
similarity index 100%
rename from src/test/ui/feature-gate-naked_functions.stderr
rename to src/test/ui/feature-gates/feature-gate-naked_functions.stderr
diff --git a/src/test/ui/feature-gate-needs-allocator.rs b/src/test/ui/feature-gates/feature-gate-needs-allocator.rs
similarity index 100%
rename from src/test/ui/feature-gate-needs-allocator.rs
rename to src/test/ui/feature-gates/feature-gate-needs-allocator.rs
diff --git a/src/test/ui/feature-gate-needs-allocator.stderr b/src/test/ui/feature-gates/feature-gate-needs-allocator.stderr
similarity index 100%
rename from src/test/ui/feature-gate-needs-allocator.stderr
rename to src/test/ui/feature-gates/feature-gate-needs-allocator.stderr
diff --git a/src/test/ui/feature-gate-negate-unsigned.rs b/src/test/ui/feature-gates/feature-gate-negate-unsigned.rs
similarity index 100%
rename from src/test/ui/feature-gate-negate-unsigned.rs
rename to src/test/ui/feature-gates/feature-gate-negate-unsigned.rs
diff --git a/src/test/ui/feature-gate-negate-unsigned.stderr b/src/test/ui/feature-gates/feature-gate-negate-unsigned.stderr
similarity index 100%
rename from src/test/ui/feature-gate-negate-unsigned.stderr
rename to src/test/ui/feature-gates/feature-gate-negate-unsigned.stderr
diff --git a/src/test/ui/feature-gate-never_type.rs b/src/test/ui/feature-gates/feature-gate-never_type.rs
similarity index 100%
rename from src/test/ui/feature-gate-never_type.rs
rename to src/test/ui/feature-gates/feature-gate-never_type.rs
diff --git a/src/test/ui/feature-gate-never_type.stderr b/src/test/ui/feature-gates/feature-gate-never_type.stderr
similarity index 100%
rename from src/test/ui/feature-gate-never_type.stderr
rename to src/test/ui/feature-gates/feature-gate-never_type.stderr
diff --git a/src/test/ui/feature-gate-nll.nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.nll.stderr
similarity index 100%
rename from src/test/ui/feature-gate-nll.nll.stderr
rename to src/test/ui/feature-gates/feature-gate-nll.nll.stderr
diff --git a/src/test/ui/feature-gate-nll.rs b/src/test/ui/feature-gates/feature-gate-nll.rs
similarity index 100%
rename from src/test/ui/feature-gate-nll.rs
rename to src/test/ui/feature-gates/feature-gate-nll.rs
diff --git a/src/test/ui/feature-gate-nll.stderr b/src/test/ui/feature-gates/feature-gate-nll.stderr
similarity index 100%
rename from src/test/ui/feature-gate-nll.stderr
rename to src/test/ui/feature-gates/feature-gate-nll.stderr
diff --git a/src/test/ui/feature-gate-no-debug-2.rs b/src/test/ui/feature-gates/feature-gate-no-debug-2.rs
similarity index 100%
rename from src/test/ui/feature-gate-no-debug-2.rs
rename to src/test/ui/feature-gates/feature-gate-no-debug-2.rs
diff --git a/src/test/ui/feature-gate-no-debug-2.stderr b/src/test/ui/feature-gates/feature-gate-no-debug-2.stderr
similarity index 100%
rename from src/test/ui/feature-gate-no-debug-2.stderr
rename to src/test/ui/feature-gates/feature-gate-no-debug-2.stderr
diff --git a/src/test/ui/feature-gate-no-debug.rs b/src/test/ui/feature-gates/feature-gate-no-debug.rs
similarity index 100%
rename from src/test/ui/feature-gate-no-debug.rs
rename to src/test/ui/feature-gates/feature-gate-no-debug.rs
diff --git a/src/test/ui/feature-gate-no-debug.stderr b/src/test/ui/feature-gates/feature-gate-no-debug.stderr
similarity index 100%
rename from src/test/ui/feature-gate-no-debug.stderr
rename to src/test/ui/feature-gates/feature-gate-no-debug.stderr
diff --git a/src/test/ui/feature-gate-no_core.rs b/src/test/ui/feature-gates/feature-gate-no_core.rs
similarity index 100%
rename from src/test/ui/feature-gate-no_core.rs
rename to src/test/ui/feature-gates/feature-gate-no_core.rs
diff --git a/src/test/ui/feature-gate-no_core.stderr b/src/test/ui/feature-gates/feature-gate-no_core.stderr
similarity index 100%
rename from src/test/ui/feature-gate-no_core.stderr
rename to src/test/ui/feature-gates/feature-gate-no_core.stderr
diff --git a/src/test/ui/feature-gate-non_ascii_idents.rs b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs
similarity index 100%
rename from src/test/ui/feature-gate-non_ascii_idents.rs
rename to src/test/ui/feature-gates/feature-gate-non_ascii_idents.rs
diff --git a/src/test/ui/feature-gate-non_ascii_idents.stderr b/src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr
similarity index 100%
rename from src/test/ui/feature-gate-non_ascii_idents.stderr
rename to src/test/ui/feature-gates/feature-gate-non_ascii_idents.stderr
diff --git a/src/test/ui/feature-gate-non_exhaustive.rs b/src/test/ui/feature-gates/feature-gate-non_exhaustive.rs
similarity index 100%
rename from src/test/ui/feature-gate-non_exhaustive.rs
rename to src/test/ui/feature-gates/feature-gate-non_exhaustive.rs
diff --git a/src/test/ui/feature-gate-non_exhaustive.stderr b/src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr
similarity index 100%
rename from src/test/ui/feature-gate-non_exhaustive.stderr
rename to src/test/ui/feature-gates/feature-gate-non_exhaustive.stderr
diff --git a/src/test/ui/feature-gate-omit-gdb-pretty-printer-section.rs b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs
similarity index 100%
rename from src/test/ui/feature-gate-omit-gdb-pretty-printer-section.rs
rename to src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.rs
diff --git a/src/test/ui/feature-gate-omit-gdb-pretty-printer-section.stderr b/src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr
similarity index 100%
rename from src/test/ui/feature-gate-omit-gdb-pretty-printer-section.stderr
rename to src/test/ui/feature-gates/feature-gate-omit-gdb-pretty-printer-section.stderr
diff --git a/src/test/ui/feature-gate-on-unimplemented.rs b/src/test/ui/feature-gates/feature-gate-on-unimplemented.rs
similarity index 100%
rename from src/test/ui/feature-gate-on-unimplemented.rs
rename to src/test/ui/feature-gates/feature-gate-on-unimplemented.rs
diff --git a/src/test/ui/feature-gate-on-unimplemented.stderr b/src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr
similarity index 100%
rename from src/test/ui/feature-gate-on-unimplemented.stderr
rename to src/test/ui/feature-gates/feature-gate-on-unimplemented.stderr
diff --git a/src/test/ui/feature-gate-optin-builtin-traits.rs b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs
similarity index 100%
rename from src/test/ui/feature-gate-optin-builtin-traits.rs
rename to src/test/ui/feature-gates/feature-gate-optin-builtin-traits.rs
diff --git a/src/test/ui/feature-gate-optin-builtin-traits.stderr b/src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr
similarity index 100%
rename from src/test/ui/feature-gate-optin-builtin-traits.stderr
rename to src/test/ui/feature-gates/feature-gate-optin-builtin-traits.stderr
diff --git a/src/test/ui/feature-gate-overlapping_marker_traits.rs b/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.rs
similarity index 100%
rename from src/test/ui/feature-gate-overlapping_marker_traits.rs
rename to src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.rs
diff --git a/src/test/ui/feature-gate-overlapping_marker_traits.stderr b/src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.stderr
similarity index 100%
rename from src/test/ui/feature-gate-overlapping_marker_traits.stderr
rename to src/test/ui/feature-gates/feature-gate-overlapping_marker_traits.stderr
diff --git a/src/test/compile-fail/feature-gate-panic-implementation.rs b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs
similarity index 100%
rename from src/test/compile-fail/feature-gate-panic-implementation.rs
rename to src/test/ui/feature-gates/feature-gate-panic-implementation.rs
diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr
new file mode 100644
index 0000000..f99228b
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr
@@ -0,0 +1,11 @@
+error[E0658]: #[panic_implementation] is an unstable feature (see issue #44489)
+ --> $DIR/feature-gate-panic-implementation.rs:18:1
+ |
+LL | #[panic_implementation] //~ ERROR #[panic_implementation] is an unstable feature (see issue #44489)
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(panic_implementation)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-pattern_parentheses.rs b/src/test/ui/feature-gates/feature-gate-pattern_parentheses.rs
similarity index 100%
rename from src/test/ui/feature-gate-pattern_parentheses.rs
rename to src/test/ui/feature-gates/feature-gate-pattern_parentheses.rs
diff --git a/src/test/ui/feature-gate-pattern_parentheses.stderr b/src/test/ui/feature-gates/feature-gate-pattern_parentheses.stderr
similarity index 100%
rename from src/test/ui/feature-gate-pattern_parentheses.stderr
rename to src/test/ui/feature-gates/feature-gate-pattern_parentheses.stderr
diff --git a/src/test/ui/feature-gate-plugin.rs b/src/test/ui/feature-gates/feature-gate-plugin.rs
similarity index 100%
rename from src/test/ui/feature-gate-plugin.rs
rename to src/test/ui/feature-gates/feature-gate-plugin.rs
diff --git a/src/test/ui/feature-gate-plugin.stderr b/src/test/ui/feature-gates/feature-gate-plugin.stderr
similarity index 100%
rename from src/test/ui/feature-gate-plugin.stderr
rename to src/test/ui/feature-gates/feature-gate-plugin.stderr
diff --git a/src/test/ui/feature-gate-plugin_registrar.rs b/src/test/ui/feature-gates/feature-gate-plugin_registrar.rs
similarity index 100%
rename from src/test/ui/feature-gate-plugin_registrar.rs
rename to src/test/ui/feature-gates/feature-gate-plugin_registrar.rs
diff --git a/src/test/ui/feature-gate-plugin_registrar.stderr b/src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr
similarity index 100%
rename from src/test/ui/feature-gate-plugin_registrar.stderr
rename to src/test/ui/feature-gates/feature-gate-plugin_registrar.stderr
diff --git a/src/test/ui/feature-gate-prelude_import.rs b/src/test/ui/feature-gates/feature-gate-prelude_import.rs
similarity index 100%
rename from src/test/ui/feature-gate-prelude_import.rs
rename to src/test/ui/feature-gates/feature-gate-prelude_import.rs
diff --git a/src/test/ui/feature-gate-prelude_import.stderr b/src/test/ui/feature-gates/feature-gate-prelude_import.stderr
similarity index 100%
rename from src/test/ui/feature-gate-prelude_import.stderr
rename to src/test/ui/feature-gates/feature-gate-prelude_import.stderr
diff --git a/src/test/ui/feature-gate-profiler-runtime.rs b/src/test/ui/feature-gates/feature-gate-profiler-runtime.rs
similarity index 100%
rename from src/test/ui/feature-gate-profiler-runtime.rs
rename to src/test/ui/feature-gates/feature-gate-profiler-runtime.rs
diff --git a/src/test/ui/feature-gate-profiler-runtime.stderr b/src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr
similarity index 100%
rename from src/test/ui/feature-gate-profiler-runtime.stderr
rename to src/test/ui/feature-gates/feature-gate-profiler-runtime.stderr
diff --git a/src/test/ui/feature-gate-raw-identifiers.rs b/src/test/ui/feature-gates/feature-gate-raw-identifiers.rs
similarity index 100%
rename from src/test/ui/feature-gate-raw-identifiers.rs
rename to src/test/ui/feature-gates/feature-gate-raw-identifiers.rs
diff --git a/src/test/ui/feature-gate-raw-identifiers.stderr b/src/test/ui/feature-gates/feature-gate-raw-identifiers.stderr
similarity index 100%
rename from src/test/ui/feature-gate-raw-identifiers.stderr
rename to src/test/ui/feature-gates/feature-gate-raw-identifiers.stderr
diff --git a/src/test/ui/feature-gate-repr-simd.rs b/src/test/ui/feature-gates/feature-gate-repr-simd.rs
similarity index 100%
rename from src/test/ui/feature-gate-repr-simd.rs
rename to src/test/ui/feature-gates/feature-gate-repr-simd.rs
diff --git a/src/test/ui/feature-gate-repr-simd.stderr b/src/test/ui/feature-gates/feature-gate-repr-simd.stderr
similarity index 100%
rename from src/test/ui/feature-gate-repr-simd.stderr
rename to src/test/ui/feature-gates/feature-gate-repr-simd.stderr
diff --git a/src/test/ui/feature-gate-repr128.rs b/src/test/ui/feature-gates/feature-gate-repr128.rs
similarity index 100%
rename from src/test/ui/feature-gate-repr128.rs
rename to src/test/ui/feature-gates/feature-gate-repr128.rs
diff --git a/src/test/ui/feature-gate-repr128.stderr b/src/test/ui/feature-gates/feature-gate-repr128.stderr
similarity index 100%
rename from src/test/ui/feature-gate-repr128.stderr
rename to src/test/ui/feature-gates/feature-gate-repr128.stderr
diff --git a/src/test/ui/feature-gate-repr_packed.rs b/src/test/ui/feature-gates/feature-gate-repr_packed.rs
similarity index 100%
rename from src/test/ui/feature-gate-repr_packed.rs
rename to src/test/ui/feature-gates/feature-gate-repr_packed.rs
diff --git a/src/test/ui/feature-gate-repr_packed.stderr b/src/test/ui/feature-gates/feature-gate-repr_packed.stderr
similarity index 100%
rename from src/test/ui/feature-gate-repr_packed.stderr
rename to src/test/ui/feature-gates/feature-gate-repr_packed.stderr
diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
new file mode 100644
index 0000000..99bc51b
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-tidy-linelength
+
+// Test that `#[rustc_*]` attributes are gated by `rustc_attrs` feature gate.
+
+#[rustc_foo]
+//~^ ERROR unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr
new file mode 100644
index 0000000..52a4d36
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr
@@ -0,0 +1,11 @@
+error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
+ --> $DIR/feature-gate-rustc-attrs.rs:15:1
+ |
+LL | #[rustc_foo]
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-rustc-diagnostic-macros.rs b/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.rs
similarity index 100%
rename from src/test/ui/feature-gate-rustc-diagnostic-macros.rs
rename to src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.rs
diff --git a/src/test/ui/feature-gate-rustc-diagnostic-macros.stderr b/src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.stderr
similarity index 100%
rename from src/test/ui/feature-gate-rustc-diagnostic-macros.stderr
rename to src/test/ui/feature-gates/feature-gate-rustc-diagnostic-macros.stderr
diff --git a/src/test/ui/feature-gate-rustc_const_unstable.rs b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs
similarity index 100%
rename from src/test/ui/feature-gate-rustc_const_unstable.rs
rename to src/test/ui/feature-gates/feature-gate-rustc_const_unstable.rs
diff --git a/src/test/ui/feature-gate-rustc_const_unstable.stderr b/src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr
similarity index 100%
rename from src/test/ui/feature-gate-rustc_const_unstable.stderr
rename to src/test/ui/feature-gates/feature-gate-rustc_const_unstable.stderr
diff --git a/src/test/ui/feature-gate-sanitizer-runtime.rs b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.rs
similarity index 100%
rename from src/test/ui/feature-gate-sanitizer-runtime.rs
rename to src/test/ui/feature-gates/feature-gate-sanitizer-runtime.rs
diff --git a/src/test/ui/feature-gate-sanitizer-runtime.stderr b/src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr
similarity index 100%
rename from src/test/ui/feature-gate-sanitizer-runtime.stderr
rename to src/test/ui/feature-gates/feature-gate-sanitizer-runtime.stderr
diff --git a/src/test/ui/feature-gates/feature-gate-self-in-typedefs.rs b/src/test/ui/feature-gates/feature-gate-self-in-typedefs.rs
new file mode 100644
index 0000000..4b476a0
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-self-in-typedefs.rs
@@ -0,0 +1,18 @@
+// 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.
+
+enum StackList<'a, T: 'a> {
+ Nil,
+ Cons(T, &'a Self)
+ //~^ ERROR cannot find type `Self` in this scope
+ //~| `Self` is only available in traits and impls
+}
+
+fn main() {}
diff --git a/src/test/ui/feature-gates/feature-gate-self-in-typedefs.stderr b/src/test/ui/feature-gates/feature-gate-self-in-typedefs.stderr
new file mode 100644
index 0000000..c3f9abd
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-self-in-typedefs.stderr
@@ -0,0 +1,9 @@
+error[E0411]: cannot find type `Self` in this scope
+ --> $DIR/feature-gate-self-in-typedefs.rs:13:17
+ |
+LL | Cons(T, &'a Self)
+ | ^^^^ `Self` is only available in traits and impls
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0411`.
diff --git a/src/test/ui/feature-gate-simd-ffi.rs b/src/test/ui/feature-gates/feature-gate-simd-ffi.rs
similarity index 100%
rename from src/test/ui/feature-gate-simd-ffi.rs
rename to src/test/ui/feature-gates/feature-gate-simd-ffi.rs
diff --git a/src/test/ui/feature-gate-simd-ffi.stderr b/src/test/ui/feature-gates/feature-gate-simd-ffi.stderr
similarity index 100%
rename from src/test/ui/feature-gate-simd-ffi.stderr
rename to src/test/ui/feature-gates/feature-gate-simd-ffi.stderr
diff --git a/src/test/ui/feature-gate-simd.rs b/src/test/ui/feature-gates/feature-gate-simd.rs
similarity index 100%
rename from src/test/ui/feature-gate-simd.rs
rename to src/test/ui/feature-gates/feature-gate-simd.rs
diff --git a/src/test/ui/feature-gate-simd.stderr b/src/test/ui/feature-gates/feature-gate-simd.stderr
similarity index 100%
rename from src/test/ui/feature-gate-simd.stderr
rename to src/test/ui/feature-gates/feature-gate-simd.stderr
diff --git a/src/test/ui/feature-gate-slice-patterns.rs b/src/test/ui/feature-gates/feature-gate-slice-patterns.rs
similarity index 100%
rename from src/test/ui/feature-gate-slice-patterns.rs
rename to src/test/ui/feature-gates/feature-gate-slice-patterns.rs
diff --git a/src/test/ui/feature-gate-slice-patterns.stderr b/src/test/ui/feature-gates/feature-gate-slice-patterns.stderr
similarity index 100%
rename from src/test/ui/feature-gate-slice-patterns.stderr
rename to src/test/ui/feature-gates/feature-gate-slice-patterns.stderr
diff --git a/src/test/ui/feature-gate-staged_api.rs b/src/test/ui/feature-gates/feature-gate-staged_api.rs
similarity index 100%
rename from src/test/ui/feature-gate-staged_api.rs
rename to src/test/ui/feature-gates/feature-gate-staged_api.rs
diff --git a/src/test/ui/feature-gate-staged_api.stderr b/src/test/ui/feature-gates/feature-gate-staged_api.stderr
similarity index 100%
rename from src/test/ui/feature-gate-staged_api.stderr
rename to src/test/ui/feature-gates/feature-gate-staged_api.stderr
diff --git a/src/test/ui/feature-gate-start.rs b/src/test/ui/feature-gates/feature-gate-start.rs
similarity index 100%
rename from src/test/ui/feature-gate-start.rs
rename to src/test/ui/feature-gates/feature-gate-start.rs
diff --git a/src/test/ui/feature-gate-start.stderr b/src/test/ui/feature-gates/feature-gate-start.stderr
similarity index 100%
rename from src/test/ui/feature-gate-start.stderr
rename to src/test/ui/feature-gates/feature-gate-start.stderr
diff --git a/src/test/ui/feature-gate-static-nobundle.rs b/src/test/ui/feature-gates/feature-gate-static-nobundle.rs
similarity index 100%
rename from src/test/ui/feature-gate-static-nobundle.rs
rename to src/test/ui/feature-gates/feature-gate-static-nobundle.rs
diff --git a/src/test/ui/feature-gate-static-nobundle.stderr b/src/test/ui/feature-gates/feature-gate-static-nobundle.stderr
similarity index 100%
rename from src/test/ui/feature-gate-static-nobundle.stderr
rename to src/test/ui/feature-gates/feature-gate-static-nobundle.stderr
diff --git a/src/test/ui/feature-gate-stmt_expr_attributes.rs b/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.rs
similarity index 100%
rename from src/test/ui/feature-gate-stmt_expr_attributes.rs
rename to src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.rs
diff --git a/src/test/ui/feature-gate-stmt_expr_attributes.stderr b/src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr
similarity index 100%
rename from src/test/ui/feature-gate-stmt_expr_attributes.stderr
rename to src/test/ui/feature-gates/feature-gate-stmt_expr_attributes.stderr
diff --git a/src/test/ui/feature-gate-thread_local.rs b/src/test/ui/feature-gates/feature-gate-thread_local.rs
similarity index 100%
rename from src/test/ui/feature-gate-thread_local.rs
rename to src/test/ui/feature-gates/feature-gate-thread_local.rs
diff --git a/src/test/ui/feature-gate-thread_local.stderr b/src/test/ui/feature-gates/feature-gate-thread_local.stderr
similarity index 100%
rename from src/test/ui/feature-gate-thread_local.stderr
rename to src/test/ui/feature-gates/feature-gate-thread_local.stderr
diff --git a/src/test/ui/feature-gates/feature-gate-tool_attributes.rs b/src/test/ui/feature-gates/feature-gate-tool_attributes.rs
new file mode 100644
index 0000000..5aa1670
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-tool_attributes.rs
@@ -0,0 +1,15 @@
+// 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.
+
+fn main() {
+ #[rustfmt::skip] //~ ERROR tool attributes are unstable
+ let x = 3
+ ;
+}
diff --git a/src/test/ui/feature-gates/feature-gate-tool_attributes.stderr b/src/test/ui/feature-gates/feature-gate-tool_attributes.stderr
new file mode 100644
index 0000000..ca9542d
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-tool_attributes.stderr
@@ -0,0 +1,11 @@
+error[E0658]: tool attributes are unstable (see issue #44690)
+ --> $DIR/feature-gate-tool_attributes.rs:12:5
+ |
+LL | #[rustfmt::skip] //~ ERROR tool attributes are unstable
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(tool_attributes)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/feature-gate-tool_lints.rs b/src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs
similarity index 100%
rename from src/test/compile-fail/feature-gate-tool_lints.rs
rename to src/test/ui/feature-gates/feature-gate-tool_lints-fail.rs
diff --git a/src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr b/src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr
new file mode 100644
index 0000000..33ee79c
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-tool_lints-fail.stderr
@@ -0,0 +1,11 @@
+error[E0658]: scoped lint `clippy::assign_ops` is experimental (see issue #44690)
+ --> $DIR/feature-gate-tool_lints-fail.rs:11:8
+ |
+LL | #[warn(clippy::assign_ops)] //~ ERROR scoped lint `clippy::assign_ops` is experimental
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(tool_lints)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/feature-gate-tool_lints.rs b/src/test/ui/feature-gates/feature-gate-tool_lints.rs
similarity index 100%
rename from src/test/ui/feature-gate-tool_lints.rs
rename to src/test/ui/feature-gates/feature-gate-tool_lints.rs
diff --git a/src/test/ui/feature-gate-tool_lints.stderr b/src/test/ui/feature-gates/feature-gate-tool_lints.stderr
similarity index 100%
rename from src/test/ui/feature-gate-tool_lints.stderr
rename to src/test/ui/feature-gates/feature-gate-tool_lints.stderr
diff --git a/src/test/ui/feature-gate-trace_macros.rs b/src/test/ui/feature-gates/feature-gate-trace_macros.rs
similarity index 100%
rename from src/test/ui/feature-gate-trace_macros.rs
rename to src/test/ui/feature-gates/feature-gate-trace_macros.rs
diff --git a/src/test/ui/feature-gate-trace_macros.stderr b/src/test/ui/feature-gates/feature-gate-trace_macros.stderr
similarity index 100%
rename from src/test/ui/feature-gate-trace_macros.stderr
rename to src/test/ui/feature-gates/feature-gate-trace_macros.stderr
diff --git a/src/test/ui/feature-gate-trivial_bounds-lint.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds-lint.rs
similarity index 100%
rename from src/test/ui/feature-gate-trivial_bounds-lint.rs
rename to src/test/ui/feature-gates/feature-gate-trivial_bounds-lint.rs
diff --git a/src/test/ui/feature-gate-trivial_bounds.rs b/src/test/ui/feature-gates/feature-gate-trivial_bounds.rs
similarity index 100%
rename from src/test/ui/feature-gate-trivial_bounds.rs
rename to src/test/ui/feature-gates/feature-gate-trivial_bounds.rs
diff --git a/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr
new file mode 100644
index 0000000..f20c1eb
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-trivial_bounds.stderr
@@ -0,0 +1,130 @@
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:20:1
+ |
+LL | enum E where i32: Foo { V } //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:22:1
+ |
+LL | struct S where i32: Foo; //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:24:1
+ |
+LL | trait T where i32: Foo {} //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:26:1
+ |
+LL | union U where i32: Foo { f: i32 } //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:30:1
+ |
+LL | / impl Foo for () where i32: Foo { //~ ERROR
+LL | | fn test(&self) {
+LL | | 3i32.test();
+LL | | Foo::test(&4i32);
+LL | | generic_function(5i32);
+LL | | }
+LL | | }
+ | |_^ the trait `Foo` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:38:1
+ |
+LL | / fn f() where i32: Foo //~ ERROR
+LL | | {
+LL | | let s = S;
+LL | | 3i32.test();
+LL | | Foo::test(&4i32);
+LL | | generic_function(5i32);
+LL | | }
+ | |_^ the trait `Foo` is not implemented for `i32`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `std::string::String: std::ops::Neg` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:46:1
+ |
+LL | / fn use_op(s: String) -> String where String: ::std::ops::Neg<Output=String> { //~ ERROR
+LL | | -s
+LL | | }
+ | |_^ the trait `std::ops::Neg` is not implemented for `std::string::String`
+ |
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the trait bound `i32: std::iter::Iterator` is not satisfied
+ --> $DIR/feature-gate-trivial_bounds.rs:50:1
+ |
+LL | / fn use_for() where i32: Iterator { //~ ERROR
+LL | | for _ in 2i32 {}
+LL | | }
+ | |_^ `i32` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `i32`
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/feature-gate-trivial_bounds.rs:62:1
+ |
+LL | struct TwoStrs(str, str) where str: Sized; //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
+ --> $DIR/feature-gate-trivial_bounds.rs:65:1
+ |
+LL | / fn unsized_local() where Dst<A>: Sized { //~ ERROR
+LL | | let x: Dst<A> = *(Box::new(Dst { x: 1 }) as Box<Dst<A>>);
+LL | | }
+ | |_^ doesn't have a size known at compile-time
+ |
+ = help: within `Dst<(dyn A + 'static)>`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Dst<(dyn A + 'static)>`
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/feature-gate-trivial_bounds.rs:69:1
+ |
+LL | / fn return_str() -> str where str: Sized { //~ ERROR
+LL | | *"Sized".to_string().into_boxed_str()
+LL | | }
+ | |_^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: see issue #48214
+ = help: add #![feature(trivial_bounds)] to the crate attributes to enable
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/feature-gate-try_reserve.rs b/src/test/ui/feature-gates/feature-gate-try_reserve.rs
similarity index 100%
rename from src/test/ui/feature-gate-try_reserve.rs
rename to src/test/ui/feature-gates/feature-gate-try_reserve.rs
diff --git a/src/test/ui/feature-gate-try_reserve.stderr b/src/test/ui/feature-gates/feature-gate-try_reserve.stderr
similarity index 100%
rename from src/test/ui/feature-gate-try_reserve.stderr
rename to src/test/ui/feature-gates/feature-gate-try_reserve.stderr
diff --git a/src/test/ui/feature-gate-type_ascription.rs b/src/test/ui/feature-gates/feature-gate-type_ascription.rs
similarity index 100%
rename from src/test/ui/feature-gate-type_ascription.rs
rename to src/test/ui/feature-gates/feature-gate-type_ascription.rs
diff --git a/src/test/ui/feature-gate-type_ascription.stderr b/src/test/ui/feature-gates/feature-gate-type_ascription.stderr
similarity index 100%
rename from src/test/ui/feature-gate-type_ascription.stderr
rename to src/test/ui/feature-gates/feature-gate-type_ascription.stderr
diff --git a/src/test/ui/feature-gate-unboxed-closures-manual-impls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures-manual-impls.rs
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs
diff --git a/src/test/ui/feature-gate-unboxed-closures-manual-impls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures-manual-impls.stderr
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr
diff --git a/src/test/ui/feature-gate-unboxed-closures-method-calls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures-method-calls.rs
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.rs
diff --git a/src/test/ui/feature-gate-unboxed-closures-method-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures-method-calls.stderr
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures-method-calls.stderr
diff --git a/src/test/ui/feature-gate-unboxed-closures-ufcs-calls.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures-ufcs-calls.rs
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.rs
diff --git a/src/test/ui/feature-gate-unboxed-closures-ufcs-calls.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures-ufcs-calls.stderr
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures-ufcs-calls.stderr
diff --git a/src/test/ui/feature-gate-unboxed-closures.rs b/src/test/ui/feature-gates/feature-gate-unboxed-closures.rs
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures.rs
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures.rs
diff --git a/src/test/ui/feature-gate-unboxed-closures.stderr b/src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr
similarity index 100%
rename from src/test/ui/feature-gate-unboxed-closures.stderr
rename to src/test/ui/feature-gates/feature-gate-unboxed-closures.stderr
diff --git a/src/test/ui/feature-gate-underscore-imports.rs b/src/test/ui/feature-gates/feature-gate-underscore-imports.rs
similarity index 100%
rename from src/test/ui/feature-gate-underscore-imports.rs
rename to src/test/ui/feature-gates/feature-gate-underscore-imports.rs
diff --git a/src/test/ui/feature-gate-underscore-imports.stderr b/src/test/ui/feature-gates/feature-gate-underscore-imports.stderr
similarity index 100%
rename from src/test/ui/feature-gate-underscore-imports.stderr
rename to src/test/ui/feature-gates/feature-gate-underscore-imports.stderr
diff --git a/src/test/ui/feature-gate-unsized_tuple_coercion.rs b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs
similarity index 100%
rename from src/test/ui/feature-gate-unsized_tuple_coercion.rs
rename to src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.rs
diff --git a/src/test/ui/feature-gate-unsized_tuple_coercion.stderr b/src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr
similarity index 100%
rename from src/test/ui/feature-gate-unsized_tuple_coercion.stderr
rename to src/test/ui/feature-gates/feature-gate-unsized_tuple_coercion.stderr
diff --git a/src/test/ui/feature-gate-untagged_unions.rs b/src/test/ui/feature-gates/feature-gate-untagged_unions.rs
similarity index 100%
rename from src/test/ui/feature-gate-untagged_unions.rs
rename to src/test/ui/feature-gates/feature-gate-untagged_unions.rs
diff --git a/src/test/ui/feature-gate-untagged_unions.stderr b/src/test/ui/feature-gates/feature-gate-untagged_unions.stderr
similarity index 100%
rename from src/test/ui/feature-gate-untagged_unions.stderr
rename to src/test/ui/feature-gates/feature-gate-untagged_unions.stderr
diff --git a/src/test/ui/feature-gate-unwind-attributes.rs b/src/test/ui/feature-gates/feature-gate-unwind-attributes.rs
similarity index 100%
rename from src/test/ui/feature-gate-unwind-attributes.rs
rename to src/test/ui/feature-gates/feature-gate-unwind-attributes.rs
diff --git a/src/test/ui/feature-gate-unwind-attributes.stderr b/src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr
similarity index 100%
rename from src/test/ui/feature-gate-unwind-attributes.stderr
rename to src/test/ui/feature-gates/feature-gate-unwind-attributes.stderr
diff --git a/src/test/ui/feature-gate-used.rs b/src/test/ui/feature-gates/feature-gate-used.rs
similarity index 100%
rename from src/test/ui/feature-gate-used.rs
rename to src/test/ui/feature-gates/feature-gate-used.rs
diff --git a/src/test/ui/feature-gate-used.stderr b/src/test/ui/feature-gates/feature-gate-used.stderr
similarity index 100%
rename from src/test/ui/feature-gate-used.stderr
rename to src/test/ui/feature-gates/feature-gate-used.stderr
diff --git a/src/test/compile-fail/feature-gate-without_gate_irrefutable_pattern.rs b/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.rs
similarity index 100%
rename from src/test/compile-fail/feature-gate-without_gate_irrefutable_pattern.rs
rename to src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.rs
diff --git a/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr b/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr
new file mode 100644
index 0000000..2b23962
--- /dev/null
+++ b/src/test/ui/feature-gates/feature-gate-without_gate_irrefutable_pattern.stderr
@@ -0,0 +1,9 @@
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/feature-gate-without_gate_irrefutable_pattern.rs:15:12
+ |
+LL | if let _ = 5 {}
+ | ^ irrefutable pattern
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0162`.
diff --git a/src/test/compile-fail/float-literal-inference-restrictions.rs b/src/test/ui/float-literal-inference-restrictions.rs
similarity index 100%
rename from src/test/compile-fail/float-literal-inference-restrictions.rs
rename to src/test/ui/float-literal-inference-restrictions.rs
diff --git a/src/test/ui/float-literal-inference-restrictions.stderr b/src/test/ui/float-literal-inference-restrictions.stderr
new file mode 100644
index 0000000..da8f6ed
--- /dev/null
+++ b/src/test/ui/float-literal-inference-restrictions.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/float-literal-inference-restrictions.rs:12:18
+ |
+LL | let x: f32 = 1; //~ ERROR mismatched types
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `1.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/float-literal-inference-restrictions.rs:13:18
+ |
+LL | let y: f32 = 1f64; //~ ERROR mismatched types
+ | ^^^^ expected f32, found f64
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/fn-bad-block-type.rs b/src/test/ui/fn/fn-bad-block-type.rs
similarity index 100%
rename from src/test/compile-fail/fn-bad-block-type.rs
rename to src/test/ui/fn/fn-bad-block-type.rs
diff --git a/src/test/ui/fn/fn-bad-block-type.stderr b/src/test/ui/fn/fn-bad-block-type.stderr
new file mode 100644
index 0000000..23d76e5
--- /dev/null
+++ b/src/test/ui/fn/fn-bad-block-type.stderr
@@ -0,0 +1,11 @@
+error[E0308]: mismatched types
+ --> $DIR/fn-bad-block-type.rs:13:19
+ |
+LL | fn f() -> isize { true }
+ | ----- ^^^^ expected isize, found bool
+ | |
+ | expected `isize` because of return type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/fn-closure-mutable-capture.nll.stderr b/src/test/ui/fn/fn-closure-mutable-capture.nll.stderr
similarity index 100%
rename from src/test/ui/fn-closure-mutable-capture.nll.stderr
rename to src/test/ui/fn/fn-closure-mutable-capture.nll.stderr
diff --git a/src/test/ui/fn-closure-mutable-capture.rs b/src/test/ui/fn/fn-closure-mutable-capture.rs
similarity index 100%
rename from src/test/ui/fn-closure-mutable-capture.rs
rename to src/test/ui/fn/fn-closure-mutable-capture.rs
diff --git a/src/test/ui/fn-closure-mutable-capture.stderr b/src/test/ui/fn/fn-closure-mutable-capture.stderr
similarity index 100%
rename from src/test/ui/fn-closure-mutable-capture.stderr
rename to src/test/ui/fn/fn-closure-mutable-capture.stderr
diff --git a/src/test/compile-fail/fn-compare-mismatch.rs b/src/test/ui/fn/fn-compare-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/fn-compare-mismatch.rs
rename to src/test/ui/fn/fn-compare-mismatch.rs
diff --git a/src/test/ui/fn/fn-compare-mismatch.stderr b/src/test/ui/fn/fn-compare-mismatch.stderr
new file mode 100644
index 0000000..995a17e
--- /dev/null
+++ b/src/test/ui/fn/fn-compare-mismatch.stderr
@@ -0,0 +1,21 @@
+error[E0369]: binary operation `==` cannot be applied to type `fn() {main::f}`
+ --> $DIR/fn-compare-mismatch.rs:14:13
+ |
+LL | let x = f == g;
+ | ^^^^^^
+ |
+ = note: an implementation of `std::cmp::PartialEq` might be missing for `fn() {main::f}`
+
+error[E0308]: mismatched types
+ --> $DIR/fn-compare-mismatch.rs:14:18
+ |
+LL | let x = f == g;
+ | ^ expected fn item, found a different fn item
+ |
+ = note: expected type `fn() {main::f}`
+ found type `fn() {main::g}`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0308, E0369.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/fn-item-type.rs b/src/test/ui/fn/fn-item-type.rs
similarity index 100%
rename from src/test/compile-fail/fn-item-type.rs
rename to src/test/ui/fn/fn-item-type.rs
diff --git a/src/test/ui/fn/fn-item-type.stderr b/src/test/ui/fn/fn-item-type.stderr
new file mode 100644
index 0000000..59dd4b2
--- /dev/null
+++ b/src/test/ui/fn/fn-item-type.stderr
@@ -0,0 +1,39 @@
+error[E0308]: mismatched types
+ --> $DIR/fn-item-type.rs:23:19
+ |
+LL | eq(foo::<u8>, bar::<u8>);
+ | ^^^^^^^^^ expected fn item, found a different fn item
+ |
+ = note: expected type `fn(isize) -> isize {foo::<u8>}`
+ found type `fn(isize) -> isize {bar::<u8>}`
+
+error[E0308]: mismatched types
+ --> $DIR/fn-item-type.rs:29:19
+ |
+LL | eq(foo::<u8>, foo::<i8>);
+ | ^^^^^^^^^ expected u8, found i8
+ |
+ = note: expected type `fn(isize) -> isize {foo::<u8>}`
+ found type `fn(isize) -> isize {foo::<i8>}`
+
+error[E0308]: mismatched types
+ --> $DIR/fn-item-type.rs:33:23
+ |
+LL | eq(bar::<String>, bar::<Vec<u8>>);
+ | ^^^^^^^^^^^^^^ expected struct `std::string::String`, found struct `std::vec::Vec`
+ |
+ = note: expected type `fn(isize) -> isize {bar::<std::string::String>}`
+ found type `fn(isize) -> isize {bar::<std::vec::Vec<u8>>}`
+
+error[E0308]: mismatched types
+ --> $DIR/fn-item-type.rs:40:26
+ |
+LL | eq(<u8 as Foo>::foo, <u16 as Foo>::foo);
+ | ^^^^^^^^^^^^^^^^^ expected u8, found u16
+ |
+ = note: expected type `fn() {<u8 as Foo>::foo}`
+ found type `fn() {<u16 as Foo>::foo}`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/fn-trait-formatting.rs b/src/test/ui/fn/fn-trait-formatting.rs
similarity index 100%
rename from src/test/compile-fail/fn-trait-formatting.rs
rename to src/test/ui/fn/fn-trait-formatting.rs
diff --git a/src/test/ui/fn/fn-trait-formatting.stderr b/src/test/ui/fn/fn-trait-formatting.stderr
new file mode 100644
index 0000000..5bf1ed7
--- /dev/null
+++ b/src/test/ui/fn/fn-trait-formatting.stderr
@@ -0,0 +1,46 @@
+error[E0308]: mismatched types
+ --> $DIR/fn-trait-formatting.rs:16:17
+ |
+LL | let _: () = (box |_: isize| {}) as Box<FnOnce(isize)>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box`
+ |
+ = note: expected type `()`
+ found type `std::boxed::Box<dyn std::ops::FnOnce(isize)>`
+
+error[E0308]: mismatched types
+ --> $DIR/fn-trait-formatting.rs:20:17
+ |
+LL | let _: () = (box |_: isize, isize| {}) as Box<Fn(isize, isize)>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box`
+ |
+ = note: expected type `()`
+ found type `std::boxed::Box<dyn std::ops::Fn(isize, isize)>`
+
+error[E0308]: mismatched types
+ --> $DIR/fn-trait-formatting.rs:24:17
+ |
+LL | let _: () = (box || -> isize { unimplemented!() }) as Box<FnMut() -> isize>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found struct `std::boxed::Box`
+ |
+ = note: expected type `()`
+ found type `std::boxed::Box<dyn std::ops::FnMut() -> isize>`
+
+error[E0277]: the trait bound `{integer}: std::ops::Fn<(isize,)>` is not satisfied
+ --> $DIR/fn-trait-formatting.rs:29:5
+ |
+LL | needs_fn(1);
+ | ^^^^^^^^ the trait `std::ops::Fn<(isize,)>` is not implemented for `{integer}`
+ |
+ = help: the following implementations were found:
+ <&'a F as std::ops::Fn<A>>
+ <core::str::LinesAnyMap as std::ops::Fn<(&'a str,)>>
+note: required by `needs_fn`
+ --> $DIR/fn-trait-formatting.rs:13:1
+ |
+LL | fn needs_fn<F>(x: F) where F: Fn(isize) -> isize {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/for-c-in-str.rs b/src/test/ui/for/for-c-in-str.rs
similarity index 100%
rename from src/test/ui/for-c-in-str.rs
rename to src/test/ui/for/for-c-in-str.rs
diff --git a/src/test/ui/for-c-in-str.stderr b/src/test/ui/for/for-c-in-str.stderr
similarity index 100%
rename from src/test/ui/for-c-in-str.stderr
rename to src/test/ui/for/for-c-in-str.stderr
diff --git a/src/test/compile-fail/for-expn.rs b/src/test/ui/for/for-expn.rs
similarity index 100%
rename from src/test/compile-fail/for-expn.rs
rename to src/test/ui/for/for-expn.rs
diff --git a/src/test/ui/for/for-expn.stderr b/src/test/ui/for/for-expn.stderr
new file mode 100644
index 0000000..14c2c1a
--- /dev/null
+++ b/src/test/ui/for/for-expn.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `foo` in this scope
+ --> $DIR/for-expn.rs:16:7
+ |
+LL | foo //~ ERROR cannot find value `foo` in this scope
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/for-loop-bogosity.rs b/src/test/ui/for/for-loop-bogosity.rs
similarity index 100%
rename from src/test/compile-fail/for-loop-bogosity.rs
rename to src/test/ui/for/for-loop-bogosity.rs
diff --git a/src/test/ui/for/for-loop-bogosity.stderr b/src/test/ui/for/for-loop-bogosity.stderr
new file mode 100644
index 0000000..0476ec0
--- /dev/null
+++ b/src/test/ui/for/for-loop-bogosity.stderr
@@ -0,0 +1,12 @@
+error[E0277]: the trait bound `MyStruct: std::iter::Iterator` is not satisfied
+ --> $DIR/for-loop-bogosity.rs:27:14
+ |
+LL | for x in bogus { //~ ERROR `MyStruct: std::iter::Iterator` is not satisfied
+ | ^^^^^ `MyStruct` is not an iterator; maybe try calling `.iter()` or a similar method
+ |
+ = help: the trait `std::iter::Iterator` is not implemented for `MyStruct`
+ = note: required by `std::iter::IntoIterator::into_iter`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/for-loop-refutable-pattern-error-message.rs b/src/test/ui/for/for-loop-refutable-pattern-error-message.rs
similarity index 100%
rename from src/test/compile-fail/for-loop-refutable-pattern-error-message.rs
rename to src/test/ui/for/for-loop-refutable-pattern-error-message.rs
diff --git a/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr
new file mode 100644
index 0000000..b76c2ff
--- /dev/null
+++ b/src/test/ui/for/for-loop-refutable-pattern-error-message.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in `for` loop binding: `&_` not covered
+ --> $DIR/for-loop-refutable-pattern-error-message.rs:12:9
+ |
+LL | for &1 in [1].iter() {} //~ ERROR refutable pattern in `for` loop binding
+ | ^^ pattern `&_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/compile-fail/for-loop-type-error.rs b/src/test/ui/for/for-loop-type-error.rs
similarity index 100%
rename from src/test/compile-fail/for-loop-type-error.rs
rename to src/test/ui/for/for-loop-type-error.rs
diff --git a/src/test/ui/for/for-loop-type-error.stderr b/src/test/ui/for/for-loop-type-error.stderr
new file mode 100644
index 0000000..f80a457
--- /dev/null
+++ b/src/test/ui/for/for-loop-type-error.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `+` cannot be applied to type `()`
+ --> $DIR/for-loop-type-error.rs:12:13
+ |
+LL | let x = () + (); //~ ERROR binary operation
+ | ^^^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/for-loop-unconstrained-element-type.rs b/src/test/ui/for/for-loop-unconstrained-element-type.rs
similarity index 100%
rename from src/test/compile-fail/for-loop-unconstrained-element-type.rs
rename to src/test/ui/for/for-loop-unconstrained-element-type.rs
diff --git a/src/test/ui/for/for-loop-unconstrained-element-type.stderr b/src/test/ui/for/for-loop-unconstrained-element-type.stderr
new file mode 100644
index 0000000..c3723c5
--- /dev/null
+++ b/src/test/ui/for/for-loop-unconstrained-element-type.stderr
@@ -0,0 +1,12 @@
+error[E0282]: type annotations needed
+ --> $DIR/for-loop-unconstrained-element-type.rs:18:14
+ |
+LL | for i in Vec::new() { } //~ ERROR type annotations needed
+ | ^^^^^^^^^^
+ | |
+ | cannot infer type
+ | the element type for this iterator is not specified
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/compile-fail/foreign-fn-return-lifetime.rs b/src/test/ui/foreign-fn-return-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/foreign-fn-return-lifetime.rs
rename to src/test/ui/foreign-fn-return-lifetime.rs
diff --git a/src/test/ui/foreign-fn-return-lifetime.stderr b/src/test/ui/foreign-fn-return-lifetime.stderr
new file mode 100644
index 0000000..ea15897
--- /dev/null
+++ b/src/test/ui/foreign-fn-return-lifetime.stderr
@@ -0,0 +1,12 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/foreign-fn-return-lifetime.rs:13:15
+ |
+LL | fn f() -> &u8; //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
+ = help: consider giving it a 'static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/compile-fail/foreign-unsafe-fn-called.rs b/src/test/ui/foreign-unsafe-fn-called.rs
similarity index 100%
rename from src/test/compile-fail/foreign-unsafe-fn-called.rs
rename to src/test/ui/foreign-unsafe-fn-called.rs
diff --git a/src/test/ui/foreign-unsafe-fn-called.stderr b/src/test/ui/foreign-unsafe-fn-called.stderr
new file mode 100644
index 0000000..498dd04
--- /dev/null
+++ b/src/test/ui/foreign-unsafe-fn-called.stderr
@@ -0,0 +1,11 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/foreign-unsafe-fn-called.rs:19:5
+ |
+LL | test::free();
+ | ^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/fully-qualified-type-name1.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs
similarity index 100%
rename from src/test/compile-fail/fully-qualified-type-name1.rs
rename to src/test/ui/fully-qualified-type/fully-qualified-type-name1.rs
diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr
new file mode 100644
index 0000000..55553c0
--- /dev/null
+++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name1.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/fully-qualified-type-name1.rs:15:9
+ |
+LL | x = 5;
+ | ^
+ | |
+ | expected enum `std::option::Option`, found integral variable
+ | help: try using a variant of the expected type: `Some(5)`
+ |
+ = note: expected type `std::option::Option<usize>`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/fully-qualified-type-name2.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.rs
similarity index 100%
rename from src/test/compile-fail/fully-qualified-type-name2.rs
rename to src/test/ui/fully-qualified-type/fully-qualified-type-name2.rs
diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr
new file mode 100644
index 0000000..f288189
--- /dev/null
+++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name2.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/fully-qualified-type-name2.rs:22:12
+ |
+LL | return x;
+ | ^ expected enum `y::foo`, found enum `x::foo`
+ |
+ = note: expected type `y::foo`
+ found type `x::foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/fully-qualified-type-name3.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs
similarity index 100%
rename from src/test/compile-fail/fully-qualified-type-name3.rs
rename to src/test/ui/fully-qualified-type/fully-qualified-type-name3.rs
diff --git a/src/test/compile-fail/fully-qualified-type-name4.rs b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.rs
similarity index 100%
rename from src/test/compile-fail/fully-qualified-type-name4.rs
rename to src/test/ui/fully-qualified-type/fully-qualified-type-name4.rs
diff --git a/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr
new file mode 100644
index 0000000..eb85548
--- /dev/null
+++ b/src/test/ui/fully-qualified-type/fully-qualified-type-name4.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/fully-qualified-type-name4.rs:16:12
+ |
+LL | return x;
+ | ^ expected enum `std::option::Option`, found usize
+ |
+ = note: expected type `std::option::Option<usize>`
+ found type `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr
new file mode 100644
index 0000000..832b570
--- /dev/null
+++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.nll.stderr
@@ -0,0 +1,9 @@
+error[E0509]: cannot move out of type `A`, which implements the `Drop` trait
+ --> $DIR/functional-struct-update-noncopyable.rs:22:14
+ |
+LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/functional-struct-update-noncopyable.rs b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs
similarity index 100%
rename from src/test/compile-fail/functional-struct-update-noncopyable.rs
rename to src/test/ui/functional-struct-update/functional-struct-update-noncopyable.rs
diff --git a/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
new file mode 100644
index 0000000..ad4fb97
--- /dev/null
+++ b/src/test/ui/functional-struct-update/functional-struct-update-noncopyable.stderr
@@ -0,0 +1,9 @@
+error[E0509]: cannot move out of type `A`, which implements the `Drop` trait
+ --> $DIR/functional-struct-update-noncopyable.rs:22:36
+ |
+LL | let _b = A { y: Arc::new(3), ..a }; //~ ERROR cannot move out of type `A`
+ | ^ cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0509`.
diff --git a/src/test/compile-fail/functional-struct-update-respects-privacy.rs b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs
similarity index 100%
rename from src/test/compile-fail/functional-struct-update-respects-privacy.rs
rename to src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.rs
diff --git a/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr
new file mode 100644
index 0000000..35a2f84
--- /dev/null
+++ b/src/test/ui/functional-struct-update/functional-struct-update-respects-privacy.stderr
@@ -0,0 +1,9 @@
+error[E0451]: field `secret_uid` of struct `foo::S` is private
+ --> $DIR/functional-struct-update-respects-privacy.rs:38:49
+ |
+LL | let s_2 = foo::S { b: format!("ess two"), ..s_1 }; // FRU ...
+ | ^^^ field `secret_uid` is private
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0451`.
diff --git a/src/test/compile-fail/future-incompatible-lint-group.rs b/src/test/ui/future-incompatible-lint-group.rs
similarity index 100%
rename from src/test/compile-fail/future-incompatible-lint-group.rs
rename to src/test/ui/future-incompatible-lint-group.rs
diff --git a/src/test/ui/future-incompatible-lint-group.stderr b/src/test/ui/future-incompatible-lint-group.stderr
new file mode 100644
index 0000000..56f4ff3
--- /dev/null
+++ b/src/test/ui/future-incompatible-lint-group.stderr
@@ -0,0 +1,17 @@
+error: anonymous parameters are deprecated and will be removed in the next edition.
+ --> $DIR/future-incompatible-lint-group.rs:14:10
+ |
+LL | fn f(u8) {} //~ ERROR anonymous parameters are deprecated
+ | ^^ help: Try naming the parameter or explicitly ignoring it: `_: u8`
+ |
+note: lint level defined here
+ --> $DIR/future-incompatible-lint-group.rs:11:9
+ |
+LL | #![deny(future_incompatible)]
+ | ^^^^^^^^^^^^^^^^^^^
+ = note: #[deny(anonymous_parameters)] implied by #[deny(future_incompatible)]
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41686 <https://github.com/rust-lang/rust/issues/41686>
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/gated-attr-literals.rs b/src/test/ui/gated-attr-literals.rs
new file mode 100644
index 0000000..8d36745
--- /dev/null
+++ b/src/test/ui/gated-attr-literals.rs
@@ -0,0 +1,43 @@
+// Copyright 2015 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 literals in attributes don't parse without the feature gate.
+
+// gate-test-attr_literals
+
+#![feature(custom_attribute)]
+
+#[fake_attr] // OK
+#[fake_attr(100)]
+ //~^ ERROR non-string literals in attributes
+#[fake_attr(1, 2, 3)]
+ //~^ ERROR non-string literals in attributes
+#[fake_attr("hello")]
+ //~^ ERROR string literals in top-level positions, are experimental
+#[fake_attr(name = "hello")] // OK
+#[fake_attr(1, "hi", key = 12, true, false)]
+ //~^ ERROR non-string literals in attributes, or string literals in top-level positions
+#[fake_attr(key = "hello", val = 10)]
+ //~^ ERROR non-string literals in attributes
+#[fake_attr(key("hello"), val(10))]
+ //~^ ERROR non-string literals in attributes, or string literals in top-level positions
+#[fake_attr(enabled = true, disabled = false)]
+ //~^ ERROR non-string literals in attributes
+#[fake_attr(true)]
+ //~^ ERROR non-string literals in attributes
+#[fake_attr(pi = 3.14159)]
+ //~^ ERROR non-string literals in attributes
+#[fake_attr(b"hi")]
+ //~^ ERROR string literals in top-level positions, are experimental
+#[fake_doc(r"doc")]
+ //~^ ERROR string literals in top-level positions, are experimental
+struct Q { }
+
+fn main() { }
diff --git a/src/test/ui/gated-attr-literals.stderr b/src/test/ui/gated-attr-literals.stderr
new file mode 100644
index 0000000..e69b648
--- /dev/null
+++ b/src/test/ui/gated-attr-literals.stderr
@@ -0,0 +1,91 @@
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:18:1
+ |
+LL | #[fake_attr(100)]
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:20:1
+ |
+LL | #[fake_attr(1, 2, 3)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:22:1
+ |
+LL | #[fake_attr("hello")]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:25:1
+ |
+LL | #[fake_attr(1, "hi", key = 12, true, false)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:27:1
+ |
+LL | #[fake_attr(key = "hello", val = 10)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:29:1
+ |
+LL | #[fake_attr(key("hello"), val(10))]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:31:1
+ |
+LL | #[fake_attr(enabled = true, disabled = false)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:33:1
+ |
+LL | #[fake_attr(true)]
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:35:1
+ |
+LL | #[fake_attr(pi = 3.14159)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:37:1
+ |
+LL | #[fake_attr(b"hi")]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error[E0658]: non-string literals in attributes, or string literals in top-level positions, are experimental (see issue #34981)
+ --> $DIR/gated-attr-literals.rs:39:1
+ |
+LL | #[fake_doc(r"doc")]
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(attr_literals)] to the crate attributes to enable
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/gated-bad-feature.rs b/src/test/ui/gated-bad-feature.rs
similarity index 100%
rename from src/test/compile-fail/gated-bad-feature.rs
rename to src/test/ui/gated-bad-feature.rs
diff --git a/src/test/ui/gated-bad-feature.stderr b/src/test/ui/gated-bad-feature.stderr
new file mode 100644
index 0000000..2bed241
--- /dev/null
+++ b/src/test/ui/gated-bad-feature.stderr
@@ -0,0 +1,38 @@
+error[E0556]: malformed feature, expected just one word
+ --> $DIR/gated-bad-feature.rs:13:5
+ |
+LL | foo(bar),
+ | ^^^^^^^^
+
+error[E0556]: malformed feature, expected just one word
+ --> $DIR/gated-bad-feature.rs:14:5
+ |
+LL | foo = "baz"
+ | ^^^^^^^^^^^
+
+error[E0555]: malformed feature attribute, expected #![feature(...)]
+ --> $DIR/gated-bad-feature.rs:19:1
+ |
+LL | #![feature] //~ ERROR: malformed feature
+ | ^^^^^^^^^^^
+
+error[E0555]: malformed feature attribute, expected #![feature(...)]
+ --> $DIR/gated-bad-feature.rs:20:1
+ |
+LL | #![feature = "foo"] //~ ERROR: malformed feature
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0557]: feature has been removed
+ --> $DIR/gated-bad-feature.rs:22:12
+ |
+LL | #![feature(test_removed_feature)] //~ ERROR: feature has been removed
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0601]: `main` function not found in crate `gated_bad_feature`
+ |
+ = note: consider adding a `main` function to `$DIR/gated-bad-feature.rs`
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0555, E0556, E0557, E0601.
+For more information about an error, try `rustc --explain E0555`.
diff --git a/src/test/compile-fail/generator-yielding-or-returning-itself.rs b/src/test/ui/generator-yielding-or-returning-itself.rs
similarity index 100%
rename from src/test/compile-fail/generator-yielding-or-returning-itself.rs
rename to src/test/ui/generator-yielding-or-returning-itself.rs
diff --git a/src/test/ui/generator-yielding-or-returning-itself.stderr b/src/test/ui/generator-yielding-or-returning-itself.stderr
new file mode 100644
index 0000000..a52e717
--- /dev/null
+++ b/src/test/ui/generator-yielding-or-returning-itself.stderr
@@ -0,0 +1,39 @@
+error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:25:34: 29:6 _] as std::ops::Generator>::Return == [generator@$DIR/generator-yielding-or-returning-itself.rs:25:34: 29:6 _]`
+ --> $DIR/generator-yielding-or-returning-itself.rs:25:5
+ |
+LL | want_cyclic_generator_return(|| {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size
+ |
+ = note: closures cannot capture themselves or take themselves as argument;
+ this error may be the result of a recent compiler bug-fix,
+ see https://github.com/rust-lang/rust/issues/46062 for more details
+note: required by `want_cyclic_generator_return`
+ --> $DIR/generator-yielding-or-returning-itself.rs:19:1
+ |
+LL | / pub fn want_cyclic_generator_return<T>(_: T)
+LL | | where T: Generator<Yield = (), Return = T>
+LL | | {
+LL | | }
+ | |_^
+
+error[E0271]: type mismatch resolving `<[generator@$DIR/generator-yielding-or-returning-itself.rs:38:33: 42:6 _] as std::ops::Generator>::Yield == [generator@$DIR/generator-yielding-or-returning-itself.rs:38:33: 42:6 _]`
+ --> $DIR/generator-yielding-or-returning-itself.rs:38:5
+ |
+LL | want_cyclic_generator_yield(|| {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic type of infinite size
+ |
+ = note: closures cannot capture themselves or take themselves as argument;
+ this error may be the result of a recent compiler bug-fix,
+ see https://github.com/rust-lang/rust/issues/46062 for more details
+note: required by `want_cyclic_generator_yield`
+ --> $DIR/generator-yielding-or-returning-itself.rs:32:1
+ |
+LL | / pub fn want_cyclic_generator_yield<T>(_: T)
+LL | | where T: Generator<Yield = T, Return = ()>
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/ui/generator/sized-yield.stderr b/src/test/ui/generator/sized-yield.stderr
index 953268e..d91db67 100644
--- a/src/test/ui/generator/sized-yield.stderr
+++ b/src/test/ui/generator/sized-yield.stderr
@@ -9,7 +9,7 @@
| |____^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: the yield type of a generator must have a statically known size
error[E0277]: the size for values of type `str` cannot be known at compilation time
@@ -19,7 +19,7 @@
| ^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
error: aborting due to 2 previous errors
diff --git a/src/test/compile-fail/generic-extern-lifetime.rs b/src/test/ui/generic/generic-extern-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/generic-extern-lifetime.rs
rename to src/test/ui/generic/generic-extern-lifetime.rs
diff --git a/src/test/ui/generic/generic-extern-lifetime.stderr b/src/test/ui/generic/generic-extern-lifetime.stderr
new file mode 100644
index 0000000..9276ae0
--- /dev/null
+++ b/src/test/ui/generic/generic-extern-lifetime.stderr
@@ -0,0 +1,21 @@
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/generic-extern-lifetime.rs:16:24
+ |
+LL | pub fn life2<'b>(x:&'a i32, y:&'b i32); //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/generic-extern-lifetime.rs:18:36
+ |
+LL | pub fn life4<'b>(x: for<'c> fn(&'a i32)); //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/generic-extern-lifetime.rs:21:38
+ |
+LL | pub fn life7<'b>() -> for<'c> fn(&'a i32); //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/src/test/compile-fail/generic-extern.rs b/src/test/ui/generic/generic-extern.rs
similarity index 100%
rename from src/test/compile-fail/generic-extern.rs
rename to src/test/ui/generic/generic-extern.rs
diff --git a/src/test/ui/generic/generic-extern.stderr b/src/test/ui/generic/generic-extern.stderr
new file mode 100644
index 0000000..c1ba2cc
--- /dev/null
+++ b/src/test/ui/generic/generic-extern.stderr
@@ -0,0 +1,11 @@
+error[E0044]: foreign items may not have type parameters
+ --> $DIR/generic-extern.rs:12:5
+ |
+LL | fn foo<T>(); //~ ERROR foreign items may not have type parameters
+ | ^^^^^^^^^^^^ can't have type parameters
+ |
+ = help: use specialization instead of type parameters by replacing them with concrete types like `u32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0044`.
diff --git a/src/test/compile-fail/generic-impl-less-params-with-defaults.rs b/src/test/ui/generic/generic-impl-less-params-with-defaults.rs
similarity index 100%
rename from src/test/compile-fail/generic-impl-less-params-with-defaults.rs
rename to src/test/ui/generic/generic-impl-less-params-with-defaults.rs
diff --git a/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr b/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr
new file mode 100644
index 0000000..a10b500
--- /dev/null
+++ b/src/test/ui/generic/generic-impl-less-params-with-defaults.stderr
@@ -0,0 +1,9 @@
+error[E0243]: wrong number of type arguments: expected at least 2, found 1
+ --> $DIR/generic-impl-less-params-with-defaults.rs:21:5
+ |
+LL | Foo::<isize>::new();
+ | ^^^^^^^^^^^^^^^^^ expected at least 2 type arguments
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0243`.
diff --git a/src/test/compile-fail/generic-impl-more-params-with-defaults.rs b/src/test/ui/generic/generic-impl-more-params-with-defaults.rs
similarity index 100%
rename from src/test/compile-fail/generic-impl-more-params-with-defaults.rs
rename to src/test/ui/generic/generic-impl-more-params-with-defaults.rs
diff --git a/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr b/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr
new file mode 100644
index 0000000..6b54bae
--- /dev/null
+++ b/src/test/ui/generic/generic-impl-more-params-with-defaults.stderr
@@ -0,0 +1,9 @@
+error[E0244]: wrong number of type arguments: expected at most 2, found 3
+ --> $DIR/generic-impl-more-params-with-defaults.rs:23:5
+ |
+LL | Vec::<isize, Heap, bool>::new();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected at most 2 type arguments
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0244`.
diff --git a/src/test/compile-fail/generic-lifetime-trait-impl.rs b/src/test/ui/generic/generic-lifetime-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/generic-lifetime-trait-impl.rs
rename to src/test/ui/generic/generic-lifetime-trait-impl.rs
diff --git a/src/test/ui/generic/generic-lifetime-trait-impl.stderr b/src/test/ui/generic/generic-lifetime-trait-impl.stderr
new file mode 100644
index 0000000..182eab0
--- /dev/null
+++ b/src/test/ui/generic/generic-lifetime-trait-impl.stderr
@@ -0,0 +1,12 @@
+error[E0195]: lifetime parameters or bounds on method `bar` do not match the trait declaration
+ --> $DIR/generic-lifetime-trait-impl.rs:29:11
+ |
+LL | fn bar<'b, T: Bar<'b>>(self) -> &'b str;
+ | ---------------- lifetimes in impl do not match this method in trait
+...
+LL | fn bar<T: Bar<'a>>(self) -> &'a str { panic!() } //~ ERROR lifetime
+ | ^^^^^^^^^^^^ lifetimes do not match method in trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0195`.
diff --git a/src/test/compile-fail/generic-no-mangle.rs b/src/test/ui/generic/generic-no-mangle.rs
similarity index 100%
rename from src/test/compile-fail/generic-no-mangle.rs
rename to src/test/ui/generic/generic-no-mangle.rs
diff --git a/src/test/ui/generic/generic-no-mangle.stderr b/src/test/ui/generic/generic-no-mangle.stderr
new file mode 100644
index 0000000..4eaa397
--- /dev/null
+++ b/src/test/ui/generic/generic-no-mangle.stderr
@@ -0,0 +1,24 @@
+error: functions generic over types must be mangled
+ --> $DIR/generic-no-mangle.rs:14:1
+ |
+LL | #[no_mangle]
+ | ------------ help: remove this attribute
+LL | pub fn foo<T>() {} //~ ERROR functions generic over types must be mangled
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/generic-no-mangle.rs:11:9
+ |
+LL | #![deny(no_mangle_generic_items)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: functions generic over types must be mangled
+ --> $DIR/generic-no-mangle.rs:17:1
+ |
+LL | #[no_mangle]
+ | ------------ help: remove this attribute
+LL | pub extern fn bar<T>() {} //~ ERROR functions generic over types must be mangled
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/generic-non-trailing-defaults.rs b/src/test/ui/generic/generic-non-trailing-defaults.rs
similarity index 100%
rename from src/test/compile-fail/generic-non-trailing-defaults.rs
rename to src/test/ui/generic/generic-non-trailing-defaults.rs
diff --git a/src/test/ui/generic/generic-non-trailing-defaults.stderr b/src/test/ui/generic/generic-non-trailing-defaults.stderr
new file mode 100644
index 0000000..ce8badf
--- /dev/null
+++ b/src/test/ui/generic/generic-non-trailing-defaults.stderr
@@ -0,0 +1,21 @@
+error: type parameters with a default must be trailing
+ --> $DIR/generic-non-trailing-defaults.rs:13:12
+ |
+LL | struct Vec<A = Heap, T>(A, T);
+ | ^
+
+error: type parameters with a default must be trailing
+ --> $DIR/generic-non-trailing-defaults.rs:16:15
+ |
+LL | struct Foo<A, B = Vec<C>, C>(A, B, C);
+ | ^
+
+error[E0128]: type parameters with a default cannot use forward declared identifiers
+ --> $DIR/generic-non-trailing-defaults.rs:16:23
+ |
+LL | struct Foo<A, B = Vec<C>, C>(A, B, C);
+ | ^ defaulted type parameters cannot be forward declared
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0128`.
diff --git a/src/test/ui/generic-param-attrs.rs b/src/test/ui/generic/generic-param-attrs.rs
similarity index 100%
rename from src/test/ui/generic-param-attrs.rs
rename to src/test/ui/generic/generic-param-attrs.rs
diff --git a/src/test/ui/generic-type-less-params-with-defaults.rs b/src/test/ui/generic/generic-type-less-params-with-defaults.rs
similarity index 100%
rename from src/test/ui/generic-type-less-params-with-defaults.rs
rename to src/test/ui/generic/generic-type-less-params-with-defaults.rs
diff --git a/src/test/ui/generic-type-less-params-with-defaults.stderr b/src/test/ui/generic/generic-type-less-params-with-defaults.stderr
similarity index 100%
rename from src/test/ui/generic-type-less-params-with-defaults.stderr
rename to src/test/ui/generic/generic-type-less-params-with-defaults.stderr
diff --git a/src/test/ui/generic-type-more-params-with-defaults.rs b/src/test/ui/generic/generic-type-more-params-with-defaults.rs
similarity index 100%
rename from src/test/ui/generic-type-more-params-with-defaults.rs
rename to src/test/ui/generic/generic-type-more-params-with-defaults.rs
diff --git a/src/test/ui/generic-type-more-params-with-defaults.stderr b/src/test/ui/generic/generic-type-more-params-with-defaults.stderr
similarity index 100%
rename from src/test/ui/generic-type-more-params-with-defaults.stderr
rename to src/test/ui/generic/generic-type-more-params-with-defaults.stderr
diff --git a/src/test/compile-fail/generic-type-params-forward-mention.rs b/src/test/ui/generic/generic-type-params-forward-mention.rs
similarity index 100%
rename from src/test/compile-fail/generic-type-params-forward-mention.rs
rename to src/test/ui/generic/generic-type-params-forward-mention.rs
diff --git a/src/test/ui/generic/generic-type-params-forward-mention.stderr b/src/test/ui/generic/generic-type-params-forward-mention.stderr
new file mode 100644
index 0000000..5427163
--- /dev/null
+++ b/src/test/ui/generic/generic-type-params-forward-mention.stderr
@@ -0,0 +1,9 @@
+error[E0128]: type parameters with a default cannot use forward declared identifiers
+ --> $DIR/generic-type-params-forward-mention.rs:12:23
+ |
+LL | struct Foo<T = Option<U>, U = bool>(T, U);
+ | ^ defaulted type parameters cannot be forward declared
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0128`.
diff --git a/src/test/compile-fail/generic-type-params-name-repr.rs b/src/test/ui/generic/generic-type-params-name-repr.rs
similarity index 100%
rename from src/test/compile-fail/generic-type-params-name-repr.rs
rename to src/test/ui/generic/generic-type-params-name-repr.rs
diff --git a/src/test/ui/generic/generic-type-params-name-repr.stderr b/src/test/ui/generic/generic-type-params-name-repr.stderr
new file mode 100644
index 0000000..1c65aea
--- /dev/null
+++ b/src/test/ui/generic/generic-type-params-name-repr.stderr
@@ -0,0 +1,57 @@
+error[E0308]: mismatched types
+ --> $DIR/generic-type-params-name-repr.rs:23:25
+ |
+LL | let _: Foo<isize> = ();
+ | ^^ expected struct `Foo`, found ()
+ |
+ = note: expected type `Foo<isize>`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/generic-type-params-name-repr.rs:30:31
+ |
+LL | let _: Foo<isize, B, C> = ();
+ | ^^ expected struct `Foo`, found ()
+ |
+ = note: expected type `Foo<isize>`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/generic-type-params-name-repr.rs:37:37
+ |
+LL | let _: HashMap<String, isize> = ();
+ | ^^ expected struct `HashMap`, found ()
+ |
+ = note: expected type `HashMap<std::string::String, isize>`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/generic-type-params-name-repr.rs:42:51
+ |
+LL | let _: HashMap<String, isize, Hash<String>> = ();
+ | ^^ expected struct `HashMap`, found ()
+ |
+ = note: expected type `HashMap<std::string::String, isize>`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/generic-type-params-name-repr.rs:49:31
+ |
+LL | let _: Foo<A, isize, C> = ();
+ | ^^ expected struct `Foo`, found ()
+ |
+ = note: expected type `Foo<A, isize>`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/generic-type-params-name-repr.rs:56:27
+ |
+LL | let _: Foo<A, B, C> = ();
+ | ^^ expected struct `Foo`, found ()
+ |
+ = note: expected type `Foo`
+ found type `()`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/glob-cycles.rs b/src/test/ui/glob-cycles.rs
similarity index 100%
rename from src/test/compile-fail/glob-cycles.rs
rename to src/test/ui/glob-cycles.rs
diff --git a/src/test/ui/glob-cycles.stderr b/src/test/ui/glob-cycles.stderr
new file mode 100644
index 0000000..a9fd930
--- /dev/null
+++ b/src/test/ui/glob-cycles.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/glob-cycles.rs:29:1
+ |
+LL | pub fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/glob-resolve1.rs b/src/test/ui/glob-resolve1.rs
similarity index 100%
rename from src/test/compile-fail/glob-resolve1.rs
rename to src/test/ui/glob-resolve1.rs
diff --git a/src/test/ui/glob-resolve1.stderr b/src/test/ui/glob-resolve1.stderr
new file mode 100644
index 0000000..650dd2c
--- /dev/null
+++ b/src/test/ui/glob-resolve1.stderr
@@ -0,0 +1,79 @@
+error[E0425]: cannot find function `fpriv` in this scope
+ --> $DIR/glob-resolve1.rs:32:5
+ |
+LL | fpriv(); //~ ERROR cannot find function `fpriv` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use bar::fpriv;
+ |
+
+error[E0425]: cannot find function `epriv` in this scope
+ --> $DIR/glob-resolve1.rs:33:5
+ |
+LL | epriv(); //~ ERROR cannot find function `epriv` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use bar::epriv;
+ |
+
+error[E0423]: expected value, found enum `B`
+ --> $DIR/glob-resolve1.rs:34:5
+ |
+LL | B; //~ ERROR expected value, found enum `B`
+ | ^
+ |
+ = note: did you mean to use one of the following variants?
+ - `B::B1`
+
+error[E0425]: cannot find value `C` in this scope
+ --> $DIR/glob-resolve1.rs:35:5
+ |
+LL | C; //~ ERROR cannot find value `C` in this scope
+ | ^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use bar::C;
+ |
+
+error[E0425]: cannot find function `import` in this scope
+ --> $DIR/glob-resolve1.rs:36:5
+ |
+LL | import(); //~ ERROR: cannot find function `import` in this scope
+ | ^^^^^^ not found in this scope
+
+error[E0412]: cannot find type `A` in this scope
+ --> $DIR/glob-resolve1.rs:38:11
+ |
+LL | foo::<A>(); //~ ERROR: cannot find type `A` in this scope
+ | ^ did you mean `B`?
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use bar::A;
+ |
+
+error[E0412]: cannot find type `C` in this scope
+ --> $DIR/glob-resolve1.rs:39:11
+ |
+LL | foo::<C>(); //~ ERROR: cannot find type `C` in this scope
+ | ^ did you mean `B`?
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use bar::C;
+ |
+
+error[E0412]: cannot find type `D` in this scope
+ --> $DIR/glob-resolve1.rs:40:11
+ |
+LL | foo::<D>(); //~ ERROR: cannot find type `D` in this scope
+ | ^ did you mean `B`?
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use bar::D;
+ |
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0412, E0423, E0425.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/ui/hashmap-iter-value-lifetime.nll.stderr b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr
new file mode 100644
index 0000000..ec52d19
--- /dev/null
+++ b/src/test/ui/hashmap-iter-value-lifetime.nll.stderr
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+ --> $DIR/hashmap-iter-value-lifetime.rs:17:5
+ |
+LL | let (_, thing) = my_stuff.iter().next().unwrap();
+ | -------- immutable borrow occurs here
+LL |
+LL | my_stuff.clear(); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^^^ mutable borrow occurs here
+LL |
+LL | println!("{}", *thing);
+ | ------ borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/hashmap-iter-value-lifetime.rs b/src/test/ui/hashmap-iter-value-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/hashmap-iter-value-lifetime.rs
rename to src/test/ui/hashmap-iter-value-lifetime.rs
diff --git a/src/test/ui/hashmap-iter-value-lifetime.stderr b/src/test/ui/hashmap-iter-value-lifetime.stderr
new file mode 100644
index 0000000..16e9c52
--- /dev/null
+++ b/src/test/ui/hashmap-iter-value-lifetime.stderr
@@ -0,0 +1,15 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+ --> $DIR/hashmap-iter-value-lifetime.rs:17:5
+ |
+LL | let (_, thing) = my_stuff.iter().next().unwrap();
+ | -------- immutable borrow occurs here
+LL |
+LL | my_stuff.clear(); //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hashmap-lifetimes.nll.stderr b/src/test/ui/hashmap-lifetimes.nll.stderr
new file mode 100644
index 0000000..943b684
--- /dev/null
+++ b/src/test/ui/hashmap-lifetimes.nll.stderr
@@ -0,0 +1,13 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+ --> $DIR/hashmap-lifetimes.rs:18:5
+ |
+LL | let mut it = my_stuff.iter();
+ | -------- immutable borrow occurs here
+LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow
+ | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+LL | it;
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/hashmap-lifetimes.rs b/src/test/ui/hashmap-lifetimes.rs
new file mode 100644
index 0000000..eb7404e
--- /dev/null
+++ b/src/test/ui/hashmap-lifetimes.rs
@@ -0,0 +1,20 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+
+
+fn main() {
+ let mut my_stuff = std::collections::HashMap::new();
+ my_stuff.insert(0, 42);
+
+ let mut it = my_stuff.iter();
+ my_stuff.insert(1, 43); //~ ERROR cannot borrow
+ it;
+}
diff --git a/src/test/ui/hashmap-lifetimes.stderr b/src/test/ui/hashmap-lifetimes.stderr
new file mode 100644
index 0000000..187c98a
--- /dev/null
+++ b/src/test/ui/hashmap-lifetimes.stderr
@@ -0,0 +1,14 @@
+error[E0502]: cannot borrow `my_stuff` as mutable because it is also borrowed as immutable
+ --> $DIR/hashmap-lifetimes.rs:18:5
+ |
+LL | let mut it = my_stuff.iter();
+ | -------- immutable borrow occurs here
+LL | my_stuff.insert(1, 43); //~ ERROR cannot borrow
+ | ^^^^^^^^ mutable borrow occurs here
+LL | it;
+LL | }
+ | - immutable borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/hidden-rt-injection.rs b/src/test/ui/hidden-rt-injection.rs
similarity index 100%
rename from src/test/compile-fail/hidden-rt-injection.rs
rename to src/test/ui/hidden-rt-injection.rs
diff --git a/src/test/ui/hidden-rt-injection.stderr b/src/test/ui/hidden-rt-injection.stderr
new file mode 100644
index 0000000..103cdf0
--- /dev/null
+++ b/src/test/ui/hidden-rt-injection.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `native`
+ --> $DIR/hidden-rt-injection.rs:15:9
+ |
+LL | use native; //~ ERROR unresolved import
+ | ^^^^^^ no `native` in the root
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/hidden-rt-injection2.rs b/src/test/ui/hidden-rt-injection2.rs
similarity index 100%
rename from src/test/compile-fail/hidden-rt-injection2.rs
rename to src/test/ui/hidden-rt-injection2.rs
diff --git a/src/test/ui/hidden-rt-injection2.stderr b/src/test/ui/hidden-rt-injection2.stderr
new file mode 100644
index 0000000..df0527f
--- /dev/null
+++ b/src/test/ui/hidden-rt-injection2.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `rt`
+ --> $DIR/hidden-rt-injection2.rs:15:9
+ |
+LL | use rt; //~ ERROR unresolved import
+ | ^^ no `rt` in the root
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
new file mode 100644
index 0000000..d668a93
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_ret_a_vs_bound_a_ret_a.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_a_b_ret_a_vs_bound_a_ret_a: (for<'a,'b> fn(&'a u32, &'b u32) -> &'a u32,
+LL | | for<'a> fn(&'a u32, &'a u32) -> &'a u32) }
+ | |_________________________________________________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32>`
+ found type `std::option::Option<for<'a> fn(&'a u32, &'a u32) -> &'a u32>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
new file mode 100644
index 0000000..23854f9
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_b_vs_bound_a.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_a_b_vs_bound_a: (for<'a,'b> fn(&'a u32, &'b u32),
+LL | | for<'a> fn(&'a u32, &'a u32)) }
+ | |__________________________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a, 'b> fn(&'a u32, &'b u32)>`
+ found type `std::option::Option<for<'a> fn(&'a u32, &'a u32)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr
new file mode 100644
index 0000000..01a9f57
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_a.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr
new file mode 100644
index 0000000..01a9f57
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_bound_b.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
new file mode 100644
index 0000000..14e4985
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_a_vs_free_x.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_a_vs_free_x: (for<'a> fn(&'a u32),
+LL | | fn(&'x u32)) }
+ | |___________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a> fn(&'a u32)>`
+ found type `std::option::Option<fn(&'x u32)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
new file mode 100644
index 0000000..a66a4ace
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_b_vs_bound_co_a.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_co_a_b_vs_bound_co_a: (for<'a,'b> fn(Co<'a>, Co<'b>),
+LL | | for<'a> fn(Co<'a>, Co<'a>)) }
+ | |______________________________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a, 'b> fn(Co<'a>, Co<'b>)>`
+ found type `std::option::Option<for<'a> fn(Co<'a>, Co<'a>)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
new file mode 100644
index 0000000..9f94b45
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_co_b_ret_contra_a.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_co_a_co_b_ret_contra_a: (for<'a,'b> fn(Co<'a>, Co<'b>) -> Contra<'a>,
+LL | | for<'a> fn(Co<'a>, Co<'a>) -> Contra<'a>) }
+ | |______________________________________________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a, 'b> fn(Co<'a>, Co<'b>) -> Contra<'a>>`
+ found type `std::option::Option<for<'a> fn(Co<'a>, Co<'a>) -> Contra<'a>>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr
new file mode 100644
index 0000000..01a9f57
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_co_a_vs_bound_co_b.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
new file mode 100644
index 0000000..5113697
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_contra_a_contra_b_ret_co_a.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_contra_a_contra_b_ret_co_a: (for<'a,'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>,
+LL | | for<'a> fn(Contra<'a>, Contra<'a>) -> Co<'a>) }
+ | |______________________________________________________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a, 'b> fn(Contra<'a>, Contra<'b>) -> Co<'a>>`
+ found type `std::option::Option<for<'a> fn(Contra<'a>, Contra<'a>) -> Co<'a>>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
new file mode 100644
index 0000000..d39d5f7
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_b_vs_bound_inv_a.stderr
@@ -0,0 +1,16 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ expected concrete lifetime, found bound lifetime parameter 'a
+...
+LL | / check! { bound_inv_a_b_vs_bound_inv_a: (for<'a,'b> fn(Inv<'a>, Inv<'b>),
+LL | | for<'a> fn(Inv<'a>, Inv<'a>)) }
+ | |__________________________________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<for<'a, 'b> fn(Inv<'a>, Inv<'b>)>`
+ found type `std::option::Option<for<'a> fn(Inv<'a>, Inv<'a>)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr
new file mode 100644
index 0000000..01a9f57
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.bound_inv_a_vs_bound_inv_b.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
new file mode 100644
index 0000000..1999df9
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.nll.stderr
@@ -0,0 +1,34 @@
+warning: not reporting region error due to nll
+ --> $DIR/hr-subtype.rs:43:26
+ |
+LL | gimme::<$t2>(None::<$t1>);
+ | ^^^^^^^^^^^
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+
+warning: not reporting region error due to nll
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
new file mode 100644
index 0000000..bf56270
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.free_inv_x_vs_free_inv_y.stderr
@@ -0,0 +1,65 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:43:26
+ |
+LL | gimme::<$t2>(None::<$t1>);
+ | ^^^^^^^^^^^ lifetime mismatch
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<fn(Inv<'y>)>`
+ found type `std::option::Option<fn(Inv<'x>)>`
+note: the lifetime 'x as defined on the function body at 42:20...
+ --> $DIR/hr-subtype.rs:42:20
+ |
+LL | fn subtype<'x,'y:'x,'z:'y>() {
+ | ^^
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 42:23
+ --> $DIR/hr-subtype.rs:42:23
+ |
+LL | fn subtype<'x,'y:'x,'z:'y>() {
+ | ^^
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ lifetime mismatch
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<fn(Inv<'x>)>`
+ found type `std::option::Option<fn(Inv<'y>)>`
+note: the lifetime 'x as defined on the function body at 48:22...
+ --> $DIR/hr-subtype.rs:48:22
+ |
+LL | fn supertype<'x,'y:'x,'z:'y>() {
+ | ^^
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 48:25
+ --> $DIR/hr-subtype.rs:48:25
+ |
+LL | fn supertype<'x,'y:'x,'z:'y>() {
+ | ^^
+...
+LL | / check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
+LL | | fn(Inv<'y>)) }
+ | |__________________________________________________- in this macro invocation
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr
new file mode 100644
index 0000000..01a9f57
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_x.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
new file mode 100644
index 0000000..f76b26b
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.nll.stderr
@@ -0,0 +1,24 @@
+warning: not reporting region error due to nll
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | | fn(&'y u32)) }
+ | |__________________________________________- in this macro invocation
+
+error: compilation successful
+ --> $DIR/hr-subtype.rs:110:1
+ |
+LL | / fn main() {
+LL | | //[bound_a_vs_bound_a]~^ ERROR compilation successful
+LL | | //[bound_a_vs_bound_b]~^^ ERROR compilation successful
+LL | | //[bound_inv_a_vs_bound_inv_b]~^^^ ERROR compilation successful
+LL | | //[bound_co_a_vs_bound_co_b]~^^^^ ERROR compilation successful
+LL | | //[free_x_vs_free_x]~^^^^^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
new file mode 100644
index 0000000..228f6db
--- /dev/null
+++ b/src/test/ui/hr-subtype/hr-subtype.free_x_vs_free_y.stderr
@@ -0,0 +1,34 @@
+error[E0308]: mismatched types
+ --> $DIR/hr-subtype.rs:49:26
+ |
+LL | gimme::<$t1>(None::<$t2>);
+ | ^^^^^^^^^^^ lifetime mismatch
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | | fn(&'y u32)) }
+ | |__________________________________________- in this macro invocation
+ |
+ = note: expected type `std::option::Option<fn(&'x u32)>`
+ found type `std::option::Option<fn(&'y u32)>`
+note: the lifetime 'x as defined on the function body at 48:22...
+ --> $DIR/hr-subtype.rs:48:22
+ |
+LL | fn supertype<'x,'y:'x,'z:'y>() {
+ | ^^
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | | fn(&'y u32)) }
+ | |__________________________________________- in this macro invocation
+note: ...does not necessarily outlive the lifetime 'y as defined on the function body at 48:25
+ --> $DIR/hr-subtype.rs:48:25
+ |
+LL | fn supertype<'x,'y:'x,'z:'y>() {
+ | ^^
+...
+LL | / check! { free_x_vs_free_y: (fn(&'x u32),
+LL | | fn(&'y u32)) }
+ | |__________________________________________- in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/hr-subtype.rs b/src/test/ui/hr-subtype/hr-subtype.rs
similarity index 100%
rename from src/test/compile-fail/hr-subtype.rs
rename to src/test/ui/hr-subtype/hr-subtype.rs
diff --git a/src/test/compile-fail/hrtb-conflate-regions.rs b/src/test/ui/hrtb/hrtb-conflate-regions.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-conflate-regions.rs
rename to src/test/ui/hrtb/hrtb-conflate-regions.rs
diff --git a/src/test/ui/hrtb/hrtb-conflate-regions.stderr b/src/test/ui/hrtb/hrtb-conflate-regions.stderr
new file mode 100644
index 0000000..42778c1
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-conflate-regions.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the trait bound `for<'a, 'b> SomeStruct: Foo<(&'a isize, &'b isize)>` is not satisfied
+ --> $DIR/hrtb-conflate-regions.rs:38:10
+ |
+LL | fn b() { want_foo2::<SomeStruct>(); } //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a, 'b> Foo<(&'a isize, &'b isize)>` is not implemented for `SomeStruct`
+ |
+ = help: the following implementations were found:
+ <SomeStruct as Foo<(&'a isize, &'a isize)>>
+note: required by `want_foo2`
+ --> $DIR/hrtb-conflate-regions.rs:18:1
+ |
+LL | / fn want_foo2<T>()
+LL | | where T : for<'a,'b> Foo<(&'a isize, &'b isize)>
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr
new file mode 100644
index 0000000..0697022
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.nll.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/hrtb-debruijn-in-receiver.rs:27:5
+ |
+LL | foo.insert();
+ | --- first mutable borrow occurs here
+LL | foo.insert(); //~ ERROR cannot borrow
+ | ^^^
+ | |
+ | second mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/hrtb-debruijn-in-receiver.rs b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-debruijn-in-receiver.rs
rename to src/test/ui/hrtb/hrtb-debruijn-in-receiver.rs
diff --git a/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr
new file mode 100644
index 0000000..9a560ca
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-debruijn-in-receiver.stderr
@@ -0,0 +1,13 @@
+error[E0499]: cannot borrow `foo` as mutable more than once at a time
+ --> $DIR/hrtb-debruijn-in-receiver.rs:27:5
+ |
+LL | foo.insert();
+ | --- first mutable borrow occurs here
+LL | foo.insert(); //~ ERROR cannot borrow
+ | ^^^ second mutable borrow occurs here
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-higher-ranker-supertraits-transitive.rs
rename to src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.rs
diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr
new file mode 100644
index 0000000..dca9fea
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits-transitive.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied
+ --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:57:5
+ |
+LL | want_bar_for_any_ccx(b); //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
+ |
+ = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound
+note: required by `want_bar_for_any_ccx`
+ --> $DIR/hrtb-higher-ranker-supertraits-transitive.rs:41:1
+ |
+LL | / fn want_bar_for_any_ccx<B>(b: &B)
+LL | | where B : for<'ccx> Bar<'ccx>
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/hrtb-higher-ranker-supertraits.rs b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-higher-ranker-supertraits.rs
rename to src/test/ui/hrtb/hrtb-higher-ranker-supertraits.rs
diff --git a/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr
new file mode 100644
index 0000000..ad069e1
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-higher-ranker-supertraits.stderr
@@ -0,0 +1,40 @@
+error[E0277]: the trait bound `for<'tcx> F: Foo<'tcx>` is not satisfied
+ --> $DIR/hrtb-higher-ranker-supertraits.rs:28:5
+ |
+LL | want_foo_for_any_tcx(f); //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'tcx> Foo<'tcx>` is not implemented for `F`
+ |
+ = help: consider adding a `where for<'tcx> F: Foo<'tcx>` bound
+note: required by `want_foo_for_any_tcx`
+ --> $DIR/hrtb-higher-ranker-supertraits.rs:31:1
+ |
+LL | / fn want_foo_for_any_tcx<F>(f: &F)
+LL | | where F : for<'tcx> Foo<'tcx>
+LL | | {
+LL | | want_foo_for_some_tcx(f);
+LL | | want_foo_for_any_tcx(f);
+LL | | }
+ | |_^
+
+error[E0277]: the trait bound `for<'ccx> B: Bar<'ccx>` is not satisfied
+ --> $DIR/hrtb-higher-ranker-supertraits.rs:45:5
+ |
+LL | want_bar_for_any_ccx(b); //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `for<'ccx> Bar<'ccx>` is not implemented for `B`
+ |
+ = help: consider adding a `where for<'ccx> B: Bar<'ccx>` bound
+note: required by `want_bar_for_any_ccx`
+ --> $DIR/hrtb-higher-ranker-supertraits.rs:48:1
+ |
+LL | / fn want_bar_for_any_ccx<B>(b: &B)
+LL | | where B : for<'ccx> Bar<'ccx>
+LL | | {
+LL | | want_foo_for_some_tcx(b);
+... |
+LL | | want_bar_for_any_ccx(b);
+LL | | }
+ | |_^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr
new file mode 100644
index 0000000..e533ecc
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/hrtb-identity-fn-borrows.rs:27:5
+ |
+LL | let y = f.call(&x);
+ | -- borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+...
+LL | drop(y);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr
new file mode 100644
index 0000000..6888ec9
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.ast.stderr
@@ -0,0 +1,11 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/hrtb-identity-fn-borrows.rs:27:5
+ |
+LL | let y = f.call(&x);
+ | - borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr b/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr
new file mode 100644
index 0000000..e533ecc
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-identity-fn-borrows.mir.stderr
@@ -0,0 +1,14 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/hrtb-identity-fn-borrows.rs:27:5
+ |
+LL | let y = f.call(&x);
+ | -- borrow of `x` occurs here
+LL | x = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^ assignment to borrowed `x` occurs here
+...
+LL | drop(y);
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/hrtb-identity-fn-borrows.rs b/src/test/ui/hrtb/hrtb-identity-fn-borrows.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-identity-fn-borrows.rs
rename to src/test/ui/hrtb/hrtb-identity-fn-borrows.rs
diff --git a/src/test/compile-fail/hrtb-just-for-static.rs b/src/test/ui/hrtb/hrtb-just-for-static.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-just-for-static.rs
rename to src/test/ui/hrtb/hrtb-just-for-static.rs
diff --git a/src/test/ui/hrtb/hrtb-just-for-static.stderr b/src/test/ui/hrtb/hrtb-just-for-static.stderr
new file mode 100644
index 0000000..615a8b3
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-just-for-static.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the trait bound `for<'a> StaticInt: Foo<&'a isize>` is not satisfied
+ --> $DIR/hrtb-just-for-static.rs:34:5
+ |
+LL | want_hrtb::<StaticInt>() //~ ERROR `for<'a> StaticInt: Foo<&'a isize>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Foo<&'a isize>` is not implemented for `StaticInt`
+ |
+ = help: the following implementations were found:
+ <StaticInt as Foo<&'static isize>>
+note: required by `want_hrtb`
+ --> $DIR/hrtb-just-for-static.rs:18:1
+ |
+LL | / fn want_hrtb<T>()
+LL | | where T : for<'a> Foo<&'a isize>
+LL | | {
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/hrtb-perfect-forwarding.rs b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs
similarity index 100%
rename from src/test/compile-fail/hrtb-perfect-forwarding.rs
rename to src/test/ui/hrtb/hrtb-perfect-forwarding.rs
diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr
new file mode 100644
index 0000000..5e8674d
--- /dev/null
+++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr
@@ -0,0 +1,23 @@
+error[E0277]: the trait bound `for<'a> T: Bar<&'a isize>` is not satisfied
+ --> $DIR/hrtb-perfect-forwarding.rs:56:5
+ |
+LL | foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied
+ | ^^^^^^^^^^^^^^^^ the trait `for<'a> Bar<&'a isize>` is not implemented for `T`
+ |
+ = help: consider adding a `where for<'a> T: Bar<&'a isize>` bound
+ = note: required because of the requirements on the impl of `for<'a> Foo<&'a isize>` for `&mut T`
+note: required by `foo_hrtb_bar_not`
+ --> $DIR/hrtb-perfect-forwarding.rs:49:1
+ |
+LL | / fn foo_hrtb_bar_not<'b,T>(mut t: T)
+LL | | where T : for<'a> Foo<&'a isize> + Bar<&'b isize>
+LL | | {
+LL | | // Not OK -- The forwarding impl for `Foo` requires that `Bar` also
+... |
+LL | | foo_hrtb_bar_not(&mut t); //~ ERROR `for<'a> T: Bar<&'a isize>` is not satisfied
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/huge-array-simple.rs b/src/test/ui/huge-array-simple.rs
similarity index 100%
rename from src/test/compile-fail/huge-array-simple.rs
rename to src/test/ui/huge-array-simple.rs
diff --git a/src/test/compile-fail/huge-array.rs b/src/test/ui/huge-array.rs
similarity index 100%
rename from src/test/compile-fail/huge-array.rs
rename to src/test/ui/huge-array.rs
diff --git a/src/test/ui/huge-array.stderr b/src/test/ui/huge-array.stderr
new file mode 100644
index 0000000..38d9eff
--- /dev/null
+++ b/src/test/ui/huge-array.stderr
@@ -0,0 +1,4 @@
+error: the type `[[u8; 1518599999]; 1518600000]` is too big for the current architecture
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/huge-enum.rs b/src/test/ui/huge-enum.rs
new file mode 100644
index 0000000..17e2076
--- /dev/null
+++ b/src/test/ui/huge-enum.rs
@@ -0,0 +1,24 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// error-pattern: Option
+// normalize-stderr-test "<\[u32; \d+\]>" -> "<[u32; N]>"
+
+// FIXME: work properly with higher limits
+
+#[cfg(target_pointer_width = "32")]
+fn main() {
+ let big: Option<[u32; (1<<29)-1]> = None;
+}
+
+#[cfg(target_pointer_width = "64")]
+fn main() {
+ let big: Option<[u32; (1<<45)-1]> = None;
+}
diff --git a/src/test/ui/huge-enum.stderr b/src/test/ui/huge-enum.stderr
new file mode 100644
index 0000000..b7cf255
--- /dev/null
+++ b/src/test/ui/huge-enum.stderr
@@ -0,0 +1,4 @@
+error: the type `std::option::Option<[u32; N]>` is too big for the current architecture
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/huge-struct.rs b/src/test/ui/huge-struct.rs
new file mode 100644
index 0000000..c935ad9
--- /dev/null
+++ b/src/test/ui/huge-struct.rs
@@ -0,0 +1,56 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// normalize-stderr-test "S32" -> "SXX"
+// normalize-stderr-test "S1M" -> "SXX"
+// error-pattern: too big for the current
+
+struct S32<T> {
+ v0: T,
+ v1: T,
+ v2: T,
+ v3: T,
+ v4: T,
+ v5: T,
+ v6: T,
+ v7: T,
+ v8: T,
+ u9: T,
+ v10: T,
+ v11: T,
+ v12: T,
+ v13: T,
+ v14: T,
+ v15: T,
+ v16: T,
+ v17: T,
+ v18: T,
+ v19: T,
+ v20: T,
+ v21: T,
+ v22: T,
+ v23: T,
+ v24: T,
+ u25: T,
+ v26: T,
+ v27: T,
+ v28: T,
+ v29: T,
+ v30: T,
+ v31: T,
+}
+
+struct S1k<T> { val: S32<S32<T>> }
+
+struct S1M<T> { val: S1k<S1k<T>> }
+
+fn main() {
+ let fat: Option<S1M<S1M<S1M<u32>>>> = None;
+}
diff --git a/src/test/ui/huge-struct.stderr b/src/test/ui/huge-struct.stderr
new file mode 100644
index 0000000..06b084b
--- /dev/null
+++ b/src/test/ui/huge-struct.stderr
@@ -0,0 +1,4 @@
+error: the type `SXX<SXX<SXX<u32>>>` is too big for the current architecture
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/hygienic-label-1.rs b/src/test/ui/hygiene/hygienic-label-1.rs
similarity index 100%
rename from src/test/compile-fail/hygienic-label-1.rs
rename to src/test/ui/hygiene/hygienic-label-1.rs
diff --git a/src/test/ui/hygiene/hygienic-label-1.stderr b/src/test/ui/hygiene/hygienic-label-1.stderr
new file mode 100644
index 0000000..051466b
--- /dev/null
+++ b/src/test/ui/hygiene/hygienic-label-1.stderr
@@ -0,0 +1,12 @@
+error[E0426]: use of undeclared label `'x`
+ --> $DIR/hygienic-label-1.rs:12:19
+ |
+LL | () => { break 'x; } //~ ERROR use of undeclared label `'x`
+ | ^^ did you mean `'x`?
+...
+LL | 'x: loop { foo!() }
+ | ------ in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0426`.
diff --git a/src/test/compile-fail/hygienic-label-2.rs b/src/test/ui/hygiene/hygienic-label-2.rs
similarity index 100%
rename from src/test/compile-fail/hygienic-label-2.rs
rename to src/test/ui/hygiene/hygienic-label-2.rs
diff --git a/src/test/ui/hygiene/hygienic-label-2.stderr b/src/test/ui/hygiene/hygienic-label-2.stderr
new file mode 100644
index 0000000..081c1c7
--- /dev/null
+++ b/src/test/ui/hygiene/hygienic-label-2.stderr
@@ -0,0 +1,9 @@
+error[E0426]: use of undeclared label `'x`
+ --> $DIR/hygienic-label-2.rs:16:16
+ |
+LL | foo!(break 'x); //~ ERROR use of undeclared label `'x`
+ | ^^ did you mean `'x`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0426`.
diff --git a/src/test/compile-fail/hygienic-label-3.rs b/src/test/ui/hygiene/hygienic-label-3.rs
similarity index 100%
rename from src/test/compile-fail/hygienic-label-3.rs
rename to src/test/ui/hygiene/hygienic-label-3.rs
diff --git a/src/test/ui/hygiene/hygienic-label-3.stderr b/src/test/ui/hygiene/hygienic-label-3.stderr
new file mode 100644
index 0000000..e5593df
--- /dev/null
+++ b/src/test/ui/hygiene/hygienic-label-3.stderr
@@ -0,0 +1,12 @@
+error[E0426]: use of undeclared label `'x`
+ --> $DIR/hygienic-label-3.rs:12:19
+ |
+LL | () => { break 'x; } //~ ERROR use of undeclared label `'x`
+ | ^^ did you mean `'x`?
+...
+LL | foo!()
+ | ------ in this macro invocation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0426`.
diff --git a/src/test/compile-fail/hygienic-label-4.rs b/src/test/ui/hygiene/hygienic-label-4.rs
similarity index 100%
rename from src/test/compile-fail/hygienic-label-4.rs
rename to src/test/ui/hygiene/hygienic-label-4.rs
diff --git a/src/test/ui/hygiene/hygienic-label-4.stderr b/src/test/ui/hygiene/hygienic-label-4.stderr
new file mode 100644
index 0000000..6035138
--- /dev/null
+++ b/src/test/ui/hygiene/hygienic-label-4.stderr
@@ -0,0 +1,9 @@
+error[E0426]: use of undeclared label `'x`
+ --> $DIR/hygienic-label-4.rs:16:16
+ |
+LL | foo!(break 'x); //~ ERROR use of undeclared label `'x`
+ | ^^ did you mean `'x`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0426`.
diff --git a/src/test/ui/hygiene/local_inner_macros.rs b/src/test/ui/hygiene/local_inner_macros.rs
index 787e2df..92e10c1 100644
--- a/src/test/ui/hygiene/local_inner_macros.rs
+++ b/src/test/ui/hygiene/local_inner_macros.rs
@@ -11,8 +11,6 @@
// compile-pass
// aux-build:local_inner_macros.rs
-#![feature(use_extern_macros)]
-
extern crate local_inner_macros;
use local_inner_macros::{public_macro, public_macro_dynamic};
diff --git a/src/test/ui/hygiene/local_inner_macros_disabled.rs b/src/test/ui/hygiene/local_inner_macros_disabled.rs
deleted file mode 100644
index 0a4bdb7..0000000
--- a/src/test/ui/hygiene/local_inner_macros_disabled.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-// `local_inner_macros` has no effect if `feature(use_extern_macros)` is not enabled
-
-// aux-build:local_inner_macros.rs
-
-#[macro_use(public_macro)]
-extern crate local_inner_macros;
-
-public_macro!(); //~ ERROR cannot find macro `helper2!` in this scope
-
-fn main() {}
diff --git a/src/test/ui/hygiene/local_inner_macros_disabled.stderr b/src/test/ui/hygiene/local_inner_macros_disabled.stderr
deleted file mode 100644
index 3dcd03b..0000000
--- a/src/test/ui/hygiene/local_inner_macros_disabled.stderr
+++ /dev/null
@@ -1,10 +0,0 @@
-error: cannot find macro `helper2!` in this scope
- --> $DIR/local_inner_macros_disabled.rs:18:1
- |
-LL | public_macro!(); //~ ERROR cannot find macro `helper2!` in this scope
- | ^^^^^^^^^^^^^^^^
- |
- = 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: aborting due to previous error
-
diff --git a/src/test/compile-fail/if-branch-types.rs b/src/test/ui/if/if-branch-types.rs
similarity index 100%
rename from src/test/compile-fail/if-branch-types.rs
rename to src/test/ui/if/if-branch-types.rs
diff --git a/src/test/ui/if/if-branch-types.stderr b/src/test/ui/if/if-branch-types.stderr
new file mode 100644
index 0000000..cefd94d
--- /dev/null
+++ b/src/test/ui/if/if-branch-types.stderr
@@ -0,0 +1,12 @@
+error[E0308]: if and else have incompatible types
+ --> $DIR/if-branch-types.rs:12:13
+ |
+LL | let x = if true { 10i32 } else { 10u32 };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found u32
+ |
+ = note: expected type `i32`
+ found type `u32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/if-let-arm-types.rs b/src/test/ui/if/if-let-arm-types.rs
similarity index 100%
rename from src/test/ui/if-let-arm-types.rs
rename to src/test/ui/if/if-let-arm-types.rs
diff --git a/src/test/ui/if-let-arm-types.stderr b/src/test/ui/if/if-let-arm-types.stderr
similarity index 100%
rename from src/test/ui/if-let-arm-types.stderr
rename to src/test/ui/if/if-let-arm-types.stderr
diff --git a/src/test/compile-fail/if-let.rs b/src/test/ui/if/if-let.rs
similarity index 100%
rename from src/test/compile-fail/if-let.rs
rename to src/test/ui/if/if-let.rs
diff --git a/src/test/ui/if/if-let.stderr b/src/test/ui/if/if-let.stderr
new file mode 100644
index 0000000..de8d6fe
--- /dev/null
+++ b/src/test/ui/if/if-let.stderr
@@ -0,0 +1,39 @@
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/if-let.rs:23:10
+ |
+LL | foo!(a, 1, { //~ ERROR irrefutable if-let
+ | ^ irrefutable pattern
+
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/if-let.rs:26:10
+ |
+LL | bar!(a, 1, { //~ ERROR irrefutable if-let
+ | ^ irrefutable pattern
+
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/if-let.rs:32:12
+ |
+LL | if let a = 1 { //~ ERROR irrefutable if-let
+ | ^ irrefutable pattern
+
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/if-let.rs:36:12
+ |
+LL | if let a = 1 { //~ ERROR irrefutable if-let
+ | ^ irrefutable pattern
+
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/if-let.rs:46:19
+ |
+LL | } else if let a = 1 { //~ ERROR irrefutable if-let
+ | ^ irrefutable pattern
+
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/if-let.rs:52:19
+ |
+LL | } else if let a = 1 { //~ ERROR irrefutable if-let
+ | ^ irrefutable pattern
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0162`.
diff --git a/src/test/compile-fail/if-loop.rs b/src/test/ui/if/if-loop.rs
similarity index 100%
rename from src/test/compile-fail/if-loop.rs
rename to src/test/ui/if/if-loop.rs
diff --git a/src/test/ui/if/if-loop.stderr b/src/test/ui/if/if-loop.stderr
new file mode 100644
index 0000000..6862560
--- /dev/null
+++ b/src/test/ui/if/if-loop.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/if-loop.rs:20:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/if-typeck.rs b/src/test/ui/if/if-typeck.rs
similarity index 100%
rename from src/test/compile-fail/if-typeck.rs
rename to src/test/ui/if/if-typeck.rs
diff --git a/src/test/ui/if/if-typeck.stderr b/src/test/ui/if/if-typeck.stderr
new file mode 100644
index 0000000..6d96f8b
--- /dev/null
+++ b/src/test/ui/if/if-typeck.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/if-typeck.rs:19:8
+ |
+LL | if f { }
+ | ^ expected bool, found fn item
+ |
+ = note: expected type `bool`
+ found type `fn() {f}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/if-without-block.rs b/src/test/ui/if/if-without-block.rs
similarity index 100%
rename from src/test/ui/if-without-block.rs
rename to src/test/ui/if/if-without-block.rs
diff --git a/src/test/ui/if-without-block.stderr b/src/test/ui/if/if-without-block.stderr
similarity index 100%
rename from src/test/ui/if-without-block.stderr
rename to src/test/ui/if/if-without-block.stderr
diff --git a/src/test/compile-fail/if-without-else-result.rs b/src/test/ui/if/if-without-else-result.rs
similarity index 100%
rename from src/test/compile-fail/if-without-else-result.rs
rename to src/test/ui/if/if-without-else-result.rs
diff --git a/src/test/ui/if/if-without-else-result.stderr b/src/test/ui/if/if-without-else-result.stderr
new file mode 100644
index 0000000..ab97f6c
--- /dev/null
+++ b/src/test/ui/if/if-without-else-result.stderr
@@ -0,0 +1,12 @@
+error[E0317]: if may be missing an else clause
+ --> $DIR/if-without-else-result.rs:12:13
+ |
+LL | let a = if true { true };
+ | ^^^^^^^^^^^^^^^^ expected (), found bool
+ |
+ = note: expected type `()`
+ found type `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0317`.
diff --git a/src/test/ui/ifmt-bad-arg.rs b/src/test/ui/if/ifmt-bad-arg.rs
similarity index 100%
rename from src/test/ui/ifmt-bad-arg.rs
rename to src/test/ui/if/ifmt-bad-arg.rs
diff --git a/src/test/ui/ifmt-bad-arg.stderr b/src/test/ui/if/ifmt-bad-arg.stderr
similarity index 100%
rename from src/test/ui/ifmt-bad-arg.stderr
rename to src/test/ui/if/ifmt-bad-arg.stderr
diff --git a/src/test/compile-fail/ifmt-bad-format-args.rs b/src/test/ui/if/ifmt-bad-format-args.rs
similarity index 100%
rename from src/test/compile-fail/ifmt-bad-format-args.rs
rename to src/test/ui/if/ifmt-bad-format-args.rs
diff --git a/src/test/ui/if/ifmt-bad-format-args.stderr b/src/test/ui/if/ifmt-bad-format-args.stderr
new file mode 100644
index 0000000..d2fe129
--- /dev/null
+++ b/src/test/ui/if/ifmt-bad-format-args.stderr
@@ -0,0 +1,18 @@
+error: requires at least a format string argument
+ --> $DIR/ifmt-bad-format-args.rs:12:5
+ |
+LL | format_args!(); //~ ERROR: requires at least a format string argument
+ | ^^^^^^^^^^^^^^^
+
+error: format argument must be a string literal
+ --> $DIR/ifmt-bad-format-args.rs:13:18
+ |
+LL | format_args!(|| {}); //~ ERROR: must be a string literal
+ | ^^^^^
+help: you might be missing a string literal to format with
+ |
+LL | format_args!("{}", || {}); //~ ERROR: must be a string literal
+ | ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/ifmt-unimpl.rs b/src/test/ui/if/ifmt-unimpl.rs
similarity index 100%
rename from src/test/compile-fail/ifmt-unimpl.rs
rename to src/test/ui/if/ifmt-unimpl.rs
diff --git a/src/test/ui/if/ifmt-unimpl.stderr b/src/test/ui/if/ifmt-unimpl.stderr
new file mode 100644
index 0000000..fbb3136
--- /dev/null
+++ b/src/test/ui/if/ifmt-unimpl.stderr
@@ -0,0 +1,12 @@
+error[E0277]: the trait bound `str: std::fmt::UpperHex` is not satisfied
+ --> $DIR/ifmt-unimpl.rs:12:21
+ |
+LL | format!("{:X}", "3");
+ | ^^^ the trait `std::fmt::UpperHex` is not implemented for `str`
+ |
+ = note: required because of the requirements on the impl of `std::fmt::UpperHex` for `&str`
+ = note: required by `std::fmt::UpperHex::fmt`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/ifmt-unknown-trait.rs b/src/test/ui/if/ifmt-unknown-trait.rs
similarity index 100%
rename from src/test/compile-fail/ifmt-unknown-trait.rs
rename to src/test/ui/if/ifmt-unknown-trait.rs
diff --git a/src/test/ui/if/ifmt-unknown-trait.stderr b/src/test/ui/if/ifmt-unknown-trait.stderr
new file mode 100644
index 0000000..3c746e4
--- /dev/null
+++ b/src/test/ui/if/ifmt-unknown-trait.stderr
@@ -0,0 +1,8 @@
+error: unknown format trait `notimplemented`
+ --> $DIR/ifmt-unknown-trait.rs:12:34
+ |
+LL | format!("{:notimplemented}", "3");
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/illegal-ufcs-drop.rs b/src/test/ui/illegal-ufcs-drop.rs
similarity index 100%
rename from src/test/compile-fail/illegal-ufcs-drop.rs
rename to src/test/ui/illegal-ufcs-drop.rs
diff --git a/src/test/ui/illegal-ufcs-drop.stderr b/src/test/ui/illegal-ufcs-drop.stderr
new file mode 100644
index 0000000..f82c546
--- /dev/null
+++ b/src/test/ui/illegal-ufcs-drop.stderr
@@ -0,0 +1,9 @@
+error[E0040]: explicit use of destructor method
+ --> $DIR/illegal-ufcs-drop.rs:19:5
+ |
+LL | Drop::drop(&mut Foo) //~ ERROR explicit use of destructor method
+ | ^^^^^^^^^^ explicit destructor calls not allowed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0040`.
diff --git a/src/test/ui/immut-function-arguments.ast.nll.stderr b/src/test/ui/immut-function-arguments.ast.nll.stderr
new file mode 100644
index 0000000..d33814a
--- /dev/null
+++ b/src/test/ui/immut-function-arguments.ast.nll.stderr
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
+ --> $DIR/immut-function-arguments.rs:15:5
+ |
+LL | fn f(y: Box<isize>) {
+ | - help: consider changing this to be mutable: `mut y`
+LL | *y = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
+ --> $DIR/immut-function-arguments.rs:20:35
+ |
+LL | let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
+ | - ^^^^^^ cannot assign
+ | |
+ | help: consider changing this to be mutable: `mut q`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/immut-function-arguments.ast.stderr b/src/test/ui/immut-function-arguments.ast.stderr
new file mode 100644
index 0000000..54125b9
--- /dev/null
+++ b/src/test/ui/immut-function-arguments.ast.stderr
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to immutable `Box` content `*y`
+ --> $DIR/immut-function-arguments.rs:15:5
+ |
+LL | fn f(y: Box<isize>) {
+ | - consider changing this to `mut y`
+LL | *y = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to immutable `Box` content `*q`
+ --> $DIR/immut-function-arguments.rs:20:35
+ |
+LL | let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
+ | - ^^^^^^ cannot borrow as mutable
+ | |
+ | consider changing this to `mut q`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/immut-function-arguments.mir.stderr b/src/test/ui/immut-function-arguments.mir.stderr
new file mode 100644
index 0000000..d33814a
--- /dev/null
+++ b/src/test/ui/immut-function-arguments.mir.stderr
@@ -0,0 +1,19 @@
+error[E0594]: cannot assign to `*y`, as `y` is not declared as mutable
+ --> $DIR/immut-function-arguments.rs:15:5
+ |
+LL | fn f(y: Box<isize>) {
+ | - help: consider changing this to be mutable: `mut y`
+LL | *y = 5; //[ast]~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `*q`, as `q` is not declared as mutable
+ --> $DIR/immut-function-arguments.rs:20:35
+ |
+LL | let _frob = |q: Box<isize>| { *q = 2; }; //[ast]~ ERROR cannot assign
+ | - ^^^^^^ cannot assign
+ | |
+ | help: consider changing this to be mutable: `mut q`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/ui/immut-function-arguments.rs
similarity index 100%
rename from src/test/compile-fail/immut-function-arguments.rs
rename to src/test/ui/immut-function-arguments.rs
diff --git a/src/test/compile-fail/impl-bounds-checking.rs b/src/test/ui/impl-bounds-checking.rs
similarity index 100%
rename from src/test/compile-fail/impl-bounds-checking.rs
rename to src/test/ui/impl-bounds-checking.rs
diff --git a/src/test/ui/impl-bounds-checking.stderr b/src/test/ui/impl-bounds-checking.stderr
new file mode 100644
index 0000000..8066613
--- /dev/null
+++ b/src/test/ui/impl-bounds-checking.stderr
@@ -0,0 +1,9 @@
+error[E0277]: the trait bound `isize: Clone2` is not satisfied
+ --> $DIR/impl-bounds-checking.rs:20:6
+ |
+LL | impl Getter<isize> for isize { //~ ERROR `isize: Clone2` is not satisfied
+ | ^^^^^^^^^^^^^ the trait `Clone2` is not implemented for `isize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/impl-trait/impl-generic-mismatch-ab.rs b/src/test/ui/impl-trait/impl-generic-mismatch-ab.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/impl-generic-mismatch-ab.rs
rename to src/test/ui/impl-trait/impl-generic-mismatch-ab.rs
diff --git a/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr
new file mode 100644
index 0000000..77ecdf2
--- /dev/null
+++ b/src/test/ui/impl-trait/impl-generic-mismatch-ab.stderr
@@ -0,0 +1,15 @@
+error[E0053]: method `foo` has an incompatible type for trait
+ --> $DIR/impl-generic-mismatch-ab.rs:18:32
+ |
+LL | fn foo<A: Debug>(&self, a: &A, b: &impl Debug);
+ | -- type in trait
+...
+LL | fn foo<B: Debug>(&self, a: &impl Debug, b: &B) { }
+ | ^^^^^^^^^^^ expected type parameter, found a different type parameter
+ |
+ = note: expected type `fn(&(), &B, &impl Debug)`
+ found type `fn(&(), &impl Debug, &B)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/ui/impl_trait_projections.rs b/src/test/ui/impl-trait/impl_trait_projections.rs
similarity index 100%
rename from src/test/ui/impl_trait_projections.rs
rename to src/test/ui/impl-trait/impl_trait_projections.rs
diff --git a/src/test/ui/impl_trait_projections.stderr b/src/test/ui/impl-trait/impl_trait_projections.stderr
similarity index 100%
rename from src/test/ui/impl_trait_projections.stderr
rename to src/test/ui/impl-trait/impl_trait_projections.stderr
diff --git a/src/test/compile-fail/impl-trait/infinite-impl-trait-issue-38064.rs b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/infinite-impl-trait-issue-38064.rs
rename to src/test/ui/impl-trait/infinite-impl-trait-issue-38064.rs
diff --git a/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr
new file mode 100644
index 0000000..f260cce
--- /dev/null
+++ b/src/test/ui/impl-trait/infinite-impl-trait-issue-38064.stderr
@@ -0,0 +1,7 @@
+error[E0275]: overflow evaluating the requirement `impl Quux`
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
new file mode 100644
index 0000000..97cb2cc
--- /dev/null
+++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
@@ -0,0 +1,73 @@
+warning: not reporting region error due to nll
+ --> $DIR/must_outlive_least_region_or_bound.rs:13:35
+ |
+LL | fn elided(x: &i32) -> impl Copy { x }
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/must_outlive_least_region_or_bound.rs:16:44
+ |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/must_outlive_least_region_or_bound.rs:22:69
+ |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/must_outlive_least_region_or_bound.rs:29:5
+ |
+LL | move |_| println!("{}", y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/must_outlive_least_region_or_bound.rs:32:51
+ |
+LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/must_outlive_least_region_or_bound.rs:13:35
+ |
+LL | fn elided(x: &i32) -> impl Copy { x }
+ | ---- ^ lifetime `'static` required
+ | |
+ | help: add explicit lifetime `'static` to the type of `x`: `&'static i32`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/must_outlive_least_region_or_bound.rs:16:44
+ |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
+ | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/must_outlive_least_region_or_bound.rs:22:69
+ |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+ | -- lifetime `'a` defined here ^ returning this value requires that `'a` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/must_outlive_least_region_or_bound.rs:29:5
+ |
+LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | //~^ ERROR lifetime mismatch
+LL | move |_| println!("{}", y)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/must_outlive_least_region_or_bound.rs:34:5
+ |
+LL | x
+ | ^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0310, E0621.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/must_outlive_least_region_or_bound.rs
rename to src/test/ui/impl-trait/must_outlive_least_region_or_bound.rs
diff --git a/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr
new file mode 100644
index 0000000..48686cb
--- /dev/null
+++ b/src/test/ui/impl-trait/must_outlive_least_region_or_bound.stderr
@@ -0,0 +1,71 @@
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/must_outlive_least_region_or_bound.rs:13:23
+ |
+LL | fn elided(x: &i32) -> impl Copy { x }
+ | ---- ^^^^^^^^^ lifetime `'static` required
+ | |
+ | help: add explicit lifetime `'static` to the type of `x`: `&'static i32`
+
+error: cannot infer an appropriate lifetime
+ --> $DIR/must_outlive_least_region_or_bound.rs:16:44
+ |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
+ | --------- ^ ...but this borrow...
+ | |
+ | this return type evaluates to the `'static` lifetime...
+ |
+note: ...can't outlive the lifetime 'a as defined on the function body at 16:13
+ --> $DIR/must_outlive_least_region_or_bound.rs:16:13
+ |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
+ | ^^
+help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the function body at 16:13
+ |
+LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
+ | ^^^^^^^^^^^^^^
+
+error: cannot infer an appropriate lifetime
+ --> $DIR/must_outlive_least_region_or_bound.rs:22:69
+ |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+ | -------------------------------- ^ ...but this borrow...
+ | |
+ | this return type evaluates to the `'static` lifetime...
+ |
+note: ...can't outlive the lifetime 'a as defined on the function body at 22:15
+ --> $DIR/must_outlive_least_region_or_bound.rs:22:15
+ |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
+ | ^^
+help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime 'a as defined on the function body at 22:15
+ |
+LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static + 'a { x }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0623]: lifetime mismatch
+ --> $DIR/must_outlive_least_region_or_bound.rs:27:61
+ |
+LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
+ | ------- ^^^^^^^^^^^^^^^^
+ | | |
+ | | ...but data from `y` is returned here
+ | this parameter and the return type are declared with different lifetimes...
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/must_outlive_least_region_or_bound.rs:32:51
+ |
+LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
+ | -- ^^^^^^^^^^^^^^^^^^^^
+ | |
+ | help: consider adding an explicit lifetime bound `T: 'static`...
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/must_outlive_least_region_or_bound.rs:32:51
+ |
+LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0310, E0621, E0623.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/impl-trait/needs_least_region_or_bound.rs b/src/test/ui/impl-trait/needs_least_region_or_bound.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/needs_least_region_or_bound.rs
rename to src/test/ui/impl-trait/needs_least_region_or_bound.rs
diff --git a/src/test/ui/impl-trait/needs_least_region_or_bound.stderr b/src/test/ui/impl-trait/needs_least_region_or_bound.stderr
new file mode 100644
index 0000000..fd2665d
--- /dev/null
+++ b/src/test/ui/impl-trait/needs_least_region_or_bound.stderr
@@ -0,0 +1,8 @@
+error: ambiguous lifetime bound in `impl Trait`
+ --> $DIR/needs_least_region_or_bound.rs:16:55
+ |
+LL | fn no_least_region<'a, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ neither `'a` nor `'b` outlives the other
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/impl-trait/no-trait.rs b/src/test/ui/impl-trait/no-trait.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/no-trait.rs
rename to src/test/ui/impl-trait/no-trait.rs
diff --git a/src/test/ui/impl-trait/no-trait.stderr b/src/test/ui/impl-trait/no-trait.stderr
new file mode 100644
index 0000000..fdd01c8
--- /dev/null
+++ b/src/test/ui/impl-trait/no-trait.stderr
@@ -0,0 +1,8 @@
+error: at least one trait must be specified
+ --> $DIR/no-trait.rs:11:11
+ |
+LL | fn f() -> impl 'static {} //~ ERROR at least one trait must be specified
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/impl-trait/type_parameters_captured.nll.stderr b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr
new file mode 100644
index 0000000..823ee44
--- /dev/null
+++ b/src/test/ui/impl-trait/type_parameters_captured.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/type_parameters_captured.rs:17:20
+ |
+LL | fn foo<T>(x: T) -> impl Any + 'static {
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/type_parameters_captured.rs:19:5
+ |
+LL | x
+ | ^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/impl-trait/type_parameters_captured.rs b/src/test/ui/impl-trait/type_parameters_captured.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/type_parameters_captured.rs
rename to src/test/ui/impl-trait/type_parameters_captured.rs
diff --git a/src/test/ui/impl-trait/type_parameters_captured.stderr b/src/test/ui/impl-trait/type_parameters_captured.stderr
new file mode 100644
index 0000000..3b9b0e0
--- /dev/null
+++ b/src/test/ui/impl-trait/type_parameters_captured.stderr
@@ -0,0 +1,17 @@
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/type_parameters_captured.rs:17:20
+ |
+LL | fn foo<T>(x: T) -> impl Any + 'static {
+ | - ^^^^^^^^^^^^^^^^^^
+ | |
+ | help: consider adding an explicit lifetime bound `T: 'static`...
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/type_parameters_captured.rs:17:20
+ |
+LL | fn foo<T>(x: T) -> impl Any + 'static {
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/impl-trait/where-allowed.rs b/src/test/ui/impl-trait/where-allowed.rs
similarity index 100%
rename from src/test/compile-fail/impl-trait/where-allowed.rs
rename to src/test/ui/impl-trait/where-allowed.rs
diff --git a/src/test/ui/impl-trait/where-allowed.stderr b/src/test/ui/impl-trait/where-allowed.stderr
new file mode 100644
index 0000000..b15893e
--- /dev/null
+++ b/src/test/ui/impl-trait/where-allowed.stderr
@@ -0,0 +1,244 @@
+error[E0666]: nested `impl Trait` is not allowed
+ --> $DIR/where-allowed.rs:60:51
+ |
+LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
+ | --------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0666]: nested `impl Trait` is not allowed
+ --> $DIR/where-allowed.rs:69:57
+ |
+LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
+ | --------^^^^^^^^^^-
+ | | |
+ | | nested `impl Trait` here
+ | outer `impl Trait`
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:28:40
+ |
+LL | fn in_fn_parameter_in_parameters(_: fn(impl Debug)) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:32:42
+ |
+LL | fn in_fn_return_in_parameters(_: fn() -> impl Debug) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:36:38
+ |
+LL | fn in_fn_parameter_in_return() -> fn(impl Debug) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:40:40
+ |
+LL | fn in_fn_return_in_return() -> fn() -> impl Debug { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:44:49
+ |
+LL | fn in_dyn_Fn_parameter_in_parameters(_: &dyn Fn(impl Debug)) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:48:51
+ |
+LL | fn in_dyn_Fn_return_in_parameters(_: &dyn Fn() -> impl Debug) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:52:55
+ |
+LL | fn in_dyn_Fn_parameter_in_return() -> &'static dyn Fn(impl Debug) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:56:57
+ |
+LL | fn in_dyn_Fn_return_in_return() -> &'static dyn Fn() -> impl Debug { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:60:51
+ |
+LL | fn in_impl_Fn_parameter_in_parameters(_: &impl Fn(impl Debug)) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:65:53
+ |
+LL | fn in_impl_Fn_return_in_parameters(_: &impl Fn() -> impl Debug) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:69:57
+ |
+LL | fn in_impl_Fn_parameter_in_return() -> &'static impl Fn(impl Debug) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:74:59
+ |
+LL | fn in_impl_Fn_return_in_return() -> &'static impl Fn() -> impl Debug { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:78:38
+ |
+LL | fn in_Fn_parameter_in_generics<F: Fn(impl Debug)> (_: F) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:82:40
+ |
+LL | fn in_Fn_return_in_generics<F: Fn() -> impl Debug> (_: F) { panic!() }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:95:32
+ |
+LL | struct InBraceStructField { x: impl Debug }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:99:41
+ |
+LL | struct InAdtInBraceStructField { x: Vec<impl Debug> }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:103:27
+ |
+LL | struct InTupleStructField(impl Debug);
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:108:25
+ |
+LL | InBraceVariant { x: impl Debug },
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:110:20
+ |
+LL | InTupleVariant(impl Debug),
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:121:23
+ |
+LL | fn in_return() -> impl Debug;
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:132:16
+ |
+LL | type Out = impl Debug;
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:138:34
+ |
+LL | fn in_trait_impl_return() -> impl Debug { () }
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:151:33
+ |
+LL | fn in_foreign_parameters(_: impl Debug);
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:154:31
+ |
+LL | fn in_foreign_return() -> impl Debug;
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:167:23
+ |
+LL | type InTypeAlias<R> = impl Debug;
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:170:39
+ |
+LL | type InReturnInTypeAlias<R> = fn() -> impl Debug;
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:174:16
+ |
+LL | impl PartialEq<impl Debug> for () {
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:179:24
+ |
+LL | impl PartialEq<()> for impl Debug {
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:184:6
+ |
+LL | impl impl Debug {
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:190:24
+ |
+LL | impl InInherentImplAdt<impl Debug> {
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:196:11
+ |
+LL | where impl Debug: Debug
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:203:15
+ |
+LL | where Vec<impl Debug>: Debug
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:210:24
+ |
+LL | where T: PartialEq<impl Debug>
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:217:17
+ |
+LL | where T: Fn(impl Debug)
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:224:22
+ |
+LL | where T: Fn() -> impl Debug
+ | ^^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:230:29
+ |
+LL | let _in_local_variable: impl Fn() = || {};
+ | ^^^^^^^^^
+
+error[E0562]: `impl Trait` not allowed outside of function and inherent method return types
+ --> $DIR/where-allowed.rs:232:46
+ |
+LL | let _in_return_in_local_variable = || -> impl Fn() { || {} };
+ | ^^^^^^^^^
+
+error: aborting due to 39 previous errors
+
+Some errors occurred: E0562, E0666.
+For more information about an error, try `rustc --explain E0562`.
diff --git a/src/test/compile-fail/impl-unused-tps-inherent.rs b/src/test/ui/impl-unused-tps-inherent.rs
similarity index 100%
rename from src/test/compile-fail/impl-unused-tps-inherent.rs
rename to src/test/ui/impl-unused-tps-inherent.rs
diff --git a/src/test/ui/impl-unused-tps-inherent.stderr b/src/test/ui/impl-unused-tps-inherent.stderr
new file mode 100644
index 0000000..c1f31de
--- /dev/null
+++ b/src/test/ui/impl-unused-tps-inherent.stderr
@@ -0,0 +1,15 @@
+error[E0207]: the type parameter `T` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps-inherent.rs:19:6
+ |
+LL | impl<T> MyType {
+ | ^ unconstrained type parameter
+
+error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps-inherent.rs:27:8
+ |
+LL | impl<T,U> MyType1<T> {
+ | ^ unconstrained type parameter
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/src/test/compile-fail/impl-unused-tps.rs b/src/test/ui/impl-unused-tps.rs
similarity index 100%
rename from src/test/compile-fail/impl-unused-tps.rs
rename to src/test/ui/impl-unused-tps.rs
diff --git a/src/test/ui/impl-unused-tps.stderr b/src/test/ui/impl-unused-tps.stderr
new file mode 100644
index 0000000..f50cc00
--- /dev/null
+++ b/src/test/ui/impl-unused-tps.stderr
@@ -0,0 +1,33 @@
+error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps.rs:23:8
+ |
+LL | impl<T,U> Foo<T> for [isize;1] {
+ | ^ unconstrained type parameter
+
+error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps.rs:40:8
+ |
+LL | impl<T,U> Bar for T {
+ | ^ unconstrained type parameter
+
+error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps.rs:48:8
+ |
+LL | impl<T,U> Bar for T
+ | ^ unconstrained type parameter
+
+error[E0207]: the type parameter `U` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps.rs:56:8
+ |
+LL | impl<T,U,V> Foo<T> for T
+ | ^ unconstrained type parameter
+
+error[E0207]: the type parameter `V` is not constrained by the impl trait, self type, or predicates
+ --> $DIR/impl-unused-tps.rs:56:10
+ |
+LL | impl<T,U,V> Foo<T> for T
+ | ^ unconstrained type parameter
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0207`.
diff --git a/src/test/compile-fail/implicit-method-bind.rs b/src/test/ui/implicit-method-bind.rs
similarity index 100%
rename from src/test/compile-fail/implicit-method-bind.rs
rename to src/test/ui/implicit-method-bind.rs
diff --git a/src/test/ui/implicit-method-bind.stderr b/src/test/ui/implicit-method-bind.stderr
new file mode 100644
index 0000000..5de9e58
--- /dev/null
+++ b/src/test/ui/implicit-method-bind.stderr
@@ -0,0 +1,11 @@
+error[E0615]: attempted to take value of method `abs` on type `i32`
+ --> $DIR/implicit-method-bind.rs:12:20
+ |
+LL | let _f = 10i32.abs; //~ ERROR attempted to take value of method
+ | ^^^
+ |
+ = help: maybe a `()` to call it is missing?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0615`.
diff --git a/src/test/compile-fail/import.rs b/src/test/ui/import.rs
similarity index 100%
rename from src/test/compile-fail/import.rs
rename to src/test/ui/import.rs
diff --git a/src/test/ui/import.stderr b/src/test/ui/import.stderr
new file mode 100644
index 0000000..8966558
--- /dev/null
+++ b/src/test/ui/import.stderr
@@ -0,0 +1,22 @@
+error[E0432]: unresolved import `zed::baz`
+ --> $DIR/import.rs:12:5
+ |
+LL | use zed::baz; //~ ERROR unresolved import `zed::baz` [E0432]
+ | ^^^^^^^^ no `baz` in `zed`. Did you mean to use `bar`?
+
+error[E0432]: unresolved import `foo`
+ --> $DIR/import.rs:18:9
+ |
+LL | use foo; //~ ERROR unresolved import `foo` [E0432]
+ | ^^^ no `foo` in the root
+
+error[E0603]: unresolved item `foo` is private
+ --> $DIR/import.rs:23:5
+ |
+LL | zed::foo(); //~ ERROR `foo` is private
+ | ^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0432, E0603.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/import2.rs b/src/test/ui/import2.rs
similarity index 100%
rename from src/test/compile-fail/import2.rs
rename to src/test/ui/import2.rs
diff --git a/src/test/ui/import2.stderr b/src/test/ui/import2.stderr
new file mode 100644
index 0000000..c075068
--- /dev/null
+++ b/src/test/ui/import2.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `baz::zed`
+ --> $DIR/import2.rs:11:10
+ |
+LL | use baz::zed::bar; //~ ERROR unresolved import `baz::zed` [E0432]
+ | ^^^ Could not find `zed` in `baz`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/import3.rs b/src/test/ui/import3.rs
similarity index 100%
rename from src/test/compile-fail/import3.rs
rename to src/test/ui/import3.rs
diff --git a/src/test/ui/import3.stderr b/src/test/ui/import3.stderr
new file mode 100644
index 0000000..5211b86
--- /dev/null
+++ b/src/test/ui/import3.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `main`
+ --> $DIR/import3.rs:12:5
+ |
+LL | use main::bar;
+ | ^^^^ Maybe a missing `extern crate main;`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/import4.rs b/src/test/ui/import4.rs
similarity index 100%
rename from src/test/compile-fail/import4.rs
rename to src/test/ui/import4.rs
diff --git a/src/test/ui/import4.stderr b/src/test/ui/import4.stderr
new file mode 100644
index 0000000..d74e781
--- /dev/null
+++ b/src/test/ui/import4.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `a::foo`
+ --> $DIR/import4.rs:15:17
+ |
+LL | mod b { pub use a::foo; }
+ | ^^^^^^ no `foo` in `a`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/auxiliary/import_crate_var.rs b/src/test/ui/imports/auxiliary/import_crate_var.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/import_crate_var.rs
rename to src/test/ui/imports/auxiliary/import_crate_var.rs
diff --git a/src/test/ui/imports/import-crate-var.rs b/src/test/ui/imports/import-crate-var.rs
new file mode 100644
index 0000000..b09883d
--- /dev/null
+++ b/src/test/ui/imports/import-crate-var.rs
@@ -0,0 +1,22 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// aux-build:import_crate_var.rs
+
+#![feature(rustc_attrs)]
+
+#[macro_use] extern crate import_crate_var;
+
+#[rustc_error]
+fn main() { //~ ERROR compilation successful
+ m!();
+ //~^ WARN `$crate` may not be imported
+ //~| NOTE `use $crate;` was erroneously allowed and will become a hard error
+}
diff --git a/src/test/ui/imports/import-crate-var.stderr b/src/test/ui/imports/import-crate-var.stderr
new file mode 100644
index 0000000..3f02223
--- /dev/null
+++ b/src/test/ui/imports/import-crate-var.stderr
@@ -0,0 +1,21 @@
+warning: `$crate` may not be imported
+ --> $DIR/import-crate-var.rs:19:5
+ |
+LL | m!();
+ | ^^^^^
+ |
+ = note: `use $crate;` was erroneously allowed and will become a hard error in a future release
+ = 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: compilation successful
+ --> $DIR/import-crate-var.rs:18:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | m!();
+LL | | //~^ WARN `$crate` may not be imported
+LL | | //~| NOTE `use $crate;` was erroneously allowed and will become a hard error
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/import-from-missing.rs b/src/test/ui/imports/import-from-missing.rs
similarity index 100%
rename from src/test/compile-fail/import-from-missing.rs
rename to src/test/ui/imports/import-from-missing.rs
diff --git a/src/test/ui/imports/import-from-missing.stderr b/src/test/ui/imports/import-from-missing.stderr
new file mode 100644
index 0000000..1b40fe4
--- /dev/null
+++ b/src/test/ui/imports/import-from-missing.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `spam::eggs`
+ --> $DIR/import-from-missing.rs:11:17
+ |
+LL | use spam::{ham, eggs}; //~ ERROR unresolved import `spam::eggs` [E0432]
+ | ^^^^ no `eggs` in `spam`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/import-glob-0.rs b/src/test/ui/imports/import-glob-0.rs
similarity index 100%
rename from src/test/compile-fail/import-glob-0.rs
rename to src/test/ui/imports/import-glob-0.rs
diff --git a/src/test/ui/imports/import-glob-0.stderr b/src/test/ui/imports/import-glob-0.stderr
new file mode 100644
index 0000000..91cae30
--- /dev/null
+++ b/src/test/ui/imports/import-glob-0.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find function `f999` in this scope
+ --> $DIR/import-glob-0.rs:24:5
+ |
+LL | f999(); //~ ERROR cannot find function `f999` in this scope
+ | ^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/import-glob-circular.rs b/src/test/ui/imports/import-glob-circular.rs
similarity index 100%
rename from src/test/compile-fail/import-glob-circular.rs
rename to src/test/ui/imports/import-glob-circular.rs
diff --git a/src/test/ui/imports/import-glob-circular.stderr b/src/test/ui/imports/import-glob-circular.stderr
new file mode 100644
index 0000000..078a6a3
--- /dev/null
+++ b/src/test/ui/imports/import-glob-circular.stderr
@@ -0,0 +1,14 @@
+error[E0425]: cannot find function `f1066` in this scope
+ --> $DIR/import-glob-circular.rs:26:17
+ |
+LL | fn test() { f1066(); } //~ ERROR cannot find function `f1066` in this scope
+ | ^^^^^ not found in this scope
+
+error[E0601]: `main` function not found in crate `import_glob_circular`
+ |
+ = note: consider adding a `main` function to `$DIR/import-glob-circular.rs`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0425, E0601.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/import-loop-2.rs b/src/test/ui/imports/import-loop-2.rs
similarity index 100%
rename from src/test/compile-fail/import-loop-2.rs
rename to src/test/ui/imports/import-loop-2.rs
diff --git a/src/test/ui/imports/import-loop-2.stderr b/src/test/ui/imports/import-loop-2.stderr
new file mode 100644
index 0000000..717f746
--- /dev/null
+++ b/src/test/ui/imports/import-loop-2.stderr
@@ -0,0 +1,19 @@
+error[E0432]: unresolved import `a::x`
+ --> $DIR/import-loop-2.rs:18:13
+ |
+LL | pub use a::x;
+ | ^^^^ no `x` in `a`
+
+error[E0601]: `main` function not found in crate `import_loop_2`
+ |
+ = note: the main function must be defined at the crate level but you have one or more functions named 'main' that are not defined at the crate level. Either move the definition or attach the `#[main]` attribute to override this behavior.
+note: here is a function named 'main'
+ --> $DIR/import-loop-2.rs:20:5
+ |
+LL | fn main() { let y = x; }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0432, E0601.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/import-loop.rs b/src/test/ui/imports/import-loop.rs
similarity index 100%
rename from src/test/compile-fail/import-loop.rs
rename to src/test/ui/imports/import-loop.rs
diff --git a/src/test/ui/imports/import-loop.stderr b/src/test/ui/imports/import-loop.stderr
new file mode 100644
index 0000000..b9a1204
--- /dev/null
+++ b/src/test/ui/imports/import-loop.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `y::x`
+ --> $DIR/import-loop.rs:16:13
+ |
+LL | pub use y::x;
+ | ^^^^ no `x` in `y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/import-prefix-macro-1.rs b/src/test/ui/imports/import-prefix-macro-1.rs
similarity index 100%
rename from src/test/compile-fail/import-prefix-macro-1.rs
rename to src/test/ui/imports/import-prefix-macro-1.rs
diff --git a/src/test/ui/imports/import-prefix-macro-1.stderr b/src/test/ui/imports/import-prefix-macro-1.stderr
new file mode 100644
index 0000000..e3f436e
--- /dev/null
+++ b/src/test/ui/imports/import-prefix-macro-1.stderr
@@ -0,0 +1,11 @@
+error: expected one of `::`, `;`, or `as`, found `{`
+ --> $DIR/import-prefix-macro-1.rs:21:27
+ |
+LL | ($p: path) => (use $p {S, Z}); //~ERROR expected one of `::`, `;`, or `as`, found `{`
+ | ^ expected one of `::`, `;`, or `as` here
+...
+LL | import! { a::b::c }
+ | ------------------- in this macro invocation
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/import-prefix-macro-2.rs b/src/test/ui/imports/import-prefix-macro-2.rs
similarity index 100%
rename from src/test/compile-fail/import-prefix-macro-2.rs
rename to src/test/ui/imports/import-prefix-macro-2.rs
diff --git a/src/test/ui/imports/import-prefix-macro-2.stderr b/src/test/ui/imports/import-prefix-macro-2.stderr
new file mode 100644
index 0000000..ab9e32a
--- /dev/null
+++ b/src/test/ui/imports/import-prefix-macro-2.stderr
@@ -0,0 +1,11 @@
+error: expected identifier, found `a::b::c`
+ --> $DIR/import-prefix-macro-2.rs:21:26
+ |
+LL | ($p: path) => (use ::$p {S, Z}); //~ERROR expected identifier, found `a::b::c`
+ | ^^ expected identifier
+...
+LL | import! { a::b::c }
+ | ------------------- in this macro invocation
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/import-trait-method.rs b/src/test/ui/imports/import-trait-method.rs
similarity index 100%
rename from src/test/compile-fail/import-trait-method.rs
rename to src/test/ui/imports/import-trait-method.rs
diff --git a/src/test/ui/imports/import-trait-method.stderr b/src/test/ui/imports/import-trait-method.stderr
new file mode 100644
index 0000000..917a68a
--- /dev/null
+++ b/src/test/ui/imports/import-trait-method.stderr
@@ -0,0 +1,9 @@
+error[E0253]: `foo` is not directly importable
+ --> $DIR/import-trait-method.rs:15:5
+ |
+LL | use Foo::foo; //~ ERROR not directly importable
+ | ^^^^^^^^ cannot be imported directly
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0253`.
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-3.rs b/src/test/ui/imports/local-modularized-tricky-fail-3.rs
new file mode 100644
index 0000000..6691d98
--- /dev/null
+++ b/src/test/ui/imports/local-modularized-tricky-fail-3.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 <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.
+
+// Crate-local macro expanded `macro_export` macros cannot be accessed with module-relative paths.
+
+macro_rules! define_exported { () => {
+ #[macro_export]
+ macro_rules! exported {
+ () => ()
+ }
+}}
+
+define_exported!();
+
+mod m {
+ use exported;
+ //~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
+}
+
+fn main() {
+ ::exported!();
+ //~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
+}
diff --git a/src/test/ui/imports/local-modularized-tricky-fail-3.stderr b/src/test/ui/imports/local-modularized-tricky-fail-3.stderr
new file mode 100644
index 0000000..34c50e0
--- /dev/null
+++ b/src/test/ui/imports/local-modularized-tricky-fail-3.stderr
@@ -0,0 +1,36 @@
+error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
+ --> $DIR/local-modularized-tricky-fail-3.rs:23:9
+ |
+LL | use exported;
+ | ^^^^^^^^
+ |
+note: the macro is defined here
+ --> $DIR/local-modularized-tricky-fail-3.rs:15:5
+ |
+LL | / macro_rules! exported {
+LL | | () => ()
+LL | | }
+ | |_____^
+...
+LL | define_exported!();
+ | ------------------- in this macro invocation
+
+error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
+ --> $DIR/local-modularized-tricky-fail-3.rs:28:5
+ |
+LL | ::exported!();
+ | ^^^^^^^^^^
+ |
+note: the macro is defined here
+ --> $DIR/local-modularized-tricky-fail-3.rs:15:5
+ |
+LL | / macro_rules! exported {
+LL | | () => ()
+LL | | }
+ | |_____^
+...
+LL | define_exported!();
+ | ------------------- in this macro invocation
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/imports/local-modularized-tricky-pass.rs b/src/test/ui/imports/local-modularized-tricky-pass.rs
index 04df357..9392473 100644
--- a/src/test/ui/imports/local-modularized-tricky-pass.rs
+++ b/src/test/ui/imports/local-modularized-tricky-pass.rs
@@ -10,8 +10,6 @@
// compile-pass
-#![feature(use_extern_macros)]
-
macro_rules! define_exported { () => {
#[macro_export]
macro_rules! exported {
diff --git a/src/test/ui/imports/local-modularized.rs b/src/test/ui/imports/local-modularized.rs
index a5297c5..260a406e 100644
--- a/src/test/ui/imports/local-modularized.rs
+++ b/src/test/ui/imports/local-modularized.rs
@@ -10,8 +10,6 @@
// compile-pass
-#![feature(use_extern_macros)]
-
#[macro_export(local_inner_macros)]
macro_rules! dollar_crate_exported {
(1) => { $crate::exported!(); };
diff --git a/src/test/ui/imports/macro-paths.rs b/src/test/ui/imports/macro-paths.rs
index e709eee..50cfd2d 100644
--- a/src/test/ui/imports/macro-paths.rs
+++ b/src/test/ui/imports/macro-paths.rs
@@ -10,8 +10,6 @@
// aux-build:two_macros.rs
-#![feature(use_extern_macros)]
-
extern crate two_macros;
mod foo {
diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr
index 799e7f9..08f45e1 100644
--- a/src/test/ui/imports/macro-paths.stderr
+++ b/src/test/ui/imports/macro-paths.stderr
@@ -1,34 +1,34 @@
error[E0659]: `bar` is ambiguous
- --> $DIR/macro-paths.rs:25:5
+ --> $DIR/macro-paths.rs:23:5
|
LL | bar::m! { //~ ERROR ambiguous
| ^^^^^^
|
note: `bar` could refer to the name defined here
- --> $DIR/macro-paths.rs:26:9
+ --> $DIR/macro-paths.rs:24:9
|
LL | mod bar { pub use two_macros::m; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `bar` could also refer to the name imported here
- --> $DIR/macro-paths.rs:24:9
+ --> $DIR/macro-paths.rs:22:9
|
LL | use foo::*;
| ^^^^^^
= note: macro-expanded items do not shadow when used in a macro invocation path
error[E0659]: `baz` is ambiguous
- --> $DIR/macro-paths.rs:35:5
+ --> $DIR/macro-paths.rs:33:5
|
LL | baz::m! { //~ ERROR ambiguous
| ^^^^^^
|
note: `baz` could refer to the name defined here
- --> $DIR/macro-paths.rs:36:9
+ --> $DIR/macro-paths.rs:34:9
|
LL | mod baz { pub use two_macros::m; }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `baz` could also refer to the name defined here
- --> $DIR/macro-paths.rs:30:1
+ --> $DIR/macro-paths.rs:28:1
|
LL | / pub mod baz {
LL | | pub use two_macros::m;
diff --git a/src/test/ui/imports/macros.rs b/src/test/ui/imports/macros.rs
index ed59078..47ab8fc 100644
--- a/src/test/ui/imports/macros.rs
+++ b/src/test/ui/imports/macros.rs
@@ -10,8 +10,6 @@
// aux-build:two_macros.rs
-#![feature(use_extern_macros)]
-
extern crate two_macros; // two identity macros `m` and `n`
mod foo {
diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr
index f91987c..01d1f4f 100644
--- a/src/test/ui/imports/macros.stderr
+++ b/src/test/ui/imports/macros.stderr
@@ -1,51 +1,51 @@
error: `m` is ambiguous
- --> $DIR/macros.rs:50:5
+ --> $DIR/macros.rs:48:5
|
LL | m!(); //~ ERROR ambiguous
| ^
|
note: `m` could refer to the macro defined here
- --> $DIR/macros.rs:48:5
+ --> $DIR/macros.rs:46:5
|
LL | macro_rules! m { () => {} }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: `m` could also refer to the macro imported here
- --> $DIR/macros.rs:49:9
+ --> $DIR/macros.rs:47:9
|
LL | use two_macros::m;
| ^^^^^^^^^^^^^
error[E0659]: `m` is ambiguous
- --> $DIR/macros.rs:28:5
+ --> $DIR/macros.rs:26:5
|
LL | m! { //~ ERROR ambiguous
| ^
|
note: `m` could refer to the name imported here
- --> $DIR/macros.rs:29:13
+ --> $DIR/macros.rs:27:13
|
LL | use foo::m;
| ^^^^^^
note: `m` could also refer to the name imported here
- --> $DIR/macros.rs:27:9
+ --> $DIR/macros.rs:25:9
|
LL | use two_macros::*;
| ^^^^^^^^^^^^^
= note: macro-expanded macro imports do not shadow
error[E0659]: `m` is ambiguous
- --> $DIR/macros.rs:41:9
+ --> $DIR/macros.rs:39:9
|
LL | m! { //~ ERROR ambiguous
| ^
|
note: `m` could refer to the name imported here
- --> $DIR/macros.rs:42:17
+ --> $DIR/macros.rs:40:17
|
LL | use two_macros::n as m;
| ^^^^^^^^^^^^^^^^^^
note: `m` could also refer to the name imported here
- --> $DIR/macros.rs:34:9
+ --> $DIR/macros.rs:32:9
|
LL | use two_macros::m;
| ^^^^^^^^^^^^^
diff --git a/src/test/compile-fail/imports/reexports.rs b/src/test/ui/imports/reexports.rs
similarity index 100%
rename from src/test/compile-fail/imports/reexports.rs
rename to src/test/ui/imports/reexports.rs
diff --git a/src/test/ui/imports/reexports.stderr b/src/test/ui/imports/reexports.stderr
new file mode 100644
index 0000000..a166344
--- /dev/null
+++ b/src/test/ui/imports/reexports.stderr
@@ -0,0 +1,34 @@
+error[E0364]: `foo` is private, and cannot be re-exported
+ --> $DIR/reexports.rs:16:17
+ |
+LL | pub use super::foo; //~ ERROR cannot be re-exported
+ | ^^^^^^^^^^
+ |
+note: consider marking `foo` as `pub` in the imported module
+ --> $DIR/reexports.rs:16:17
+ |
+LL | pub use super::foo; //~ ERROR cannot be re-exported
+ | ^^^^^^^^^^
+
+error: A non-empty glob must import something with the glob's visibility
+ --> $DIR/reexports.rs:17:17
+ |
+LL | pub use super::*; //~ ERROR must import something with the glob's visibility
+ | ^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/reexports.rs:38:9
+ |
+LL | use b::a::foo::S; //~ ERROR `foo`
+ | ^^^^^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/reexports.rs:39:9
+ |
+LL | use b::b::foo::S as T; //~ ERROR `foo`
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0364, E0603.
+For more information about an error, try `rustc --explain E0364`.
diff --git a/src/test/ui/imports/shadow_builtin_macros.rs b/src/test/ui/imports/shadow_builtin_macros.rs
index 93de136..90718ab 100644
--- a/src/test/ui/imports/shadow_builtin_macros.rs
+++ b/src/test/ui/imports/shadow_builtin_macros.rs
@@ -10,8 +10,6 @@
// aux-build:two_macros.rs
-#![feature(use_extern_macros)]
-
mod foo {
extern crate two_macros;
pub use self::two_macros::m as panic;
diff --git a/src/test/ui/imports/shadow_builtin_macros.stderr b/src/test/ui/imports/shadow_builtin_macros.stderr
index c9d80ad..693b7aa 100644
--- a/src/test/ui/imports/shadow_builtin_macros.stderr
+++ b/src/test/ui/imports/shadow_builtin_macros.stderr
@@ -1,5 +1,5 @@
error: `panic` is already in scope
- --> $DIR/shadow_builtin_macros.rs:42:9
+ --> $DIR/shadow_builtin_macros.rs:40:9
|
LL | macro_rules! panic { () => {} } //~ ERROR `panic` is already in scope
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -10,13 +10,13 @@
= note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)
error[E0659]: `panic` is ambiguous
- --> $DIR/shadow_builtin_macros.rs:27:14
+ --> $DIR/shadow_builtin_macros.rs:25:14
|
LL | fn f() { panic!(); } //~ ERROR ambiguous
| ^^^^^
|
note: `panic` could refer to the name imported here
- --> $DIR/shadow_builtin_macros.rs:26:9
+ --> $DIR/shadow_builtin_macros.rs:24:9
|
LL | use foo::*;
| ^^^^^^
@@ -24,13 +24,13 @@
= note: consider adding an explicit import of `panic` to disambiguate
error[E0659]: `panic` is ambiguous
- --> $DIR/shadow_builtin_macros.rs:32:14
+ --> $DIR/shadow_builtin_macros.rs:30:14
|
LL | fn f() { panic!(); } //~ ERROR ambiguous
| ^^^^^
|
note: `panic` could refer to the name imported here
- --> $DIR/shadow_builtin_macros.rs:31:26
+ --> $DIR/shadow_builtin_macros.rs:29:26
|
LL | ::two_macros::m!(use foo::panic;);
| ^^^^^^^^^^
@@ -38,18 +38,18 @@
= note: macro-expanded macro imports do not shadow
error[E0659]: `n` is ambiguous
- --> $DIR/shadow_builtin_macros.rs:61:5
+ --> $DIR/shadow_builtin_macros.rs:59:5
|
LL | n!(); //~ ERROR ambiguous
| ^
|
note: `n` could refer to the name imported here
- --> $DIR/shadow_builtin_macros.rs:60:9
+ --> $DIR/shadow_builtin_macros.rs:58:9
|
LL | use bar::*;
| ^^^^^^
note: `n` could also refer to the name imported here
- --> $DIR/shadow_builtin_macros.rs:48:13
+ --> $DIR/shadow_builtin_macros.rs:46:13
|
LL | #[macro_use(n)]
| ^
diff --git a/src/test/compile-fail/imports/unused-macro-use.rs b/src/test/ui/imports/unused-macro-use.rs
similarity index 100%
rename from src/test/compile-fail/imports/unused-macro-use.rs
rename to src/test/ui/imports/unused-macro-use.rs
diff --git a/src/test/ui/imports/unused-macro-use.stderr b/src/test/ui/imports/unused-macro-use.stderr
new file mode 100644
index 0000000..0920b5c
--- /dev/null
+++ b/src/test/ui/imports/unused-macro-use.stderr
@@ -0,0 +1,21 @@
+error: unused `#[macro_use]` import
+ --> $DIR/unused-macro-use.rs:13:1
+ |
+LL | #[macro_use] //~ ERROR unused `#[macro_use]` import
+ | ^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-macro-use.rs:11:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: #[deny(unused_imports)] implied by #[deny(unused)]
+
+error: unused `#[macro_use]` import
+ --> $DIR/unused-macro-use.rs:17:5
+ |
+LL | panic //~ ERROR unused `#[macro_use]` import
+ | ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/imports/unused.rs b/src/test/ui/imports/unused.rs
similarity index 100%
rename from src/test/compile-fail/imports/unused.rs
rename to src/test/ui/imports/unused.rs
diff --git a/src/test/ui/imports/unused.stderr b/src/test/ui/imports/unused.stderr
new file mode 100644
index 0000000..ff5c937
--- /dev/null
+++ b/src/test/ui/imports/unused.stderr
@@ -0,0 +1,15 @@
+error: unused import: `super::f`
+ --> $DIR/unused.rs:17:24
+ |
+LL | pub(super) use super::f; //~ ERROR unused
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused.rs:11:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: #[deny(unused_imports)] implied by #[deny(unused)]
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed
index c9381e6..153e500 100644
--- a/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed
+++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.fixed
@@ -9,7 +9,7 @@
// except according to those terms.
// run-rustfix
-// compile-flags: --edition 2018
+// edition:2018
#![allow(unused)]
#![deny(elided_lifetimes_in_paths)]
diff --git a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs
index 8151dd0..41aa7e1 100644
--- a/src/test/ui/in-band-lifetimes/elided-lifetimes.rs
+++ b/src/test/ui/in-band-lifetimes/elided-lifetimes.rs
@@ -9,7 +9,7 @@
// except according to those terms.
// run-rustfix
-// compile-flags: --edition 2018
+// edition:2018
#![allow(unused)]
#![deny(elided_lifetimes_in_paths)]
diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr
index 1470783..c07921b 100644
--- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr
+++ b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr
@@ -22,7 +22,7 @@
--> $DIR/mismatched.rs:16:46
|
LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch
- | -- -- ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+ | -- -- ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
| | |
| | lifetime `'b` defined here
| lifetime `'a` defined here
diff --git a/src/test/compile-fail/inaccessible-test-modules.rs b/src/test/ui/inaccessible-test-modules.rs
similarity index 100%
rename from src/test/compile-fail/inaccessible-test-modules.rs
rename to src/test/ui/inaccessible-test-modules.rs
diff --git a/src/test/ui/inaccessible-test-modules.stderr b/src/test/ui/inaccessible-test-modules.stderr
new file mode 100644
index 0000000..ce8eaf5
--- /dev/null
+++ b/src/test/ui/inaccessible-test-modules.stderr
@@ -0,0 +1,15 @@
+error[E0432]: unresolved import `__test`
+ --> $DIR/inaccessible-test-modules.rs:15:5
+ |
+LL | use __test as x; //~ ERROR unresolved import `__test`
+ | ^^^^^^^^^^^ no `__test` in the root. Did you mean to use `__test`?
+
+error[E0432]: unresolved import `__test_reexports`
+ --> $DIR/inaccessible-test-modules.rs:16:5
+ |
+LL | use __test_reexports as y; //~ ERROR unresolved import `__test_reexports`
+ | ^^^^^^^^^^^^^^^^^^^^^ no `__test_reexports` in the root. Did you mean to use `__test_reexports`?
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/index-bot.rs b/src/test/ui/index-bot.rs
similarity index 100%
rename from src/test/compile-fail/index-bot.rs
rename to src/test/ui/index-bot.rs
diff --git a/src/test/ui/index-bot.stderr b/src/test/ui/index-bot.stderr
new file mode 100644
index 0000000..1086196
--- /dev/null
+++ b/src/test/ui/index-bot.stderr
@@ -0,0 +1,9 @@
+error[E0608]: cannot index into a value of type `!`
+ --> $DIR/index-bot.rs:12:5
+ |
+LL | (return)[0]; //~ ERROR cannot index into a value of type `!`
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0608`.
diff --git a/src/test/compile-fail/index_message.rs b/src/test/ui/index_message.rs
similarity index 100%
rename from src/test/compile-fail/index_message.rs
rename to src/test/ui/index_message.rs
diff --git a/src/test/ui/index_message.stderr b/src/test/ui/index_message.stderr
new file mode 100644
index 0000000..208d33e
--- /dev/null
+++ b/src/test/ui/index_message.stderr
@@ -0,0 +1,9 @@
+error[E0608]: cannot index into a value of type `()`
+ --> $DIR/index_message.rs:13:13
+ |
+LL | let _ = z[0]; //~ ERROR cannot index into a value of type `()`
+ | ^^^^ help: to access tuple elements, use: `z.0`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0608`.
diff --git a/src/test/compile-fail/indexing-requires-a-uint.rs b/src/test/ui/indexing-requires-a-uint.rs
similarity index 100%
rename from src/test/compile-fail/indexing-requires-a-uint.rs
rename to src/test/ui/indexing-requires-a-uint.rs
diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr
new file mode 100644
index 0000000..e9608e0
--- /dev/null
+++ b/src/test/ui/indexing-requires-a-uint.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `u8: std::slice::SliceIndex<[{integer}]>` is not satisfied
+ --> $DIR/indexing-requires-a-uint.rs:16:5
+ |
+LL | [0][0u8]; //~ ERROR: the trait bound `u8: std::slice::SliceIndex<[{integer}]>` is not satisfied
+ | ^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[{integer}]>` is not implemented for `u8`
+ = note: required because of the requirements on the impl of `std::ops::Index<u8>` for `[{integer}]`
+
+error[E0308]: mismatched types
+ --> $DIR/indexing-requires-a-uint.rs:22:18
+ |
+LL | bar::<isize>(i); // i should not be re-coerced back to an isize
+ | ^ expected isize, found usize
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/auxiliary/inference_unstable_iterator.rs b/src/test/ui/inference/auxiliary/inference_unstable_iterator.rs
similarity index 100%
rename from src/test/ui/auxiliary/inference_unstable_iterator.rs
rename to src/test/ui/inference/auxiliary/inference_unstable_iterator.rs
diff --git a/src/test/ui/auxiliary/inference_unstable_itertools.rs b/src/test/ui/inference/auxiliary/inference_unstable_itertools.rs
similarity index 100%
rename from src/test/ui/auxiliary/inference_unstable_itertools.rs
rename to src/test/ui/inference/auxiliary/inference_unstable_itertools.rs
diff --git a/src/test/ui/inference-variable-behind-raw-pointer.rs b/src/test/ui/inference/inference-variable-behind-raw-pointer.rs
similarity index 100%
rename from src/test/ui/inference-variable-behind-raw-pointer.rs
rename to src/test/ui/inference/inference-variable-behind-raw-pointer.rs
diff --git a/src/test/ui/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference/inference-variable-behind-raw-pointer.stderr
similarity index 100%
rename from src/test/ui/inference-variable-behind-raw-pointer.stderr
rename to src/test/ui/inference/inference-variable-behind-raw-pointer.stderr
diff --git a/src/test/ui/inference_unstable.rs b/src/test/ui/inference/inference_unstable.rs
similarity index 100%
rename from src/test/ui/inference_unstable.rs
rename to src/test/ui/inference/inference_unstable.rs
diff --git a/src/test/ui/inference_unstable.stderr b/src/test/ui/inference/inference_unstable.stderr
similarity index 100%
rename from src/test/ui/inference_unstable.stderr
rename to src/test/ui/inference/inference_unstable.stderr
diff --git a/src/test/ui/inference_unstable_featured.rs b/src/test/ui/inference/inference_unstable_featured.rs
similarity index 100%
rename from src/test/ui/inference_unstable_featured.rs
rename to src/test/ui/inference/inference_unstable_featured.rs
diff --git a/src/test/ui/inference_unstable_featured.stderr b/src/test/ui/inference/inference_unstable_featured.stderr
similarity index 100%
rename from src/test/ui/inference_unstable_featured.stderr
rename to src/test/ui/inference/inference_unstable_featured.stderr
diff --git a/src/test/ui/inference_unstable_forced.rs b/src/test/ui/inference/inference_unstable_forced.rs
similarity index 100%
rename from src/test/ui/inference_unstable_forced.rs
rename to src/test/ui/inference/inference_unstable_forced.rs
diff --git a/src/test/ui/inference_unstable_forced.stderr b/src/test/ui/inference/inference_unstable_forced.stderr
similarity index 100%
rename from src/test/ui/inference_unstable_forced.stderr
rename to src/test/ui/inference/inference_unstable_forced.stderr
diff --git a/src/test/compile-fail/infinite-autoderef.rs b/src/test/ui/infinite/infinite-autoderef.rs
similarity index 100%
rename from src/test/compile-fail/infinite-autoderef.rs
rename to src/test/ui/infinite/infinite-autoderef.rs
diff --git a/src/test/ui/infinite/infinite-autoderef.stderr b/src/test/ui/infinite/infinite-autoderef.stderr
new file mode 100644
index 0000000..b5e20ea
--- /dev/null
+++ b/src/test/ui/infinite/infinite-autoderef.stderr
@@ -0,0 +1,52 @@
+error[E0308]: mismatched types
+ --> $DIR/infinite-autoderef.rs:30:13
+ |
+LL | x = box x;
+ | ^^^^^
+ | |
+ | cyclic type of infinite size
+ | help: try using a conversion method: `box x.to_string()`
+
+error[E0055]: reached the recursion limit while auto-dereferencing Foo
+ --> $DIR/infinite-autoderef.rs:35:5
+ |
+LL | Foo.foo;
+ | ^^^^^^^ deref recursion limit reached
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error[E0055]: reached the recursion limit while auto-dereferencing Foo
+ --> $DIR/infinite-autoderef.rs:35:9
+ |
+LL | Foo.foo;
+ | ^^^ deref recursion limit reached
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error[E0609]: no field `foo` on type `Foo`
+ --> $DIR/infinite-autoderef.rs:35:9
+ |
+LL | Foo.foo;
+ | ^^^ unknown field
+
+error[E0055]: reached the recursion limit while auto-dereferencing Foo
+ --> $DIR/infinite-autoderef.rs:36:9
+ |
+LL | Foo.bar();
+ | ^^^ deref recursion limit reached
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error[E0599]: no method named `bar` found for type `Foo` in the current scope
+ --> $DIR/infinite-autoderef.rs:36:9
+ |
+LL | struct Foo;
+ | ----------- method `bar` not found for this
+...
+LL | Foo.bar();
+ | ^^^
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0055, E0308, E0599, E0609.
+For more information about an error, try `rustc --explain E0055`.
diff --git a/src/test/compile-fail/infinite-instantiation.rs b/src/test/ui/infinite/infinite-instantiation.rs
similarity index 100%
rename from src/test/compile-fail/infinite-instantiation.rs
rename to src/test/ui/infinite/infinite-instantiation.rs
diff --git a/src/test/ui/infinite/infinite-instantiation.stderr b/src/test/ui/infinite/infinite-instantiation.stderr
new file mode 100644
index 0000000..483605f
--- /dev/null
+++ b/src/test/ui/infinite/infinite-instantiation.stderr
@@ -0,0 +1,14 @@
+error: reached the recursion limit while instantiating `function::<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<std::option::Option<usize>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ --> $DIR/infinite-instantiation.rs:33:1
+ |
+LL | / fn function<T:ToOpt + Clone>(counter: usize, t: T) {
+LL | | //~^ ERROR reached the recursion limit while instantiating `function::<std::option::Option<
+LL | | if counter > 0 {
+LL | | function(counter - 1, t.to_option());
+... |
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/infinite-macro-expansion.rs b/src/test/ui/infinite/infinite-macro-expansion.rs
similarity index 100%
rename from src/test/compile-fail/infinite-macro-expansion.rs
rename to src/test/ui/infinite/infinite-macro-expansion.rs
diff --git a/src/test/ui/infinite/infinite-macro-expansion.stderr b/src/test/ui/infinite/infinite-macro-expansion.stderr
new file mode 100644
index 0000000..7921669
--- /dev/null
+++ b/src/test/ui/infinite/infinite-macro-expansion.stderr
@@ -0,0 +1,13 @@
+error: recursion limit reached while expanding the macro `recursive`
+ --> $DIR/infinite-macro-expansion.rs:12:12
+ |
+LL | () => (recursive!()) //~ ERROR recursion limit reached while expanding the macro `recursive`
+ | ^^^^^^^^^^^^
+...
+LL | recursive!()
+ | ------------ in this macro invocation
+ |
+ = help: consider adding a `#![recursion_limit="128"]` attribute to your crate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/infinite-recursion-const-fn.rs b/src/test/ui/infinite/infinite-recursion-const-fn.rs
similarity index 100%
rename from src/test/ui/infinite-recursion-const-fn.rs
rename to src/test/ui/infinite/infinite-recursion-const-fn.rs
diff --git a/src/test/ui/infinite-recursion-const-fn.stderr b/src/test/ui/infinite/infinite-recursion-const-fn.stderr
similarity index 100%
rename from src/test/ui/infinite-recursion-const-fn.stderr
rename to src/test/ui/infinite/infinite-recursion-const-fn.stderr
diff --git a/src/test/compile-fail/infinite-tag-type-recursion.rs b/src/test/ui/infinite/infinite-tag-type-recursion.rs
similarity index 100%
rename from src/test/compile-fail/infinite-tag-type-recursion.rs
rename to src/test/ui/infinite/infinite-tag-type-recursion.rs
diff --git a/src/test/ui/infinite/infinite-tag-type-recursion.stderr b/src/test/ui/infinite/infinite-tag-type-recursion.stderr
new file mode 100644
index 0000000..e1fa3de
--- /dev/null
+++ b/src/test/ui/infinite/infinite-tag-type-recursion.stderr
@@ -0,0 +1,13 @@
+error[E0072]: recursive type `mlist` has infinite size
+ --> $DIR/infinite-tag-type-recursion.rs:11:1
+ |
+LL | enum mlist { cons(isize, mlist), nil, }
+ | ^^^^^^^^^^ ----- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `mlist` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/src/test/compile-fail/infinite-vec-type-recursion.rs b/src/test/ui/infinite/infinite-vec-type-recursion.rs
similarity index 100%
rename from src/test/compile-fail/infinite-vec-type-recursion.rs
rename to src/test/ui/infinite/infinite-vec-type-recursion.rs
diff --git a/src/test/ui/infinite/infinite-vec-type-recursion.stderr b/src/test/ui/infinite/infinite-vec-type-recursion.stderr
new file mode 100644
index 0000000..3e2d3d6
--- /dev/null
+++ b/src/test/ui/infinite/infinite-vec-type-recursion.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when processing `x`
+ --> $DIR/infinite-vec-type-recursion.rs:11:14
+ |
+LL | type x = Vec<x>;
+ | ^
+ |
+ = note: ...which again requires processing `x`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/inhabitedness-infinite-loop.rs b/src/test/ui/inhabitedness-infinite-loop.rs
similarity index 100%
rename from src/test/compile-fail/inhabitedness-infinite-loop.rs
rename to src/test/ui/inhabitedness-infinite-loop.rs
diff --git a/src/test/ui/inhabitedness-infinite-loop.stderr b/src/test/ui/inhabitedness-infinite-loop.stderr
new file mode 100644
index 0000000..24237f3
--- /dev/null
+++ b/src/test/ui/inhabitedness-infinite-loop.stderr
@@ -0,0 +1,4 @@
+error: reached recursion limit while checking inhabitedness of `Foo<'_, (((((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))))), (((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))))), ((((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))))), (((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))), ((((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))))), (((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))), ((((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))))), (((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))), ((((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))))), (((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))), ((((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !))))), (((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))), ((((!, !), (!, !)), ((!, !), (!, !))), (((!, !), (!, !)), ((!, !), (!, !)))))))))))))))>`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/init-unsafe.rs b/src/test/ui/init-unsafe.rs
similarity index 100%
rename from src/test/compile-fail/init-unsafe.rs
rename to src/test/ui/init-unsafe.rs
diff --git a/src/test/ui/init-unsafe.stderr b/src/test/ui/init-unsafe.stderr
new file mode 100644
index 0000000..f3d041f
--- /dev/null
+++ b/src/test/ui/init-unsafe.stderr
@@ -0,0 +1,11 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/init-unsafe.rs:17:17
+ |
+LL | let stuff = init::<isize>(); //~ ERROR call to unsafe function is unsafe
+ | ^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/inner-static-type-parameter.rs b/src/test/ui/inner-static-type-parameter.rs
similarity index 100%
rename from src/test/compile-fail/inner-static-type-parameter.rs
rename to src/test/ui/inner-static-type-parameter.rs
diff --git a/src/test/ui/inner-static-type-parameter.stderr b/src/test/ui/inner-static-type-parameter.stderr
new file mode 100644
index 0000000..1820e5c
--- /dev/null
+++ b/src/test/ui/inner-static-type-parameter.stderr
@@ -0,0 +1,22 @@
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/inner-static-type-parameter.rs:16:19
+ |
+LL | fn foo<T>() {
+ | --- - type variable from outer function
+ | |
+ | try adding a local type parameter in this method instead
+LL | static a: Bar<T> = Bar::What;
+ | ^ use of type variable from outer function
+
+error[E0392]: parameter `T` is never used
+ --> $DIR/inner-static-type-parameter.rs:13:10
+ |
+LL | enum Bar<T> { What } //~ ERROR parameter `T` is never used
+ | ^ unused type parameter
+ |
+ = help: consider removing `T` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0392, E0401.
+For more information about an error, try `rustc --explain E0392`.
diff --git a/src/test/compile-fail/integer-literal-suffix-inference.rs b/src/test/ui/integer-literal-suffix-inference.rs
similarity index 100%
rename from src/test/compile-fail/integer-literal-suffix-inference.rs
rename to src/test/ui/integer-literal-suffix-inference.rs
diff --git a/src/test/ui/integer-literal-suffix-inference.stderr b/src/test/ui/integer-literal-suffix-inference.stderr
new file mode 100644
index 0000000..1c5d656
--- /dev/null
+++ b/src/test/ui/integer-literal-suffix-inference.stderr
@@ -0,0 +1,291 @@
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:42:11
+ |
+LL | id_i8(a16);
+ | ^^^ expected i8, found i16
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:45:11
+ |
+LL | id_i8(a32);
+ | ^^^ expected i8, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:48:11
+ |
+LL | id_i8(a64);
+ | ^^^ expected i8, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:52:12
+ |
+LL | id_i16(a8);
+ | ^^ expected i16, found i8
+help: you can cast an `i8` to `i16`, which will sign-extend the source value
+ |
+LL | id_i16(a8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:56:12
+ |
+LL | id_i16(a32);
+ | ^^^ expected i16, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:59:12
+ |
+LL | id_i16(a64);
+ | ^^^ expected i16, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:63:12
+ |
+LL | id_i32(a8);
+ | ^^ expected i32, found i8
+help: you can cast an `i8` to `i32`, which will sign-extend the source value
+ |
+LL | id_i32(a8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:66:12
+ |
+LL | id_i32(a16);
+ | ^^^ expected i32, found i16
+help: you can cast an `i16` to `i32`, which will sign-extend the source value
+ |
+LL | id_i32(a16.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:70:12
+ |
+LL | id_i32(a64);
+ | ^^^ expected i32, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:74:12
+ |
+LL | id_i64(a8);
+ | ^^ expected i64, found i8
+help: you can cast an `i8` to `i64`, which will sign-extend the source value
+ |
+LL | id_i64(a8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:77:12
+ |
+LL | id_i64(a16);
+ | ^^^ expected i64, found i16
+help: you can cast an `i16` to `i64`, which will sign-extend the source value
+ |
+LL | id_i64(a16.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:80:12
+ |
+LL | id_i64(a32);
+ | ^^^ expected i64, found i32
+help: you can cast an `i32` to `i64`, which will sign-extend the source value
+ |
+LL | id_i64(a32.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:86:11
+ |
+LL | id_i8(c16);
+ | ^^^ expected i8, found i16
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:89:11
+ |
+LL | id_i8(c32);
+ | ^^^ expected i8, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:92:11
+ |
+LL | id_i8(c64);
+ | ^^^ expected i8, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:96:12
+ |
+LL | id_i16(c8);
+ | ^^ expected i16, found i8
+help: you can cast an `i8` to `i16`, which will sign-extend the source value
+ |
+LL | id_i16(c8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:100:12
+ |
+LL | id_i16(c32);
+ | ^^^ expected i16, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:103:12
+ |
+LL | id_i16(c64);
+ | ^^^ expected i16, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:107:12
+ |
+LL | id_i32(c8);
+ | ^^ expected i32, found i8
+help: you can cast an `i8` to `i32`, which will sign-extend the source value
+ |
+LL | id_i32(c8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:110:12
+ |
+LL | id_i32(c16);
+ | ^^^ expected i32, found i16
+help: you can cast an `i16` to `i32`, which will sign-extend the source value
+ |
+LL | id_i32(c16.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:114:12
+ |
+LL | id_i32(c64);
+ | ^^^ expected i32, found i64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:118:12
+ |
+LL | id_i64(a8);
+ | ^^ expected i64, found i8
+help: you can cast an `i8` to `i64`, which will sign-extend the source value
+ |
+LL | id_i64(a8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:121:12
+ |
+LL | id_i64(a16);
+ | ^^^ expected i64, found i16
+help: you can cast an `i16` to `i64`, which will sign-extend the source value
+ |
+LL | id_i64(a16.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:124:12
+ |
+LL | id_i64(a32);
+ | ^^^ expected i64, found i32
+help: you can cast an `i32` to `i64`, which will sign-extend the source value
+ |
+LL | id_i64(a32.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:130:11
+ |
+LL | id_u8(b16);
+ | ^^^ expected u8, found u16
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:133:11
+ |
+LL | id_u8(b32);
+ | ^^^ expected u8, found u32
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:136:11
+ |
+LL | id_u8(b64);
+ | ^^^ expected u8, found u64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:140:12
+ |
+LL | id_u16(b8);
+ | ^^ expected u16, found u8
+help: you can cast an `u8` to `u16`, which will zero-extend the source value
+ |
+LL | id_u16(b8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:144:12
+ |
+LL | id_u16(b32);
+ | ^^^ expected u16, found u32
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:147:12
+ |
+LL | id_u16(b64);
+ | ^^^ expected u16, found u64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:151:12
+ |
+LL | id_u32(b8);
+ | ^^ expected u32, found u8
+help: you can cast an `u8` to `u32`, which will zero-extend the source value
+ |
+LL | id_u32(b8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:154:12
+ |
+LL | id_u32(b16);
+ | ^^^ expected u32, found u16
+help: you can cast an `u16` to `u32`, which will zero-extend the source value
+ |
+LL | id_u32(b16.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:158:12
+ |
+LL | id_u32(b64);
+ | ^^^ expected u32, found u64
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:162:12
+ |
+LL | id_u64(b8);
+ | ^^ expected u64, found u8
+help: you can cast an `u8` to `u64`, which will zero-extend the source value
+ |
+LL | id_u64(b8.into());
+ | ^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:165:12
+ |
+LL | id_u64(b16);
+ | ^^^ expected u64, found u16
+help: you can cast an `u16` to `u64`, which will zero-extend the source value
+ |
+LL | id_u64(b16.into());
+ | ^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/integer-literal-suffix-inference.rs:168:12
+ |
+LL | id_u64(b32);
+ | ^^^ expected u64, found u32
+help: you can cast an `u32` to `u64`, which will zero-extend the source value
+ |
+LL | id_u64(b32.into());
+ | ^^^^^^^^^^
+
+error: aborting due to 36 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/integral-indexing.rs b/src/test/ui/integral-indexing.rs
similarity index 100%
rename from src/test/compile-fail/integral-indexing.rs
rename to src/test/ui/integral-indexing.rs
diff --git a/src/test/ui/integral-indexing.stderr b/src/test/ui/integral-indexing.stderr
new file mode 100644
index 0000000..d86421a
--- /dev/null
+++ b/src/test/ui/integral-indexing.stderr
@@ -0,0 +1,75 @@
+error[E0277]: the trait bound `u8: std::slice::SliceIndex<[isize]>` is not satisfied
+ --> $DIR/integral-indexing.rs:16:5
+ |
+LL | v[3u8]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied
+ | ^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u8`
+ = note: required because of the requirements on the impl of `std::ops::Index<u8>` for `std::vec::Vec<isize>`
+
+error[E0277]: the trait bound `i8: std::slice::SliceIndex<[isize]>` is not satisfied
+ --> $DIR/integral-indexing.rs:17:5
+ |
+LL | v[3i8]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied
+ | ^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i8`
+ = note: required because of the requirements on the impl of `std::ops::Index<i8>` for `std::vec::Vec<isize>`
+
+error[E0277]: the trait bound `u32: std::slice::SliceIndex<[isize]>` is not satisfied
+ --> $DIR/integral-indexing.rs:18:5
+ |
+LL | v[3u32]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied
+ | ^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `u32`
+ = note: required because of the requirements on the impl of `std::ops::Index<u32>` for `std::vec::Vec<isize>`
+
+error[E0277]: the trait bound `i32: std::slice::SliceIndex<[isize]>` is not satisfied
+ --> $DIR/integral-indexing.rs:19:5
+ |
+LL | v[3i32]; //~ERROR : std::slice::SliceIndex<[isize]>` is not satisfied
+ | ^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[isize]>` is not implemented for `i32`
+ = note: required because of the requirements on the impl of `std::ops::Index<i32>` for `std::vec::Vec<isize>`
+
+error[E0277]: the trait bound `u8: std::slice::SliceIndex<[u8]>` is not satisfied
+ --> $DIR/integral-indexing.rs:22:5
+ |
+LL | s.as_bytes()[3u8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u8`
+ = note: required because of the requirements on the impl of `std::ops::Index<u8>` for `[u8]`
+
+error[E0277]: the trait bound `i8: std::slice::SliceIndex<[u8]>` is not satisfied
+ --> $DIR/integral-indexing.rs:23:5
+ |
+LL | s.as_bytes()[3i8]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i8`
+ = note: required because of the requirements on the impl of `std::ops::Index<i8>` for `[u8]`
+
+error[E0277]: the trait bound `u32: std::slice::SliceIndex<[u8]>` is not satisfied
+ --> $DIR/integral-indexing.rs:24:5
+ |
+LL | s.as_bytes()[3u32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `u32`
+ = note: required because of the requirements on the impl of `std::ops::Index<u32>` for `[u8]`
+
+error[E0277]: the trait bound `i32: std::slice::SliceIndex<[u8]>` is not satisfied
+ --> $DIR/integral-indexing.rs:25:5
+ |
+LL | s.as_bytes()[3i32]; //~ERROR : std::slice::SliceIndex<[u8]>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^ slice indices are of type `usize` or ranges of `usize`
+ |
+ = help: the trait `std::slice::SliceIndex<[u8]>` is not implemented for `i32`
+ = note: required because of the requirements on the impl of `std::ops::Index<i32>` for `[u8]`
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/integral-variable-unification-error.rs b/src/test/ui/integral-variable-unification-error.rs
similarity index 100%
rename from src/test/compile-fail/integral-variable-unification-error.rs
rename to src/test/ui/integral-variable-unification-error.rs
diff --git a/src/test/ui/integral-variable-unification-error.stderr b/src/test/ui/integral-variable-unification-error.stderr
new file mode 100644
index 0000000..bbaa603
--- /dev/null
+++ b/src/test/ui/integral-variable-unification-error.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/integral-variable-unification-error.rs:13:9
+ |
+LL | x = 5.0;
+ | ^^^ expected integral variable, found floating-point variable
+ |
+ = note: expected type `{integer}`
+ found type `{float}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/auxiliary/internal_unstable.rs b/src/test/ui/internal/auxiliary/internal_unstable.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/internal_unstable.rs
rename to src/test/ui/internal/auxiliary/internal_unstable.rs
diff --git a/src/test/compile-fail/internal-unstable-noallow.rs b/src/test/ui/internal/internal-unstable-noallow.rs
similarity index 100%
rename from src/test/compile-fail/internal-unstable-noallow.rs
rename to src/test/ui/internal/internal-unstable-noallow.rs
diff --git a/src/test/ui/internal/internal-unstable-noallow.stderr b/src/test/ui/internal/internal-unstable-noallow.stderr
new file mode 100644
index 0000000..fc81005
--- /dev/null
+++ b/src/test/ui/internal/internal-unstable-noallow.stderr
@@ -0,0 +1,39 @@
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable-noallow.rs:26:5
+ |
+LL | call_unstable_noallow!();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+ = 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[E0658]: use of unstable library feature 'struct_field'
+ --> $DIR/internal-unstable-noallow.rs:28:5
+ |
+LL | construct_unstable_noallow!(0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(struct_field)] to the crate attributes to enable
+ = 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[E0658]: use of unstable library feature 'method'
+ --> $DIR/internal-unstable-noallow.rs:30:35
+ |
+LL | |x: internal_unstable::Foo| { call_method_noallow!(x) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(method)] to the crate attributes to enable
+ = 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[E0658]: use of unstable library feature 'struct2_field'
+ --> $DIR/internal-unstable-noallow.rs:32:35
+ |
+LL | |x: internal_unstable::Bar| { access_field_noallow!(x) };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(struct2_field)] to the crate attributes to enable
+ = 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: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/internal-unstable-thread-local.rs b/src/test/ui/internal/internal-unstable-thread-local.rs
similarity index 100%
rename from src/test/compile-fail/internal-unstable-thread-local.rs
rename to src/test/ui/internal/internal-unstable-thread-local.rs
diff --git a/src/test/ui/internal/internal-unstable-thread-local.stderr b/src/test/ui/internal/internal-unstable-thread-local.stderr
new file mode 100644
index 0000000..b77b946
--- /dev/null
+++ b/src/test/ui/internal/internal-unstable-thread-local.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable-thread-local.rs:19:32
+ |
+LL | thread_local!(static BAR: () = internal_unstable::unstable()); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/internal-unstable.rs b/src/test/ui/internal/internal-unstable.rs
similarity index 100%
rename from src/test/compile-fail/internal-unstable.rs
rename to src/test/ui/internal/internal-unstable.rs
diff --git a/src/test/ui/internal/internal-unstable.stderr b/src/test/ui/internal/internal-unstable.stderr
new file mode 100644
index 0000000..ec4f072
--- /dev/null
+++ b/src/test/ui/internal/internal-unstable.stderr
@@ -0,0 +1,46 @@
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable.rs:43:25
+ |
+LL | pass_through_allow!(internal_unstable::unstable()); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable.rs:45:27
+ |
+LL | pass_through_noallow!(internal_unstable::unstable()); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable.rs:49:22
+ |
+LL | println!("{:?}", internal_unstable::unstable()); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable.rs:51:10
+ |
+LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'function'
+ --> $DIR/internal-unstable.rs:22:9
+ |
+LL | internal_unstable::unstable(); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | bar!(internal_unstable::unstable()); //~ ERROR use of unstable
+ | ------------------------------------ in this macro invocation
+ |
+ = help: add #![feature(function)] to the crate attributes to enable
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/intrinsic-invalid-number-of-arguments.rs b/src/test/ui/intrinsic-invalid-number-of-arguments.rs
similarity index 100%
rename from src/test/compile-fail/intrinsic-invalid-number-of-arguments.rs
rename to src/test/ui/intrinsic-invalid-number-of-arguments.rs
diff --git a/src/test/ui/intrinsic-invalid-number-of-arguments.stderr b/src/test/ui/intrinsic-invalid-number-of-arguments.stderr
new file mode 100644
index 0000000..af852b6
--- /dev/null
+++ b/src/test/ui/intrinsic-invalid-number-of-arguments.stderr
@@ -0,0 +1,9 @@
+error[E0444]: platform-specific intrinsic has invalid number of arguments: found 3, expected 1
+ --> $DIR/intrinsic-invalid-number-of-arguments.rs:20:5
+ |
+LL | fn x86_mm_movemask_pd(x: f64x2, y: f64x2, z: f64x2) -> i32; //~ platform-specific intrinsic
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0444`.
diff --git a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs
index 18ca5d0..c0a10fe 100644
--- a/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs
+++ b/src/test/ui/invalid-module-declaration/invalid-module-declaration.rs
@@ -11,9 +11,6 @@
// ignore-tidy-linelength
// ignore-windows
-// error-pattern: cannot declare a new module at this location
-// error-pattern: maybe move this module
-
mod auxiliary {
mod foo;
}
diff --git a/src/test/compile-fail/invalid-crate-type.rs b/src/test/ui/invalid/invalid-crate-type.rs
similarity index 100%
rename from src/test/compile-fail/invalid-crate-type.rs
rename to src/test/ui/invalid/invalid-crate-type.rs
diff --git a/src/test/ui/invalid/invalid-crate-type.stderr b/src/test/ui/invalid/invalid-crate-type.stderr
new file mode 100644
index 0000000..6dc8a0f
--- /dev/null
+++ b/src/test/ui/invalid/invalid-crate-type.stderr
@@ -0,0 +1,10 @@
+error: invalid `crate_type` value
+ --> $DIR/invalid-crate-type.rs:12:1
+ |
+LL | #![crate_type="foo"] //~ ERROR invalid `crate_type` value
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: #[deny(unknown_crate_types)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/invalid-inline.rs b/src/test/ui/invalid/invalid-inline.rs
similarity index 100%
rename from src/test/compile-fail/invalid-inline.rs
rename to src/test/ui/invalid/invalid-inline.rs
diff --git a/src/test/ui/invalid/invalid-inline.stderr b/src/test/ui/invalid/invalid-inline.stderr
new file mode 100644
index 0000000..d4861c2
--- /dev/null
+++ b/src/test/ui/invalid/invalid-inline.stderr
@@ -0,0 +1,22 @@
+error[E0535]: invalid argument
+ --> $DIR/invalid-inline.rs:12:10
+ |
+LL | #[inline(please_no)] //~ ERROR invalid argument
+ | ^^^^^^^^^
+
+error[E0534]: expected one argument
+ --> $DIR/invalid-inline.rs:16:1
+ |
+LL | #[inline(please,no)] //~ ERROR expected one argument
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0534]: expected one argument
+ --> $DIR/invalid-inline.rs:20:1
+ |
+LL | #[inline()] //~ ERROR expected one argument
+ | ^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0534, E0535.
+For more information about an error, try `rustc --explain E0534`.
diff --git a/src/test/compile-fail/invalid-macro-matcher.rs b/src/test/ui/invalid/invalid-macro-matcher.rs
similarity index 100%
rename from src/test/compile-fail/invalid-macro-matcher.rs
rename to src/test/ui/invalid/invalid-macro-matcher.rs
diff --git a/src/test/ui/invalid/invalid-macro-matcher.stderr b/src/test/ui/invalid/invalid-macro-matcher.stderr
new file mode 100644
index 0000000..d3ddb61
--- /dev/null
+++ b/src/test/ui/invalid/invalid-macro-matcher.stderr
@@ -0,0 +1,8 @@
+error: invalid macro matcher; matchers must be contained in balanced delimiters
+ --> $DIR/invalid-macro-matcher.rs:14:5
+ |
+LL | _ => (); //~ ERROR invalid macro matcher
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/invalid-path-in-const.rs b/src/test/ui/invalid/invalid-path-in-const.rs
similarity index 100%
rename from src/test/ui/invalid-path-in-const.rs
rename to src/test/ui/invalid/invalid-path-in-const.rs
diff --git a/src/test/ui/invalid-path-in-const.stderr b/src/test/ui/invalid/invalid-path-in-const.stderr
similarity index 100%
rename from src/test/ui/invalid-path-in-const.stderr
rename to src/test/ui/invalid/invalid-path-in-const.stderr
diff --git a/src/test/compile-fail/invalid-plugin-attr.rs b/src/test/ui/invalid/invalid-plugin-attr.rs
similarity index 100%
rename from src/test/compile-fail/invalid-plugin-attr.rs
rename to src/test/ui/invalid/invalid-plugin-attr.rs
diff --git a/src/test/ui/invalid/invalid-plugin-attr.stderr b/src/test/ui/invalid/invalid-plugin-attr.stderr
new file mode 100644
index 0000000..a5d321e
--- /dev/null
+++ b/src/test/ui/invalid/invalid-plugin-attr.stderr
@@ -0,0 +1,20 @@
+error: unused attribute
+ --> $DIR/invalid-plugin-attr.rs:14:1
+ |
+LL | #[plugin(bla)] //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/invalid-plugin-attr.rs:11:9
+ |
+LL | #![deny(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo]
+ --> $DIR/invalid-plugin-attr.rs:14:1
+ |
+LL | #[plugin(bla)] //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/invalid-variadic-function.rs b/src/test/ui/invalid/invalid-variadic-function.rs
similarity index 100%
rename from src/test/ui/invalid-variadic-function.rs
rename to src/test/ui/invalid/invalid-variadic-function.rs
diff --git a/src/test/ui/invalid-variadic-function.stderr b/src/test/ui/invalid/invalid-variadic-function.stderr
similarity index 100%
rename from src/test/ui/invalid-variadic-function.stderr
rename to src/test/ui/invalid/invalid-variadic-function.stderr
diff --git a/src/test/compile-fail/invalid_crate_type_syntax.rs b/src/test/ui/invalid_crate_type_syntax.rs
similarity index 100%
rename from src/test/compile-fail/invalid_crate_type_syntax.rs
rename to src/test/ui/invalid_crate_type_syntax.rs
diff --git a/src/test/ui/invalid_crate_type_syntax.stderr b/src/test/ui/invalid_crate_type_syntax.stderr
new file mode 100644
index 0000000..b609695
--- /dev/null
+++ b/src/test/ui/invalid_crate_type_syntax.stderr
@@ -0,0 +1,15 @@
+error: `crate_type` requires a value
+ --> $DIR/invalid_crate_type_syntax.rs:12:1
+ |
+LL | #![crate_type(lib)] //~ ERROR `crate_type` requires a value
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: for example: `#![crate_type="lib"]`
+
+error[E0601]: `main` function not found in crate `invalid_crate_type_syntax`
+ |
+ = note: consider adding a `main` function to `$DIR/invalid_crate_type_syntax.rs`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/ui/issue-10636-1.rs b/src/test/ui/issue-10636-1.rs
new file mode 100644
index 0000000..fdd5077
--- /dev/null
+++ b/src/test/ui/issue-10636-1.rs
@@ -0,0 +1,19 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// compile-flags: -Z parse-only
+
+struct Obj { //~ NOTE: unclosed delimiter
+ member: usize
+)
+//~^ ERROR incorrect close delimiter
+//~| NOTE incorrect close delimiter
+
+fn main() {}
diff --git a/src/test/ui/issue-10636-1.stderr b/src/test/ui/issue-10636-1.stderr
new file mode 100644
index 0000000..af80e25
--- /dev/null
+++ b/src/test/ui/issue-10636-1.stderr
@@ -0,0 +1,11 @@
+error: incorrect close delimiter: `)`
+ --> $DIR/issue-10636-1.rs:15:1
+ |
+LL | struct Obj { //~ NOTE: unclosed delimiter
+ | - unclosed delimiter
+LL | member: usize
+LL | )
+ | ^ incorrect close delimiter
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-11692-2.rs b/src/test/ui/issue-11692-2.rs
deleted file mode 100644
index 50525e0..0000000
--- a/src/test/ui/issue-11692-2.rs
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-fn main() {
- concat!(test!());
- //~^ ERROR expected a macro, found built-in attribute
-}
diff --git a/src/test/ui/issue-11692-2.stderr b/src/test/ui/issue-11692-2.stderr
deleted file mode 100644
index 0c13094..0000000
--- a/src/test/ui/issue-11692-2.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: expected a macro, found built-in attribute
- --> $DIR/issue-11692-2.rs:12:13
- |
-LL | concat!(test!());
- | ^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-12567.nll.stderr b/src/test/ui/issue-12567.nll.stderr
deleted file mode 100644
index 29bda25..0000000
--- a/src/test/ui/issue-12567.nll.stderr
+++ /dev/null
@@ -1,43 +0,0 @@
-error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:14:11
- |
-LL | match (l1, l2) {
- | ^^^^^^^^ cannot move out of here
-LL | (&[], &[]) => println!("both empty"),
-LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | -- data moved here
-...
-LL | (&[hd1, ..], &[hd2, ..])
- | --- ... and here
-help: to prevent move, use ref or ref mut
- |
-LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
-LL | => println!("one empty"),
-LL | //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
-LL | //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
-LL | (&[hd1, ..], &[ref hd2, ..])
- |
-
-error[E0508]: cannot move out of type `[T]`, a non-copy slice
- --> $DIR/issue-12567.rs:14:11
- |
-LL | match (l1, l2) {
- | ^^^^^^^^ cannot move out of here
-LL | (&[], &[]) => println!("both empty"),
-LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
- | -- data moved here
-...
-LL | (&[hd1, ..], &[hd2, ..])
- | --- ... and here
-help: to prevent move, use ref or ref mut
- |
-LL | (&[], &[ref hd, ..]) | (&[hd, ..], &[])
-LL | => println!("one empty"),
-LL | //~^^ ERROR: cannot move out of type `[T]`, a non-copy slice
-LL | //~^^^ ERROR: cannot move out of type `[T]`, a non-copy slice
-LL | (&[ref hd1, ..], &[hd2, ..])
- |
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/issue-14285.nll.stderr b/src/test/ui/issue-14285.nll.stderr
deleted file mode 100644
index c95d540..0000000
--- a/src/test/ui/issue-14285.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/issue-14285.rs:22:7
- |
-LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
- | ^
-
-error[E0621]: explicit lifetime required in the type of `a`
- --> $DIR/issue-14285.rs:22:7
- |
-LL | fn foo<'a>(a: &Foo) -> B<'a> {
- | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)`
-LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
- | ^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issue-14366.stderr b/src/test/ui/issue-14366.stderr
deleted file mode 100644
index ff61ef0..0000000
--- a/src/test/ui/issue-14366.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/issue-14366.rs:12:14
- |
-LL | let _x = "test" as &::std::any::Any;
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required for the cast to the object type `dyn std::any::Any`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-15034.nll.stderr b/src/test/ui/issue-15034.nll.stderr
deleted file mode 100644
index 4c84826..0000000
--- a/src/test/ui/issue-15034.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/issue-15034.rs:27:9
- |
-LL | Parser { lexer: lexer }
- | ^^^^^^
-
-error[E0621]: explicit lifetime required in the type of `lexer`
- --> $DIR/issue-15034.rs:27:25
- |
-LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
- | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
-LL | Parser { lexer: lexer }
- | ^^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issue-15756.stderr b/src/test/ui/issue-15756.stderr
deleted file mode 100644
index cea2018..0000000
--- a/src/test/ui/issue-15756.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `[T]` cannot be known at compilation time
- --> $DIR/issue-15756.rs:17:10
- |
-LL | &mut something
- | ^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[T]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: all local variables must have a statically known size
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-17651.stderr b/src/test/ui/issue-17651.stderr
deleted file mode 100644
index 7b7e5b5..0000000
--- a/src/test/ui/issue-17651.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
- --> $DIR/issue-17651.rs:15:9
- |
-LL | (|| Box::new(*(&[0][..])))();
- | ^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `<std::boxed::Box<T>>::new`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-17954.ast.nll.stderr b/src/test/ui/issue-17954.ast.nll.stderr
deleted file mode 100644
index 5cab7ca..0000000
--- a/src/test/ui/issue-17954.ast.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `FOO` does not live long enough
- --> $DIR/issue-17954.rs:20:13
- |
-LL | let a = &FOO;
- | ^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `FOO` dropped here while still borrowed
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issue-17954.ast.stderr b/src/test/ui/issue-17954.ast.stderr
deleted file mode 100644
index 677d2cb..0000000
--- a/src/test/ui/issue-17954.ast.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: borrowed value does not live long enough
- --> $DIR/issue-17954.rs:20:14
- |
-LL | let a = &FOO;
- | ^^^ temporary value does not live long enough
-...
-LL | }
- | - temporary value only lives until here
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issue-17954.mir.stderr b/src/test/ui/issue-17954.mir.stderr
deleted file mode 100644
index 5cab7ca..0000000
--- a/src/test/ui/issue-17954.mir.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0597]: `FOO` does not live long enough
- --> $DIR/issue-17954.rs:20:13
- |
-LL | let a = &FOO;
- | ^^^^ borrowed value does not live long enough
-...
-LL | }
- | - `FOO` dropped here while still borrowed
- |
- = note: borrowed value must be valid for the static lifetime...
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issue-17954.rs b/src/test/ui/issue-17954.rs
deleted file mode 100644
index b5e550e..0000000
--- a/src/test/ui/issue-17954.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// 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.
-
-// revisions: ast mir
-//[mir]compile-flags: -Z borrowck=mir
-
-#![feature(thread_local)]
-
-#[thread_local]
-static FOO: u8 = 3;
-
-fn main() {
- let a = &FOO;
- //[mir]~^ ERROR `FOO` does not live long enough [E0597]
- //[mir]~| does not live long enough
- //[mir]~| NOTE borrowed value must be valid for the static lifetime
- //[ast]~^^^^ ERROR borrowed value does not live long enough
- //[ast]~| does not live long enough
- //[ast]~| NOTE borrowed value must be valid for the static lifetime
-
- std::thread::spawn(move || {
- println!("{}", a);
- });
-}
-//[mir]~^ `FOO` dropped here while still borrowed
-//[ast]~^^ temporary value only lives until here
diff --git a/src/test/ui/issue-18107.stderr b/src/test/ui/issue-18107.stderr
deleted file mode 100644
index 6fa9fb6..0000000
--- a/src/test/ui/issue-18107.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `(dyn AbstractRenderer + 'static)` cannot be known at compilation time
- --> $DIR/issue-18107.rs:14:5
- |
-LL | AbstractRenderer
- | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: the return type of a function must have a statically known size
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-18919.stderr b/src/test/ui/issue-18919.stderr
deleted file mode 100644
index f9a098b..0000000
--- a/src/test/ui/issue-18919.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -> isize` cannot be known at compilation time
- --> $DIR/issue-18919.rs:13:1
- |
-LL | / fn ho_func(f: Option<FuncType>) {
-LL | | //~^ ERROR the size for values of type
-LL | | }
- | |_^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `std::option::Option`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20005.stderr b/src/test/ui/issue-20005.stderr
deleted file mode 100644
index 645dcb1..0000000
--- a/src/test/ui/issue-20005.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0277]: the size for values of type `Self` cannot be known at compilation time
- --> $DIR/issue-20005.rs:18:5
- |
-LL | / fn to<Dst>( //~ ERROR the size for values of type
-LL | | self
-LL | | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
-LL | | From::from(self)
-LL | | }
- | |_____^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `Self`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where Self: std::marker::Sized` bound
-note: required by `From`
- --> $DIR/issue-20005.rs:11:1
- |
-LL | trait From<Src> {
- | ^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20433.stderr b/src/test/ui/issue-20433.stderr
deleted file mode 100644
index 5e8bf28..0000000
--- a/src/test/ui/issue-20433.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
- --> $DIR/issue-20433.rs:16:5
- |
-LL | fn iceman(c: Vec<[i32]>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[i32]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `std::vec::Vec`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20605.stderr b/src/test/ui/issue-20605.stderr
deleted file mode 100644
index e85ea87..0000000
--- a/src/test/ui/issue-20605.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `dyn std::iter::Iterator<Item=&mut u8>` cannot be known at compilation time
- --> $DIR/issue-20605.rs:12:17
- |
-LL | for item in *things { *item = 0 }
- | ^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item=&mut u8>`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `std::iter::IntoIterator::into_iter`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20801.nll.stderr b/src/test/ui/issue-20801.nll.stderr
deleted file mode 100644
index fc94cc4..0000000
--- a/src/test/ui/issue-20801.nll.stderr
+++ /dev/null
@@ -1,39 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-20801.rs:36:22
- |
-LL | let a = unsafe { *mut_ref() };
- | ^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&*mut_ref()`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-20801.rs:39:22
- |
-LL | let b = unsafe { *imm_ref() };
- | ^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&*imm_ref()`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-20801.rs:42:22
- |
-LL | let c = unsafe { *mut_ptr() };
- | ^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&*mut_ptr()`
-
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-20801.rs:45:22
- |
-LL | let d = unsafe { *const_ptr() };
- | ^^^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&*const_ptr()`
-
-error: aborting due to 4 previous errors
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-22874.stderr b/src/test/ui/issue-22874.stderr
deleted file mode 100644
index a8144dc..0000000
--- a/src/test/ui/issue-22874.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `[std::string::String]` cannot be known at compilation time
- --> $DIR/issue-22874.rs:12:5
- |
-LL | rows: [[String]],
- | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[std::string::String]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: slice and array elements must have `Sized` type
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-23281.stderr b/src/test/ui/issue-23281.stderr
deleted file mode 100644
index c7391ad..0000000
--- a/src/test/ui/issue-23281.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time
- --> $DIR/issue-23281.rs:16:5
- |
-LL | pub fn function(funs: Vec<Fn() -> ()>) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `std::vec::Vec`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-24446.stderr b/src/test/ui/issue-24446.stderr
deleted file mode 100644
index 8614fc6..0000000
--- a/src/test/ui/issue-24446.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0308]: mismatched types
- --> $DIR/issue-24446.rs:12:31
- |
-LL | static foo: Fn() -> u32 = || -> u32 {
- | _______________________________^
-LL | | //~^ ERROR mismatched types
-LL | | //~| ERROR the size for values of type
-LL | | 0
-LL | | };
- | |_____^ expected trait std::ops::Fn, found closure
- |
- = note: expected type `(dyn std::ops::Fn() -> u32 + 'static)`
- found type `[closure@$DIR/issue-24446.rs:12:31: 16:6]`
-
-error[E0277]: the size for values of type `(dyn std::ops::Fn() -> u32 + 'static)` cannot be known at compilation time
- --> $DIR/issue-24446.rs:12:31
- |
-LL | static foo: Fn() -> u32 = || -> u32 {
- | _______________________________^
-LL | | //~^ ERROR mismatched types
-LL | | //~| ERROR the size for values of type
-LL | | 0
-LL | | };
- | |_____^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: constant expressions must have a statically known size
-
-error: aborting due to 2 previous errors
-
-Some errors occurred: E0277, E0308.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-27060-2.stderr b/src/test/ui/issue-27060-2.stderr
deleted file mode 100644
index 7961b17..0000000
--- a/src/test/ui/issue-27060-2.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0277]: the size for values of type `T` cannot be known at compilation time
- --> $DIR/issue-27060-2.rs:13:5
- |
-LL | data: T, //~ ERROR the size for values of type
- | ^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where T: std::marker::Sized` bound
- = note: only the last field of a struct may have a dynamically sized type
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-27078.stderr b/src/test/ui/issue-27078.stderr
deleted file mode 100644
index dcfd82f..0000000
--- a/src/test/ui/issue-27078.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0277]: the size for values of type `Self` cannot be known at compilation time
- --> $DIR/issue-27078.rs:15:12
- |
-LL | fn foo(self) -> &'static i32 {
- | ^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `Self`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where Self: std::marker::Sized` bound
- = note: all local variables must have a statically known size
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-3154.nll.stderr b/src/test/ui/issue-3154.nll.stderr
deleted file mode 100644
index 91010bd..0000000
--- a/src/test/ui/issue-3154.nll.stderr
+++ /dev/null
@@ -1,23 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/issue-3154.rs:16:15
- |
-LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
- | ^
-
-warning: not reporting region error due to nll
- --> $DIR/issue-3154.rs:16:5
- |
-LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
- | ^^^^^
-
-error[E0621]: explicit lifetime required in the type of `x`
- --> $DIR/issue-3154.rs:16:15
- |
-LL | fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
- | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q`
-LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
- | ^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issue-35988.stderr b/src/test/ui/issue-35988.stderr
deleted file mode 100644
index 38a9409..0000000
--- a/src/test/ui/issue-35988.stderr
+++ /dev/null
@@ -1,13 +0,0 @@
-error[E0277]: the size for values of type `[std::boxed::Box<E>]` cannot be known at compilation time
- --> $DIR/issue-35988.rs:12:7
- |
-LL | V([Box<E>]),
- | ^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box<E>]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-38954.stderr b/src/test/ui/issue-38954.stderr
deleted file mode 100644
index 714ab00..0000000
--- a/src/test/ui/issue-38954.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/issue-38954.rs:11:23
- |
-LL | fn _test(ref _p: str) {}
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr
deleted file mode 100644
index 162e43a..0000000
--- a/src/test/ui/issue-40402-ref-hints/issue-40402-1.nll.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-40402-1.rs:19:13
- |
-LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content
- | ^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&f.v[0]`
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr
deleted file mode 100644
index cd75be2..0000000
--- a/src/test/ui/issue-40402-ref-hints/issue-40402-2.nll.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/issue-40402-2.rs:15:18
- |
-LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
- | - - ^^^^
- | | | |
- | | | cannot move out of borrowed content
- | | | help: consider using a reference instead: `&x[0]`
- | | move occurs because b has type `std::string::String`, which does not implement the `Copy` trait
- | move occurs because a has type `std::string::String`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-40510-1.nll.stderr b/src/test/ui/issue-40510-1.nll.stderr
deleted file mode 100644
index 6c77bcb..0000000
--- a/src/test/ui/issue-40510-1.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error: unsatisfied lifetime constraints
- --> $DIR/issue-40510-1.rs:18:9
- |
-LL | || {
- | --
- | ||
- | |return type of closure is &'2 mut std::boxed::Box<()>
- | lifetime `'1` represents this closure's body
-LL | &mut x
- | ^^^^^^ return requires that `'1` must outlive `'2`
- |
- = note: closure implements `FnMut`, so references to captured variables can't escape the closure
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-40510-3.nll.stderr b/src/test/ui/issue-40510-3.nll.stderr
deleted file mode 100644
index 8aeef86..0000000
--- a/src/test/ui/issue-40510-3.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error: unsatisfied lifetime constraints
- --> $DIR/issue-40510-3.rs:18:9
- |
-LL | || {
- | --
- | ||
- | |return type of closure is [closure@$DIR/issue-40510-3.rs:18:9: 20:10 x:&'2 mut std::vec::Vec<()>]
- | lifetime `'1` represents this closure's body
-LL | / || {
-LL | | x.push(())
-LL | | }
- | |_________^ requires that `'1` must outlive `'2`
- |
- = note: closure implements `FnMut`, so references to captured variables can't escape the closure
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-41229-ref-str.stderr b/src/test/ui/issue-41229-ref-str.stderr
deleted file mode 100644
index d8933a3..0000000
--- a/src/test/ui/issue-41229-ref-str.stderr
+++ /dev/null
@@ -1,12 +0,0 @@
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/issue-41229-ref-str.rs:11:28
- |
-LL | pub fn example(ref s: str) {}
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-41726.stderr b/src/test/ui/issue-41726.stderr
deleted file mode 100644
index 1723095..0000000
--- a/src/test/ui/issue-41726.stderr
+++ /dev/null
@@ -1,9 +0,0 @@
-error[E0596]: cannot borrow immutable indexed content as mutable
- --> $DIR/issue-41726.rs:15:9
- |
-LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
- | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issue-42312.stderr b/src/test/ui/issue-42312.stderr
deleted file mode 100644
index 8c7d5d8..0000000
--- a/src/test/ui/issue-42312.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-error[E0277]: the size for values of type `<Self as std::ops::Deref>::Target` cannot be known at compilation time
- --> $DIR/issue-42312.rs:14:29
- |
-LL | fn baz(_: Self::Target) where Self: Deref {}
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `<Self as std::ops::Deref>::Target`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where <Self as std::ops::Deref>::Target: std::marker::Sized` bound
-
-error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time
- --> $DIR/issue-42312.rs:18:23
- |
-LL | pub fn f(_: ToString) {}
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-4335.nll.stderr b/src/test/ui/issue-4335.nll.stderr
deleted file mode 100644
index 4ccd24f..0000000
--- a/src/test/ui/issue-4335.nll.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error[E0507]: cannot move out of captured variable in an `FnMut` closure
- --> $DIR/issue-4335.rs:16:20
- |
-LL | id(Box::new(|| *v))
- | ^^ cannot move out of captured variable in an `FnMut` closure
-
-error[E0597]: `v` does not live long enough
- --> $DIR/issue-4335.rs:16:21
- |
-LL | id(Box::new(|| *v))
- | -- ^ borrowed value does not live long enough
- | |
- | value captured here
-...
-LL | }
- | - `v` dropped here while still borrowed
- |
-note: borrowed value must be valid for the lifetime 'r as defined on the function body at 15:6...
- --> $DIR/issue-4335.rs:15:6
- |
-LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
- | ^^
-
-error: aborting due to 2 previous errors
-
-Some errors occurred: E0507, E0597.
-For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-49074.rs b/src/test/ui/issue-49074.rs
deleted file mode 100644
index 2e7e118..0000000
--- a/src/test/ui/issue-49074.rs
+++ /dev/null
@@ -1,24 +0,0 @@
-// 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.
-
-// Check that unknown attribute error is shown even if there are unresolved macros.
-
-#[marco_use] // typo
-//~^ ERROR The attribute `marco_use` is currently unknown to the compiler
-mod foo {
- macro_rules! bar {
- () => ();
- }
-}
-
-fn main() {
- bar!();
- //~^ ERROR cannot find macro `bar!`
-}
diff --git a/src/test/ui/issue-49074.stderr b/src/test/ui/issue-49074.stderr
deleted file mode 100644
index c9984ea..0000000
--- a/src/test/ui/issue-49074.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-error: cannot find macro `bar!` in this scope
- --> $DIR/issue-49074.rs:22:4
- |
-LL | bar!();
- | ^^^
- |
- = help: have you added the `#[macro_use]` on the module/import?
-
-error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
- --> $DIR/issue-49074.rs:13:1
- |
-LL | #[marco_use] // typo
- | ^^^^^^^^^^^^
- |
- = help: add #![feature(custom_attribute)] to the crate attributes to enable
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issue-49824.nll.stderr b/src/test/ui/issue-49824.nll.stderr
deleted file mode 100644
index fb4bed7..0000000
--- a/src/test/ui/issue-49824.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-error: unsatisfied lifetime constraints
- --> $DIR/issue-49824.rs:22:9
- |
-LL | || {
- | --
- | ||
- | |return type of closure is [closure@$DIR/issue-49824.rs:22:9: 24:10 x:&'2 mut i32]
- | lifetime `'1` represents this closure's body
-LL | / || {
-LL | | let _y = &mut x;
-LL | | }
- | |_________^ requires that `'1` must outlive `'2`
- |
- = note: closure implements `FnMut`, so references to captured variables can't escape the closure
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-51602.rs b/src/test/ui/issue-51602.rs
new file mode 100644
index 0000000..a3edecb
--- /dev/null
+++ b/src/test/ui/issue-51602.rs
@@ -0,0 +1,15 @@
+// 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.
+
+fn main(){
+ if i in 1..10 {
+ break;
+ }
+}
diff --git a/src/test/ui/issue-51602.stderr b/src/test/ui/issue-51602.stderr
new file mode 100644
index 0000000..ac079b4
--- /dev/null
+++ b/src/test/ui/issue-51602.stderr
@@ -0,0 +1,10 @@
+error: expected `{`, found `in`
+ --> $DIR/issue-51602.rs:12:10
+ |
+LL | if i in 1..10 {
+ | -- ^^ expected `{`
+ | |
+ | this `if` statement has a condition, but no block
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-52213.nll.stderr b/src/test/ui/issue-52213.nll.stderr
deleted file mode 100644
index 4e1efc9..0000000
--- a/src/test/ui/issue-52213.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/issue-52213.rs:12:11
- |
-LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
- | ^^^^^
-
-error: unsatisfied lifetime constraints
- --> $DIR/issue-52213.rs:13:11
- |
-LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
- | -- -- lifetime `'b` defined here
- | |
- | lifetime `'a` defined here
-LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
-LL | ((u,),) => u,
- | ^ requires that `'a` must outlive `'b`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-52533-1.nll.stderr b/src/test/ui/issue-52533-1.nll.stderr
deleted file mode 100644
index 87fda1d..0000000
--- a/src/test/ui/issue-52533-1.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/issue-52533-1.rs:19:18
- |
-LL | gimme(|x, y| y)
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/issue-52533-1.rs:19:18
- |
-LL | gimme(|x, y| y)
- | - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
- | | |
- | | has type `&Foo<'_, '1, u32>`
- | has type `&Foo<'_, '2, u32>`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-52533.nll.stderr b/src/test/ui/issue-52533.nll.stderr
deleted file mode 100644
index a13b06e..0000000
--- a/src/test/ui/issue-52533.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/issue-52533.rs:15:16
- |
-LL | foo(|a, b| b)
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/issue-52533.rs:15:16
- |
-LL | foo(|a, b| b)
- | - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
- | | |
- | | has type `&'1 u32`
- | has type `&'2 u32`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/issue-53251.rs b/src/test/ui/issue-53251.rs
new file mode 100644
index 0000000..aa9da74
--- /dev/null
+++ b/src/test/ui/issue-53251.rs
@@ -0,0 +1,28 @@
+// 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.
+
+struct S;
+
+impl S {
+ fn f() {}
+}
+
+macro_rules! impl_add {
+ ($($n:ident)*) => {
+ $(
+ fn $n() {
+ S::f::<i64>();
+ //~^ ERROR too many type parameters provided
+ }
+ )*
+ }
+}
+
+impl_add!(a b);
diff --git a/src/test/ui/issue-53251.stderr b/src/test/ui/issue-53251.stderr
new file mode 100644
index 0000000..bf99e73
--- /dev/null
+++ b/src/test/ui/issue-53251.stderr
@@ -0,0 +1,17 @@
+error[E0601]: `main` function not found in crate `issue_53251`
+ |
+ = note: consider adding a `main` function to `$DIR/issue-53251.rs`
+
+error[E0087]: too many type parameters provided: expected at most 0 type parameters, found 1 type parameter
+ --> $DIR/issue-53251.rs:21:24
+ |
+LL | S::f::<i64>();
+ | ^^^ expected 0 type parameters
+...
+LL | impl_add!(a b);
+ | --------------- in this macro invocation
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0087, E0601.
+For more information about an error, try `rustc --explain E0087`.
diff --git a/src/test/ui/issue-5883.stderr b/src/test/ui/issue-5883.stderr
deleted file mode 100644
index 8dfeaa7..0000000
--- a/src/test/ui/issue-5883.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
- --> $DIR/issue-5883.rs:17:15
- |
-LL | fn new_struct(r: A+'static)
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: all local variables must have a statically known size
-
-error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
- --> $DIR/issue-5883.rs:18:8
- |
-LL | -> Struct { //~^ ERROR the size for values of type
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required because it appears within the type `Struct`
- = note: the return type of a function must have a statically known size
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/auxiliary/empty-struct.rs b/src/test/ui/issues/auxiliary/empty-struct.rs
similarity index 100%
copy from src/test/compile-fail/auxiliary/empty-struct.rs
copy to src/test/ui/issues/auxiliary/empty-struct.rs
diff --git a/src/test/compile-fail/auxiliary/issue-19163.rs b/src/test/ui/issues/auxiliary/issue-19163.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue-19163.rs
rename to src/test/ui/issues/auxiliary/issue-19163.rs
diff --git a/src/test/compile-fail/auxiliary/issue-21146-inc.rs b/src/test/ui/issues/auxiliary/issue-21146-inc.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue-21146-inc.rs
rename to src/test/ui/issues/auxiliary/issue-21146-inc.rs
diff --git a/src/test/compile-fail/auxiliary/issue-29181.rs b/src/test/ui/issues/auxiliary/issue-29181.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue-29181.rs
rename to src/test/ui/issues/auxiliary/issue-29181.rs
diff --git a/src/test/compile-fail/auxiliary/issue-30535.rs b/src/test/ui/issues/auxiliary/issue-30535.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue-30535.rs
rename to src/test/ui/issues/auxiliary/issue-30535.rs
diff --git a/src/test/ui/auxiliary/issue-36708.rs b/src/test/ui/issues/auxiliary/issue-36708.rs
similarity index 100%
rename from src/test/ui/auxiliary/issue-36708.rs
rename to src/test/ui/issues/auxiliary/issue-36708.rs
diff --git a/src/test/compile-fail/auxiliary/issue-36881-aux.rs b/src/test/ui/issues/auxiliary/issue-36881-aux.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue-36881-aux.rs
rename to src/test/ui/issues/auxiliary/issue-36881-aux.rs
diff --git a/src/test/compile-fail/auxiliary/issue-52489.rs b/src/test/ui/issues/auxiliary/issue-52489.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue-52489.rs
rename to src/test/ui/issues/auxiliary/issue-52489.rs
diff --git a/src/test/compile-fail/auxiliary/issue_11680.rs b/src/test/ui/issues/auxiliary/issue_11680.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_11680.rs
rename to src/test/ui/issues/auxiliary/issue_11680.rs
diff --git a/src/test/compile-fail/auxiliary/issue_16725.rs b/src/test/ui/issues/auxiliary/issue_16725.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_16725.rs
rename to src/test/ui/issues/auxiliary/issue_16725.rs
diff --git a/src/test/compile-fail/auxiliary/issue_17718_const_privacy.rs b/src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_17718_const_privacy.rs
rename to src/test/ui/issues/auxiliary/issue_17718_const_privacy.rs
diff --git a/src/test/compile-fail/auxiliary/issue_1920.rs b/src/test/ui/issues/auxiliary/issue_1920.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_1920.rs
rename to src/test/ui/issues/auxiliary/issue_1920.rs
diff --git a/src/test/compile-fail/auxiliary/issue_21202.rs b/src/test/ui/issues/auxiliary/issue_21202.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_21202.rs
rename to src/test/ui/issues/auxiliary/issue_21202.rs
diff --git a/src/test/compile-fail/auxiliary/issue_30123_aux.rs b/src/test/ui/issues/auxiliary/issue_30123_aux.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_30123_aux.rs
rename to src/test/ui/issues/auxiliary/issue_30123_aux.rs
diff --git a/src/test/compile-fail/auxiliary/issue_41549.rs b/src/test/ui/issues/auxiliary/issue_41549.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_41549.rs
rename to src/test/ui/issues/auxiliary/issue_41549.rs
diff --git a/src/test/compile-fail/auxiliary/issue_5844_aux.rs b/src/test/ui/issues/auxiliary/issue_5844_aux.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/issue_5844_aux.rs
rename to src/test/ui/issues/auxiliary/issue_5844_aux.rs
diff --git a/src/test/compile-fail/auxiliary/lint_stability.rs b/src/test/ui/issues/auxiliary/lint_stability.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_stability.rs
rename to src/test/ui/issues/auxiliary/lint_stability.rs
diff --git a/src/test/compile-fail/auxiliary/private_trait_xc.rs b/src/test/ui/issues/auxiliary/private_trait_xc.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/private_trait_xc.rs
rename to src/test/ui/issues/auxiliary/private_trait_xc.rs
diff --git a/src/test/ui/auxiliary/xcrate_issue_43189_a.rs b/src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs
similarity index 100%
rename from src/test/ui/auxiliary/xcrate_issue_43189_a.rs
rename to src/test/ui/issues/auxiliary/xcrate_issue_43189_a.rs
diff --git a/src/test/ui/auxiliary/xcrate_issue_43189_b.rs b/src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs
similarity index 100%
rename from src/test/ui/auxiliary/xcrate_issue_43189_b.rs
rename to src/test/ui/issues/auxiliary/xcrate_issue_43189_b.rs
diff --git a/src/test/ui/auxiliary/xcrate_issue_46112_rexport_core.rs b/src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs
similarity index 100%
rename from src/test/ui/auxiliary/xcrate_issue_46112_rexport_core.rs
rename to src/test/ui/issues/auxiliary/xcrate_issue_46112_rexport_core.rs
diff --git a/src/test/ui/issue-10176.rs b/src/test/ui/issues/issue-10176.rs
similarity index 100%
rename from src/test/ui/issue-10176.rs
rename to src/test/ui/issues/issue-10176.rs
diff --git a/src/test/ui/issue-10176.stderr b/src/test/ui/issues/issue-10176.stderr
similarity index 100%
rename from src/test/ui/issue-10176.stderr
rename to src/test/ui/issues/issue-10176.stderr
diff --git a/src/test/ui/issue-10200.rs b/src/test/ui/issues/issue-10200.rs
similarity index 100%
rename from src/test/ui/issue-10200.rs
rename to src/test/ui/issues/issue-10200.rs
diff --git a/src/test/ui/issue-10200.stderr b/src/test/ui/issues/issue-10200.stderr
similarity index 100%
rename from src/test/ui/issue-10200.stderr
rename to src/test/ui/issues/issue-10200.stderr
diff --git a/src/test/ui/issue-10291.nll.stderr b/src/test/ui/issues/issue-10291.nll.stderr
similarity index 100%
rename from src/test/ui/issue-10291.nll.stderr
rename to src/test/ui/issues/issue-10291.nll.stderr
diff --git a/src/test/ui/issue-10291.rs b/src/test/ui/issues/issue-10291.rs
similarity index 100%
rename from src/test/ui/issue-10291.rs
rename to src/test/ui/issues/issue-10291.rs
diff --git a/src/test/ui/issue-10291.stderr b/src/test/ui/issues/issue-10291.stderr
similarity index 100%
rename from src/test/ui/issue-10291.stderr
rename to src/test/ui/issues/issue-10291.stderr
diff --git a/src/test/ui/issue-10398.nll.stderr b/src/test/ui/issues/issue-10398.nll.stderr
similarity index 100%
rename from src/test/ui/issue-10398.nll.stderr
rename to src/test/ui/issues/issue-10398.nll.stderr
diff --git a/src/test/ui/issue-10398.rs b/src/test/ui/issues/issue-10398.rs
similarity index 100%
rename from src/test/ui/issue-10398.rs
rename to src/test/ui/issues/issue-10398.rs
diff --git a/src/test/ui/issue-10398.stderr b/src/test/ui/issues/issue-10398.stderr
similarity index 100%
rename from src/test/ui/issue-10398.stderr
rename to src/test/ui/issues/issue-10398.stderr
diff --git a/src/test/ui/issue-10401.rs b/src/test/ui/issues/issue-10401.rs
similarity index 100%
rename from src/test/ui/issue-10401.rs
rename to src/test/ui/issues/issue-10401.rs
diff --git a/src/test/ui/issue-10401.stderr b/src/test/ui/issues/issue-10401.stderr
similarity index 100%
rename from src/test/ui/issue-10401.stderr
rename to src/test/ui/issues/issue-10401.stderr
diff --git a/src/test/ui/issue-10412.rs b/src/test/ui/issues/issue-10412.rs
similarity index 100%
rename from src/test/ui/issue-10412.rs
rename to src/test/ui/issues/issue-10412.rs
diff --git a/src/test/ui/issue-10412.stderr b/src/test/ui/issues/issue-10412.stderr
similarity index 100%
rename from src/test/ui/issue-10412.stderr
rename to src/test/ui/issues/issue-10412.stderr
diff --git a/src/test/ui/issue-10465.rs b/src/test/ui/issues/issue-10465.rs
similarity index 100%
rename from src/test/ui/issue-10465.rs
rename to src/test/ui/issues/issue-10465.rs
diff --git a/src/test/ui/issue-10465.stderr b/src/test/ui/issues/issue-10465.stderr
similarity index 100%
rename from src/test/ui/issue-10465.stderr
rename to src/test/ui/issues/issue-10465.stderr
diff --git a/src/test/ui/issue-10536.rs b/src/test/ui/issues/issue-10536.rs
similarity index 100%
rename from src/test/ui/issue-10536.rs
rename to src/test/ui/issues/issue-10536.rs
diff --git a/src/test/ui/issue-10536.stderr b/src/test/ui/issues/issue-10536.stderr
similarity index 100%
rename from src/test/ui/issue-10536.stderr
rename to src/test/ui/issues/issue-10536.stderr
diff --git a/src/test/ui/issue-10545.rs b/src/test/ui/issues/issue-10545.rs
similarity index 100%
rename from src/test/ui/issue-10545.rs
rename to src/test/ui/issues/issue-10545.rs
diff --git a/src/test/ui/issue-10545.stderr b/src/test/ui/issues/issue-10545.stderr
similarity index 100%
rename from src/test/ui/issue-10545.stderr
rename to src/test/ui/issues/issue-10545.stderr
diff --git a/src/test/ui/issue-10656.rs b/src/test/ui/issues/issue-10656.rs
similarity index 100%
rename from src/test/ui/issue-10656.rs
rename to src/test/ui/issues/issue-10656.rs
diff --git a/src/test/ui/issue-10656.stderr b/src/test/ui/issues/issue-10656.stderr
similarity index 100%
rename from src/test/ui/issue-10656.stderr
rename to src/test/ui/issues/issue-10656.stderr
diff --git a/src/test/ui/issue-10764.rs b/src/test/ui/issues/issue-10764.rs
similarity index 100%
rename from src/test/ui/issue-10764.rs
rename to src/test/ui/issues/issue-10764.rs
diff --git a/src/test/ui/issue-10764.stderr b/src/test/ui/issues/issue-10764.stderr
similarity index 100%
rename from src/test/ui/issue-10764.stderr
rename to src/test/ui/issues/issue-10764.stderr
diff --git a/src/test/ui/issue-10877.rs b/src/test/ui/issues/issue-10877.rs
similarity index 100%
rename from src/test/ui/issue-10877.rs
rename to src/test/ui/issues/issue-10877.rs
diff --git a/src/test/ui/issue-10877.stderr b/src/test/ui/issues/issue-10877.stderr
similarity index 100%
rename from src/test/ui/issue-10877.stderr
rename to src/test/ui/issues/issue-10877.stderr
diff --git a/src/test/ui/issue-10969.rs b/src/test/ui/issues/issue-10969.rs
similarity index 100%
rename from src/test/ui/issue-10969.rs
rename to src/test/ui/issues/issue-10969.rs
diff --git a/src/test/ui/issue-10969.stderr b/src/test/ui/issues/issue-10969.stderr
similarity index 100%
rename from src/test/ui/issue-10969.stderr
rename to src/test/ui/issues/issue-10969.stderr
diff --git a/src/test/ui/issue-10991.rs b/src/test/ui/issues/issue-10991.rs
similarity index 100%
rename from src/test/ui/issue-10991.rs
rename to src/test/ui/issues/issue-10991.rs
diff --git a/src/test/ui/issue-10991.stderr b/src/test/ui/issues/issue-10991.stderr
similarity index 100%
rename from src/test/ui/issue-10991.stderr
rename to src/test/ui/issues/issue-10991.stderr
diff --git a/src/test/ui/issue-11004.rs b/src/test/ui/issues/issue-11004.rs
similarity index 100%
rename from src/test/ui/issue-11004.rs
rename to src/test/ui/issues/issue-11004.rs
diff --git a/src/test/ui/issue-11004.stderr b/src/test/ui/issues/issue-11004.stderr
similarity index 100%
rename from src/test/ui/issue-11004.stderr
rename to src/test/ui/issues/issue-11004.stderr
diff --git a/src/test/ui/issue-11154.rs b/src/test/ui/issues/issue-11154.rs
similarity index 100%
rename from src/test/ui/issue-11154.rs
rename to src/test/ui/issues/issue-11154.rs
diff --git a/src/test/ui/issue-11154.stderr b/src/test/ui/issues/issue-11154.stderr
similarity index 100%
rename from src/test/ui/issue-11154.stderr
rename to src/test/ui/issues/issue-11154.stderr
diff --git a/src/test/ui/issue-11192.nll.stderr b/src/test/ui/issues/issue-11192.nll.stderr
similarity index 100%
rename from src/test/ui/issue-11192.nll.stderr
rename to src/test/ui/issues/issue-11192.nll.stderr
diff --git a/src/test/ui/issue-11192.rs b/src/test/ui/issues/issue-11192.rs
similarity index 100%
rename from src/test/ui/issue-11192.rs
rename to src/test/ui/issues/issue-11192.rs
diff --git a/src/test/ui/issue-11192.stderr b/src/test/ui/issues/issue-11192.stderr
similarity index 100%
rename from src/test/ui/issue-11192.stderr
rename to src/test/ui/issues/issue-11192.stderr
diff --git a/src/test/ui/issue-11319.rs b/src/test/ui/issues/issue-11319.rs
similarity index 100%
rename from src/test/ui/issue-11319.rs
rename to src/test/ui/issues/issue-11319.rs
diff --git a/src/test/ui/issue-11319.stderr b/src/test/ui/issues/issue-11319.stderr
similarity index 100%
rename from src/test/ui/issue-11319.stderr
rename to src/test/ui/issues/issue-11319.stderr
diff --git a/src/test/ui/issue-11374.rs b/src/test/ui/issues/issue-11374.rs
similarity index 100%
rename from src/test/ui/issue-11374.rs
rename to src/test/ui/issues/issue-11374.rs
diff --git a/src/test/ui/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr
similarity index 100%
rename from src/test/ui/issue-11374.stderr
rename to src/test/ui/issues/issue-11374.stderr
diff --git a/src/test/ui/issue-11493.ast.stderr b/src/test/ui/issues/issue-11493.ast.stderr
similarity index 100%
rename from src/test/ui/issue-11493.ast.stderr
rename to src/test/ui/issues/issue-11493.ast.stderr
diff --git a/src/test/ui/issue-11493.mir.stderr b/src/test/ui/issues/issue-11493.mir.stderr
similarity index 100%
rename from src/test/ui/issue-11493.mir.stderr
rename to src/test/ui/issues/issue-11493.mir.stderr
diff --git a/src/test/ui/issue-11493.rs b/src/test/ui/issues/issue-11493.rs
similarity index 100%
rename from src/test/ui/issue-11493.rs
rename to src/test/ui/issues/issue-11493.rs
diff --git a/src/test/ui/issue-11515.rs b/src/test/ui/issues/issue-11515.rs
similarity index 100%
rename from src/test/ui/issue-11515.rs
rename to src/test/ui/issues/issue-11515.rs
diff --git a/src/test/ui/issue-11515.stderr b/src/test/ui/issues/issue-11515.stderr
similarity index 100%
rename from src/test/ui/issue-11515.stderr
rename to src/test/ui/issues/issue-11515.stderr
diff --git a/src/test/compile-fail/issue-11593.rs b/src/test/ui/issues/issue-11593.rs
similarity index 100%
rename from src/test/compile-fail/issue-11593.rs
rename to src/test/ui/issues/issue-11593.rs
diff --git a/src/test/ui/issues/issue-11593.stderr b/src/test/ui/issues/issue-11593.stderr
new file mode 100644
index 0000000..24e1a5e
--- /dev/null
+++ b/src/test/ui/issues/issue-11593.stderr
@@ -0,0 +1,9 @@
+error[E0603]: trait `Foo` is private
+ --> $DIR/issue-11593.rs:17:6
+ |
+LL | impl private_trait_xc::Foo for Bar {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/issue-11680.rs b/src/test/ui/issues/issue-11680.rs
similarity index 100%
rename from src/test/compile-fail/issue-11680.rs
rename to src/test/ui/issues/issue-11680.rs
diff --git a/src/test/ui/issues/issue-11680.stderr b/src/test/ui/issues/issue-11680.stderr
new file mode 100644
index 0000000..37cfe96
--- /dev/null
+++ b/src/test/ui/issues/issue-11680.stderr
@@ -0,0 +1,15 @@
+error[E0603]: enum `Foo` is private
+ --> $DIR/issue-11680.rs:16:14
+ |
+LL | let _b = other::Foo::Bar(1);
+ | ^^^^^^^^^^^^^^^
+
+error[E0603]: enum `Foo` is private
+ --> $DIR/issue-11680.rs:19:14
+ |
+LL | let _b = other::test::Foo::Bar(1);
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/issue-11681.rs b/src/test/ui/issues/issue-11681.rs
similarity index 100%
rename from src/test/ui/issue-11681.rs
rename to src/test/ui/issues/issue-11681.rs
diff --git a/src/test/ui/issue-11681.stderr b/src/test/ui/issues/issue-11681.stderr
similarity index 100%
rename from src/test/ui/issue-11681.stderr
rename to src/test/ui/issues/issue-11681.stderr
diff --git a/src/test/ui/issue-11692-1.rs b/src/test/ui/issues/issue-11692-1.rs
similarity index 100%
rename from src/test/ui/issue-11692-1.rs
rename to src/test/ui/issues/issue-11692-1.rs
diff --git a/src/test/ui/issue-11692-1.stderr b/src/test/ui/issues/issue-11692-1.stderr
similarity index 100%
rename from src/test/ui/issue-11692-1.stderr
rename to src/test/ui/issues/issue-11692-1.stderr
diff --git a/src/test/ui/issues/issue-11692-2.rs b/src/test/ui/issues/issue-11692-2.rs
new file mode 100644
index 0000000..acac2d1
--- /dev/null
+++ b/src/test/ui/issues/issue-11692-2.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+fn main() {
+ concat!(test!());
+ //~^ ERROR cannot find macro `test!` in this scope
+}
diff --git a/src/test/ui/issues/issue-11692-2.stderr b/src/test/ui/issues/issue-11692-2.stderr
new file mode 100644
index 0000000..51d6041
--- /dev/null
+++ b/src/test/ui/issues/issue-11692-2.stderr
@@ -0,0 +1,8 @@
+error: cannot find macro `test!` in this scope
+ --> $DIR/issue-11692-2.rs:12:13
+ |
+LL | concat!(test!());
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-11740.rs b/src/test/ui/issues/issue-11740.rs
similarity index 100%
rename from src/test/ui/issue-11740.rs
rename to src/test/ui/issues/issue-11740.rs
diff --git a/src/test/ui/issue-11740.stderr b/src/test/ui/issues/issue-11740.stderr
similarity index 100%
rename from src/test/ui/issue-11740.stderr
rename to src/test/ui/issues/issue-11740.stderr
diff --git a/src/test/ui/issue-11771.rs b/src/test/ui/issues/issue-11771.rs
similarity index 100%
rename from src/test/ui/issue-11771.rs
rename to src/test/ui/issues/issue-11771.rs
diff --git a/src/test/ui/issue-11771.stderr b/src/test/ui/issues/issue-11771.stderr
similarity index 100%
rename from src/test/ui/issue-11771.stderr
rename to src/test/ui/issues/issue-11771.stderr
diff --git a/src/test/ui/issue-11844.rs b/src/test/ui/issues/issue-11844.rs
similarity index 100%
rename from src/test/ui/issue-11844.rs
rename to src/test/ui/issues/issue-11844.rs
diff --git a/src/test/ui/issue-11844.stderr b/src/test/ui/issues/issue-11844.stderr
similarity index 100%
rename from src/test/ui/issue-11844.stderr
rename to src/test/ui/issues/issue-11844.stderr
diff --git a/src/test/ui/issue-11873.nll.stderr b/src/test/ui/issues/issue-11873.nll.stderr
similarity index 100%
rename from src/test/ui/issue-11873.nll.stderr
rename to src/test/ui/issues/issue-11873.nll.stderr
diff --git a/src/test/ui/issue-11873.rs b/src/test/ui/issues/issue-11873.rs
similarity index 100%
rename from src/test/ui/issue-11873.rs
rename to src/test/ui/issues/issue-11873.rs
diff --git a/src/test/ui/issue-11873.stderr b/src/test/ui/issues/issue-11873.stderr
similarity index 100%
rename from src/test/ui/issue-11873.stderr
rename to src/test/ui/issues/issue-11873.stderr
diff --git a/src/test/ui/issue-12028.rs b/src/test/ui/issues/issue-12028.rs
similarity index 100%
rename from src/test/ui/issue-12028.rs
rename to src/test/ui/issues/issue-12028.rs
diff --git a/src/test/ui/issue-12028.stderr b/src/test/ui/issues/issue-12028.stderr
similarity index 100%
rename from src/test/ui/issue-12028.stderr
rename to src/test/ui/issues/issue-12028.stderr
diff --git a/src/test/ui/issue-12041.nll.stderr b/src/test/ui/issues/issue-12041.nll.stderr
similarity index 100%
rename from src/test/ui/issue-12041.nll.stderr
rename to src/test/ui/issues/issue-12041.nll.stderr
diff --git a/src/test/ui/issue-12041.rs b/src/test/ui/issues/issue-12041.rs
similarity index 100%
rename from src/test/ui/issue-12041.rs
rename to src/test/ui/issues/issue-12041.rs
diff --git a/src/test/ui/issue-12041.stderr b/src/test/ui/issues/issue-12041.stderr
similarity index 100%
rename from src/test/ui/issue-12041.stderr
rename to src/test/ui/issues/issue-12041.stderr
diff --git a/src/test/ui/issue-12116.rs b/src/test/ui/issues/issue-12116.rs
similarity index 100%
rename from src/test/ui/issue-12116.rs
rename to src/test/ui/issues/issue-12116.rs
diff --git a/src/test/ui/issue-12116.stderr b/src/test/ui/issues/issue-12116.stderr
similarity index 100%
rename from src/test/ui/issue-12116.stderr
rename to src/test/ui/issues/issue-12116.stderr
diff --git a/src/test/ui/issue-12127.rs b/src/test/ui/issues/issue-12127.rs
similarity index 100%
rename from src/test/ui/issue-12127.rs
rename to src/test/ui/issues/issue-12127.rs
diff --git a/src/test/ui/issue-12127.stderr b/src/test/ui/issues/issue-12127.stderr
similarity index 100%
rename from src/test/ui/issue-12127.stderr
rename to src/test/ui/issues/issue-12127.stderr
diff --git a/src/test/ui/issue-12187-1.rs b/src/test/ui/issues/issue-12187-1.rs
similarity index 100%
rename from src/test/ui/issue-12187-1.rs
rename to src/test/ui/issues/issue-12187-1.rs
diff --git a/src/test/ui/issue-12187-1.stderr b/src/test/ui/issues/issue-12187-1.stderr
similarity index 100%
rename from src/test/ui/issue-12187-1.stderr
rename to src/test/ui/issues/issue-12187-1.stderr
diff --git a/src/test/ui/issue-12187-2.rs b/src/test/ui/issues/issue-12187-2.rs
similarity index 100%
rename from src/test/ui/issue-12187-2.rs
rename to src/test/ui/issues/issue-12187-2.rs
diff --git a/src/test/ui/issue-12187-2.stderr b/src/test/ui/issues/issue-12187-2.stderr
similarity index 100%
rename from src/test/ui/issue-12187-2.stderr
rename to src/test/ui/issues/issue-12187-2.stderr
diff --git a/src/test/ui/issue-12369.rs b/src/test/ui/issues/issue-12369.rs
similarity index 100%
rename from src/test/ui/issue-12369.rs
rename to src/test/ui/issues/issue-12369.rs
diff --git a/src/test/ui/issue-12369.stderr b/src/test/ui/issues/issue-12369.stderr
similarity index 100%
rename from src/test/ui/issue-12369.stderr
rename to src/test/ui/issues/issue-12369.stderr
diff --git a/src/test/ui/issue-12470.nll.stderr b/src/test/ui/issues/issue-12470.nll.stderr
similarity index 100%
rename from src/test/ui/issue-12470.nll.stderr
rename to src/test/ui/issues/issue-12470.nll.stderr
diff --git a/src/test/ui/issue-12470.rs b/src/test/ui/issues/issue-12470.rs
similarity index 100%
rename from src/test/ui/issue-12470.rs
rename to src/test/ui/issues/issue-12470.rs
diff --git a/src/test/ui/issue-12470.stderr b/src/test/ui/issues/issue-12470.stderr
similarity index 100%
rename from src/test/ui/issue-12470.stderr
rename to src/test/ui/issues/issue-12470.stderr
diff --git a/src/test/ui/issue-12511.rs b/src/test/ui/issues/issue-12511.rs
similarity index 100%
rename from src/test/ui/issue-12511.rs
rename to src/test/ui/issues/issue-12511.rs
diff --git a/src/test/ui/issue-12511.stderr b/src/test/ui/issues/issue-12511.stderr
similarity index 100%
rename from src/test/ui/issue-12511.stderr
rename to src/test/ui/issues/issue-12511.stderr
diff --git a/src/test/ui/issue-12552.rs b/src/test/ui/issues/issue-12552.rs
similarity index 100%
rename from src/test/ui/issue-12552.rs
rename to src/test/ui/issues/issue-12552.rs
diff --git a/src/test/ui/issue-12552.stderr b/src/test/ui/issues/issue-12552.stderr
similarity index 100%
rename from src/test/ui/issue-12552.stderr
rename to src/test/ui/issues/issue-12552.stderr
diff --git a/src/test/ui/issues/issue-12567.nll.stderr b/src/test/ui/issues/issue-12567.nll.stderr
new file mode 100644
index 0000000..72d21d4
--- /dev/null
+++ b/src/test/ui/issues/issue-12567.nll.stderr
@@ -0,0 +1,45 @@
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:14:11
+ |
+LL | match (l1, l2) {
+ | ^^^^^^^^ cannot move out of here
+LL | (&[], &[]) => println!("both empty"),
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | -- data moved here
+...
+LL | (&[hd1, ..], &[hd2, ..])
+ | --- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/issue-12567.rs:16:17
+ |
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | ^^
+...
+LL | (&[hd1, ..], &[hd2, ..])
+ | ^^^
+
+error[E0508]: cannot move out of type `[T]`, a non-copy slice
+ --> $DIR/issue-12567.rs:14:11
+ |
+LL | match (l1, l2) {
+ | ^^^^^^^^ cannot move out of here
+LL | (&[], &[]) => println!("both empty"),
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | -- data moved here
+...
+LL | (&[hd1, ..], &[hd2, ..])
+ | --- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/issue-12567.rs:16:17
+ |
+LL | (&[], &[hd, ..]) | (&[hd, ..], &[])
+ | ^^
+...
+LL | (&[hd1, ..], &[hd2, ..])
+ | ^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/issue-12567.rs b/src/test/ui/issues/issue-12567.rs
similarity index 100%
rename from src/test/ui/issue-12567.rs
rename to src/test/ui/issues/issue-12567.rs
diff --git a/src/test/ui/issue-12567.stderr b/src/test/ui/issues/issue-12567.stderr
similarity index 100%
rename from src/test/ui/issue-12567.stderr
rename to src/test/ui/issues/issue-12567.stderr
diff --git a/src/test/ui/issue-12796.rs b/src/test/ui/issues/issue-12796.rs
similarity index 100%
rename from src/test/ui/issue-12796.rs
rename to src/test/ui/issues/issue-12796.rs
diff --git a/src/test/ui/issue-12796.stderr b/src/test/ui/issues/issue-12796.stderr
similarity index 100%
rename from src/test/ui/issue-12796.stderr
rename to src/test/ui/issues/issue-12796.stderr
diff --git a/src/test/ui/issue-12863.rs b/src/test/ui/issues/issue-12863.rs
similarity index 100%
rename from src/test/ui/issue-12863.rs
rename to src/test/ui/issues/issue-12863.rs
diff --git a/src/test/ui/issue-12863.stderr b/src/test/ui/issues/issue-12863.stderr
similarity index 100%
rename from src/test/ui/issue-12863.stderr
rename to src/test/ui/issues/issue-12863.stderr
diff --git a/src/test/ui/issue-12997-1.rs b/src/test/ui/issues/issue-12997-1.rs
similarity index 100%
rename from src/test/ui/issue-12997-1.rs
rename to src/test/ui/issues/issue-12997-1.rs
diff --git a/src/test/ui/issue-12997-1.stderr b/src/test/ui/issues/issue-12997-1.stderr
similarity index 100%
rename from src/test/ui/issue-12997-1.stderr
rename to src/test/ui/issues/issue-12997-1.stderr
diff --git a/src/test/ui/issue-12997-2.rs b/src/test/ui/issues/issue-12997-2.rs
similarity index 100%
rename from src/test/ui/issue-12997-2.rs
rename to src/test/ui/issues/issue-12997-2.rs
diff --git a/src/test/ui/issue-12997-2.stderr b/src/test/ui/issues/issue-12997-2.stderr
similarity index 100%
rename from src/test/ui/issue-12997-2.stderr
rename to src/test/ui/issues/issue-12997-2.stderr
diff --git a/src/test/ui/issue-13033.rs b/src/test/ui/issues/issue-13033.rs
similarity index 100%
rename from src/test/ui/issue-13033.rs
rename to src/test/ui/issues/issue-13033.rs
diff --git a/src/test/ui/issue-13033.stderr b/src/test/ui/issues/issue-13033.stderr
similarity index 100%
rename from src/test/ui/issue-13033.stderr
rename to src/test/ui/issues/issue-13033.stderr
diff --git a/src/test/ui/issue-13058.nll.stderr b/src/test/ui/issues/issue-13058.nll.stderr
similarity index 100%
rename from src/test/ui/issue-13058.nll.stderr
rename to src/test/ui/issues/issue-13058.nll.stderr
diff --git a/src/test/ui/issue-13058.rs b/src/test/ui/issues/issue-13058.rs
similarity index 100%
rename from src/test/ui/issue-13058.rs
rename to src/test/ui/issues/issue-13058.rs
diff --git a/src/test/ui/issue-13058.stderr b/src/test/ui/issues/issue-13058.stderr
similarity index 100%
rename from src/test/ui/issue-13058.stderr
rename to src/test/ui/issues/issue-13058.stderr
diff --git a/src/test/ui/issue-13352.rs b/src/test/ui/issues/issue-13352.rs
similarity index 100%
rename from src/test/ui/issue-13352.rs
rename to src/test/ui/issues/issue-13352.rs
diff --git a/src/test/ui/issue-13352.stderr b/src/test/ui/issues/issue-13352.stderr
similarity index 100%
rename from src/test/ui/issue-13352.stderr
rename to src/test/ui/issues/issue-13352.stderr
diff --git a/src/test/ui/issue-13359.rs b/src/test/ui/issues/issue-13359.rs
similarity index 100%
rename from src/test/ui/issue-13359.rs
rename to src/test/ui/issues/issue-13359.rs
diff --git a/src/test/ui/issue-13359.stderr b/src/test/ui/issues/issue-13359.stderr
similarity index 100%
rename from src/test/ui/issue-13359.stderr
rename to src/test/ui/issues/issue-13359.stderr
diff --git a/src/test/ui/issue-13404.rs b/src/test/ui/issues/issue-13404.rs
similarity index 100%
rename from src/test/ui/issue-13404.rs
rename to src/test/ui/issues/issue-13404.rs
diff --git a/src/test/ui/issue-13404.stderr b/src/test/ui/issues/issue-13404.stderr
similarity index 100%
rename from src/test/ui/issue-13404.stderr
rename to src/test/ui/issues/issue-13404.stderr
diff --git a/src/test/ui/issue-13407.rs b/src/test/ui/issues/issue-13407.rs
similarity index 100%
rename from src/test/ui/issue-13407.rs
rename to src/test/ui/issues/issue-13407.rs
diff --git a/src/test/ui/issue-13407.stderr b/src/test/ui/issues/issue-13407.stderr
similarity index 100%
rename from src/test/ui/issue-13407.stderr
rename to src/test/ui/issues/issue-13407.stderr
diff --git a/src/test/ui/issue-13446.rs b/src/test/ui/issues/issue-13446.rs
similarity index 100%
rename from src/test/ui/issue-13446.rs
rename to src/test/ui/issues/issue-13446.rs
diff --git a/src/test/ui/issue-13446.stderr b/src/test/ui/issues/issue-13446.stderr
similarity index 100%
rename from src/test/ui/issue-13446.stderr
rename to src/test/ui/issues/issue-13446.stderr
diff --git a/src/test/ui/issue-13466.rs b/src/test/ui/issues/issue-13466.rs
similarity index 100%
rename from src/test/ui/issue-13466.rs
rename to src/test/ui/issues/issue-13466.rs
diff --git a/src/test/ui/issue-13466.stderr b/src/test/ui/issues/issue-13466.stderr
similarity index 100%
rename from src/test/ui/issue-13466.stderr
rename to src/test/ui/issues/issue-13466.stderr
diff --git a/src/test/ui/issue-13482-2.rs b/src/test/ui/issues/issue-13482-2.rs
similarity index 100%
rename from src/test/ui/issue-13482-2.rs
rename to src/test/ui/issues/issue-13482-2.rs
diff --git a/src/test/ui/issue-13482-2.stderr b/src/test/ui/issues/issue-13482-2.stderr
similarity index 100%
rename from src/test/ui/issue-13482-2.stderr
rename to src/test/ui/issues/issue-13482-2.stderr
diff --git a/src/test/ui/issue-13482.rs b/src/test/ui/issues/issue-13482.rs
similarity index 100%
rename from src/test/ui/issue-13482.rs
rename to src/test/ui/issues/issue-13482.rs
diff --git a/src/test/ui/issue-13482.stderr b/src/test/ui/issues/issue-13482.stderr
similarity index 100%
rename from src/test/ui/issue-13482.stderr
rename to src/test/ui/issues/issue-13482.stderr
diff --git a/src/test/ui/issue-13483.rs b/src/test/ui/issues/issue-13483.rs
similarity index 100%
rename from src/test/ui/issue-13483.rs
rename to src/test/ui/issues/issue-13483.rs
diff --git a/src/test/ui/issue-13483.stderr b/src/test/ui/issues/issue-13483.stderr
similarity index 100%
rename from src/test/ui/issue-13483.stderr
rename to src/test/ui/issues/issue-13483.stderr
diff --git a/src/test/ui/issue-13497-2.nll.stderr b/src/test/ui/issues/issue-13497-2.nll.stderr
similarity index 100%
rename from src/test/ui/issue-13497-2.nll.stderr
rename to src/test/ui/issues/issue-13497-2.nll.stderr
diff --git a/src/test/ui/issue-13497-2.rs b/src/test/ui/issues/issue-13497-2.rs
similarity index 100%
rename from src/test/ui/issue-13497-2.rs
rename to src/test/ui/issues/issue-13497-2.rs
diff --git a/src/test/ui/issue-13497-2.stderr b/src/test/ui/issues/issue-13497-2.stderr
similarity index 100%
rename from src/test/ui/issue-13497-2.stderr
rename to src/test/ui/issues/issue-13497-2.stderr
diff --git a/src/test/ui/issue-13497.rs b/src/test/ui/issues/issue-13497.rs
similarity index 100%
rename from src/test/ui/issue-13497.rs
rename to src/test/ui/issues/issue-13497.rs
diff --git a/src/test/ui/issue-13497.stderr b/src/test/ui/issues/issue-13497.stderr
similarity index 100%
rename from src/test/ui/issue-13497.stderr
rename to src/test/ui/issues/issue-13497.stderr
diff --git a/src/test/ui/issue-1362.rs b/src/test/ui/issues/issue-1362.rs
similarity index 100%
rename from src/test/ui/issue-1362.rs
rename to src/test/ui/issues/issue-1362.rs
diff --git a/src/test/ui/issue-1362.stderr b/src/test/ui/issues/issue-1362.stderr
similarity index 100%
rename from src/test/ui/issue-1362.stderr
rename to src/test/ui/issues/issue-1362.stderr
diff --git a/src/test/ui/issue-13641.rs b/src/test/ui/issues/issue-13641.rs
similarity index 100%
rename from src/test/ui/issue-13641.rs
rename to src/test/ui/issues/issue-13641.rs
diff --git a/src/test/ui/issue-13641.stderr b/src/test/ui/issues/issue-13641.stderr
similarity index 100%
rename from src/test/ui/issue-13641.stderr
rename to src/test/ui/issues/issue-13641.stderr
diff --git a/src/test/ui/issue-13727.rs b/src/test/ui/issues/issue-13727.rs
similarity index 100%
rename from src/test/ui/issue-13727.rs
rename to src/test/ui/issues/issue-13727.rs
diff --git a/src/test/ui/issue-13727.stderr b/src/test/ui/issues/issue-13727.stderr
similarity index 100%
rename from src/test/ui/issue-13727.stderr
rename to src/test/ui/issues/issue-13727.stderr
diff --git a/src/test/ui/issue-13847.rs b/src/test/ui/issues/issue-13847.rs
similarity index 100%
rename from src/test/ui/issue-13847.rs
rename to src/test/ui/issues/issue-13847.rs
diff --git a/src/test/ui/issue-13847.stderr b/src/test/ui/issues/issue-13847.stderr
similarity index 100%
rename from src/test/ui/issue-13847.stderr
rename to src/test/ui/issues/issue-13847.stderr
diff --git a/src/test/ui/issue-13853-2.rs b/src/test/ui/issues/issue-13853-2.rs
similarity index 100%
rename from src/test/ui/issue-13853-2.rs
rename to src/test/ui/issues/issue-13853-2.rs
diff --git a/src/test/ui/issue-13853-2.stderr b/src/test/ui/issues/issue-13853-2.stderr
similarity index 100%
rename from src/test/ui/issue-13853-2.stderr
rename to src/test/ui/issues/issue-13853-2.stderr
diff --git a/src/test/ui/issue-13853-5.rs b/src/test/ui/issues/issue-13853-5.rs
similarity index 100%
rename from src/test/ui/issue-13853-5.rs
rename to src/test/ui/issues/issue-13853-5.rs
diff --git a/src/test/ui/issue-13853-5.stderr b/src/test/ui/issues/issue-13853-5.stderr
similarity index 100%
rename from src/test/ui/issue-13853-5.stderr
rename to src/test/ui/issues/issue-13853-5.stderr
diff --git a/src/test/ui/issue-13853.rs b/src/test/ui/issues/issue-13853.rs
similarity index 100%
rename from src/test/ui/issue-13853.rs
rename to src/test/ui/issues/issue-13853.rs
diff --git a/src/test/ui/issue-13853.stderr b/src/test/ui/issues/issue-13853.stderr
similarity index 100%
rename from src/test/ui/issue-13853.stderr
rename to src/test/ui/issues/issue-13853.stderr
diff --git a/src/test/ui/issue-14091-2.rs b/src/test/ui/issues/issue-14091-2.rs
similarity index 100%
rename from src/test/ui/issue-14091-2.rs
rename to src/test/ui/issues/issue-14091-2.rs
diff --git a/src/test/ui/issue-14091-2.stderr b/src/test/ui/issues/issue-14091-2.stderr
similarity index 100%
rename from src/test/ui/issue-14091-2.stderr
rename to src/test/ui/issues/issue-14091-2.stderr
diff --git a/src/test/ui/issue-14091.rs b/src/test/ui/issues/issue-14091.rs
similarity index 100%
rename from src/test/ui/issue-14091.rs
rename to src/test/ui/issues/issue-14091.rs
diff --git a/src/test/ui/issue-14091.stderr b/src/test/ui/issues/issue-14091.stderr
similarity index 100%
rename from src/test/ui/issue-14091.stderr
rename to src/test/ui/issues/issue-14091.stderr
diff --git a/src/test/ui/issue-14092.rs b/src/test/ui/issues/issue-14092.rs
similarity index 100%
rename from src/test/ui/issue-14092.rs
rename to src/test/ui/issues/issue-14092.rs
diff --git a/src/test/ui/issue-14092.stderr b/src/test/ui/issues/issue-14092.stderr
similarity index 100%
rename from src/test/ui/issue-14092.stderr
rename to src/test/ui/issues/issue-14092.stderr
diff --git a/src/test/ui/issue-14221.rs b/src/test/ui/issues/issue-14221.rs
similarity index 100%
rename from src/test/ui/issue-14221.rs
rename to src/test/ui/issues/issue-14221.rs
diff --git a/src/test/ui/issue-14221.stderr b/src/test/ui/issues/issue-14221.stderr
similarity index 100%
rename from src/test/ui/issue-14221.stderr
rename to src/test/ui/issues/issue-14221.stderr
diff --git a/src/test/ui/issue-14227.rs b/src/test/ui/issues/issue-14227.rs
similarity index 100%
rename from src/test/ui/issue-14227.rs
rename to src/test/ui/issues/issue-14227.rs
diff --git a/src/test/ui/issue-14227.stderr b/src/test/ui/issues/issue-14227.stderr
similarity index 100%
rename from src/test/ui/issue-14227.stderr
rename to src/test/ui/issues/issue-14227.stderr
diff --git a/src/test/ui/issues/issue-14285.nll.stderr b/src/test/ui/issues/issue-14285.nll.stderr
new file mode 100644
index 0000000..cf3e44f
--- /dev/null
+++ b/src/test/ui/issues/issue-14285.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/issue-14285.rs:22:7
+ |
+LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `a`
+ --> $DIR/issue-14285.rs:22:5
+ |
+LL | fn foo<'a>(a: &Foo) -> B<'a> {
+ | ---- help: add explicit lifetime `'a` to the type of `a`: `&'a (dyn Foo + 'a)`
+LL | B(a) //~ ERROR 22:5: 22:9: explicit lifetime required in the type of `a` [E0621]
+ | ^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issue-14285.rs b/src/test/ui/issues/issue-14285.rs
similarity index 100%
rename from src/test/ui/issue-14285.rs
rename to src/test/ui/issues/issue-14285.rs
diff --git a/src/test/ui/issue-14285.stderr b/src/test/ui/issues/issue-14285.stderr
similarity index 100%
rename from src/test/ui/issue-14285.stderr
rename to src/test/ui/issues/issue-14285.stderr
diff --git a/src/test/ui/issue-14309.rs b/src/test/ui/issues/issue-14309.rs
similarity index 100%
rename from src/test/ui/issue-14309.rs
rename to src/test/ui/issues/issue-14309.rs
diff --git a/src/test/ui/issue-14309.stderr b/src/test/ui/issues/issue-14309.stderr
similarity index 100%
rename from src/test/ui/issue-14309.stderr
rename to src/test/ui/issues/issue-14309.stderr
diff --git a/src/test/ui/issue-14366.rs b/src/test/ui/issues/issue-14366.rs
similarity index 100%
rename from src/test/ui/issue-14366.rs
rename to src/test/ui/issues/issue-14366.rs
diff --git a/src/test/ui/issues/issue-14366.stderr b/src/test/ui/issues/issue-14366.stderr
new file mode 100644
index 0000000..3c3ecd2
--- /dev/null
+++ b/src/test/ui/issues/issue-14366.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/issue-14366.rs:12:14
+ |
+LL | let _x = "test" as &::std::any::Any;
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required for the cast to the object type `dyn std::any::Any`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-1448-2.rs b/src/test/ui/issues/issue-1448-2.rs
similarity index 100%
rename from src/test/ui/issue-1448-2.rs
rename to src/test/ui/issues/issue-1448-2.rs
diff --git a/src/test/ui/issue-1448-2.stderr b/src/test/ui/issues/issue-1448-2.stderr
similarity index 100%
rename from src/test/ui/issue-1448-2.stderr
rename to src/test/ui/issues/issue-1448-2.stderr
diff --git a/src/test/ui/issue-14541.rs b/src/test/ui/issues/issue-14541.rs
similarity index 100%
rename from src/test/ui/issue-14541.rs
rename to src/test/ui/issues/issue-14541.rs
diff --git a/src/test/ui/issue-14541.stderr b/src/test/ui/issues/issue-14541.stderr
similarity index 100%
rename from src/test/ui/issue-14541.stderr
rename to src/test/ui/issues/issue-14541.stderr
diff --git a/src/test/ui/issue-14721.rs b/src/test/ui/issues/issue-14721.rs
similarity index 100%
rename from src/test/ui/issue-14721.rs
rename to src/test/ui/issues/issue-14721.rs
diff --git a/src/test/ui/issue-14721.stderr b/src/test/ui/issues/issue-14721.stderr
similarity index 100%
rename from src/test/ui/issue-14721.stderr
rename to src/test/ui/issues/issue-14721.stderr
diff --git a/src/test/ui/issue-1476.rs b/src/test/ui/issues/issue-1476.rs
similarity index 100%
rename from src/test/ui/issue-1476.rs
rename to src/test/ui/issues/issue-1476.rs
diff --git a/src/test/ui/issue-1476.stderr b/src/test/ui/issues/issue-1476.stderr
similarity index 100%
rename from src/test/ui/issue-1476.stderr
rename to src/test/ui/issues/issue-1476.stderr
diff --git a/src/test/ui/issue-14772.rs b/src/test/ui/issues/issue-14772.rs
similarity index 100%
rename from src/test/ui/issue-14772.rs
rename to src/test/ui/issues/issue-14772.rs
diff --git a/src/test/ui/issue-14772.stderr b/src/test/ui/issues/issue-14772.stderr
similarity index 100%
rename from src/test/ui/issue-14772.stderr
rename to src/test/ui/issues/issue-14772.stderr
diff --git a/src/test/ui/issue-14845.rs b/src/test/ui/issues/issue-14845.rs
similarity index 100%
rename from src/test/ui/issue-14845.rs
rename to src/test/ui/issues/issue-14845.rs
diff --git a/src/test/ui/issue-14845.stderr b/src/test/ui/issues/issue-14845.stderr
similarity index 100%
rename from src/test/ui/issue-14845.stderr
rename to src/test/ui/issues/issue-14845.stderr
diff --git a/src/test/ui/issue-14853.rs b/src/test/ui/issues/issue-14853.rs
similarity index 100%
rename from src/test/ui/issue-14853.rs
rename to src/test/ui/issues/issue-14853.rs
diff --git a/src/test/ui/issue-14853.stderr b/src/test/ui/issues/issue-14853.stderr
similarity index 100%
rename from src/test/ui/issue-14853.stderr
rename to src/test/ui/issues/issue-14853.stderr
diff --git a/src/test/ui/issue-14915.rs b/src/test/ui/issues/issue-14915.rs
similarity index 100%
rename from src/test/ui/issue-14915.rs
rename to src/test/ui/issues/issue-14915.rs
diff --git a/src/test/ui/issue-14915.stderr b/src/test/ui/issues/issue-14915.stderr
similarity index 100%
rename from src/test/ui/issue-14915.stderr
rename to src/test/ui/issues/issue-14915.stderr
diff --git a/src/test/ui/issues/issue-15034.nll.stderr b/src/test/ui/issues/issue-15034.nll.stderr
new file mode 100644
index 0000000..8dd18fa
--- /dev/null
+++ b/src/test/ui/issues/issue-15034.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/issue-15034.rs:27:9
+ |
+LL | Parser { lexer: lexer }
+ | ^^^^^^
+
+error[E0621]: explicit lifetime required in the type of `lexer`
+ --> $DIR/issue-15034.rs:27:9
+ |
+LL | pub fn new(lexer: &'a mut Lexer) -> Parser<'a> {
+ | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>`
+LL | Parser { lexer: lexer }
+ | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issue-15034.rs b/src/test/ui/issues/issue-15034.rs
similarity index 100%
rename from src/test/ui/issue-15034.rs
rename to src/test/ui/issues/issue-15034.rs
diff --git a/src/test/ui/issue-15034.stderr b/src/test/ui/issues/issue-15034.stderr
similarity index 100%
rename from src/test/ui/issue-15034.stderr
rename to src/test/ui/issues/issue-15034.stderr
diff --git a/src/test/ui/issue-15094.rs b/src/test/ui/issues/issue-15094.rs
similarity index 100%
rename from src/test/ui/issue-15094.rs
rename to src/test/ui/issues/issue-15094.rs
diff --git a/src/test/ui/issue-15094.stderr b/src/test/ui/issues/issue-15094.stderr
similarity index 100%
rename from src/test/ui/issue-15094.stderr
rename to src/test/ui/issues/issue-15094.stderr
diff --git a/src/test/ui/issue-15129.rs b/src/test/ui/issues/issue-15129.rs
similarity index 100%
rename from src/test/ui/issue-15129.rs
rename to src/test/ui/issues/issue-15129.rs
diff --git a/src/test/ui/issue-15129.stderr b/src/test/ui/issues/issue-15129.stderr
similarity index 100%
rename from src/test/ui/issue-15129.stderr
rename to src/test/ui/issues/issue-15129.stderr
diff --git a/src/test/ui/issue-15167.rs b/src/test/ui/issues/issue-15167.rs
similarity index 100%
rename from src/test/ui/issue-15167.rs
rename to src/test/ui/issues/issue-15167.rs
diff --git a/src/test/ui/issue-15167.stderr b/src/test/ui/issues/issue-15167.stderr
similarity index 100%
rename from src/test/ui/issue-15167.stderr
rename to src/test/ui/issues/issue-15167.stderr
diff --git a/src/test/ui/issue-15207.rs b/src/test/ui/issues/issue-15207.rs
similarity index 100%
rename from src/test/ui/issue-15207.rs
rename to src/test/ui/issues/issue-15207.rs
diff --git a/src/test/ui/issue-15207.stderr b/src/test/ui/issues/issue-15207.stderr
similarity index 100%
rename from src/test/ui/issue-15207.stderr
rename to src/test/ui/issues/issue-15207.stderr
diff --git a/src/test/ui/issue-15260.rs b/src/test/ui/issues/issue-15260.rs
similarity index 100%
rename from src/test/ui/issue-15260.rs
rename to src/test/ui/issues/issue-15260.rs
diff --git a/src/test/ui/issue-15260.stderr b/src/test/ui/issues/issue-15260.stderr
similarity index 100%
rename from src/test/ui/issue-15260.stderr
rename to src/test/ui/issues/issue-15260.stderr
diff --git a/src/test/ui/issue-15381.rs b/src/test/ui/issues/issue-15381.rs
similarity index 100%
rename from src/test/ui/issue-15381.rs
rename to src/test/ui/issues/issue-15381.rs
diff --git a/src/test/ui/issue-15381.stderr b/src/test/ui/issues/issue-15381.stderr
similarity index 100%
rename from src/test/ui/issue-15381.stderr
rename to src/test/ui/issues/issue-15381.stderr
diff --git a/src/test/ui/issue-15524.rs b/src/test/ui/issues/issue-15524.rs
similarity index 100%
rename from src/test/ui/issue-15524.rs
rename to src/test/ui/issues/issue-15524.rs
diff --git a/src/test/ui/issue-15524.stderr b/src/test/ui/issues/issue-15524.stderr
similarity index 100%
rename from src/test/ui/issue-15524.stderr
rename to src/test/ui/issues/issue-15524.stderr
diff --git a/src/test/ui/issue-15756.rs b/src/test/ui/issues/issue-15756.rs
similarity index 100%
rename from src/test/ui/issue-15756.rs
rename to src/test/ui/issues/issue-15756.rs
diff --git a/src/test/ui/issues/issue-15756.stderr b/src/test/ui/issues/issue-15756.stderr
new file mode 100644
index 0000000..877e0ea
--- /dev/null
+++ b/src/test/ui/issues/issue-15756.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `[T]` cannot be known at compilation time
+ --> $DIR/issue-15756.rs:17:10
+ |
+LL | &mut something
+ | ^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[T]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-15783.rs b/src/test/ui/issues/issue-15783.rs
similarity index 100%
rename from src/test/ui/issue-15783.rs
rename to src/test/ui/issues/issue-15783.rs
diff --git a/src/test/ui/issue-15783.stderr b/src/test/ui/issues/issue-15783.stderr
similarity index 100%
rename from src/test/ui/issue-15783.stderr
rename to src/test/ui/issues/issue-15783.stderr
diff --git a/src/test/ui/issue-15896.rs b/src/test/ui/issues/issue-15896.rs
similarity index 100%
rename from src/test/ui/issue-15896.rs
rename to src/test/ui/issues/issue-15896.rs
diff --git a/src/test/ui/issue-15896.stderr b/src/test/ui/issues/issue-15896.stderr
similarity index 100%
rename from src/test/ui/issue-15896.stderr
rename to src/test/ui/issues/issue-15896.stderr
diff --git a/src/test/ui/issues/issue-15919.rs b/src/test/ui/issues/issue-15919.rs
new file mode 100644
index 0000000..f371995
--- /dev/null
+++ b/src/test/ui/issues/issue-15919.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 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.
+
+// error-pattern: too big for the current architecture
+// normalize-stderr-test "\[usize; \d+\]" -> "[usize; N]"
+
+#[cfg(target_pointer_width = "32")]
+fn main() {
+ let x = [0usize; 0xffff_ffff];
+}
+
+#[cfg(target_pointer_width = "64")]
+fn main() {
+ let x = [0usize; 0xffff_ffff_ffff_ffff];
+}
diff --git a/src/test/ui/issues/issue-15919.stderr b/src/test/ui/issues/issue-15919.stderr
new file mode 100644
index 0000000..e4e88cc
--- /dev/null
+++ b/src/test/ui/issues/issue-15919.stderr
@@ -0,0 +1,4 @@
+error: the type `[usize; N]` is too big for the current architecture
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-15965.rs b/src/test/ui/issues/issue-15965.rs
similarity index 100%
rename from src/test/ui/issue-15965.rs
rename to src/test/ui/issues/issue-15965.rs
diff --git a/src/test/ui/issue-15965.stderr b/src/test/ui/issues/issue-15965.stderr
similarity index 100%
rename from src/test/ui/issue-15965.stderr
rename to src/test/ui/issues/issue-15965.stderr
diff --git a/src/test/ui/issue-16048.rs b/src/test/ui/issues/issue-16048.rs
similarity index 100%
rename from src/test/ui/issue-16048.rs
rename to src/test/ui/issues/issue-16048.rs
diff --git a/src/test/ui/issue-16048.stderr b/src/test/ui/issues/issue-16048.stderr
similarity index 100%
rename from src/test/ui/issue-16048.stderr
rename to src/test/ui/issues/issue-16048.stderr
diff --git a/src/test/ui/issue-16098.rs b/src/test/ui/issues/issue-16098.rs
similarity index 100%
rename from src/test/ui/issue-16098.rs
rename to src/test/ui/issues/issue-16098.rs
diff --git a/src/test/ui/issue-16098.stderr b/src/test/ui/issues/issue-16098.stderr
similarity index 100%
rename from src/test/ui/issue-16098.stderr
rename to src/test/ui/issues/issue-16098.stderr
diff --git a/src/test/ui/issue-16149.rs b/src/test/ui/issues/issue-16149.rs
similarity index 100%
rename from src/test/ui/issue-16149.rs
rename to src/test/ui/issues/issue-16149.rs
diff --git a/src/test/ui/issue-16149.stderr b/src/test/ui/issues/issue-16149.stderr
similarity index 100%
rename from src/test/ui/issue-16149.stderr
rename to src/test/ui/issues/issue-16149.stderr
diff --git a/src/test/ui/issue-16250.rs b/src/test/ui/issues/issue-16250.rs
similarity index 100%
rename from src/test/ui/issue-16250.rs
rename to src/test/ui/issues/issue-16250.rs
diff --git a/src/test/ui/issue-16250.stderr b/src/test/ui/issues/issue-16250.stderr
similarity index 100%
rename from src/test/ui/issue-16250.stderr
rename to src/test/ui/issues/issue-16250.stderr
diff --git a/src/test/ui/issue-16338.rs b/src/test/ui/issues/issue-16338.rs
similarity index 100%
rename from src/test/ui/issue-16338.rs
rename to src/test/ui/issues/issue-16338.rs
diff --git a/src/test/ui/issue-16338.stderr b/src/test/ui/issues/issue-16338.stderr
similarity index 100%
rename from src/test/ui/issue-16338.stderr
rename to src/test/ui/issues/issue-16338.stderr
diff --git a/src/test/ui/issue-16401.rs b/src/test/ui/issues/issue-16401.rs
similarity index 100%
rename from src/test/ui/issue-16401.rs
rename to src/test/ui/issues/issue-16401.rs
diff --git a/src/test/ui/issue-16401.stderr b/src/test/ui/issues/issue-16401.stderr
similarity index 100%
rename from src/test/ui/issue-16401.stderr
rename to src/test/ui/issues/issue-16401.stderr
diff --git a/src/test/ui/issue-16538.rs b/src/test/ui/issues/issue-16538.rs
similarity index 100%
rename from src/test/ui/issue-16538.rs
rename to src/test/ui/issues/issue-16538.rs
diff --git a/src/test/ui/issue-16538.stderr b/src/test/ui/issues/issue-16538.stderr
similarity index 100%
rename from src/test/ui/issue-16538.stderr
rename to src/test/ui/issues/issue-16538.stderr
diff --git a/src/test/ui/issue-16562.rs b/src/test/ui/issues/issue-16562.rs
similarity index 100%
rename from src/test/ui/issue-16562.rs
rename to src/test/ui/issues/issue-16562.rs
diff --git a/src/test/ui/issue-16562.stderr b/src/test/ui/issues/issue-16562.stderr
similarity index 100%
rename from src/test/ui/issue-16562.stderr
rename to src/test/ui/issues/issue-16562.stderr
diff --git a/src/test/ui/issue-16683.nll.stderr b/src/test/ui/issues/issue-16683.nll.stderr
similarity index 100%
rename from src/test/ui/issue-16683.nll.stderr
rename to src/test/ui/issues/issue-16683.nll.stderr
diff --git a/src/test/ui/issue-16683.rs b/src/test/ui/issues/issue-16683.rs
similarity index 100%
rename from src/test/ui/issue-16683.rs
rename to src/test/ui/issues/issue-16683.rs
diff --git a/src/test/ui/issue-16683.stderr b/src/test/ui/issues/issue-16683.stderr
similarity index 100%
rename from src/test/ui/issue-16683.stderr
rename to src/test/ui/issues/issue-16683.stderr
diff --git a/src/test/compile-fail/issue-16725.rs b/src/test/ui/issues/issue-16725.rs
similarity index 100%
rename from src/test/compile-fail/issue-16725.rs
rename to src/test/ui/issues/issue-16725.rs
diff --git a/src/test/ui/issues/issue-16725.stderr b/src/test/ui/issues/issue-16725.stderr
new file mode 100644
index 0000000..709f3cf
--- /dev/null
+++ b/src/test/ui/issues/issue-16725.stderr
@@ -0,0 +1,9 @@
+error[E0603]: function `bar` is private
+ --> $DIR/issue-16725.rs:16:14
+ |
+LL | unsafe { foo::bar(); }
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/issue-16922.nll.stderr b/src/test/ui/issues/issue-16922.nll.stderr
similarity index 100%
rename from src/test/ui/issue-16922.nll.stderr
rename to src/test/ui/issues/issue-16922.nll.stderr
diff --git a/src/test/ui/issue-16922.rs b/src/test/ui/issues/issue-16922.rs
similarity index 100%
rename from src/test/ui/issue-16922.rs
rename to src/test/ui/issues/issue-16922.rs
diff --git a/src/test/ui/issue-16922.stderr b/src/test/ui/issues/issue-16922.stderr
similarity index 100%
rename from src/test/ui/issue-16922.stderr
rename to src/test/ui/issues/issue-16922.stderr
diff --git a/src/test/ui/issue-16939.rs b/src/test/ui/issues/issue-16939.rs
similarity index 100%
rename from src/test/ui/issue-16939.rs
rename to src/test/ui/issues/issue-16939.rs
diff --git a/src/test/ui/issue-16939.stderr b/src/test/ui/issues/issue-16939.stderr
similarity index 100%
rename from src/test/ui/issue-16939.stderr
rename to src/test/ui/issues/issue-16939.stderr
diff --git a/src/test/ui/issue-16966.rs b/src/test/ui/issues/issue-16966.rs
similarity index 100%
rename from src/test/ui/issue-16966.rs
rename to src/test/ui/issues/issue-16966.rs
diff --git a/src/test/ui/issue-16966.stderr b/src/test/ui/issues/issue-16966.stderr
similarity index 100%
rename from src/test/ui/issue-16966.stderr
rename to src/test/ui/issues/issue-16966.stderr
diff --git a/src/test/ui/issue-1697.rs b/src/test/ui/issues/issue-1697.rs
similarity index 100%
rename from src/test/ui/issue-1697.rs
rename to src/test/ui/issues/issue-1697.rs
diff --git a/src/test/ui/issue-1697.stderr b/src/test/ui/issues/issue-1697.stderr
similarity index 100%
rename from src/test/ui/issue-1697.stderr
rename to src/test/ui/issues/issue-1697.stderr
diff --git a/src/test/ui/issue-16994.rs b/src/test/ui/issues/issue-16994.rs
similarity index 100%
rename from src/test/ui/issue-16994.rs
rename to src/test/ui/issues/issue-16994.rs
diff --git a/src/test/ui/issue-16994.stderr b/src/test/ui/issues/issue-16994.stderr
similarity index 100%
rename from src/test/ui/issue-16994.stderr
rename to src/test/ui/issues/issue-16994.stderr
diff --git a/src/test/ui/issue-17001.rs b/src/test/ui/issues/issue-17001.rs
similarity index 100%
rename from src/test/ui/issue-17001.rs
rename to src/test/ui/issues/issue-17001.rs
diff --git a/src/test/ui/issue-17001.stderr b/src/test/ui/issues/issue-17001.stderr
similarity index 100%
rename from src/test/ui/issue-17001.stderr
rename to src/test/ui/issues/issue-17001.stderr
diff --git a/src/test/ui/issue-17025.rs b/src/test/ui/issues/issue-17025.rs
similarity index 100%
rename from src/test/ui/issue-17025.rs
rename to src/test/ui/issues/issue-17025.rs
diff --git a/src/test/ui/issue-17033.rs b/src/test/ui/issues/issue-17033.rs
similarity index 100%
rename from src/test/ui/issue-17033.rs
rename to src/test/ui/issues/issue-17033.rs
diff --git a/src/test/ui/issue-17033.stderr b/src/test/ui/issues/issue-17033.stderr
similarity index 100%
rename from src/test/ui/issue-17033.stderr
rename to src/test/ui/issues/issue-17033.stderr
diff --git a/src/test/ui/issue-17252.rs b/src/test/ui/issues/issue-17252.rs
similarity index 100%
rename from src/test/ui/issue-17252.rs
rename to src/test/ui/issues/issue-17252.rs
diff --git a/src/test/ui/issue-17252.stderr b/src/test/ui/issues/issue-17252.stderr
similarity index 100%
rename from src/test/ui/issue-17252.stderr
rename to src/test/ui/issues/issue-17252.stderr
diff --git a/src/test/ui/issue-17263.nll.stderr b/src/test/ui/issues/issue-17263.nll.stderr
similarity index 100%
rename from src/test/ui/issue-17263.nll.stderr
rename to src/test/ui/issues/issue-17263.nll.stderr
diff --git a/src/test/ui/issue-17263.rs b/src/test/ui/issues/issue-17263.rs
similarity index 100%
rename from src/test/ui/issue-17263.rs
rename to src/test/ui/issues/issue-17263.rs
diff --git a/src/test/ui/issue-17263.stderr b/src/test/ui/issues/issue-17263.stderr
similarity index 100%
rename from src/test/ui/issue-17263.stderr
rename to src/test/ui/issues/issue-17263.stderr
diff --git a/src/test/ui/issue-17337.rs b/src/test/ui/issues/issue-17337.rs
similarity index 100%
rename from src/test/ui/issue-17337.rs
rename to src/test/ui/issues/issue-17337.rs
diff --git a/src/test/ui/issue-17337.stderr b/src/test/ui/issues/issue-17337.stderr
similarity index 100%
rename from src/test/ui/issue-17337.stderr
rename to src/test/ui/issues/issue-17337.stderr
diff --git a/src/test/ui/issue-17373.rs b/src/test/ui/issues/issue-17373.rs
similarity index 100%
rename from src/test/ui/issue-17373.rs
rename to src/test/ui/issues/issue-17373.rs
diff --git a/src/test/ui/issue-17373.stderr b/src/test/ui/issues/issue-17373.stderr
similarity index 100%
rename from src/test/ui/issue-17373.stderr
rename to src/test/ui/issues/issue-17373.stderr
diff --git a/src/test/ui/issue-17385.nll.stderr b/src/test/ui/issues/issue-17385.nll.stderr
similarity index 100%
rename from src/test/ui/issue-17385.nll.stderr
rename to src/test/ui/issues/issue-17385.nll.stderr
diff --git a/src/test/ui/issue-17385.rs b/src/test/ui/issues/issue-17385.rs
similarity index 100%
rename from src/test/ui/issue-17385.rs
rename to src/test/ui/issues/issue-17385.rs
diff --git a/src/test/ui/issue-17385.stderr b/src/test/ui/issues/issue-17385.stderr
similarity index 100%
rename from src/test/ui/issue-17385.stderr
rename to src/test/ui/issues/issue-17385.stderr
diff --git a/src/test/ui/issue-17405.rs b/src/test/ui/issues/issue-17405.rs
similarity index 100%
rename from src/test/ui/issue-17405.rs
rename to src/test/ui/issues/issue-17405.rs
diff --git a/src/test/ui/issue-17405.stderr b/src/test/ui/issues/issue-17405.stderr
similarity index 100%
rename from src/test/ui/issue-17405.stderr
rename to src/test/ui/issues/issue-17405.stderr
diff --git a/src/test/ui/issue-17431-1.rs b/src/test/ui/issues/issue-17431-1.rs
similarity index 100%
rename from src/test/ui/issue-17431-1.rs
rename to src/test/ui/issues/issue-17431-1.rs
diff --git a/src/test/ui/issue-17431-1.stderr b/src/test/ui/issues/issue-17431-1.stderr
similarity index 100%
rename from src/test/ui/issue-17431-1.stderr
rename to src/test/ui/issues/issue-17431-1.stderr
diff --git a/src/test/ui/issue-17431-2.rs b/src/test/ui/issues/issue-17431-2.rs
similarity index 100%
rename from src/test/ui/issue-17431-2.rs
rename to src/test/ui/issues/issue-17431-2.rs
diff --git a/src/test/ui/issue-17431-2.stderr b/src/test/ui/issues/issue-17431-2.stderr
similarity index 100%
rename from src/test/ui/issue-17431-2.stderr
rename to src/test/ui/issues/issue-17431-2.stderr
diff --git a/src/test/ui/issue-17431-3.rs b/src/test/ui/issues/issue-17431-3.rs
similarity index 100%
rename from src/test/ui/issue-17431-3.rs
rename to src/test/ui/issues/issue-17431-3.rs
diff --git a/src/test/ui/issue-17431-3.stderr b/src/test/ui/issues/issue-17431-3.stderr
similarity index 100%
rename from src/test/ui/issue-17431-3.stderr
rename to src/test/ui/issues/issue-17431-3.stderr
diff --git a/src/test/ui/issue-17431-4.rs b/src/test/ui/issues/issue-17431-4.rs
similarity index 100%
rename from src/test/ui/issue-17431-4.rs
rename to src/test/ui/issues/issue-17431-4.rs
diff --git a/src/test/ui/issue-17431-4.stderr b/src/test/ui/issues/issue-17431-4.stderr
similarity index 100%
rename from src/test/ui/issue-17431-4.stderr
rename to src/test/ui/issues/issue-17431-4.stderr
diff --git a/src/test/ui/issue-17431-5.rs b/src/test/ui/issues/issue-17431-5.rs
similarity index 100%
rename from src/test/ui/issue-17431-5.rs
rename to src/test/ui/issues/issue-17431-5.rs
diff --git a/src/test/ui/issue-17431-5.stderr b/src/test/ui/issues/issue-17431-5.stderr
similarity index 100%
rename from src/test/ui/issue-17431-5.stderr
rename to src/test/ui/issues/issue-17431-5.stderr
diff --git a/src/test/ui/issue-17431-6.rs b/src/test/ui/issues/issue-17431-6.rs
similarity index 100%
rename from src/test/ui/issue-17431-6.rs
rename to src/test/ui/issues/issue-17431-6.rs
diff --git a/src/test/ui/issue-17431-6.stderr b/src/test/ui/issues/issue-17431-6.stderr
similarity index 100%
rename from src/test/ui/issue-17431-6.stderr
rename to src/test/ui/issues/issue-17431-6.stderr
diff --git a/src/test/ui/issue-17431-7.rs b/src/test/ui/issues/issue-17431-7.rs
similarity index 100%
rename from src/test/ui/issue-17431-7.rs
rename to src/test/ui/issues/issue-17431-7.rs
diff --git a/src/test/ui/issue-17431-7.stderr b/src/test/ui/issues/issue-17431-7.stderr
similarity index 100%
rename from src/test/ui/issue-17431-7.stderr
rename to src/test/ui/issues/issue-17431-7.stderr
diff --git a/src/test/ui/issue-17441.rs b/src/test/ui/issues/issue-17441.rs
similarity index 100%
rename from src/test/ui/issue-17441.rs
rename to src/test/ui/issues/issue-17441.rs
diff --git a/src/test/ui/issue-17441.stderr b/src/test/ui/issues/issue-17441.stderr
similarity index 100%
rename from src/test/ui/issue-17441.stderr
rename to src/test/ui/issues/issue-17441.stderr
diff --git a/src/test/ui/issue-17444.rs b/src/test/ui/issues/issue-17444.rs
similarity index 100%
rename from src/test/ui/issue-17444.rs
rename to src/test/ui/issues/issue-17444.rs
diff --git a/src/test/ui/issue-17444.stderr b/src/test/ui/issues/issue-17444.stderr
similarity index 100%
rename from src/test/ui/issue-17444.stderr
rename to src/test/ui/issues/issue-17444.stderr
diff --git a/src/test/ui/issue-17458.rs b/src/test/ui/issues/issue-17458.rs
similarity index 100%
rename from src/test/ui/issue-17458.rs
rename to src/test/ui/issues/issue-17458.rs
diff --git a/src/test/ui/issue-17458.stderr b/src/test/ui/issues/issue-17458.stderr
similarity index 100%
rename from src/test/ui/issue-17458.stderr
rename to src/test/ui/issues/issue-17458.stderr
diff --git a/src/test/ui/issue-17545.nll.stderr b/src/test/ui/issues/issue-17545.nll.stderr
similarity index 100%
rename from src/test/ui/issue-17545.nll.stderr
rename to src/test/ui/issues/issue-17545.nll.stderr
diff --git a/src/test/ui/issue-17545.rs b/src/test/ui/issues/issue-17545.rs
similarity index 100%
rename from src/test/ui/issue-17545.rs
rename to src/test/ui/issues/issue-17545.rs
diff --git a/src/test/ui/issue-17545.stderr b/src/test/ui/issues/issue-17545.stderr
similarity index 100%
rename from src/test/ui/issue-17545.stderr
rename to src/test/ui/issues/issue-17545.stderr
diff --git a/src/test/ui/issue-17546.rs b/src/test/ui/issues/issue-17546.rs
similarity index 100%
rename from src/test/ui/issue-17546.rs
rename to src/test/ui/issues/issue-17546.rs
diff --git a/src/test/ui/issue-17546.stderr b/src/test/ui/issues/issue-17546.stderr
similarity index 100%
rename from src/test/ui/issue-17546.stderr
rename to src/test/ui/issues/issue-17546.stderr
diff --git a/src/test/ui/issue-17551.rs b/src/test/ui/issues/issue-17551.rs
similarity index 100%
rename from src/test/ui/issue-17551.rs
rename to src/test/ui/issues/issue-17551.rs
diff --git a/src/test/ui/issue-17551.stderr b/src/test/ui/issues/issue-17551.stderr
similarity index 100%
rename from src/test/ui/issue-17551.stderr
rename to src/test/ui/issues/issue-17551.stderr
diff --git a/src/test/ui/issue-17651.rs b/src/test/ui/issues/issue-17651.rs
similarity index 100%
rename from src/test/ui/issue-17651.rs
rename to src/test/ui/issues/issue-17651.rs
diff --git a/src/test/ui/issues/issue-17651.stderr b/src/test/ui/issues/issue-17651.stderr
new file mode 100644
index 0000000..3e5679b
--- /dev/null
+++ b/src/test/ui/issues/issue-17651.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
+ --> $DIR/issue-17651.rs:15:9
+ |
+LL | (|| Box::new(*(&[0][..])))();
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `<std::boxed::Box<T>>::new`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-17718-const-bad-values.rs b/src/test/ui/issues/issue-17718-const-bad-values.rs
similarity index 100%
rename from src/test/ui/issue-17718-const-bad-values.rs
rename to src/test/ui/issues/issue-17718-const-bad-values.rs
diff --git a/src/test/ui/issue-17718-const-bad-values.stderr b/src/test/ui/issues/issue-17718-const-bad-values.stderr
similarity index 100%
rename from src/test/ui/issue-17718-const-bad-values.stderr
rename to src/test/ui/issues/issue-17718-const-bad-values.stderr
diff --git a/src/test/ui/issue-17718-const-borrow.rs b/src/test/ui/issues/issue-17718-const-borrow.rs
similarity index 100%
rename from src/test/ui/issue-17718-const-borrow.rs
rename to src/test/ui/issues/issue-17718-const-borrow.rs
diff --git a/src/test/ui/issue-17718-const-borrow.stderr b/src/test/ui/issues/issue-17718-const-borrow.stderr
similarity index 100%
rename from src/test/ui/issue-17718-const-borrow.stderr
rename to src/test/ui/issues/issue-17718-const-borrow.stderr
diff --git a/src/test/ui/issue-17718-const-naming.rs b/src/test/ui/issues/issue-17718-const-naming.rs
similarity index 100%
rename from src/test/ui/issue-17718-const-naming.rs
rename to src/test/ui/issues/issue-17718-const-naming.rs
diff --git a/src/test/ui/issue-17718-const-naming.stderr b/src/test/ui/issues/issue-17718-const-naming.stderr
similarity index 100%
rename from src/test/ui/issue-17718-const-naming.stderr
rename to src/test/ui/issues/issue-17718-const-naming.stderr
diff --git a/src/test/compile-fail/issue-17718-const-privacy.rs b/src/test/ui/issues/issue-17718-const-privacy.rs
similarity index 100%
rename from src/test/compile-fail/issue-17718-const-privacy.rs
rename to src/test/ui/issues/issue-17718-const-privacy.rs
diff --git a/src/test/ui/issues/issue-17718-const-privacy.stderr b/src/test/ui/issues/issue-17718-const-privacy.stderr
new file mode 100644
index 0000000..a453e59
--- /dev/null
+++ b/src/test/ui/issues/issue-17718-const-privacy.stderr
@@ -0,0 +1,15 @@
+error[E0603]: constant `B` is private
+ --> $DIR/issue-17718-const-privacy.rs:15:5
+ |
+LL | use a::B; //~ ERROR: constant `B` is private
+ | ^^^^
+
+error[E0603]: constant `BAR` is private
+ --> $DIR/issue-17718-const-privacy.rs:18:5
+ |
+LL | BAR, //~ ERROR: constant `BAR` is private
+ | ^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/ui/issue-17718-constants-not-static.rs b/src/test/ui/issues/issue-17718-constants-not-static.rs
similarity index 100%
rename from src/test/ui/issue-17718-constants-not-static.rs
rename to src/test/ui/issues/issue-17718-constants-not-static.rs
diff --git a/src/test/ui/issue-17718-constants-not-static.stderr b/src/test/ui/issues/issue-17718-constants-not-static.stderr
similarity index 100%
rename from src/test/ui/issue-17718-constants-not-static.stderr
rename to src/test/ui/issues/issue-17718-constants-not-static.stderr
diff --git a/src/test/ui/issue-17718-patterns.rs b/src/test/ui/issues/issue-17718-patterns.rs
similarity index 100%
rename from src/test/ui/issue-17718-patterns.rs
rename to src/test/ui/issues/issue-17718-patterns.rs
diff --git a/src/test/ui/issue-17718-patterns.stderr b/src/test/ui/issues/issue-17718-patterns.stderr
similarity index 100%
rename from src/test/ui/issue-17718-patterns.stderr
rename to src/test/ui/issues/issue-17718-patterns.stderr
diff --git a/src/test/ui/issue-17718-references.rs b/src/test/ui/issues/issue-17718-references.rs
similarity index 100%
rename from src/test/ui/issue-17718-references.rs
rename to src/test/ui/issues/issue-17718-references.rs
diff --git a/src/test/ui/issue-17718-references.stderr b/src/test/ui/issues/issue-17718-references.stderr
similarity index 100%
rename from src/test/ui/issue-17718-references.stderr
rename to src/test/ui/issues/issue-17718-references.stderr
diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr
new file mode 100644
index 0000000..f8da3c3
--- /dev/null
+++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of static item
+ --> $DIR/issue-17718-static-move.rs:16:14
+ |
+LL | let _a = FOO; //~ ERROR: cannot move out of static item
+ | ^^^
+ | |
+ | cannot move out of static item
+ | help: consider borrowing here: `&FOO`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-17718-static-move.rs b/src/test/ui/issues/issue-17718-static-move.rs
similarity index 100%
rename from src/test/ui/issue-17718-static-move.rs
rename to src/test/ui/issues/issue-17718-static-move.rs
diff --git a/src/test/ui/issue-17718-static-move.stderr b/src/test/ui/issues/issue-17718-static-move.stderr
similarity index 100%
rename from src/test/ui/issue-17718-static-move.stderr
rename to src/test/ui/issues/issue-17718-static-move.stderr
diff --git a/src/test/ui/issue-17718-static-sync.rs b/src/test/ui/issues/issue-17718-static-sync.rs
similarity index 100%
rename from src/test/ui/issue-17718-static-sync.rs
rename to src/test/ui/issues/issue-17718-static-sync.rs
diff --git a/src/test/ui/issue-17718-static-sync.stderr b/src/test/ui/issues/issue-17718-static-sync.stderr
similarity index 100%
rename from src/test/ui/issue-17718-static-sync.stderr
rename to src/test/ui/issues/issue-17718-static-sync.stderr
diff --git a/src/test/ui/issue-17728.nll.stderr b/src/test/ui/issues/issue-17728.nll.stderr
similarity index 100%
rename from src/test/ui/issue-17728.nll.stderr
rename to src/test/ui/issues/issue-17728.nll.stderr
diff --git a/src/test/ui/issue-17728.rs b/src/test/ui/issues/issue-17728.rs
similarity index 100%
rename from src/test/ui/issue-17728.rs
rename to src/test/ui/issues/issue-17728.rs
diff --git a/src/test/ui/issue-17728.stderr b/src/test/ui/issues/issue-17728.stderr
similarity index 100%
rename from src/test/ui/issue-17728.stderr
rename to src/test/ui/issues/issue-17728.stderr
diff --git a/src/test/ui/issue-17740.rs b/src/test/ui/issues/issue-17740.rs
similarity index 100%
rename from src/test/ui/issue-17740.rs
rename to src/test/ui/issues/issue-17740.rs
diff --git a/src/test/ui/issue-17740.stderr b/src/test/ui/issues/issue-17740.stderr
similarity index 100%
rename from src/test/ui/issue-17740.stderr
rename to src/test/ui/issues/issue-17740.stderr
diff --git a/src/test/ui/issue-17758.nll.stderr b/src/test/ui/issues/issue-17758.nll.stderr
similarity index 100%
rename from src/test/ui/issue-17758.nll.stderr
rename to src/test/ui/issues/issue-17758.nll.stderr
diff --git a/src/test/ui/issue-17758.rs b/src/test/ui/issues/issue-17758.rs
similarity index 100%
rename from src/test/ui/issue-17758.rs
rename to src/test/ui/issues/issue-17758.rs
diff --git a/src/test/ui/issue-17758.stderr b/src/test/ui/issues/issue-17758.stderr
similarity index 100%
rename from src/test/ui/issue-17758.stderr
rename to src/test/ui/issues/issue-17758.stderr
diff --git a/src/test/ui/issue-17800.rs b/src/test/ui/issues/issue-17800.rs
similarity index 100%
rename from src/test/ui/issue-17800.rs
rename to src/test/ui/issues/issue-17800.rs
diff --git a/src/test/ui/issue-17800.stderr b/src/test/ui/issues/issue-17800.stderr
similarity index 100%
rename from src/test/ui/issue-17800.stderr
rename to src/test/ui/issues/issue-17800.stderr
diff --git a/src/test/ui/issue-17904-2.rs b/src/test/ui/issues/issue-17904-2.rs
similarity index 100%
rename from src/test/ui/issue-17904-2.rs
rename to src/test/ui/issues/issue-17904-2.rs
diff --git a/src/test/ui/issue-17904-2.stderr b/src/test/ui/issues/issue-17904-2.stderr
similarity index 100%
rename from src/test/ui/issue-17904-2.stderr
rename to src/test/ui/issues/issue-17904-2.stderr
diff --git a/src/test/ui/issue-17905.rs b/src/test/ui/issues/issue-17905.rs
similarity index 100%
rename from src/test/ui/issue-17905.rs
rename to src/test/ui/issues/issue-17905.rs
diff --git a/src/test/ui/issue-17905.stderr b/src/test/ui/issues/issue-17905.stderr
similarity index 100%
rename from src/test/ui/issue-17905.stderr
rename to src/test/ui/issues/issue-17905.stderr
diff --git a/src/test/ui/issues/issue-17913.rs b/src/test/ui/issues/issue-17913.rs
new file mode 100644
index 0000000..9b91599
--- /dev/null
+++ b/src/test/ui/issues/issue-17913.rs
@@ -0,0 +1,28 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// normalize-stderr-test "\[&usize; \d+\]" -> "[&usize; N]"
+// error-pattern: too big for the current architecture
+
+#![feature(box_syntax)]
+
+#[cfg(target_pointer_width = "64")]
+fn main() {
+ let n = 0_usize;
+ let a: Box<_> = box [&n; 0xF000000000000000_usize];
+ println!("{}", a[0xFFFFFF_usize]);
+}
+
+#[cfg(target_pointer_width = "32")]
+fn main() {
+ let n = 0_usize;
+ let a: Box<_> = box [&n; 0xFFFFFFFF_usize];
+ println!("{}", a[0xFFFFFF_usize]);
+}
diff --git a/src/test/ui/issues/issue-17913.stderr b/src/test/ui/issues/issue-17913.stderr
new file mode 100644
index 0000000..ae388c4
--- /dev/null
+++ b/src/test/ui/issues/issue-17913.stderr
@@ -0,0 +1,4 @@
+error: the type `[&usize; N]` is too big for the current architecture
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-17933.rs b/src/test/ui/issues/issue-17933.rs
similarity index 100%
rename from src/test/ui/issue-17933.rs
rename to src/test/ui/issues/issue-17933.rs
diff --git a/src/test/ui/issue-17933.stderr b/src/test/ui/issues/issue-17933.stderr
similarity index 100%
rename from src/test/ui/issue-17933.stderr
rename to src/test/ui/issues/issue-17933.stderr
diff --git a/src/test/ui/issues/issue-17954.nll.stderr b/src/test/ui/issues/issue-17954.nll.stderr
new file mode 100644
index 0000000..67a5e3e
--- /dev/null
+++ b/src/test/ui/issues/issue-17954.nll.stderr
@@ -0,0 +1,12 @@
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/issue-17954.rs:17:13
+ |
+LL | let a = &FOO;
+ | ^^^^ thread-local variables cannot be borrowed beyond the end of the function
+...
+LL | }
+ | - end of enclosing function is here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0712`.
diff --git a/src/test/ui/issues/issue-17954.rs b/src/test/ui/issues/issue-17954.rs
new file mode 100644
index 0000000..ce554a7
--- /dev/null
+++ b/src/test/ui/issues/issue-17954.rs
@@ -0,0 +1,26 @@
+// 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.
+
+#![feature(thread_local)]
+
+#[thread_local]
+static FOO: u8 = 3;
+
+fn main() {
+ let a = &FOO;
+ //~^ ERROR borrowed value does not live long enough
+ //~| does not live long enough
+ //~| NOTE borrowed value must be valid for the static lifetime
+
+ std::thread::spawn(move || {
+ println!("{}", a);
+ });
+}
+//~^ NOTE temporary value only lives until here
diff --git a/src/test/ui/issues/issue-17954.stderr b/src/test/ui/issues/issue-17954.stderr
new file mode 100644
index 0000000..76858a9
--- /dev/null
+++ b/src/test/ui/issues/issue-17954.stderr
@@ -0,0 +1,14 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/issue-17954.rs:17:14
+ |
+LL | let a = &FOO;
+ | ^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/issue-17959.rs b/src/test/ui/issues/issue-17959.rs
similarity index 100%
rename from src/test/ui/issue-17959.rs
rename to src/test/ui/issues/issue-17959.rs
diff --git a/src/test/ui/issue-17959.stderr b/src/test/ui/issues/issue-17959.stderr
similarity index 100%
rename from src/test/ui/issue-17959.stderr
rename to src/test/ui/issues/issue-17959.stderr
diff --git a/src/test/ui/issue-17994.rs b/src/test/ui/issues/issue-17994.rs
similarity index 100%
rename from src/test/ui/issue-17994.rs
rename to src/test/ui/issues/issue-17994.rs
diff --git a/src/test/ui/issue-17994.stderr b/src/test/ui/issues/issue-17994.stderr
similarity index 100%
rename from src/test/ui/issue-17994.stderr
rename to src/test/ui/issues/issue-17994.stderr
diff --git a/src/test/ui/issue-17999.rs b/src/test/ui/issues/issue-17999.rs
similarity index 100%
rename from src/test/ui/issue-17999.rs
rename to src/test/ui/issues/issue-17999.rs
diff --git a/src/test/ui/issue-17999.stderr b/src/test/ui/issues/issue-17999.stderr
similarity index 100%
rename from src/test/ui/issue-17999.stderr
rename to src/test/ui/issues/issue-17999.stderr
diff --git a/src/test/ui/issue-18058.rs b/src/test/ui/issues/issue-18058.rs
similarity index 100%
rename from src/test/ui/issue-18058.rs
rename to src/test/ui/issues/issue-18058.rs
diff --git a/src/test/ui/issue-18058.stderr b/src/test/ui/issues/issue-18058.stderr
similarity index 100%
rename from src/test/ui/issue-18058.stderr
rename to src/test/ui/issues/issue-18058.stderr
diff --git a/src/test/ui/issue-18107.rs b/src/test/ui/issues/issue-18107.rs
similarity index 100%
rename from src/test/ui/issue-18107.rs
rename to src/test/ui/issues/issue-18107.rs
diff --git a/src/test/ui/issues/issue-18107.stderr b/src/test/ui/issues/issue-18107.stderr
new file mode 100644
index 0000000..c813e29
--- /dev/null
+++ b/src/test/ui/issues/issue-18107.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `(dyn AbstractRenderer + 'static)` cannot be known at compilation time
+ --> $DIR/issue-18107.rs:14:5
+ |
+LL | AbstractRenderer
+ | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn AbstractRenderer + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: the return type of a function must have a statically known size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-18118-2.rs b/src/test/ui/issues/issue-18118-2.rs
similarity index 100%
rename from src/test/ui/issue-18118-2.rs
rename to src/test/ui/issues/issue-18118-2.rs
diff --git a/src/test/ui/issue-18118-2.stderr b/src/test/ui/issues/issue-18118-2.stderr
similarity index 100%
rename from src/test/ui/issue-18118-2.stderr
rename to src/test/ui/issues/issue-18118-2.stderr
diff --git a/src/test/ui/issue-18118.nll.stderr b/src/test/ui/issues/issue-18118.nll.stderr
similarity index 100%
rename from src/test/ui/issue-18118.nll.stderr
rename to src/test/ui/issues/issue-18118.nll.stderr
diff --git a/src/test/ui/issue-18118.rs b/src/test/ui/issues/issue-18118.rs
similarity index 100%
rename from src/test/ui/issue-18118.rs
rename to src/test/ui/issues/issue-18118.rs
diff --git a/src/test/ui/issue-18118.stderr b/src/test/ui/issues/issue-18118.stderr
similarity index 100%
rename from src/test/ui/issue-18118.stderr
rename to src/test/ui/issues/issue-18118.stderr
diff --git a/src/test/ui/issue-18119.rs b/src/test/ui/issues/issue-18119.rs
similarity index 100%
rename from src/test/ui/issue-18119.rs
rename to src/test/ui/issues/issue-18119.rs
diff --git a/src/test/ui/issue-18119.stderr b/src/test/ui/issues/issue-18119.stderr
similarity index 100%
rename from src/test/ui/issue-18119.stderr
rename to src/test/ui/issues/issue-18119.stderr
diff --git a/src/test/ui/issue-18159.rs b/src/test/ui/issues/issue-18159.rs
similarity index 100%
rename from src/test/ui/issue-18159.rs
rename to src/test/ui/issues/issue-18159.rs
diff --git a/src/test/ui/issue-18159.stderr b/src/test/ui/issues/issue-18159.stderr
similarity index 100%
rename from src/test/ui/issue-18159.stderr
rename to src/test/ui/issues/issue-18159.stderr
diff --git a/src/test/ui/issue-18183.rs b/src/test/ui/issues/issue-18183.rs
similarity index 100%
rename from src/test/ui/issue-18183.rs
rename to src/test/ui/issues/issue-18183.rs
diff --git a/src/test/ui/issue-18183.stderr b/src/test/ui/issues/issue-18183.stderr
similarity index 100%
rename from src/test/ui/issue-18183.stderr
rename to src/test/ui/issues/issue-18183.stderr
diff --git a/src/test/ui/issue-18294.rs b/src/test/ui/issues/issue-18294.rs
similarity index 100%
rename from src/test/ui/issue-18294.rs
rename to src/test/ui/issues/issue-18294.rs
diff --git a/src/test/ui/issue-18294.stderr b/src/test/ui/issues/issue-18294.stderr
similarity index 100%
rename from src/test/ui/issue-18294.stderr
rename to src/test/ui/issues/issue-18294.stderr
diff --git a/src/test/ui/issue-18389.rs b/src/test/ui/issues/issue-18389.rs
similarity index 100%
rename from src/test/ui/issue-18389.rs
rename to src/test/ui/issues/issue-18389.rs
diff --git a/src/test/ui/issue-18389.stderr b/src/test/ui/issues/issue-18389.stderr
similarity index 100%
rename from src/test/ui/issue-18389.stderr
rename to src/test/ui/issues/issue-18389.stderr
diff --git a/src/test/ui/issue-18400.rs b/src/test/ui/issues/issue-18400.rs
similarity index 100%
rename from src/test/ui/issue-18400.rs
rename to src/test/ui/issues/issue-18400.rs
diff --git a/src/test/ui/issue-18400.stderr b/src/test/ui/issues/issue-18400.stderr
similarity index 100%
rename from src/test/ui/issue-18400.stderr
rename to src/test/ui/issues/issue-18400.stderr
diff --git a/src/test/ui/issue-18423.rs b/src/test/ui/issues/issue-18423.rs
similarity index 100%
rename from src/test/ui/issue-18423.rs
rename to src/test/ui/issues/issue-18423.rs
diff --git a/src/test/ui/issue-18423.stderr b/src/test/ui/issues/issue-18423.stderr
similarity index 100%
rename from src/test/ui/issue-18423.stderr
rename to src/test/ui/issues/issue-18423.stderr
diff --git a/src/test/ui/issue-18446.rs b/src/test/ui/issues/issue-18446.rs
similarity index 100%
rename from src/test/ui/issue-18446.rs
rename to src/test/ui/issues/issue-18446.rs
diff --git a/src/test/ui/issue-18446.stderr b/src/test/ui/issues/issue-18446.stderr
similarity index 100%
rename from src/test/ui/issue-18446.stderr
rename to src/test/ui/issues/issue-18446.stderr
diff --git a/src/test/ui/issue-18532.rs b/src/test/ui/issues/issue-18532.rs
similarity index 100%
rename from src/test/ui/issue-18532.rs
rename to src/test/ui/issues/issue-18532.rs
diff --git a/src/test/ui/issue-18532.stderr b/src/test/ui/issues/issue-18532.stderr
similarity index 100%
rename from src/test/ui/issue-18532.stderr
rename to src/test/ui/issues/issue-18532.stderr
diff --git a/src/test/ui/issue-18566.nll.stderr b/src/test/ui/issues/issue-18566.nll.stderr
similarity index 100%
rename from src/test/ui/issue-18566.nll.stderr
rename to src/test/ui/issues/issue-18566.nll.stderr
diff --git a/src/test/ui/issue-18566.rs b/src/test/ui/issues/issue-18566.rs
similarity index 100%
rename from src/test/ui/issue-18566.rs
rename to src/test/ui/issues/issue-18566.rs
diff --git a/src/test/ui/issue-18566.stderr b/src/test/ui/issues/issue-18566.stderr
similarity index 100%
rename from src/test/ui/issue-18566.stderr
rename to src/test/ui/issues/issue-18566.stderr
diff --git a/src/test/ui/issue-18611.rs b/src/test/ui/issues/issue-18611.rs
similarity index 100%
rename from src/test/ui/issue-18611.rs
rename to src/test/ui/issues/issue-18611.rs
diff --git a/src/test/ui/issue-18611.stderr b/src/test/ui/issues/issue-18611.stderr
similarity index 100%
rename from src/test/ui/issue-18611.stderr
rename to src/test/ui/issues/issue-18611.stderr
diff --git a/src/test/ui/issue-1871.rs b/src/test/ui/issues/issue-1871.rs
similarity index 100%
rename from src/test/ui/issue-1871.rs
rename to src/test/ui/issues/issue-1871.rs
diff --git a/src/test/ui/issue-1871.stderr b/src/test/ui/issues/issue-1871.stderr
similarity index 100%
rename from src/test/ui/issue-1871.stderr
rename to src/test/ui/issues/issue-1871.stderr
diff --git a/src/test/ui/issue-18783.nll.stderr b/src/test/ui/issues/issue-18783.nll.stderr
similarity index 100%
rename from src/test/ui/issue-18783.nll.stderr
rename to src/test/ui/issues/issue-18783.nll.stderr
diff --git a/src/test/ui/issue-18783.rs b/src/test/ui/issues/issue-18783.rs
similarity index 100%
rename from src/test/ui/issue-18783.rs
rename to src/test/ui/issues/issue-18783.rs
diff --git a/src/test/ui/issue-18783.stderr b/src/test/ui/issues/issue-18783.stderr
similarity index 100%
rename from src/test/ui/issue-18783.stderr
rename to src/test/ui/issues/issue-18783.stderr
diff --git a/src/test/ui/issue-18819.rs b/src/test/ui/issues/issue-18819.rs
similarity index 100%
rename from src/test/ui/issue-18819.rs
rename to src/test/ui/issues/issue-18819.rs
diff --git a/src/test/ui/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr
similarity index 100%
rename from src/test/ui/issue-18819.stderr
rename to src/test/ui/issues/issue-18819.stderr
diff --git a/src/test/ui/issue-18919.rs b/src/test/ui/issues/issue-18919.rs
similarity index 100%
rename from src/test/ui/issue-18919.rs
rename to src/test/ui/issues/issue-18919.rs
diff --git a/src/test/ui/issues/issue-18919.stderr b/src/test/ui/issues/issue-18919.stderr
new file mode 100644
index 0000000..0e71b0b
--- /dev/null
+++ b/src/test/ui/issues/issue-18919.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the size for values of type `dyn for<'r> std::ops::Fn(&'r isize) -> isize` cannot be known at compilation time
+ --> $DIR/issue-18919.rs:13:1
+ |
+LL | / fn ho_func(f: Option<FuncType>) {
+LL | | //~^ ERROR the size for values of type
+LL | | }
+ | |_^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn for<'r> std::ops::Fn(&'r isize) -> isize`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::option::Option`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-18937.rs b/src/test/ui/issues/issue-18937.rs
similarity index 100%
rename from src/test/ui/issue-18937.rs
rename to src/test/ui/issues/issue-18937.rs
diff --git a/src/test/ui/issue-18937.stderr b/src/test/ui/issues/issue-18937.stderr
similarity index 100%
rename from src/test/ui/issue-18937.stderr
rename to src/test/ui/issues/issue-18937.stderr
diff --git a/src/test/ui/issue-18959.rs b/src/test/ui/issues/issue-18959.rs
similarity index 100%
rename from src/test/ui/issue-18959.rs
rename to src/test/ui/issues/issue-18959.rs
diff --git a/src/test/ui/issue-18959.stderr b/src/test/ui/issues/issue-18959.stderr
similarity index 100%
rename from src/test/ui/issue-18959.stderr
rename to src/test/ui/issues/issue-18959.stderr
diff --git a/src/test/ui/issue-1900.rs b/src/test/ui/issues/issue-1900.rs
similarity index 100%
rename from src/test/ui/issue-1900.rs
rename to src/test/ui/issues/issue-1900.rs
diff --git a/src/test/ui/issue-1900.stderr b/src/test/ui/issues/issue-1900.stderr
similarity index 100%
rename from src/test/ui/issue-1900.stderr
rename to src/test/ui/issues/issue-1900.stderr
diff --git a/src/test/ui/issue-19086.rs b/src/test/ui/issues/issue-19086.rs
similarity index 100%
rename from src/test/ui/issue-19086.rs
rename to src/test/ui/issues/issue-19086.rs
diff --git a/src/test/ui/issue-19086.stderr b/src/test/ui/issues/issue-19086.stderr
similarity index 100%
rename from src/test/ui/issue-19086.stderr
rename to src/test/ui/issues/issue-19086.stderr
diff --git a/src/test/ui/issue-19100.fixed b/src/test/ui/issues/issue-19100.fixed
similarity index 100%
rename from src/test/ui/issue-19100.fixed
rename to src/test/ui/issues/issue-19100.fixed
diff --git a/src/test/ui/issue-19100.rs b/src/test/ui/issues/issue-19100.rs
similarity index 100%
rename from src/test/ui/issue-19100.rs
rename to src/test/ui/issues/issue-19100.rs
diff --git a/src/test/ui/issue-19100.stderr b/src/test/ui/issues/issue-19100.stderr
similarity index 100%
rename from src/test/ui/issue-19100.stderr
rename to src/test/ui/issues/issue-19100.stderr
diff --git a/src/test/ui/issues/issue-19163.nll.stderr b/src/test/ui/issues/issue-19163.nll.stderr
new file mode 100644
index 0000000..32059bf
--- /dev/null
+++ b/src/test/ui/issues/issue-19163.nll.stderr
@@ -0,0 +1,9 @@
+error[E0596]: cannot borrow data in a `&` reference as mutable
+ --> $DIR/issue-19163.rs:19:14
+ |
+LL | mywrite!(&v, "Hello world");
+ | ^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/issue-19163.rs b/src/test/ui/issues/issue-19163.rs
similarity index 100%
rename from src/test/compile-fail/issue-19163.rs
rename to src/test/ui/issues/issue-19163.rs
diff --git a/src/test/ui/issues/issue-19163.stderr b/src/test/ui/issues/issue-19163.stderr
new file mode 100644
index 0000000..f7e65e1
--- /dev/null
+++ b/src/test/ui/issues/issue-19163.stderr
@@ -0,0 +1,9 @@
+error[E0596]: cannot borrow immutable borrowed content as mutable
+ --> $DIR/issue-19163.rs:19:14
+ |
+LL | mywrite!(&v, "Hello world");
+ | ^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/issue-1920-1.rs b/src/test/ui/issues/issue-1920-1.rs
similarity index 100%
rename from src/test/compile-fail/issue-1920-1.rs
rename to src/test/ui/issues/issue-1920-1.rs
diff --git a/src/test/ui/issues/issue-1920-1.stderr b/src/test/ui/issues/issue-1920-1.stderr
new file mode 100644
index 0000000..bd823ad
--- /dev/null
+++ b/src/test/ui/issues/issue-1920-1.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `foo::issue_1920::S: std::clone::Clone` is not satisfied
+ --> $DIR/issue-1920-1.rs:22:5
+ |
+LL | assert_clone::<foo::issue_1920::S>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `foo::issue_1920::S`
+ |
+note: required by `assert_clone`
+ --> $DIR/issue-1920-1.rs:19:1
+ |
+LL | fn assert_clone<T>() where T : Clone { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/issue-1920-2.rs b/src/test/ui/issues/issue-1920-2.rs
similarity index 100%
rename from src/test/compile-fail/issue-1920-2.rs
rename to src/test/ui/issues/issue-1920-2.rs
diff --git a/src/test/ui/issues/issue-1920-2.stderr b/src/test/ui/issues/issue-1920-2.stderr
new file mode 100644
index 0000000..cf98a89
--- /dev/null
+++ b/src/test/ui/issues/issue-1920-2.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `bar::S: std::clone::Clone` is not satisfied
+ --> $DIR/issue-1920-2.rs:20:5
+ |
+LL | assert_clone::<bar::S>();
+ | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `bar::S`
+ |
+note: required by `assert_clone`
+ --> $DIR/issue-1920-2.rs:17:1
+ |
+LL | fn assert_clone<T>() where T : Clone { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/issue-1920-3.rs b/src/test/ui/issues/issue-1920-3.rs
similarity index 100%
rename from src/test/compile-fail/issue-1920-3.rs
rename to src/test/ui/issues/issue-1920-3.rs
diff --git a/src/test/ui/issues/issue-1920-3.stderr b/src/test/ui/issues/issue-1920-3.stderr
new file mode 100644
index 0000000..6f5efd0
--- /dev/null
+++ b/src/test/ui/issues/issue-1920-3.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `issue_1920::S: std::clone::Clone` is not satisfied
+ --> $DIR/issue-1920-3.rs:24:5
+ |
+LL | assert_clone::<foo::issue_1920::S>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::clone::Clone` is not implemented for `issue_1920::S`
+ |
+note: required by `assert_clone`
+ --> $DIR/issue-1920-3.rs:21:1
+ |
+LL | fn assert_clone<T>() where T : Clone { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-19244-1.rs b/src/test/ui/issues/issue-19244-1.rs
similarity index 100%
rename from src/test/ui/issue-19244-1.rs
rename to src/test/ui/issues/issue-19244-1.rs
diff --git a/src/test/ui/issue-19244-1.stderr b/src/test/ui/issues/issue-19244-1.stderr
similarity index 100%
rename from src/test/ui/issue-19244-1.stderr
rename to src/test/ui/issues/issue-19244-1.stderr
diff --git a/src/test/ui/issue-19244-2.rs b/src/test/ui/issues/issue-19244-2.rs
similarity index 100%
rename from src/test/ui/issue-19244-2.rs
rename to src/test/ui/issues/issue-19244-2.rs
diff --git a/src/test/ui/issue-19244-2.stderr b/src/test/ui/issues/issue-19244-2.stderr
similarity index 100%
rename from src/test/ui/issue-19244-2.stderr
rename to src/test/ui/issues/issue-19244-2.stderr
diff --git a/src/test/ui/issue-19380.rs b/src/test/ui/issues/issue-19380.rs
similarity index 100%
rename from src/test/ui/issue-19380.rs
rename to src/test/ui/issues/issue-19380.rs
diff --git a/src/test/ui/issue-19380.stderr b/src/test/ui/issues/issue-19380.stderr
similarity index 100%
rename from src/test/ui/issue-19380.stderr
rename to src/test/ui/issues/issue-19380.stderr
diff --git a/src/test/ui/issue-19482.rs b/src/test/ui/issues/issue-19482.rs
similarity index 100%
rename from src/test/ui/issue-19482.rs
rename to src/test/ui/issues/issue-19482.rs
diff --git a/src/test/ui/issue-19482.stderr b/src/test/ui/issues/issue-19482.stderr
similarity index 100%
rename from src/test/ui/issue-19482.stderr
rename to src/test/ui/issues/issue-19482.stderr
diff --git a/src/test/ui/issue-19498.rs b/src/test/ui/issues/issue-19498.rs
similarity index 100%
rename from src/test/ui/issue-19498.rs
rename to src/test/ui/issues/issue-19498.rs
diff --git a/src/test/ui/issue-19498.stderr b/src/test/ui/issues/issue-19498.stderr
similarity index 100%
rename from src/test/ui/issue-19498.stderr
rename to src/test/ui/issues/issue-19498.stderr
diff --git a/src/test/ui/issue-19521.rs b/src/test/ui/issues/issue-19521.rs
similarity index 100%
rename from src/test/ui/issue-19521.rs
rename to src/test/ui/issues/issue-19521.rs
diff --git a/src/test/ui/issue-19521.stderr b/src/test/ui/issues/issue-19521.stderr
similarity index 100%
rename from src/test/ui/issue-19521.stderr
rename to src/test/ui/issues/issue-19521.stderr
diff --git a/src/test/ui/issue-19538.rs b/src/test/ui/issues/issue-19538.rs
similarity index 100%
rename from src/test/ui/issue-19538.rs
rename to src/test/ui/issues/issue-19538.rs
diff --git a/src/test/ui/issue-19538.stderr b/src/test/ui/issues/issue-19538.stderr
similarity index 100%
rename from src/test/ui/issue-19538.stderr
rename to src/test/ui/issues/issue-19538.stderr
diff --git a/src/test/ui/issue-19601.rs b/src/test/ui/issues/issue-19601.rs
similarity index 100%
rename from src/test/ui/issue-19601.rs
rename to src/test/ui/issues/issue-19601.rs
diff --git a/src/test/ui/issue-19601.stderr b/src/test/ui/issues/issue-19601.stderr
similarity index 100%
rename from src/test/ui/issue-19601.stderr
rename to src/test/ui/issues/issue-19601.stderr
diff --git a/src/test/ui/issue-1962.rs b/src/test/ui/issues/issue-1962.rs
similarity index 100%
rename from src/test/ui/issue-1962.rs
rename to src/test/ui/issues/issue-1962.rs
diff --git a/src/test/ui/issue-1962.stderr b/src/test/ui/issues/issue-1962.stderr
similarity index 100%
rename from src/test/ui/issue-1962.stderr
rename to src/test/ui/issues/issue-1962.stderr
diff --git a/src/test/ui/issue-19660.rs b/src/test/ui/issues/issue-19660.rs
similarity index 100%
rename from src/test/ui/issue-19660.rs
rename to src/test/ui/issues/issue-19660.rs
diff --git a/src/test/ui/issue-19660.stderr b/src/test/ui/issues/issue-19660.stderr
similarity index 100%
rename from src/test/ui/issue-19660.stderr
rename to src/test/ui/issues/issue-19660.stderr
diff --git a/src/test/ui/issue-19692.rs b/src/test/ui/issues/issue-19692.rs
similarity index 100%
rename from src/test/ui/issue-19692.rs
rename to src/test/ui/issues/issue-19692.rs
diff --git a/src/test/ui/issue-19692.stderr b/src/test/ui/issues/issue-19692.stderr
similarity index 100%
rename from src/test/ui/issue-19692.stderr
rename to src/test/ui/issues/issue-19692.stderr
diff --git a/src/test/ui/issue-19707.rs b/src/test/ui/issues/issue-19707.rs
similarity index 100%
rename from src/test/ui/issue-19707.rs
rename to src/test/ui/issues/issue-19707.rs
diff --git a/src/test/ui/issue-19707.stderr b/src/test/ui/issues/issue-19707.stderr
similarity index 100%
rename from src/test/ui/issue-19707.stderr
rename to src/test/ui/issues/issue-19707.stderr
diff --git a/src/test/ui/issue-19734.rs b/src/test/ui/issues/issue-19734.rs
similarity index 100%
rename from src/test/ui/issue-19734.rs
rename to src/test/ui/issues/issue-19734.rs
diff --git a/src/test/ui/issue-19734.stderr b/src/test/ui/issues/issue-19734.stderr
similarity index 100%
rename from src/test/ui/issue-19734.stderr
rename to src/test/ui/issues/issue-19734.stderr
diff --git a/src/test/ui/issue-19883.rs b/src/test/ui/issues/issue-19883.rs
similarity index 100%
rename from src/test/ui/issue-19883.rs
rename to src/test/ui/issues/issue-19883.rs
diff --git a/src/test/ui/issue-19883.stderr b/src/test/ui/issues/issue-19883.stderr
similarity index 100%
rename from src/test/ui/issue-19883.stderr
rename to src/test/ui/issues/issue-19883.stderr
diff --git a/src/test/ui/issue-19922.rs b/src/test/ui/issues/issue-19922.rs
similarity index 100%
rename from src/test/ui/issue-19922.rs
rename to src/test/ui/issues/issue-19922.rs
diff --git a/src/test/ui/issue-19922.stderr b/src/test/ui/issues/issue-19922.stderr
similarity index 100%
rename from src/test/ui/issue-19922.stderr
rename to src/test/ui/issues/issue-19922.stderr
diff --git a/src/test/ui/issue-19982.rs b/src/test/ui/issues/issue-19982.rs
similarity index 100%
rename from src/test/ui/issue-19982.rs
rename to src/test/ui/issues/issue-19982.rs
diff --git a/src/test/ui/issue-19982.stderr b/src/test/ui/issues/issue-19982.stderr
similarity index 100%
rename from src/test/ui/issue-19982.stderr
rename to src/test/ui/issues/issue-19982.stderr
diff --git a/src/test/ui/issue-19991.rs b/src/test/ui/issues/issue-19991.rs
similarity index 100%
rename from src/test/ui/issue-19991.rs
rename to src/test/ui/issues/issue-19991.rs
diff --git a/src/test/ui/issue-19991.stderr b/src/test/ui/issues/issue-19991.stderr
similarity index 100%
rename from src/test/ui/issue-19991.stderr
rename to src/test/ui/issues/issue-19991.stderr
diff --git a/src/test/ui/issue-20005.rs b/src/test/ui/issues/issue-20005.rs
similarity index 100%
rename from src/test/ui/issue-20005.rs
rename to src/test/ui/issues/issue-20005.rs
diff --git a/src/test/ui/issues/issue-20005.stderr b/src/test/ui/issues/issue-20005.stderr
new file mode 100644
index 0000000..b0b38c9
--- /dev/null
+++ b/src/test/ui/issues/issue-20005.stderr
@@ -0,0 +1,22 @@
+error[E0277]: the size for values of type `Self` cannot be known at compilation time
+ --> $DIR/issue-20005.rs:18:5
+ |
+LL | / fn to<Dst>( //~ ERROR the size for values of type
+LL | | self
+LL | | ) -> <Dst as From<Self>>::Result where Dst: From<Self> {
+LL | | From::from(self)
+LL | | }
+ | |_____^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Self`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Self: std::marker::Sized` bound
+note: required by `From`
+ --> $DIR/issue-20005.rs:11:1
+ |
+LL | trait From<Src> {
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20162.rs b/src/test/ui/issues/issue-20162.rs
similarity index 100%
rename from src/test/ui/issue-20162.rs
rename to src/test/ui/issues/issue-20162.rs
diff --git a/src/test/ui/issue-20162.stderr b/src/test/ui/issues/issue-20162.stderr
similarity index 100%
rename from src/test/ui/issue-20162.stderr
rename to src/test/ui/issues/issue-20162.stderr
diff --git a/src/test/ui/issue-20225.rs b/src/test/ui/issues/issue-20225.rs
similarity index 100%
rename from src/test/ui/issue-20225.rs
rename to src/test/ui/issues/issue-20225.rs
diff --git a/src/test/ui/issue-20225.stderr b/src/test/ui/issues/issue-20225.stderr
similarity index 100%
rename from src/test/ui/issue-20225.stderr
rename to src/test/ui/issues/issue-20225.stderr
diff --git a/src/test/ui/issue-20261.rs b/src/test/ui/issues/issue-20261.rs
similarity index 100%
rename from src/test/ui/issue-20261.rs
rename to src/test/ui/issues/issue-20261.rs
diff --git a/src/test/ui/issue-20261.stderr b/src/test/ui/issues/issue-20261.stderr
similarity index 100%
rename from src/test/ui/issue-20261.stderr
rename to src/test/ui/issues/issue-20261.stderr
diff --git a/src/test/ui/issue-20313.rs b/src/test/ui/issues/issue-20313.rs
similarity index 100%
rename from src/test/ui/issue-20313.rs
rename to src/test/ui/issues/issue-20313.rs
diff --git a/src/test/ui/issue-20313.stderr b/src/test/ui/issues/issue-20313.stderr
similarity index 100%
rename from src/test/ui/issue-20313.stderr
rename to src/test/ui/issues/issue-20313.stderr
diff --git a/src/test/ui/issue-20413.rs b/src/test/ui/issues/issue-20413.rs
similarity index 100%
rename from src/test/ui/issue-20413.rs
rename to src/test/ui/issues/issue-20413.rs
diff --git a/src/test/ui/issue-20413.stderr b/src/test/ui/issues/issue-20413.stderr
similarity index 100%
rename from src/test/ui/issue-20413.stderr
rename to src/test/ui/issues/issue-20413.stderr
diff --git a/src/test/ui/issue-20433.rs b/src/test/ui/issues/issue-20433.rs
similarity index 100%
rename from src/test/ui/issue-20433.rs
rename to src/test/ui/issues/issue-20433.rs
diff --git a/src/test/ui/issues/issue-20433.stderr b/src/test/ui/issues/issue-20433.stderr
new file mode 100644
index 0000000..9800c9b
--- /dev/null
+++ b/src/test/ui/issues/issue-20433.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+ --> $DIR/issue-20433.rs:16:5
+ |
+LL | fn iceman(c: Vec<[i32]>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[i32]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::vec::Vec`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20605.rs b/src/test/ui/issues/issue-20605.rs
similarity index 100%
rename from src/test/ui/issue-20605.rs
rename to src/test/ui/issues/issue-20605.rs
diff --git a/src/test/ui/issues/issue-20605.stderr b/src/test/ui/issues/issue-20605.stderr
new file mode 100644
index 0000000..fb32283
--- /dev/null
+++ b/src/test/ui/issues/issue-20605.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `dyn std::iter::Iterator<Item=&mut u8>` cannot be known at compilation time
+ --> $DIR/issue-20605.rs:12:17
+ |
+LL | for item in *things { *item = 0 }
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `dyn std::iter::Iterator<Item=&mut u8>`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::iter::IntoIterator::into_iter`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-20616-1.rs b/src/test/ui/issues/issue-20616-1.rs
similarity index 100%
rename from src/test/ui/issue-20616-1.rs
rename to src/test/ui/issues/issue-20616-1.rs
diff --git a/src/test/ui/issue-20616-1.stderr b/src/test/ui/issues/issue-20616-1.stderr
similarity index 100%
rename from src/test/ui/issue-20616-1.stderr
rename to src/test/ui/issues/issue-20616-1.stderr
diff --git a/src/test/ui/issue-20616-2.rs b/src/test/ui/issues/issue-20616-2.rs
similarity index 100%
rename from src/test/ui/issue-20616-2.rs
rename to src/test/ui/issues/issue-20616-2.rs
diff --git a/src/test/ui/issue-20616-2.stderr b/src/test/ui/issues/issue-20616-2.stderr
similarity index 100%
rename from src/test/ui/issue-20616-2.stderr
rename to src/test/ui/issues/issue-20616-2.stderr
diff --git a/src/test/ui/issue-20616-3.rs b/src/test/ui/issues/issue-20616-3.rs
similarity index 100%
rename from src/test/ui/issue-20616-3.rs
rename to src/test/ui/issues/issue-20616-3.rs
diff --git a/src/test/ui/issue-20616-3.stderr b/src/test/ui/issues/issue-20616-3.stderr
similarity index 100%
rename from src/test/ui/issue-20616-3.stderr
rename to src/test/ui/issues/issue-20616-3.stderr
diff --git a/src/test/ui/issue-20616-4.rs b/src/test/ui/issues/issue-20616-4.rs
similarity index 100%
rename from src/test/ui/issue-20616-4.rs
rename to src/test/ui/issues/issue-20616-4.rs
diff --git a/src/test/ui/issue-20616-4.stderr b/src/test/ui/issues/issue-20616-4.stderr
similarity index 100%
rename from src/test/ui/issue-20616-4.stderr
rename to src/test/ui/issues/issue-20616-4.stderr
diff --git a/src/test/ui/issue-20616-5.rs b/src/test/ui/issues/issue-20616-5.rs
similarity index 100%
rename from src/test/ui/issue-20616-5.rs
rename to src/test/ui/issues/issue-20616-5.rs
diff --git a/src/test/ui/issue-20616-5.stderr b/src/test/ui/issues/issue-20616-5.stderr
similarity index 100%
rename from src/test/ui/issue-20616-5.stderr
rename to src/test/ui/issues/issue-20616-5.stderr
diff --git a/src/test/ui/issue-20616-6.rs b/src/test/ui/issues/issue-20616-6.rs
similarity index 100%
rename from src/test/ui/issue-20616-6.rs
rename to src/test/ui/issues/issue-20616-6.rs
diff --git a/src/test/ui/issue-20616-6.stderr b/src/test/ui/issues/issue-20616-6.stderr
similarity index 100%
rename from src/test/ui/issue-20616-6.stderr
rename to src/test/ui/issues/issue-20616-6.stderr
diff --git a/src/test/ui/issue-20616-7.rs b/src/test/ui/issues/issue-20616-7.rs
similarity index 100%
rename from src/test/ui/issue-20616-7.rs
rename to src/test/ui/issues/issue-20616-7.rs
diff --git a/src/test/ui/issue-20616-7.stderr b/src/test/ui/issues/issue-20616-7.stderr
similarity index 100%
rename from src/test/ui/issue-20616-7.stderr
rename to src/test/ui/issues/issue-20616-7.stderr
diff --git a/src/test/ui/issue-20616-8.rs b/src/test/ui/issues/issue-20616-8.rs
similarity index 100%
rename from src/test/ui/issue-20616-8.rs
rename to src/test/ui/issues/issue-20616-8.rs
diff --git a/src/test/ui/issue-20616-8.stderr b/src/test/ui/issues/issue-20616-8.stderr
similarity index 100%
rename from src/test/ui/issue-20616-8.stderr
rename to src/test/ui/issues/issue-20616-8.stderr
diff --git a/src/test/ui/issue-20616-9.rs b/src/test/ui/issues/issue-20616-9.rs
similarity index 100%
rename from src/test/ui/issue-20616-9.rs
rename to src/test/ui/issues/issue-20616-9.rs
diff --git a/src/test/ui/issue-20616-9.stderr b/src/test/ui/issues/issue-20616-9.stderr
similarity index 100%
rename from src/test/ui/issue-20616-9.stderr
rename to src/test/ui/issues/issue-20616-9.stderr
diff --git a/src/test/ui/issue-20692.rs b/src/test/ui/issues/issue-20692.rs
similarity index 100%
rename from src/test/ui/issue-20692.rs
rename to src/test/ui/issues/issue-20692.rs
diff --git a/src/test/ui/issue-20692.stderr b/src/test/ui/issues/issue-20692.stderr
similarity index 100%
rename from src/test/ui/issue-20692.stderr
rename to src/test/ui/issues/issue-20692.stderr
diff --git a/src/test/ui/issue-20714.rs b/src/test/ui/issues/issue-20714.rs
similarity index 100%
rename from src/test/ui/issue-20714.rs
rename to src/test/ui/issues/issue-20714.rs
diff --git a/src/test/ui/issue-20714.stderr b/src/test/ui/issues/issue-20714.stderr
similarity index 100%
rename from src/test/ui/issue-20714.stderr
rename to src/test/ui/issues/issue-20714.stderr
diff --git a/src/test/ui/issue-20772.rs b/src/test/ui/issues/issue-20772.rs
similarity index 100%
rename from src/test/ui/issue-20772.rs
rename to src/test/ui/issues/issue-20772.rs
diff --git a/src/test/ui/issue-20772.stderr b/src/test/ui/issues/issue-20772.stderr
similarity index 100%
rename from src/test/ui/issue-20772.stderr
rename to src/test/ui/issues/issue-20772.stderr
diff --git a/src/test/ui/issues/issue-20801.nll.stderr b/src/test/ui/issues/issue-20801.nll.stderr
new file mode 100644
index 0000000..3a6784e
--- /dev/null
+++ b/src/test/ui/issues/issue-20801.nll.stderr
@@ -0,0 +1,39 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-20801.rs:36:22
+ |
+LL | let a = unsafe { *mut_ref() };
+ | ^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `mut_ref()`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-20801.rs:39:22
+ |
+LL | let b = unsafe { *imm_ref() };
+ | ^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `imm_ref()`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-20801.rs:42:22
+ |
+LL | let c = unsafe { *mut_ptr() };
+ | ^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `mut_ptr()`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-20801.rs:45:22
+ |
+LL | let d = unsafe { *const_ptr() };
+ | ^^^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `const_ptr()`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-20801.rs b/src/test/ui/issues/issue-20801.rs
similarity index 100%
rename from src/test/ui/issue-20801.rs
rename to src/test/ui/issues/issue-20801.rs
diff --git a/src/test/ui/issue-20801.stderr b/src/test/ui/issues/issue-20801.stderr
similarity index 100%
rename from src/test/ui/issue-20801.stderr
rename to src/test/ui/issues/issue-20801.stderr
diff --git a/src/test/ui/issue-20825.rs b/src/test/ui/issues/issue-20825.rs
similarity index 100%
rename from src/test/ui/issue-20825.rs
rename to src/test/ui/issues/issue-20825.rs
diff --git a/src/test/ui/issue-20825.stderr b/src/test/ui/issues/issue-20825.stderr
similarity index 100%
rename from src/test/ui/issue-20825.stderr
rename to src/test/ui/issues/issue-20825.stderr
diff --git a/src/test/ui/issue-20831-debruijn.rs b/src/test/ui/issues/issue-20831-debruijn.rs
similarity index 100%
rename from src/test/ui/issue-20831-debruijn.rs
rename to src/test/ui/issues/issue-20831-debruijn.rs
diff --git a/src/test/ui/issue-20831-debruijn.stderr b/src/test/ui/issues/issue-20831-debruijn.stderr
similarity index 100%
rename from src/test/ui/issue-20831-debruijn.stderr
rename to src/test/ui/issues/issue-20831-debruijn.stderr
diff --git a/src/test/ui/issue-20939.rs b/src/test/ui/issues/issue-20939.rs
similarity index 100%
rename from src/test/ui/issue-20939.rs
rename to src/test/ui/issues/issue-20939.rs
diff --git a/src/test/ui/issue-20939.stderr b/src/test/ui/issues/issue-20939.stderr
similarity index 100%
rename from src/test/ui/issue-20939.stderr
rename to src/test/ui/issues/issue-20939.stderr
diff --git a/src/test/ui/issue-2111.rs b/src/test/ui/issues/issue-2111.rs
similarity index 100%
rename from src/test/ui/issue-2111.rs
rename to src/test/ui/issues/issue-2111.rs
diff --git a/src/test/ui/issue-2111.stderr b/src/test/ui/issues/issue-2111.stderr
similarity index 100%
rename from src/test/ui/issue-2111.stderr
rename to src/test/ui/issues/issue-2111.stderr
diff --git a/src/test/compile-fail/issue-21146.rs b/src/test/ui/issues/issue-21146.rs
similarity index 100%
rename from src/test/compile-fail/issue-21146.rs
rename to src/test/ui/issues/issue-21146.rs
diff --git a/src/test/ui/issues/issue-21146.stderr b/src/test/ui/issues/issue-21146.stderr
new file mode 100644
index 0000000..fab3812
--- /dev/null
+++ b/src/test/ui/issues/issue-21146.stderr
@@ -0,0 +1,8 @@
+error: expected one of `!` or `::`, found `<eof>`
+ --> $DIR/auxiliary/issue-21146-inc.rs:13:1
+ |
+LL | parse_error
+ | ^^^^^^^^^^^ expected one of `!` or `::` here
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-21160.rs b/src/test/ui/issues/issue-21160.rs
similarity index 100%
rename from src/test/ui/issue-21160.rs
rename to src/test/ui/issues/issue-21160.rs
diff --git a/src/test/ui/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr
similarity index 100%
rename from src/test/ui/issue-21160.stderr
rename to src/test/ui/issues/issue-21160.stderr
diff --git a/src/test/ui/issue-21174.rs b/src/test/ui/issues/issue-21174.rs
similarity index 100%
rename from src/test/ui/issue-21174.rs
rename to src/test/ui/issues/issue-21174.rs
diff --git a/src/test/ui/issue-21174.stderr b/src/test/ui/issues/issue-21174.stderr
similarity index 100%
rename from src/test/ui/issue-21174.stderr
rename to src/test/ui/issues/issue-21174.stderr
diff --git a/src/test/ui/issue-21177.rs b/src/test/ui/issues/issue-21177.rs
similarity index 100%
rename from src/test/ui/issue-21177.rs
rename to src/test/ui/issues/issue-21177.rs
diff --git a/src/test/ui/issue-21177.stderr b/src/test/ui/issues/issue-21177.stderr
similarity index 100%
rename from src/test/ui/issue-21177.stderr
rename to src/test/ui/issues/issue-21177.stderr
diff --git a/src/test/compile-fail/issue-21202.rs b/src/test/ui/issues/issue-21202.rs
similarity index 100%
rename from src/test/compile-fail/issue-21202.rs
rename to src/test/ui/issues/issue-21202.rs
diff --git a/src/test/ui/issues/issue-21202.stderr b/src/test/ui/issues/issue-21202.stderr
new file mode 100644
index 0000000..9d17ff6
--- /dev/null
+++ b/src/test/ui/issues/issue-21202.stderr
@@ -0,0 +1,9 @@
+error[E0624]: method `foo` is private
+ --> $DIR/issue-21202.rs:20:9
+ |
+LL | Foo::foo(&f);
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/ui/issue-21332.rs b/src/test/ui/issues/issue-21332.rs
similarity index 100%
rename from src/test/ui/issue-21332.rs
rename to src/test/ui/issues/issue-21332.rs
diff --git a/src/test/ui/issue-21332.stderr b/src/test/ui/issues/issue-21332.stderr
similarity index 100%
rename from src/test/ui/issue-21332.stderr
rename to src/test/ui/issues/issue-21332.stderr
diff --git a/src/test/ui/issue-21356.rs b/src/test/ui/issues/issue-21356.rs
similarity index 100%
rename from src/test/ui/issue-21356.rs
rename to src/test/ui/issues/issue-21356.rs
diff --git a/src/test/ui/issue-21356.stderr b/src/test/ui/issues/issue-21356.stderr
similarity index 100%
rename from src/test/ui/issue-21356.stderr
rename to src/test/ui/issues/issue-21356.stderr
diff --git a/src/test/ui/issue-21449.rs b/src/test/ui/issues/issue-21449.rs
similarity index 100%
rename from src/test/ui/issue-21449.rs
rename to src/test/ui/issues/issue-21449.rs
diff --git a/src/test/ui/issue-21449.stderr b/src/test/ui/issues/issue-21449.stderr
similarity index 100%
rename from src/test/ui/issue-21449.stderr
rename to src/test/ui/issues/issue-21449.stderr
diff --git a/src/test/ui/issue-2149.rs b/src/test/ui/issues/issue-2149.rs
similarity index 100%
rename from src/test/ui/issue-2149.rs
rename to src/test/ui/issues/issue-2149.rs
diff --git a/src/test/ui/issue-2149.stderr b/src/test/ui/issues/issue-2149.stderr
similarity index 100%
rename from src/test/ui/issue-2149.stderr
rename to src/test/ui/issues/issue-2149.stderr
diff --git a/src/test/ui/issue-2150.rs b/src/test/ui/issues/issue-2150.rs
similarity index 100%
rename from src/test/ui/issue-2150.rs
rename to src/test/ui/issues/issue-2150.rs
diff --git a/src/test/ui/issue-2150.stderr b/src/test/ui/issues/issue-2150.stderr
similarity index 100%
rename from src/test/ui/issue-2150.stderr
rename to src/test/ui/issues/issue-2150.stderr
diff --git a/src/test/ui/issue-2151.rs b/src/test/ui/issues/issue-2151.rs
similarity index 100%
rename from src/test/ui/issue-2151.rs
rename to src/test/ui/issues/issue-2151.rs
diff --git a/src/test/ui/issue-2151.stderr b/src/test/ui/issues/issue-2151.stderr
similarity index 100%
rename from src/test/ui/issue-2151.stderr
rename to src/test/ui/issues/issue-2151.stderr
diff --git a/src/test/ui/issue-21546.rs b/src/test/ui/issues/issue-21546.rs
similarity index 100%
rename from src/test/ui/issue-21546.rs
rename to src/test/ui/issues/issue-21546.rs
diff --git a/src/test/ui/issue-21546.stderr b/src/test/ui/issues/issue-21546.stderr
similarity index 100%
rename from src/test/ui/issue-21546.stderr
rename to src/test/ui/issues/issue-21546.stderr
diff --git a/src/test/ui/issue-21554.rs b/src/test/ui/issues/issue-21554.rs
similarity index 100%
rename from src/test/ui/issue-21554.rs
rename to src/test/ui/issues/issue-21554.rs
diff --git a/src/test/ui/issue-21554.stderr b/src/test/ui/issues/issue-21554.stderr
similarity index 100%
rename from src/test/ui/issue-21554.stderr
rename to src/test/ui/issues/issue-21554.stderr
diff --git a/src/test/ui/issue-21600.nll.stderr b/src/test/ui/issues/issue-21600.nll.stderr
similarity index 100%
rename from src/test/ui/issue-21600.nll.stderr
rename to src/test/ui/issues/issue-21600.nll.stderr
diff --git a/src/test/ui/issue-21600.rs b/src/test/ui/issues/issue-21600.rs
similarity index 100%
rename from src/test/ui/issue-21600.rs
rename to src/test/ui/issues/issue-21600.rs
diff --git a/src/test/ui/issue-21600.stderr b/src/test/ui/issues/issue-21600.stderr
similarity index 100%
rename from src/test/ui/issue-21600.stderr
rename to src/test/ui/issues/issue-21600.stderr
diff --git a/src/test/ui/issue-21701.rs b/src/test/ui/issues/issue-21701.rs
similarity index 100%
rename from src/test/ui/issue-21701.rs
rename to src/test/ui/issues/issue-21701.rs
diff --git a/src/test/ui/issue-21701.stderr b/src/test/ui/issues/issue-21701.stderr
similarity index 100%
rename from src/test/ui/issue-21701.stderr
rename to src/test/ui/issues/issue-21701.stderr
diff --git a/src/test/ui/issue-21763.rs b/src/test/ui/issues/issue-21763.rs
similarity index 100%
rename from src/test/ui/issue-21763.rs
rename to src/test/ui/issues/issue-21763.rs
diff --git a/src/test/ui/issue-21763.stderr b/src/test/ui/issues/issue-21763.stderr
similarity index 100%
rename from src/test/ui/issue-21763.stderr
rename to src/test/ui/issues/issue-21763.stderr
diff --git a/src/test/ui/issue-21837.rs b/src/test/ui/issues/issue-21837.rs
similarity index 100%
rename from src/test/ui/issue-21837.rs
rename to src/test/ui/issues/issue-21837.rs
diff --git a/src/test/ui/issue-21837.stderr b/src/test/ui/issues/issue-21837.stderr
similarity index 100%
rename from src/test/ui/issue-21837.stderr
rename to src/test/ui/issues/issue-21837.stderr
diff --git a/src/test/ui/issue-21946.rs b/src/test/ui/issues/issue-21946.rs
similarity index 100%
rename from src/test/ui/issue-21946.rs
rename to src/test/ui/issues/issue-21946.rs
diff --git a/src/test/ui/issue-21946.stderr b/src/test/ui/issues/issue-21946.stderr
similarity index 100%
rename from src/test/ui/issue-21946.stderr
rename to src/test/ui/issues/issue-21946.stderr
diff --git a/src/test/ui/issue-21950.rs b/src/test/ui/issues/issue-21950.rs
similarity index 100%
rename from src/test/ui/issue-21950.rs
rename to src/test/ui/issues/issue-21950.rs
diff --git a/src/test/ui/issue-21950.stderr b/src/test/ui/issues/issue-21950.stderr
similarity index 100%
rename from src/test/ui/issue-21950.stderr
rename to src/test/ui/issues/issue-21950.stderr
diff --git a/src/test/ui/issue-21974.rs b/src/test/ui/issues/issue-21974.rs
similarity index 100%
rename from src/test/ui/issue-21974.rs
rename to src/test/ui/issues/issue-21974.rs
diff --git a/src/test/ui/issue-21974.stderr b/src/test/ui/issues/issue-21974.stderr
similarity index 100%
rename from src/test/ui/issue-21974.stderr
rename to src/test/ui/issues/issue-21974.stderr
diff --git a/src/test/ui/issue-22034.rs b/src/test/ui/issues/issue-22034.rs
similarity index 100%
rename from src/test/ui/issue-22034.rs
rename to src/test/ui/issues/issue-22034.rs
diff --git a/src/test/ui/issue-22034.stderr b/src/test/ui/issues/issue-22034.stderr
similarity index 100%
rename from src/test/ui/issue-22034.stderr
rename to src/test/ui/issues/issue-22034.stderr
diff --git a/src/test/ui/issue-22037.rs b/src/test/ui/issues/issue-22037.rs
similarity index 100%
rename from src/test/ui/issue-22037.rs
rename to src/test/ui/issues/issue-22037.rs
diff --git a/src/test/ui/issue-22037.stderr b/src/test/ui/issues/issue-22037.stderr
similarity index 100%
rename from src/test/ui/issue-22037.stderr
rename to src/test/ui/issues/issue-22037.stderr
diff --git a/src/test/ui/issue-22289.rs b/src/test/ui/issues/issue-22289.rs
similarity index 100%
rename from src/test/ui/issue-22289.rs
rename to src/test/ui/issues/issue-22289.rs
diff --git a/src/test/ui/issue-22289.stderr b/src/test/ui/issues/issue-22289.stderr
similarity index 100%
rename from src/test/ui/issue-22289.stderr
rename to src/test/ui/issues/issue-22289.stderr
diff --git a/src/test/ui/issue-22312.rs b/src/test/ui/issues/issue-22312.rs
similarity index 100%
rename from src/test/ui/issue-22312.rs
rename to src/test/ui/issues/issue-22312.rs
diff --git a/src/test/ui/issue-22312.stderr b/src/test/ui/issues/issue-22312.stderr
similarity index 100%
rename from src/test/ui/issue-22312.stderr
rename to src/test/ui/issues/issue-22312.stderr
diff --git a/src/test/ui/issue-22370.rs b/src/test/ui/issues/issue-22370.rs
similarity index 100%
rename from src/test/ui/issue-22370.rs
rename to src/test/ui/issues/issue-22370.rs
diff --git a/src/test/ui/issue-22370.stderr b/src/test/ui/issues/issue-22370.stderr
similarity index 100%
rename from src/test/ui/issue-22370.stderr
rename to src/test/ui/issues/issue-22370.stderr
diff --git a/src/test/ui/issue-22384.rs b/src/test/ui/issues/issue-22384.rs
similarity index 100%
rename from src/test/ui/issue-22384.rs
rename to src/test/ui/issues/issue-22384.rs
diff --git a/src/test/ui/issue-22384.stderr b/src/test/ui/issues/issue-22384.stderr
similarity index 100%
rename from src/test/ui/issue-22384.stderr
rename to src/test/ui/issues/issue-22384.stderr
diff --git a/src/test/ui/issue-22434.rs b/src/test/ui/issues/issue-22434.rs
similarity index 100%
rename from src/test/ui/issue-22434.rs
rename to src/test/ui/issues/issue-22434.rs
diff --git a/src/test/ui/issue-22434.stderr b/src/test/ui/issues/issue-22434.stderr
similarity index 100%
rename from src/test/ui/issue-22434.stderr
rename to src/test/ui/issues/issue-22434.stderr
diff --git a/src/test/ui/issue-22468.rs b/src/test/ui/issues/issue-22468.rs
similarity index 100%
rename from src/test/ui/issue-22468.rs
rename to src/test/ui/issues/issue-22468.rs
diff --git a/src/test/ui/issue-22468.stderr b/src/test/ui/issues/issue-22468.stderr
similarity index 100%
rename from src/test/ui/issue-22468.stderr
rename to src/test/ui/issues/issue-22468.stderr
diff --git a/src/test/ui/issue-22560.rs b/src/test/ui/issues/issue-22560.rs
similarity index 100%
rename from src/test/ui/issue-22560.rs
rename to src/test/ui/issues/issue-22560.rs
diff --git a/src/test/ui/issue-22560.stderr b/src/test/ui/issues/issue-22560.stderr
similarity index 100%
rename from src/test/ui/issue-22560.stderr
rename to src/test/ui/issues/issue-22560.stderr
diff --git a/src/test/ui/issue-22599.rs b/src/test/ui/issues/issue-22599.rs
similarity index 100%
rename from src/test/ui/issue-22599.rs
rename to src/test/ui/issues/issue-22599.rs
diff --git a/src/test/ui/issue-22599.stderr b/src/test/ui/issues/issue-22599.stderr
similarity index 100%
rename from src/test/ui/issue-22599.stderr
rename to src/test/ui/issues/issue-22599.stderr
diff --git a/src/test/ui/issue-22603.rs b/src/test/ui/issues/issue-22603.rs
similarity index 100%
rename from src/test/ui/issue-22603.rs
rename to src/test/ui/issues/issue-22603.rs
diff --git a/src/test/ui/issue-22603.stderr b/src/test/ui/issues/issue-22603.stderr
similarity index 100%
rename from src/test/ui/issue-22603.stderr
rename to src/test/ui/issues/issue-22603.stderr
diff --git a/src/test/ui/issues/issue-22638.rs b/src/test/ui/issues/issue-22638.rs
new file mode 100644
index 0000000..10ea107
--- /dev/null
+++ b/src/test/ui/issues/issue-22638.rs
@@ -0,0 +1,71 @@
+// Copyright 2015 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.
+
+// normalize-stderr-test: "<\[closure@.+`" -> "$$CLOSURE`"
+
+#![allow(unused)]
+
+#![recursion_limit = "20"]
+#![type_length_limit = "20000000"]
+#![crate_type = "rlib"]
+
+#[derive(Clone)]
+struct A (B);
+
+impl A {
+ pub fn matches<F: Fn()>(&self, f: &F) {
+ let &A(ref term) = self;
+ term.matches(f);
+ }
+}
+
+#[derive(Clone)]
+enum B {
+ Variant1,
+ Variant2(C),
+}
+
+impl B {
+ pub fn matches<F: Fn()>(&self, f: &F) {
+ match self {
+ &B::Variant2(ref factor) => {
+ factor.matches(&|| ())
+ }
+ _ => unreachable!("")
+ }
+ }
+}
+
+#[derive(Clone)]
+struct C (D);
+
+impl C {
+ pub fn matches<F: Fn()>(&self, f: &F) {
+ let &C(ref base) = self;
+ base.matches(&|| {
+ C(base.clone()).matches(f)
+ })
+ }
+}
+
+#[derive(Clone)]
+struct D (Box<A>);
+
+impl D {
+ pub fn matches<F: Fn()>(&self, f: &F) {
+ //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure
+ let &D(ref a) = self;
+ a.matches(f)
+ }
+}
+
+pub fn matches() {
+ A(B::Variant1).matches(&(|| ()))
+}
diff --git a/src/test/ui/issues/issue-22638.stderr b/src/test/ui/issues/issue-22638.stderr
new file mode 100644
index 0000000..299d74b
--- /dev/null
+++ b/src/test/ui/issues/issue-22638.stderr
@@ -0,0 +1,14 @@
+error: reached the type-length limit while instantiating `D::matches::$CLOSURE`
+ --> $DIR/issue-22638.rs:62:5
+ |
+LL | / pub fn matches<F: Fn()>(&self, f: &F) {
+LL | | //~^ ERROR reached the type-length limit while instantiating `D::matches::<[closure
+LL | | let &D(ref a) = self;
+LL | | a.matches(f)
+LL | | }
+ | |_____^
+ |
+ = note: consider adding a `#![type_length_limit="40000000"]` attribute to your crate
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-22644.rs b/src/test/ui/issues/issue-22644.rs
similarity index 100%
rename from src/test/ui/issue-22644.rs
rename to src/test/ui/issues/issue-22644.rs
diff --git a/src/test/ui/issue-22644.stderr b/src/test/ui/issues/issue-22644.stderr
similarity index 100%
rename from src/test/ui/issue-22644.stderr
rename to src/test/ui/issues/issue-22644.stderr
diff --git a/src/test/ui/issue-22673.rs b/src/test/ui/issues/issue-22673.rs
similarity index 100%
rename from src/test/ui/issue-22673.rs
rename to src/test/ui/issues/issue-22673.rs
diff --git a/src/test/ui/issue-22673.stderr b/src/test/ui/issues/issue-22673.stderr
similarity index 100%
rename from src/test/ui/issue-22673.stderr
rename to src/test/ui/issues/issue-22673.stderr
diff --git a/src/test/ui/issue-22684.rs b/src/test/ui/issues/issue-22684.rs
similarity index 100%
rename from src/test/ui/issue-22684.rs
rename to src/test/ui/issues/issue-22684.rs
diff --git a/src/test/ui/issue-22684.stderr b/src/test/ui/issues/issue-22684.stderr
similarity index 100%
rename from src/test/ui/issue-22684.stderr
rename to src/test/ui/issues/issue-22684.stderr
diff --git a/src/test/ui/issue-22706.rs b/src/test/ui/issues/issue-22706.rs
similarity index 100%
rename from src/test/ui/issue-22706.rs
rename to src/test/ui/issues/issue-22706.rs
diff --git a/src/test/ui/issue-22706.stderr b/src/test/ui/issues/issue-22706.stderr
similarity index 100%
rename from src/test/ui/issue-22706.stderr
rename to src/test/ui/issues/issue-22706.stderr
diff --git a/src/test/ui/issue-22789.rs b/src/test/ui/issues/issue-22789.rs
similarity index 100%
rename from src/test/ui/issue-22789.rs
rename to src/test/ui/issues/issue-22789.rs
diff --git a/src/test/ui/issue-22789.stderr b/src/test/ui/issues/issue-22789.stderr
similarity index 100%
rename from src/test/ui/issue-22789.stderr
rename to src/test/ui/issues/issue-22789.stderr
diff --git a/src/test/ui/issue-2281-part1.rs b/src/test/ui/issues/issue-2281-part1.rs
similarity index 100%
rename from src/test/ui/issue-2281-part1.rs
rename to src/test/ui/issues/issue-2281-part1.rs
diff --git a/src/test/ui/issue-2281-part1.stderr b/src/test/ui/issues/issue-2281-part1.stderr
similarity index 100%
rename from src/test/ui/issue-2281-part1.stderr
rename to src/test/ui/issues/issue-2281-part1.stderr
diff --git a/src/test/ui/issue-22874.rs b/src/test/ui/issues/issue-22874.rs
similarity index 100%
rename from src/test/ui/issue-22874.rs
rename to src/test/ui/issues/issue-22874.rs
diff --git a/src/test/ui/issues/issue-22874.stderr b/src/test/ui/issues/issue-22874.stderr
new file mode 100644
index 0000000..a69ee7c
--- /dev/null
+++ b/src/test/ui/issues/issue-22874.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[std::string::String]` cannot be known at compilation time
+ --> $DIR/issue-22874.rs:12:5
+ |
+LL | rows: [[String]],
+ | ^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[std::string::String]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: slice and array elements must have `Sized` type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-22886.rs b/src/test/ui/issues/issue-22886.rs
similarity index 100%
rename from src/test/ui/issue-22886.rs
rename to src/test/ui/issues/issue-22886.rs
diff --git a/src/test/ui/issue-22886.stderr b/src/test/ui/issues/issue-22886.stderr
similarity index 100%
rename from src/test/ui/issue-22886.stderr
rename to src/test/ui/issues/issue-22886.stderr
diff --git a/src/test/ui/issue-22933-1.rs b/src/test/ui/issues/issue-22933-1.rs
similarity index 100%
rename from src/test/ui/issue-22933-1.rs
rename to src/test/ui/issues/issue-22933-1.rs
diff --git a/src/test/ui/issue-22933-1.stderr b/src/test/ui/issues/issue-22933-1.stderr
similarity index 100%
rename from src/test/ui/issue-22933-1.stderr
rename to src/test/ui/issues/issue-22933-1.stderr
diff --git a/src/test/ui/issue-22933-2.rs b/src/test/ui/issues/issue-22933-2.rs
similarity index 100%
rename from src/test/ui/issue-22933-2.rs
rename to src/test/ui/issues/issue-22933-2.rs
diff --git a/src/test/ui/issue-22933-2.stderr b/src/test/ui/issues/issue-22933-2.stderr
similarity index 100%
rename from src/test/ui/issue-22933-2.stderr
rename to src/test/ui/issues/issue-22933-2.stderr
diff --git a/src/test/ui/issue-22933-3.rs b/src/test/ui/issues/issue-22933-3.rs
similarity index 100%
rename from src/test/ui/issue-22933-3.rs
rename to src/test/ui/issues/issue-22933-3.rs
diff --git a/src/test/ui/issue-22933-3.stderr b/src/test/ui/issues/issue-22933-3.stderr
similarity index 100%
rename from src/test/ui/issue-22933-3.stderr
rename to src/test/ui/issues/issue-22933-3.stderr
diff --git a/src/test/ui/issue-23024.rs b/src/test/ui/issues/issue-23024.rs
similarity index 100%
rename from src/test/ui/issue-23024.rs
rename to src/test/ui/issues/issue-23024.rs
diff --git a/src/test/ui/issue-23024.stderr b/src/test/ui/issues/issue-23024.stderr
similarity index 100%
rename from src/test/ui/issue-23024.stderr
rename to src/test/ui/issues/issue-23024.stderr
diff --git a/src/test/ui/issue-23041.rs b/src/test/ui/issues/issue-23041.rs
similarity index 100%
rename from src/test/ui/issue-23041.rs
rename to src/test/ui/issues/issue-23041.rs
diff --git a/src/test/ui/issue-23041.stderr b/src/test/ui/issues/issue-23041.stderr
similarity index 100%
rename from src/test/ui/issue-23041.stderr
rename to src/test/ui/issues/issue-23041.stderr
diff --git a/src/test/ui/issue-23046.rs b/src/test/ui/issues/issue-23046.rs
similarity index 100%
rename from src/test/ui/issue-23046.rs
rename to src/test/ui/issues/issue-23046.rs
diff --git a/src/test/ui/issue-23046.stderr b/src/test/ui/issues/issue-23046.stderr
similarity index 100%
rename from src/test/ui/issue-23046.stderr
rename to src/test/ui/issues/issue-23046.stderr
diff --git a/src/test/ui/issue-23073.rs b/src/test/ui/issues/issue-23073.rs
similarity index 100%
rename from src/test/ui/issue-23073.rs
rename to src/test/ui/issues/issue-23073.rs
diff --git a/src/test/ui/issue-23073.stderr b/src/test/ui/issues/issue-23073.stderr
similarity index 100%
rename from src/test/ui/issue-23073.stderr
rename to src/test/ui/issues/issue-23073.stderr
diff --git a/src/test/ui/issue-23080-2.rs b/src/test/ui/issues/issue-23080-2.rs
similarity index 100%
rename from src/test/ui/issue-23080-2.rs
rename to src/test/ui/issues/issue-23080-2.rs
diff --git a/src/test/ui/issue-23080-2.stderr b/src/test/ui/issues/issue-23080-2.stderr
similarity index 100%
rename from src/test/ui/issue-23080-2.stderr
rename to src/test/ui/issues/issue-23080-2.stderr
diff --git a/src/test/ui/issue-23080.rs b/src/test/ui/issues/issue-23080.rs
similarity index 100%
rename from src/test/ui/issue-23080.rs
rename to src/test/ui/issues/issue-23080.rs
diff --git a/src/test/ui/issue-23080.stderr b/src/test/ui/issues/issue-23080.stderr
similarity index 100%
rename from src/test/ui/issue-23080.stderr
rename to src/test/ui/issues/issue-23080.stderr
diff --git a/src/test/ui/issue-23122-1.rs b/src/test/ui/issues/issue-23122-1.rs
similarity index 100%
rename from src/test/ui/issue-23122-1.rs
rename to src/test/ui/issues/issue-23122-1.rs
diff --git a/src/test/ui/issue-23122-1.stderr b/src/test/ui/issues/issue-23122-1.stderr
similarity index 100%
rename from src/test/ui/issue-23122-1.stderr
rename to src/test/ui/issues/issue-23122-1.stderr
diff --git a/src/test/ui/issue-23122-2.rs b/src/test/ui/issues/issue-23122-2.rs
similarity index 100%
rename from src/test/ui/issue-23122-2.rs
rename to src/test/ui/issues/issue-23122-2.rs
diff --git a/src/test/ui/issue-23122-2.stderr b/src/test/ui/issues/issue-23122-2.stderr
similarity index 100%
rename from src/test/ui/issue-23122-2.stderr
rename to src/test/ui/issues/issue-23122-2.stderr
diff --git a/src/test/ui/issue-23173.rs b/src/test/ui/issues/issue-23173.rs
similarity index 100%
rename from src/test/ui/issue-23173.rs
rename to src/test/ui/issues/issue-23173.rs
diff --git a/src/test/ui/issue-23173.stderr b/src/test/ui/issues/issue-23173.stderr
similarity index 100%
rename from src/test/ui/issue-23173.stderr
rename to src/test/ui/issues/issue-23173.stderr
diff --git a/src/test/ui/issue-23217.rs b/src/test/ui/issues/issue-23217.rs
similarity index 100%
rename from src/test/ui/issue-23217.rs
rename to src/test/ui/issues/issue-23217.rs
diff --git a/src/test/ui/issue-23217.stderr b/src/test/ui/issues/issue-23217.stderr
similarity index 100%
rename from src/test/ui/issue-23217.stderr
rename to src/test/ui/issues/issue-23217.stderr
diff --git a/src/test/ui/issue-23253.rs b/src/test/ui/issues/issue-23253.rs
similarity index 100%
rename from src/test/ui/issue-23253.rs
rename to src/test/ui/issues/issue-23253.rs
diff --git a/src/test/ui/issue-23253.stderr b/src/test/ui/issues/issue-23253.stderr
similarity index 100%
rename from src/test/ui/issue-23253.stderr
rename to src/test/ui/issues/issue-23253.stderr
diff --git a/src/test/ui/issue-23281.rs b/src/test/ui/issues/issue-23281.rs
similarity index 100%
rename from src/test/ui/issue-23281.rs
rename to src/test/ui/issues/issue-23281.rs
diff --git a/src/test/ui/issues/issue-23281.stderr b/src/test/ui/issues/issue-23281.stderr
new file mode 100644
index 0000000..78db19d
--- /dev/null
+++ b/src/test/ui/issues/issue-23281.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `(dyn std::ops::Fn() + 'static)` cannot be known at compilation time
+ --> $DIR/issue-23281.rs:16:5
+ |
+LL | pub fn function(funs: Vec<Fn() -> ()>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::vec::Vec`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-2330.rs b/src/test/ui/issues/issue-2330.rs
similarity index 100%
rename from src/test/ui/issue-2330.rs
rename to src/test/ui/issues/issue-2330.rs
diff --git a/src/test/ui/issue-2330.stderr b/src/test/ui/issues/issue-2330.stderr
similarity index 100%
rename from src/test/ui/issue-2330.stderr
rename to src/test/ui/issues/issue-2330.stderr
diff --git a/src/test/ui/issue-23302-1.rs b/src/test/ui/issues/issue-23302-1.rs
similarity index 100%
rename from src/test/ui/issue-23302-1.rs
rename to src/test/ui/issues/issue-23302-1.rs
diff --git a/src/test/ui/issue-23302-1.stderr b/src/test/ui/issues/issue-23302-1.stderr
similarity index 100%
rename from src/test/ui/issue-23302-1.stderr
rename to src/test/ui/issues/issue-23302-1.stderr
diff --git a/src/test/ui/issue-23302-2.rs b/src/test/ui/issues/issue-23302-2.rs
similarity index 100%
rename from src/test/ui/issue-23302-2.rs
rename to src/test/ui/issues/issue-23302-2.rs
diff --git a/src/test/ui/issue-23302-2.stderr b/src/test/ui/issues/issue-23302-2.stderr
similarity index 100%
rename from src/test/ui/issue-23302-2.stderr
rename to src/test/ui/issues/issue-23302-2.stderr
diff --git a/src/test/ui/issue-23302-3.rs b/src/test/ui/issues/issue-23302-3.rs
similarity index 100%
rename from src/test/ui/issue-23302-3.rs
rename to src/test/ui/issues/issue-23302-3.rs
diff --git a/src/test/ui/issue-23302-3.stderr b/src/test/ui/issues/issue-23302-3.stderr
similarity index 100%
rename from src/test/ui/issue-23302-3.stderr
rename to src/test/ui/issues/issue-23302-3.stderr
diff --git a/src/test/ui/issue-23543.rs b/src/test/ui/issues/issue-23543.rs
similarity index 100%
rename from src/test/ui/issue-23543.rs
rename to src/test/ui/issues/issue-23543.rs
diff --git a/src/test/ui/issue-23543.stderr b/src/test/ui/issues/issue-23543.stderr
similarity index 100%
rename from src/test/ui/issue-23543.stderr
rename to src/test/ui/issues/issue-23543.stderr
diff --git a/src/test/ui/issue-23544.rs b/src/test/ui/issues/issue-23544.rs
similarity index 100%
rename from src/test/ui/issue-23544.rs
rename to src/test/ui/issues/issue-23544.rs
diff --git a/src/test/ui/issue-23544.stderr b/src/test/ui/issues/issue-23544.stderr
similarity index 100%
rename from src/test/ui/issue-23544.stderr
rename to src/test/ui/issues/issue-23544.stderr
diff --git a/src/test/ui/issue-23589.rs b/src/test/ui/issues/issue-23589.rs
similarity index 100%
rename from src/test/ui/issue-23589.rs
rename to src/test/ui/issues/issue-23589.rs
diff --git a/src/test/ui/issue-23589.stderr b/src/test/ui/issues/issue-23589.stderr
similarity index 100%
rename from src/test/ui/issue-23589.stderr
rename to src/test/ui/issues/issue-23589.stderr
diff --git a/src/test/ui/issue-23595-2.rs b/src/test/ui/issues/issue-23595-2.rs
similarity index 100%
rename from src/test/ui/issue-23595-2.rs
rename to src/test/ui/issues/issue-23595-2.rs
diff --git a/src/test/ui/issue-23595-2.stderr b/src/test/ui/issues/issue-23595-2.stderr
similarity index 100%
rename from src/test/ui/issue-23595-2.stderr
rename to src/test/ui/issues/issue-23595-2.stderr
diff --git a/src/test/ui/issue-23716.rs b/src/test/ui/issues/issue-23716.rs
similarity index 100%
rename from src/test/ui/issue-23716.rs
rename to src/test/ui/issues/issue-23716.rs
diff --git a/src/test/ui/issue-23716.stderr b/src/test/ui/issues/issue-23716.stderr
similarity index 100%
rename from src/test/ui/issue-23716.stderr
rename to src/test/ui/issues/issue-23716.stderr
diff --git a/src/test/ui/issue-23966.rs b/src/test/ui/issues/issue-23966.rs
similarity index 100%
rename from src/test/ui/issue-23966.rs
rename to src/test/ui/issues/issue-23966.rs
diff --git a/src/test/ui/issue-23966.stderr b/src/test/ui/issues/issue-23966.stderr
similarity index 100%
rename from src/test/ui/issue-23966.stderr
rename to src/test/ui/issues/issue-23966.stderr
diff --git a/src/test/ui/issue-24013.rs b/src/test/ui/issues/issue-24013.rs
similarity index 100%
rename from src/test/ui/issue-24013.rs
rename to src/test/ui/issues/issue-24013.rs
diff --git a/src/test/ui/issue-24013.stderr b/src/test/ui/issues/issue-24013.stderr
similarity index 100%
rename from src/test/ui/issue-24013.stderr
rename to src/test/ui/issues/issue-24013.stderr
diff --git a/src/test/ui/issue-24036.rs b/src/test/ui/issues/issue-24036.rs
similarity index 100%
rename from src/test/ui/issue-24036.rs
rename to src/test/ui/issues/issue-24036.rs
diff --git a/src/test/ui/issue-24036.stderr b/src/test/ui/issues/issue-24036.stderr
similarity index 100%
rename from src/test/ui/issue-24036.stderr
rename to src/test/ui/issues/issue-24036.stderr
diff --git a/src/test/ui/issue-24081.rs b/src/test/ui/issues/issue-24081.rs
similarity index 100%
rename from src/test/ui/issue-24081.rs
rename to src/test/ui/issues/issue-24081.rs
diff --git a/src/test/ui/issue-24081.stderr b/src/test/ui/issues/issue-24081.stderr
similarity index 100%
rename from src/test/ui/issue-24081.stderr
rename to src/test/ui/issues/issue-24081.stderr
diff --git a/src/test/ui/issue-24204.rs b/src/test/ui/issues/issue-24204.rs
similarity index 100%
rename from src/test/ui/issue-24204.rs
rename to src/test/ui/issues/issue-24204.rs
diff --git a/src/test/ui/issue-24204.stderr b/src/test/ui/issues/issue-24204.stderr
similarity index 100%
rename from src/test/ui/issue-24204.stderr
rename to src/test/ui/issues/issue-24204.stderr
diff --git a/src/test/ui/issue-24267-flow-exit.nll.stderr b/src/test/ui/issues/issue-24267-flow-exit.nll.stderr
similarity index 100%
rename from src/test/ui/issue-24267-flow-exit.nll.stderr
rename to src/test/ui/issues/issue-24267-flow-exit.nll.stderr
diff --git a/src/test/ui/issue-24267-flow-exit.rs b/src/test/ui/issues/issue-24267-flow-exit.rs
similarity index 100%
rename from src/test/ui/issue-24267-flow-exit.rs
rename to src/test/ui/issues/issue-24267-flow-exit.rs
diff --git a/src/test/ui/issue-24267-flow-exit.stderr b/src/test/ui/issues/issue-24267-flow-exit.stderr
similarity index 100%
rename from src/test/ui/issue-24267-flow-exit.stderr
rename to src/test/ui/issues/issue-24267-flow-exit.stderr
diff --git a/src/test/ui/issue-24322.rs b/src/test/ui/issues/issue-24322.rs
similarity index 100%
rename from src/test/ui/issue-24322.rs
rename to src/test/ui/issues/issue-24322.rs
diff --git a/src/test/ui/issue-24322.stderr b/src/test/ui/issues/issue-24322.stderr
similarity index 100%
rename from src/test/ui/issue-24322.stderr
rename to src/test/ui/issues/issue-24322.stderr
diff --git a/src/test/ui/issue-24352.rs b/src/test/ui/issues/issue-24352.rs
similarity index 100%
rename from src/test/ui/issue-24352.rs
rename to src/test/ui/issues/issue-24352.rs
diff --git a/src/test/ui/issue-24352.stderr b/src/test/ui/issues/issue-24352.stderr
similarity index 100%
rename from src/test/ui/issue-24352.stderr
rename to src/test/ui/issues/issue-24352.stderr
diff --git a/src/test/ui/issue-24357.nll.stderr b/src/test/ui/issues/issue-24357.nll.stderr
similarity index 100%
rename from src/test/ui/issue-24357.nll.stderr
rename to src/test/ui/issues/issue-24357.nll.stderr
diff --git a/src/test/ui/issue-24357.rs b/src/test/ui/issues/issue-24357.rs
similarity index 100%
rename from src/test/ui/issue-24357.rs
rename to src/test/ui/issues/issue-24357.rs
diff --git a/src/test/ui/issue-24357.stderr b/src/test/ui/issues/issue-24357.stderr
similarity index 100%
rename from src/test/ui/issue-24357.stderr
rename to src/test/ui/issues/issue-24357.stderr
diff --git a/src/test/ui/issue-24363.rs b/src/test/ui/issues/issue-24363.rs
similarity index 100%
rename from src/test/ui/issue-24363.rs
rename to src/test/ui/issues/issue-24363.rs
diff --git a/src/test/ui/issue-24363.stderr b/src/test/ui/issues/issue-24363.stderr
similarity index 100%
rename from src/test/ui/issue-24363.stderr
rename to src/test/ui/issues/issue-24363.stderr
diff --git a/src/test/ui/issue-24365.rs b/src/test/ui/issues/issue-24365.rs
similarity index 100%
rename from src/test/ui/issue-24365.rs
rename to src/test/ui/issues/issue-24365.rs
diff --git a/src/test/ui/issue-24365.stderr b/src/test/ui/issues/issue-24365.stderr
similarity index 100%
rename from src/test/ui/issue-24365.stderr
rename to src/test/ui/issues/issue-24365.stderr
diff --git a/src/test/ui/issue-24424.rs b/src/test/ui/issues/issue-24424.rs
similarity index 100%
rename from src/test/ui/issue-24424.rs
rename to src/test/ui/issues/issue-24424.rs
diff --git a/src/test/ui/issue-24424.stderr b/src/test/ui/issues/issue-24424.stderr
similarity index 100%
rename from src/test/ui/issue-24424.stderr
rename to src/test/ui/issues/issue-24424.stderr
diff --git a/src/test/ui/issue-24446.rs b/src/test/ui/issues/issue-24446.rs
similarity index 100%
rename from src/test/ui/issue-24446.rs
rename to src/test/ui/issues/issue-24446.rs
diff --git a/src/test/ui/issues/issue-24446.stderr b/src/test/ui/issues/issue-24446.stderr
new file mode 100644
index 0000000..3c42462
--- /dev/null
+++ b/src/test/ui/issues/issue-24446.stderr
@@ -0,0 +1,33 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-24446.rs:12:31
+ |
+LL | static foo: Fn() -> u32 = || -> u32 {
+ | _______________________________^
+LL | | //~^ ERROR mismatched types
+LL | | //~| ERROR the size for values of type
+LL | | 0
+LL | | };
+ | |_____^ expected trait std::ops::Fn, found closure
+ |
+ = note: expected type `(dyn std::ops::Fn() -> u32 + 'static)`
+ found type `[closure@$DIR/issue-24446.rs:12:31: 16:6]`
+
+error[E0277]: the size for values of type `(dyn std::ops::Fn() -> u32 + 'static)` cannot be known at compilation time
+ --> $DIR/issue-24446.rs:12:31
+ |
+LL | static foo: Fn() -> u32 = || -> u32 {
+ | _______________________________^
+LL | | //~^ ERROR mismatched types
+LL | | //~| ERROR the size for values of type
+LL | | 0
+LL | | };
+ | |_____^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::ops::Fn() -> u32 + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: constant expressions must have a statically known size
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-24682.rs b/src/test/ui/issues/issue-24682.rs
similarity index 100%
rename from src/test/ui/issue-24682.rs
rename to src/test/ui/issues/issue-24682.rs
diff --git a/src/test/ui/issue-24682.stderr b/src/test/ui/issues/issue-24682.stderr
similarity index 100%
rename from src/test/ui/issue-24682.stderr
rename to src/test/ui/issues/issue-24682.stderr
diff --git a/src/test/ui/issue-24819.rs b/src/test/ui/issues/issue-24819.rs
similarity index 100%
rename from src/test/ui/issue-24819.rs
rename to src/test/ui/issues/issue-24819.rs
diff --git a/src/test/ui/issue-24819.stderr b/src/test/ui/issues/issue-24819.stderr
similarity index 100%
rename from src/test/ui/issue-24819.stderr
rename to src/test/ui/issues/issue-24819.stderr
diff --git a/src/test/ui/issue-24883.rs b/src/test/ui/issues/issue-24883.rs
similarity index 100%
rename from src/test/ui/issue-24883.rs
rename to src/test/ui/issues/issue-24883.rs
diff --git a/src/test/ui/issue-24883.stderr b/src/test/ui/issues/issue-24883.stderr
similarity index 100%
rename from src/test/ui/issue-24883.stderr
rename to src/test/ui/issues/issue-24883.stderr
diff --git a/src/test/ui/issue-25076.rs b/src/test/ui/issues/issue-25076.rs
similarity index 100%
rename from src/test/ui/issue-25076.rs
rename to src/test/ui/issues/issue-25076.rs
diff --git a/src/test/ui/issue-25076.stderr b/src/test/ui/issues/issue-25076.stderr
similarity index 100%
rename from src/test/ui/issue-25076.stderr
rename to src/test/ui/issues/issue-25076.stderr
diff --git a/src/test/ui/issue-25368.rs b/src/test/ui/issues/issue-25368.rs
similarity index 100%
rename from src/test/ui/issue-25368.rs
rename to src/test/ui/issues/issue-25368.rs
diff --git a/src/test/ui/issue-25368.stderr b/src/test/ui/issues/issue-25368.stderr
similarity index 100%
rename from src/test/ui/issue-25368.stderr
rename to src/test/ui/issues/issue-25368.stderr
diff --git a/src/test/ui/issue-25385.rs b/src/test/ui/issues/issue-25385.rs
similarity index 100%
rename from src/test/ui/issue-25385.rs
rename to src/test/ui/issues/issue-25385.rs
diff --git a/src/test/ui/issue-25385.stderr b/src/test/ui/issues/issue-25385.stderr
similarity index 100%
rename from src/test/ui/issue-25385.stderr
rename to src/test/ui/issues/issue-25385.stderr
diff --git a/src/test/ui/issue-25386.rs b/src/test/ui/issues/issue-25386.rs
similarity index 100%
rename from src/test/ui/issue-25386.rs
rename to src/test/ui/issues/issue-25386.rs
diff --git a/src/test/ui/issue-25386.stderr b/src/test/ui/issues/issue-25386.stderr
similarity index 100%
rename from src/test/ui/issue-25386.stderr
rename to src/test/ui/issues/issue-25386.stderr
diff --git a/src/test/ui/issue-25396.rs b/src/test/ui/issues/issue-25396.rs
similarity index 100%
rename from src/test/ui/issue-25396.rs
rename to src/test/ui/issues/issue-25396.rs
diff --git a/src/test/ui/issue-25396.stderr b/src/test/ui/issues/issue-25396.stderr
similarity index 100%
rename from src/test/ui/issue-25396.stderr
rename to src/test/ui/issues/issue-25396.stderr
diff --git a/src/test/ui/issue-25439.rs b/src/test/ui/issues/issue-25439.rs
similarity index 100%
rename from src/test/ui/issue-25439.rs
rename to src/test/ui/issues/issue-25439.rs
diff --git a/src/test/ui/issue-25439.stderr b/src/test/ui/issues/issue-25439.stderr
similarity index 100%
rename from src/test/ui/issue-25439.stderr
rename to src/test/ui/issues/issue-25439.stderr
diff --git a/src/test/ui/issue-25579.ast.nll.stderr b/src/test/ui/issues/issue-25579.ast.nll.stderr
similarity index 100%
rename from src/test/ui/issue-25579.ast.nll.stderr
rename to src/test/ui/issues/issue-25579.ast.nll.stderr
diff --git a/src/test/ui/issue-25579.ast.stderr b/src/test/ui/issues/issue-25579.ast.stderr
similarity index 100%
rename from src/test/ui/issue-25579.ast.stderr
rename to src/test/ui/issues/issue-25579.ast.stderr
diff --git a/src/test/ui/issue-25579.mir.stderr b/src/test/ui/issues/issue-25579.mir.stderr
similarity index 100%
rename from src/test/ui/issue-25579.mir.stderr
rename to src/test/ui/issues/issue-25579.mir.stderr
diff --git a/src/test/ui/issue-25579.rs b/src/test/ui/issues/issue-25579.rs
similarity index 100%
rename from src/test/ui/issue-25579.rs
rename to src/test/ui/issues/issue-25579.rs
diff --git a/src/test/ui/issue-25700.rs b/src/test/ui/issues/issue-25700.rs
similarity index 100%
rename from src/test/ui/issue-25700.rs
rename to src/test/ui/issues/issue-25700.rs
diff --git a/src/test/ui/issue-25700.stderr b/src/test/ui/issues/issue-25700.stderr
similarity index 100%
rename from src/test/ui/issue-25700.stderr
rename to src/test/ui/issues/issue-25700.stderr
diff --git a/src/test/ui/issue-25793.nll.stderr b/src/test/ui/issues/issue-25793.nll.stderr
similarity index 100%
rename from src/test/ui/issue-25793.nll.stderr
rename to src/test/ui/issues/issue-25793.nll.stderr
diff --git a/src/test/ui/issue-25793.rs b/src/test/ui/issues/issue-25793.rs
similarity index 100%
rename from src/test/ui/issue-25793.rs
rename to src/test/ui/issues/issue-25793.rs
diff --git a/src/test/ui/issue-25793.stderr b/src/test/ui/issues/issue-25793.stderr
similarity index 100%
rename from src/test/ui/issue-25793.stderr
rename to src/test/ui/issues/issue-25793.stderr
diff --git a/src/test/ui/issue-25826.rs b/src/test/ui/issues/issue-25826.rs
similarity index 100%
rename from src/test/ui/issue-25826.rs
rename to src/test/ui/issues/issue-25826.rs
diff --git a/src/test/ui/issue-25826.stderr b/src/test/ui/issues/issue-25826.stderr
similarity index 100%
rename from src/test/ui/issue-25826.stderr
rename to src/test/ui/issues/issue-25826.stderr
diff --git a/src/test/ui/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr
similarity index 100%
rename from src/test/ui/issue-2590.nll.stderr
rename to src/test/ui/issues/issue-2590.nll.stderr
diff --git a/src/test/ui/issue-2590.rs b/src/test/ui/issues/issue-2590.rs
similarity index 100%
rename from src/test/ui/issue-2590.rs
rename to src/test/ui/issues/issue-2590.rs
diff --git a/src/test/ui/issue-2590.stderr b/src/test/ui/issues/issue-2590.stderr
similarity index 100%
rename from src/test/ui/issue-2590.stderr
rename to src/test/ui/issues/issue-2590.stderr
diff --git a/src/test/ui/issue-25901.rs b/src/test/ui/issues/issue-25901.rs
similarity index 100%
rename from src/test/ui/issue-25901.rs
rename to src/test/ui/issues/issue-25901.rs
diff --git a/src/test/ui/issue-25901.stderr b/src/test/ui/issues/issue-25901.stderr
similarity index 100%
rename from src/test/ui/issue-25901.stderr
rename to src/test/ui/issues/issue-25901.stderr
diff --git a/src/test/ui/issue-26056.rs b/src/test/ui/issues/issue-26056.rs
similarity index 100%
rename from src/test/ui/issue-26056.rs
rename to src/test/ui/issues/issue-26056.rs
diff --git a/src/test/ui/issue-26056.stderr b/src/test/ui/issues/issue-26056.stderr
similarity index 100%
rename from src/test/ui/issue-26056.stderr
rename to src/test/ui/issues/issue-26056.stderr
diff --git a/src/test/ui/issue-26093.rs b/src/test/ui/issues/issue-26093.rs
similarity index 100%
rename from src/test/ui/issue-26093.rs
rename to src/test/ui/issues/issue-26093.rs
diff --git a/src/test/ui/issue-26093.stderr b/src/test/ui/issues/issue-26093.stderr
similarity index 100%
rename from src/test/ui/issue-26093.stderr
rename to src/test/ui/issues/issue-26093.stderr
diff --git a/src/test/ui/issue-26094.rs b/src/test/ui/issues/issue-26094.rs
similarity index 100%
rename from src/test/ui/issue-26094.rs
rename to src/test/ui/issues/issue-26094.rs
diff --git a/src/test/ui/issue-26094.stderr b/src/test/ui/issues/issue-26094.stderr
similarity index 100%
rename from src/test/ui/issue-26094.stderr
rename to src/test/ui/issues/issue-26094.stderr
diff --git a/src/test/ui/issue-26158.rs b/src/test/ui/issues/issue-26158.rs
similarity index 100%
rename from src/test/ui/issue-26158.rs
rename to src/test/ui/issues/issue-26158.rs
diff --git a/src/test/ui/issue-26158.stderr b/src/test/ui/issues/issue-26158.stderr
similarity index 100%
rename from src/test/ui/issue-26158.stderr
rename to src/test/ui/issues/issue-26158.stderr
diff --git a/src/test/ui/issue-26217.nll.stderr b/src/test/ui/issues/issue-26217.nll.stderr
similarity index 100%
rename from src/test/ui/issue-26217.nll.stderr
rename to src/test/ui/issues/issue-26217.nll.stderr
diff --git a/src/test/ui/issue-26217.rs b/src/test/ui/issues/issue-26217.rs
similarity index 100%
rename from src/test/ui/issue-26217.rs
rename to src/test/ui/issues/issue-26217.rs
diff --git a/src/test/ui/issue-26217.stderr b/src/test/ui/issues/issue-26217.stderr
similarity index 100%
rename from src/test/ui/issue-26217.stderr
rename to src/test/ui/issues/issue-26217.stderr
diff --git a/src/test/ui/issue-26237.rs b/src/test/ui/issues/issue-26237.rs
similarity index 100%
rename from src/test/ui/issue-26237.rs
rename to src/test/ui/issues/issue-26237.rs
diff --git a/src/test/ui/issue-26237.stderr b/src/test/ui/issues/issue-26237.stderr
similarity index 100%
rename from src/test/ui/issue-26237.stderr
rename to src/test/ui/issues/issue-26237.stderr
diff --git a/src/test/ui/issue-26262.rs b/src/test/ui/issues/issue-26262.rs
similarity index 100%
rename from src/test/ui/issue-26262.rs
rename to src/test/ui/issues/issue-26262.rs
diff --git a/src/test/ui/issue-26262.stderr b/src/test/ui/issues/issue-26262.stderr
similarity index 100%
rename from src/test/ui/issue-26262.stderr
rename to src/test/ui/issues/issue-26262.stderr
diff --git a/src/test/ui/issue-26459.rs b/src/test/ui/issues/issue-26459.rs
similarity index 100%
rename from src/test/ui/issue-26459.rs
rename to src/test/ui/issues/issue-26459.rs
diff --git a/src/test/ui/issue-26459.stderr b/src/test/ui/issues/issue-26459.stderr
similarity index 100%
rename from src/test/ui/issue-26459.stderr
rename to src/test/ui/issues/issue-26459.stderr
diff --git a/src/test/ui/issue-26472.rs b/src/test/ui/issues/issue-26472.rs
similarity index 100%
rename from src/test/ui/issue-26472.rs
rename to src/test/ui/issues/issue-26472.rs
diff --git a/src/test/ui/issue-26472.stderr b/src/test/ui/issues/issue-26472.stderr
similarity index 100%
rename from src/test/ui/issue-26472.stderr
rename to src/test/ui/issues/issue-26472.stderr
diff --git a/src/test/compile-fail/issue-26548.rs b/src/test/ui/issues/issue-26548.rs
similarity index 100%
rename from src/test/compile-fail/issue-26548.rs
rename to src/test/ui/issues/issue-26548.rs
diff --git a/src/test/ui/issues/issue-26548.stderr b/src/test/ui/issues/issue-26548.stderr
new file mode 100644
index 0000000..7ebeb76
--- /dev/null
+++ b/src/test/ui/issues/issue-26548.stderr
@@ -0,0 +1,13 @@
+error[E0391]: cycle detected when computing layout of `std::option::Option<S>`
+ |
+note: ...which requires computing layout of `S`...
+ = note: ...which again requires computing layout of `std::option::Option<S>`, completing the cycle
+note: cycle used when processing `main`
+ --> $DIR/issue-26548.rs:19:1
+ |
+LL | fn main() { //~ NOTE cycle used when processing `main`
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/ui/issue-26614.rs b/src/test/ui/issues/issue-26614.rs
similarity index 100%
rename from src/test/ui/issue-26614.rs
rename to src/test/ui/issues/issue-26614.rs
diff --git a/src/test/ui/issue-26614.stderr b/src/test/ui/issues/issue-26614.stderr
similarity index 100%
rename from src/test/ui/issue-26614.stderr
rename to src/test/ui/issues/issue-26614.stderr
diff --git a/src/test/ui/issue-26638.rs b/src/test/ui/issues/issue-26638.rs
similarity index 100%
rename from src/test/ui/issue-26638.rs
rename to src/test/ui/issues/issue-26638.rs
diff --git a/src/test/ui/issue-26638.stderr b/src/test/ui/issues/issue-26638.stderr
similarity index 100%
rename from src/test/ui/issue-26638.stderr
rename to src/test/ui/issues/issue-26638.stderr
diff --git a/src/test/ui/issue-26812.rs b/src/test/ui/issues/issue-26812.rs
similarity index 100%
rename from src/test/ui/issue-26812.rs
rename to src/test/ui/issues/issue-26812.rs
diff --git a/src/test/ui/issue-26812.stderr b/src/test/ui/issues/issue-26812.stderr
similarity index 100%
rename from src/test/ui/issue-26812.stderr
rename to src/test/ui/issues/issue-26812.stderr
diff --git a/src/test/ui/issue-26886.rs b/src/test/ui/issues/issue-26886.rs
similarity index 100%
rename from src/test/ui/issue-26886.rs
rename to src/test/ui/issues/issue-26886.rs
diff --git a/src/test/ui/issue-26886.stderr b/src/test/ui/issues/issue-26886.stderr
similarity index 100%
rename from src/test/ui/issue-26886.stderr
rename to src/test/ui/issues/issue-26886.stderr
diff --git a/src/test/ui/issue-26905.rs b/src/test/ui/issues/issue-26905.rs
similarity index 100%
rename from src/test/ui/issue-26905.rs
rename to src/test/ui/issues/issue-26905.rs
diff --git a/src/test/ui/issue-26905.stderr b/src/test/ui/issues/issue-26905.stderr
similarity index 100%
rename from src/test/ui/issue-26905.stderr
rename to src/test/ui/issues/issue-26905.stderr
diff --git a/src/test/ui/issue-26930.rs b/src/test/ui/issues/issue-26930.rs
similarity index 100%
rename from src/test/ui/issue-26930.rs
rename to src/test/ui/issues/issue-26930.rs
diff --git a/src/test/ui/issue-26930.stderr b/src/test/ui/issues/issue-26930.stderr
similarity index 100%
rename from src/test/ui/issue-26930.stderr
rename to src/test/ui/issues/issue-26930.stderr
diff --git a/src/test/ui/issue-26948.rs b/src/test/ui/issues/issue-26948.rs
similarity index 100%
rename from src/test/ui/issue-26948.rs
rename to src/test/ui/issues/issue-26948.rs
diff --git a/src/test/ui/issue-26948.stderr b/src/test/ui/issues/issue-26948.stderr
similarity index 100%
rename from src/test/ui/issue-26948.stderr
rename to src/test/ui/issues/issue-26948.stderr
diff --git a/src/test/ui/issue-27008.rs b/src/test/ui/issues/issue-27008.rs
similarity index 100%
rename from src/test/ui/issue-27008.rs
rename to src/test/ui/issues/issue-27008.rs
diff --git a/src/test/ui/issue-27008.stderr b/src/test/ui/issues/issue-27008.stderr
similarity index 100%
rename from src/test/ui/issue-27008.stderr
rename to src/test/ui/issues/issue-27008.stderr
diff --git a/src/test/ui/issue-27033.rs b/src/test/ui/issues/issue-27033.rs
similarity index 100%
rename from src/test/ui/issue-27033.rs
rename to src/test/ui/issues/issue-27033.rs
diff --git a/src/test/ui/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr
similarity index 100%
rename from src/test/ui/issue-27033.stderr
rename to src/test/ui/issues/issue-27033.stderr
diff --git a/src/test/ui/issue-27042.rs b/src/test/ui/issues/issue-27042.rs
similarity index 100%
rename from src/test/ui/issue-27042.rs
rename to src/test/ui/issues/issue-27042.rs
diff --git a/src/test/ui/issue-27042.stderr b/src/test/ui/issues/issue-27042.stderr
similarity index 100%
rename from src/test/ui/issue-27042.stderr
rename to src/test/ui/issues/issue-27042.stderr
diff --git a/src/test/ui/issue-27060-2.rs b/src/test/ui/issues/issue-27060-2.rs
similarity index 100%
rename from src/test/ui/issue-27060-2.rs
rename to src/test/ui/issues/issue-27060-2.rs
diff --git a/src/test/ui/issues/issue-27060-2.stderr b/src/test/ui/issues/issue-27060-2.stderr
new file mode 100644
index 0000000..c9a29ac
--- /dev/null
+++ b/src/test/ui/issues/issue-27060-2.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/issue-27060-2.rs:13:5
+ |
+LL | data: T, //~ ERROR the size for values of type
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+ = note: the last field of a packed struct may only have a dynamically sized type if it does not need drop to be run
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-27060.rs b/src/test/ui/issues/issue-27060.rs
similarity index 100%
rename from src/test/ui/issue-27060.rs
rename to src/test/ui/issues/issue-27060.rs
diff --git a/src/test/ui/issue-27060.stderr b/src/test/ui/issues/issue-27060.stderr
similarity index 100%
rename from src/test/ui/issue-27060.stderr
rename to src/test/ui/issues/issue-27060.stderr
diff --git a/src/test/ui/issue-27078.rs b/src/test/ui/issues/issue-27078.rs
similarity index 100%
rename from src/test/ui/issue-27078.rs
rename to src/test/ui/issues/issue-27078.rs
diff --git a/src/test/ui/issues/issue-27078.stderr b/src/test/ui/issues/issue-27078.stderr
new file mode 100644
index 0000000..269a69d
--- /dev/null
+++ b/src/test/ui/issues/issue-27078.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the size for values of type `Self` cannot be known at compilation time
+ --> $DIR/issue-27078.rs:15:12
+ |
+LL | fn foo(self) -> &'static i32 {
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Self`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Self: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-2718-a.rs b/src/test/ui/issues/issue-2718-a.rs
similarity index 100%
rename from src/test/ui/issue-2718-a.rs
rename to src/test/ui/issues/issue-2718-a.rs
diff --git a/src/test/ui/issue-2718-a.stderr b/src/test/ui/issues/issue-2718-a.stderr
similarity index 100%
rename from src/test/ui/issue-2718-a.stderr
rename to src/test/ui/issues/issue-2718-a.stderr
diff --git a/src/test/ui/issue-27282-move-match-input-into-guard.rs b/src/test/ui/issues/issue-27282-move-match-input-into-guard.rs
similarity index 100%
rename from src/test/ui/issue-27282-move-match-input-into-guard.rs
rename to src/test/ui/issues/issue-27282-move-match-input-into-guard.rs
diff --git a/src/test/ui/issue-27282-move-match-input-into-guard.stderr b/src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr
similarity index 100%
rename from src/test/ui/issue-27282-move-match-input-into-guard.stderr
rename to src/test/ui/issues/issue-27282-move-match-input-into-guard.stderr
diff --git a/src/test/ui/issue-27282-move-ref-mut-into-guard.rs b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs
similarity index 100%
rename from src/test/ui/issue-27282-move-ref-mut-into-guard.rs
rename to src/test/ui/issues/issue-27282-move-ref-mut-into-guard.rs
diff --git a/src/test/ui/issue-27282-move-ref-mut-into-guard.stderr b/src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr
similarity index 100%
rename from src/test/ui/issue-27282-move-ref-mut-into-guard.stderr
rename to src/test/ui/issues/issue-27282-move-ref-mut-into-guard.stderr
diff --git a/src/test/ui/issue-27282-mutate-before-diverging-arm-1.rs b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs
similarity index 100%
rename from src/test/ui/issue-27282-mutate-before-diverging-arm-1.rs
rename to src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.rs
diff --git a/src/test/ui/issue-27282-mutate-before-diverging-arm-1.stderr b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr
similarity index 100%
rename from src/test/ui/issue-27282-mutate-before-diverging-arm-1.stderr
rename to src/test/ui/issues/issue-27282-mutate-before-diverging-arm-1.stderr
diff --git a/src/test/ui/issue-27282-mutate-before-diverging-arm-2.rs b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.rs
similarity index 100%
rename from src/test/ui/issue-27282-mutate-before-diverging-arm-2.rs
rename to src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.rs
diff --git a/src/test/ui/issue-27282-mutate-before-diverging-arm-2.stderr b/src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.stderr
similarity index 100%
rename from src/test/ui/issue-27282-mutate-before-diverging-arm-2.stderr
rename to src/test/ui/issues/issue-27282-mutate-before-diverging-arm-2.stderr
diff --git a/src/test/ui/issue-27282-reborrow-ref-mut-in-guard.rs b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs
similarity index 100%
rename from src/test/ui/issue-27282-reborrow-ref-mut-in-guard.rs
rename to src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.rs
diff --git a/src/test/ui/issue-27282-reborrow-ref-mut-in-guard.stderr b/src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr
similarity index 100%
rename from src/test/ui/issue-27282-reborrow-ref-mut-in-guard.stderr
rename to src/test/ui/issues/issue-27282-reborrow-ref-mut-in-guard.stderr
diff --git a/src/test/ui/issue-27340.rs b/src/test/ui/issues/issue-27340.rs
similarity index 100%
rename from src/test/ui/issue-27340.rs
rename to src/test/ui/issues/issue-27340.rs
diff --git a/src/test/ui/issue-27340.stderr b/src/test/ui/issues/issue-27340.stderr
similarity index 100%
rename from src/test/ui/issue-27340.stderr
rename to src/test/ui/issues/issue-27340.stderr
diff --git a/src/test/ui/issue-27433.rs b/src/test/ui/issues/issue-27433.rs
similarity index 100%
rename from src/test/ui/issue-27433.rs
rename to src/test/ui/issues/issue-27433.rs
diff --git a/src/test/ui/issue-27433.stderr b/src/test/ui/issues/issue-27433.stderr
similarity index 100%
rename from src/test/ui/issue-27433.stderr
rename to src/test/ui/issues/issue-27433.stderr
diff --git a/src/test/ui/issue-27592.nll.stderr b/src/test/ui/issues/issue-27592.nll.stderr
similarity index 100%
rename from src/test/ui/issue-27592.nll.stderr
rename to src/test/ui/issues/issue-27592.nll.stderr
diff --git a/src/test/ui/issue-27592.rs b/src/test/ui/issues/issue-27592.rs
similarity index 100%
rename from src/test/ui/issue-27592.rs
rename to src/test/ui/issues/issue-27592.rs
diff --git a/src/test/ui/issue-27592.stderr b/src/test/ui/issues/issue-27592.stderr
similarity index 100%
rename from src/test/ui/issue-27592.stderr
rename to src/test/ui/issues/issue-27592.stderr
diff --git a/src/test/ui/issue-27815.rs b/src/test/ui/issues/issue-27815.rs
similarity index 100%
rename from src/test/ui/issue-27815.rs
rename to src/test/ui/issues/issue-27815.rs
diff --git a/src/test/ui/issue-27815.stderr b/src/test/ui/issues/issue-27815.stderr
similarity index 100%
rename from src/test/ui/issue-27815.stderr
rename to src/test/ui/issues/issue-27815.stderr
diff --git a/src/test/ui/issue-27842.rs b/src/test/ui/issues/issue-27842.rs
similarity index 100%
rename from src/test/ui/issue-27842.rs
rename to src/test/ui/issues/issue-27842.rs
diff --git a/src/test/ui/issue-27842.stderr b/src/test/ui/issues/issue-27842.stderr
similarity index 100%
rename from src/test/ui/issue-27842.stderr
rename to src/test/ui/issues/issue-27842.stderr
diff --git a/src/test/ui/issue-27895.rs b/src/test/ui/issues/issue-27895.rs
similarity index 100%
rename from src/test/ui/issue-27895.rs
rename to src/test/ui/issues/issue-27895.rs
diff --git a/src/test/ui/issue-27895.stderr b/src/test/ui/issues/issue-27895.stderr
similarity index 100%
rename from src/test/ui/issue-27895.stderr
rename to src/test/ui/issues/issue-27895.stderr
diff --git a/src/test/ui/issue-27942.rs b/src/test/ui/issues/issue-27942.rs
similarity index 100%
rename from src/test/ui/issue-27942.rs
rename to src/test/ui/issues/issue-27942.rs
diff --git a/src/test/ui/issue-27942.stderr b/src/test/ui/issues/issue-27942.stderr
similarity index 100%
rename from src/test/ui/issue-27942.stderr
rename to src/test/ui/issues/issue-27942.stderr
diff --git a/src/test/compile-fail/issue-28075.rs b/src/test/ui/issues/issue-28075.rs
similarity index 100%
rename from src/test/compile-fail/issue-28075.rs
rename to src/test/ui/issues/issue-28075.rs
diff --git a/src/test/ui/issues/issue-28075.stderr b/src/test/ui/issues/issue-28075.stderr
new file mode 100644
index 0000000..b42a322
--- /dev/null
+++ b/src/test/ui/issues/issue-28075.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/issue-28075.rs:19:22
+ |
+LL | use lint_stability::{unstable, deprecated};
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issue-28098.rs b/src/test/ui/issues/issue-28098.rs
similarity index 100%
rename from src/test/ui/issue-28098.rs
rename to src/test/ui/issues/issue-28098.rs
diff --git a/src/test/ui/issue-28098.stderr b/src/test/ui/issues/issue-28098.stderr
similarity index 100%
rename from src/test/ui/issue-28098.stderr
rename to src/test/ui/issues/issue-28098.stderr
diff --git a/src/test/ui/issue-28105.rs b/src/test/ui/issues/issue-28105.rs
similarity index 100%
rename from src/test/ui/issue-28105.rs
rename to src/test/ui/issues/issue-28105.rs
diff --git a/src/test/ui/issue-28105.stderr b/src/test/ui/issues/issue-28105.stderr
similarity index 100%
rename from src/test/ui/issue-28105.stderr
rename to src/test/ui/issues/issue-28105.stderr
diff --git a/src/test/ui/issue-28109.rs b/src/test/ui/issues/issue-28109.rs
similarity index 100%
rename from src/test/ui/issue-28109.rs
rename to src/test/ui/issues/issue-28109.rs
diff --git a/src/test/ui/issue-28109.stderr b/src/test/ui/issues/issue-28109.stderr
similarity index 100%
rename from src/test/ui/issue-28109.stderr
rename to src/test/ui/issues/issue-28109.stderr
diff --git a/src/test/ui/issue-28113.rs b/src/test/ui/issues/issue-28113.rs
similarity index 100%
rename from src/test/ui/issue-28113.rs
rename to src/test/ui/issues/issue-28113.rs
diff --git a/src/test/ui/issue-28113.stderr b/src/test/ui/issues/issue-28113.stderr
similarity index 100%
rename from src/test/ui/issue-28113.stderr
rename to src/test/ui/issues/issue-28113.stderr
diff --git a/src/test/ui/issue-2823.rs b/src/test/ui/issues/issue-2823.rs
similarity index 100%
rename from src/test/ui/issue-2823.rs
rename to src/test/ui/issues/issue-2823.rs
diff --git a/src/test/ui/issue-2823.stderr b/src/test/ui/issues/issue-2823.stderr
similarity index 100%
rename from src/test/ui/issue-2823.stderr
rename to src/test/ui/issues/issue-2823.stderr
diff --git a/src/test/ui/issue-28324.rs b/src/test/ui/issues/issue-28324.rs
similarity index 100%
rename from src/test/ui/issue-28324.rs
rename to src/test/ui/issues/issue-28324.rs
diff --git a/src/test/ui/issue-28324.stderr b/src/test/ui/issues/issue-28324.stderr
similarity index 100%
rename from src/test/ui/issue-28324.stderr
rename to src/test/ui/issues/issue-28324.stderr
diff --git a/src/test/ui/issue-28344.rs b/src/test/ui/issues/issue-28344.rs
similarity index 100%
rename from src/test/ui/issue-28344.rs
rename to src/test/ui/issues/issue-28344.rs
diff --git a/src/test/ui/issue-28344.stderr b/src/test/ui/issues/issue-28344.stderr
similarity index 100%
rename from src/test/ui/issue-28344.stderr
rename to src/test/ui/issues/issue-28344.stderr
diff --git a/src/test/compile-fail/issue-28388-1.rs b/src/test/ui/issues/issue-28388-1.rs
similarity index 100%
rename from src/test/compile-fail/issue-28388-1.rs
rename to src/test/ui/issues/issue-28388-1.rs
diff --git a/src/test/ui/issues/issue-28388-1.stderr b/src/test/ui/issues/issue-28388-1.stderr
new file mode 100644
index 0000000..9f4b6cb
--- /dev/null
+++ b/src/test/ui/issues/issue-28388-1.stderr
@@ -0,0 +1,9 @@
+error[E0578]: cannot find module or enum `foo` in the crate root
+ --> $DIR/issue-28388-1.rs:13:5
+ |
+LL | use foo::{}; //~ ERROR cannot find module or enum `foo` in the crate root
+ | ^^^ not found in the crate root
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0578`.
diff --git a/src/test/compile-fail/issue-28388-2.rs b/src/test/ui/issues/issue-28388-2.rs
similarity index 100%
rename from src/test/compile-fail/issue-28388-2.rs
rename to src/test/ui/issues/issue-28388-2.rs
diff --git a/src/test/ui/issues/issue-28388-2.stderr b/src/test/ui/issues/issue-28388-2.stderr
new file mode 100644
index 0000000..7809934
--- /dev/null
+++ b/src/test/ui/issues/issue-28388-2.stderr
@@ -0,0 +1,9 @@
+error[E0603]: module `n` is private
+ --> $DIR/issue-28388-2.rs:17:5
+ |
+LL | use m::n::{};
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/issue-28388-3.rs b/src/test/ui/issues/issue-28388-3.rs
similarity index 100%
rename from src/test/compile-fail/issue-28388-3.rs
rename to src/test/ui/issues/issue-28388-3.rs
diff --git a/src/test/ui/issues/issue-28388-3.stderr b/src/test/ui/issues/issue-28388-3.stderr
new file mode 100644
index 0000000..653fdb5
--- /dev/null
+++ b/src/test/ui/issues/issue-28388-3.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/issue-28388-3.rs:17:5
+ |
+LL | use lint_stability::UnstableEnum::{};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issue-28433.rs b/src/test/ui/issues/issue-28433.rs
similarity index 100%
rename from src/test/ui/issue-28433.rs
rename to src/test/ui/issues/issue-28433.rs
diff --git a/src/test/ui/issue-28433.stderr b/src/test/ui/issues/issue-28433.stderr
similarity index 100%
rename from src/test/ui/issue-28433.stderr
rename to src/test/ui/issues/issue-28433.stderr
diff --git a/src/test/ui/issue-28472.rs b/src/test/ui/issues/issue-28472.rs
similarity index 100%
rename from src/test/ui/issue-28472.rs
rename to src/test/ui/issues/issue-28472.rs
diff --git a/src/test/ui/issue-28472.stderr b/src/test/ui/issues/issue-28472.stderr
similarity index 100%
rename from src/test/ui/issue-28472.stderr
rename to src/test/ui/issues/issue-28472.stderr
diff --git a/src/test/ui/issue-2848.rs b/src/test/ui/issues/issue-2848.rs
similarity index 100%
rename from src/test/ui/issue-2848.rs
rename to src/test/ui/issues/issue-2848.rs
diff --git a/src/test/ui/issue-2848.stderr b/src/test/ui/issues/issue-2848.stderr
similarity index 100%
rename from src/test/ui/issue-2848.stderr
rename to src/test/ui/issues/issue-2848.stderr
diff --git a/src/test/ui/issue-2849.rs b/src/test/ui/issues/issue-2849.rs
similarity index 100%
rename from src/test/ui/issue-2849.rs
rename to src/test/ui/issues/issue-2849.rs
diff --git a/src/test/ui/issue-2849.stderr b/src/test/ui/issues/issue-2849.stderr
similarity index 100%
rename from src/test/ui/issue-2849.stderr
rename to src/test/ui/issues/issue-2849.stderr
diff --git a/src/test/ui/issue-28568.rs b/src/test/ui/issues/issue-28568.rs
similarity index 100%
rename from src/test/ui/issue-28568.rs
rename to src/test/ui/issues/issue-28568.rs
diff --git a/src/test/ui/issue-28568.stderr b/src/test/ui/issues/issue-28568.stderr
similarity index 100%
rename from src/test/ui/issue-28568.stderr
rename to src/test/ui/issues/issue-28568.stderr
diff --git a/src/test/ui/issue-28576.rs b/src/test/ui/issues/issue-28576.rs
similarity index 100%
rename from src/test/ui/issue-28576.rs
rename to src/test/ui/issues/issue-28576.rs
diff --git a/src/test/ui/issue-28576.stderr b/src/test/ui/issues/issue-28576.stderr
similarity index 100%
rename from src/test/ui/issue-28576.stderr
rename to src/test/ui/issues/issue-28576.stderr
diff --git a/src/test/ui/issue-28586.rs b/src/test/ui/issues/issue-28586.rs
similarity index 100%
rename from src/test/ui/issue-28586.rs
rename to src/test/ui/issues/issue-28586.rs
diff --git a/src/test/ui/issue-28586.stderr b/src/test/ui/issues/issue-28586.stderr
similarity index 100%
rename from src/test/ui/issue-28586.stderr
rename to src/test/ui/issues/issue-28586.stderr
diff --git a/src/test/ui/issues/issue-28625.rs b/src/test/ui/issues/issue-28625.rs
new file mode 100644
index 0000000..273629a
--- /dev/null
+++ b/src/test/ui/issues/issue-28625.rs
@@ -0,0 +1,32 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// normalize-stderr-test "\d+ bits" -> "N bits"
+
+trait Bar {
+ type Bar;
+}
+
+struct ArrayPeano<T: Bar> {
+ data: T::Bar,
+}
+
+fn foo<T>(a: &ArrayPeano<T>) -> &[T] where T: Bar {
+ unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
+}
+
+impl Bar for () {
+ type Bar = ();
+}
+
+fn main() {
+ let x: ArrayPeano<()> = ArrayPeano { data: () };
+ foo(&x);
+}
diff --git a/src/test/ui/issues/issue-28625.stderr b/src/test/ui/issues/issue-28625.stderr
new file mode 100644
index 0000000..22f8db4
--- /dev/null
+++ b/src/test/ui/issues/issue-28625.stderr
@@ -0,0 +1,12 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/issue-28625.rs:22:14
+ |
+LL | unsafe { std::mem::transmute(a) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: source type: &ArrayPeano<T> (N bits)
+ = note: target type: &[T] (N bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/ui/issue-28776.rs b/src/test/ui/issues/issue-28776.rs
similarity index 100%
rename from src/test/ui/issue-28776.rs
rename to src/test/ui/issues/issue-28776.rs
diff --git a/src/test/ui/issue-28776.stderr b/src/test/ui/issues/issue-28776.stderr
similarity index 100%
rename from src/test/ui/issue-28776.stderr
rename to src/test/ui/issues/issue-28776.stderr
diff --git a/src/test/ui/issue-28837.rs b/src/test/ui/issues/issue-28837.rs
similarity index 100%
rename from src/test/ui/issue-28837.rs
rename to src/test/ui/issues/issue-28837.rs
diff --git a/src/test/ui/issue-28837.stderr b/src/test/ui/issues/issue-28837.stderr
similarity index 100%
rename from src/test/ui/issue-28837.stderr
rename to src/test/ui/issues/issue-28837.stderr
diff --git a/src/test/ui/issues/issue-28848.rs b/src/test/ui/issues/issue-28848.rs
new file mode 100644
index 0000000..c13fd5f
--- /dev/null
+++ b/src/test/ui/issues/issue-28848.rs
@@ -0,0 +1,25 @@
+// 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-compare-mode-nll
+
+struct Foo<'a, 'b: 'a>(&'a &'b ());
+
+impl<'a, 'b> Foo<'a, 'b> {
+ fn xmute(a: &'b ()) -> &'a () {
+ unreachable!()
+ }
+}
+
+pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
+ Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-28848.stderr b/src/test/ui/issues/issue-28848.stderr
new file mode 100644
index 0000000..dadcff2
--- /dev/null
+++ b/src/test/ui/issues/issue-28848.stderr
@@ -0,0 +1,20 @@
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/issue-28848.rs:22:5
+ |
+LL | Foo::<'a, 'b>::xmute(u) //~ ERROR lifetime bound not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime 'b as defined on the function body at 21:16
+ --> $DIR/issue-28848.rs:21:16
+ |
+LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
+ | ^^
+note: but lifetime parameter must outlive the lifetime 'a as defined on the function body at 21:12
+ --> $DIR/issue-28848.rs:21:12
+ |
+LL | pub fn foo<'a, 'b>(u: &'b ()) -> &'a () {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0478`.
diff --git a/src/test/ui/issue-28971.rs b/src/test/ui/issues/issue-28971.rs
similarity index 100%
rename from src/test/ui/issue-28971.rs
rename to src/test/ui/issues/issue-28971.rs
diff --git a/src/test/ui/issue-28971.stderr b/src/test/ui/issues/issue-28971.stderr
similarity index 100%
rename from src/test/ui/issue-28971.stderr
rename to src/test/ui/issues/issue-28971.stderr
diff --git a/src/test/ui/issue-28992-empty.rs b/src/test/ui/issues/issue-28992-empty.rs
similarity index 100%
rename from src/test/ui/issue-28992-empty.rs
rename to src/test/ui/issues/issue-28992-empty.rs
diff --git a/src/test/ui/issue-28992-empty.stderr b/src/test/ui/issues/issue-28992-empty.stderr
similarity index 100%
rename from src/test/ui/issue-28992-empty.stderr
rename to src/test/ui/issues/issue-28992-empty.stderr
diff --git a/src/test/ui/issue-29084.rs b/src/test/ui/issues/issue-29084.rs
similarity index 100%
rename from src/test/ui/issue-29084.rs
rename to src/test/ui/issues/issue-29084.rs
diff --git a/src/test/ui/issue-29084.stderr b/src/test/ui/issues/issue-29084.stderr
similarity index 100%
rename from src/test/ui/issue-29084.stderr
rename to src/test/ui/issues/issue-29084.stderr
diff --git a/src/test/ui/issue-29124.rs b/src/test/ui/issues/issue-29124.rs
similarity index 100%
rename from src/test/ui/issue-29124.rs
rename to src/test/ui/issues/issue-29124.rs
diff --git a/src/test/ui/issue-29124.stderr b/src/test/ui/issues/issue-29124.stderr
similarity index 100%
rename from src/test/ui/issue-29124.stderr
rename to src/test/ui/issues/issue-29124.stderr
diff --git a/src/test/ui/issue-29147.rs b/src/test/ui/issues/issue-29147.rs
similarity index 100%
rename from src/test/ui/issue-29147.rs
rename to src/test/ui/issues/issue-29147.rs
diff --git a/src/test/ui/issue-29147.stderr b/src/test/ui/issues/issue-29147.stderr
similarity index 100%
rename from src/test/ui/issue-29147.stderr
rename to src/test/ui/issues/issue-29147.stderr
diff --git a/src/test/ui/issue-29161.rs b/src/test/ui/issues/issue-29161.rs
similarity index 100%
rename from src/test/ui/issue-29161.rs
rename to src/test/ui/issues/issue-29161.rs
diff --git a/src/test/ui/issue-29161.stderr b/src/test/ui/issues/issue-29161.stderr
similarity index 100%
rename from src/test/ui/issue-29161.stderr
rename to src/test/ui/issues/issue-29161.stderr
diff --git a/src/test/compile-fail/issue-29181.rs b/src/test/ui/issues/issue-29181.rs
similarity index 100%
rename from src/test/compile-fail/issue-29181.rs
rename to src/test/ui/issues/issue-29181.rs
diff --git a/src/test/ui/issues/issue-29181.stderr b/src/test/ui/issues/issue-29181.stderr
new file mode 100644
index 0000000..5dda784
--- /dev/null
+++ b/src/test/ui/issues/issue-29181.stderr
@@ -0,0 +1,9 @@
+error[E0599]: no method named `homura` found for type `{integer}` in the current scope
+ --> $DIR/issue-29181.rs:16:7
+ |
+LL | 0.homura(); //~ ERROR no method named `homura` found
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issue-29184.rs b/src/test/ui/issues/issue-29184.rs
similarity index 100%
rename from src/test/ui/issue-29184.rs
rename to src/test/ui/issues/issue-29184.rs
diff --git a/src/test/ui/issue-29184.stderr b/src/test/ui/issues/issue-29184.stderr
similarity index 100%
rename from src/test/ui/issue-29184.stderr
rename to src/test/ui/issues/issue-29184.stderr
diff --git a/src/test/ui/issue-2937.rs b/src/test/ui/issues/issue-2937.rs
similarity index 100%
rename from src/test/ui/issue-2937.rs
rename to src/test/ui/issues/issue-2937.rs
diff --git a/src/test/ui/issue-2937.stderr b/src/test/ui/issues/issue-2937.stderr
similarity index 100%
rename from src/test/ui/issue-2937.stderr
rename to src/test/ui/issues/issue-2937.stderr
diff --git a/src/test/ui/issue-2951.rs b/src/test/ui/issues/issue-2951.rs
similarity index 100%
rename from src/test/ui/issue-2951.rs
rename to src/test/ui/issues/issue-2951.rs
diff --git a/src/test/ui/issue-2951.stderr b/src/test/ui/issues/issue-2951.stderr
similarity index 100%
rename from src/test/ui/issue-2951.stderr
rename to src/test/ui/issues/issue-2951.stderr
diff --git a/src/test/ui/issue-29723.rs b/src/test/ui/issues/issue-29723.rs
similarity index 100%
rename from src/test/ui/issue-29723.rs
rename to src/test/ui/issues/issue-29723.rs
diff --git a/src/test/ui/issue-29723.stderr b/src/test/ui/issues/issue-29723.stderr
similarity index 100%
rename from src/test/ui/issue-29723.stderr
rename to src/test/ui/issues/issue-29723.stderr
diff --git a/src/test/ui/issue-29857.rs b/src/test/ui/issues/issue-29857.rs
similarity index 100%
rename from src/test/ui/issue-29857.rs
rename to src/test/ui/issues/issue-29857.rs
diff --git a/src/test/ui/issue-29857.stderr b/src/test/ui/issues/issue-29857.stderr
similarity index 100%
rename from src/test/ui/issue-29857.stderr
rename to src/test/ui/issues/issue-29857.stderr
diff --git a/src/test/ui/issue-29861.rs b/src/test/ui/issues/issue-29861.rs
similarity index 100%
rename from src/test/ui/issue-29861.rs
rename to src/test/ui/issues/issue-29861.rs
diff --git a/src/test/ui/issue-29861.stderr b/src/test/ui/issues/issue-29861.stderr
similarity index 100%
rename from src/test/ui/issue-29861.stderr
rename to src/test/ui/issues/issue-29861.stderr
diff --git a/src/test/ui/issue-2995.rs b/src/test/ui/issues/issue-2995.rs
similarity index 100%
rename from src/test/ui/issue-2995.rs
rename to src/test/ui/issues/issue-2995.rs
diff --git a/src/test/ui/issue-2995.stderr b/src/test/ui/issues/issue-2995.stderr
similarity index 100%
rename from src/test/ui/issue-2995.stderr
rename to src/test/ui/issues/issue-2995.stderr
diff --git a/src/test/ui/issue-30007.rs b/src/test/ui/issues/issue-30007.rs
similarity index 100%
rename from src/test/ui/issue-30007.rs
rename to src/test/ui/issues/issue-30007.rs
diff --git a/src/test/ui/issue-30007.stderr b/src/test/ui/issues/issue-30007.stderr
similarity index 100%
rename from src/test/ui/issue-30007.stderr
rename to src/test/ui/issues/issue-30007.stderr
diff --git a/src/test/ui/issue-30079.rs b/src/test/ui/issues/issue-30079.rs
similarity index 100%
rename from src/test/ui/issue-30079.rs
rename to src/test/ui/issues/issue-30079.rs
diff --git a/src/test/ui/issue-30079.stderr b/src/test/ui/issues/issue-30079.stderr
similarity index 100%
rename from src/test/ui/issue-30079.stderr
rename to src/test/ui/issues/issue-30079.stderr
diff --git a/src/test/ui/issue-3008-1.rs b/src/test/ui/issues/issue-3008-1.rs
similarity index 100%
rename from src/test/ui/issue-3008-1.rs
rename to src/test/ui/issues/issue-3008-1.rs
diff --git a/src/test/ui/issue-3008-1.stderr b/src/test/ui/issues/issue-3008-1.stderr
similarity index 100%
rename from src/test/ui/issue-3008-1.stderr
rename to src/test/ui/issues/issue-3008-1.stderr
diff --git a/src/test/ui/issue-3008-2.rs b/src/test/ui/issues/issue-3008-2.rs
similarity index 100%
rename from src/test/ui/issue-3008-2.rs
rename to src/test/ui/issues/issue-3008-2.rs
diff --git a/src/test/ui/issue-3008-2.stderr b/src/test/ui/issues/issue-3008-2.stderr
similarity index 100%
rename from src/test/ui/issue-3008-2.stderr
rename to src/test/ui/issues/issue-3008-2.stderr
diff --git a/src/test/ui/issue-3008-3.rs b/src/test/ui/issues/issue-3008-3.rs
similarity index 100%
rename from src/test/ui/issue-3008-3.rs
rename to src/test/ui/issues/issue-3008-3.rs
diff --git a/src/test/ui/issue-3008-3.stderr b/src/test/ui/issues/issue-3008-3.stderr
similarity index 100%
rename from src/test/ui/issue-3008-3.stderr
rename to src/test/ui/issues/issue-3008-3.stderr
diff --git a/src/test/compile-fail/issue-30123.rs b/src/test/ui/issues/issue-30123.rs
similarity index 100%
rename from src/test/compile-fail/issue-30123.rs
rename to src/test/ui/issues/issue-30123.rs
diff --git a/src/test/ui/issues/issue-30123.stderr b/src/test/ui/issues/issue-30123.stderr
new file mode 100644
index 0000000..094c962
--- /dev/null
+++ b/src/test/ui/issues/issue-30123.stderr
@@ -0,0 +1,9 @@
+error[E0599]: no function or associated item named `new_undirected` found for type `issue_30123_aux::Graph<i32, i32>` in the current scope
+ --> $DIR/issue-30123.rs:17:14
+ |
+LL | let ug = Graph::<i32, i32>::new_undirected();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `issue_30123_aux::Graph<i32, i32>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issue-3021-b.rs b/src/test/ui/issues/issue-3021-b.rs
similarity index 100%
rename from src/test/ui/issue-3021-b.rs
rename to src/test/ui/issues/issue-3021-b.rs
diff --git a/src/test/ui/issue-3021-b.stderr b/src/test/ui/issues/issue-3021-b.stderr
similarity index 100%
rename from src/test/ui/issue-3021-b.stderr
rename to src/test/ui/issues/issue-3021-b.stderr
diff --git a/src/test/ui/issue-3021-c.rs b/src/test/ui/issues/issue-3021-c.rs
similarity index 100%
rename from src/test/ui/issue-3021-c.rs
rename to src/test/ui/issues/issue-3021-c.rs
diff --git a/src/test/ui/issue-3021-c.stderr b/src/test/ui/issues/issue-3021-c.stderr
similarity index 100%
rename from src/test/ui/issue-3021-c.stderr
rename to src/test/ui/issues/issue-3021-c.stderr
diff --git a/src/test/ui/issue-3021-d.rs b/src/test/ui/issues/issue-3021-d.rs
similarity index 100%
rename from src/test/ui/issue-3021-d.rs
rename to src/test/ui/issues/issue-3021-d.rs
diff --git a/src/test/ui/issue-3021-d.stderr b/src/test/ui/issues/issue-3021-d.stderr
similarity index 100%
rename from src/test/ui/issue-3021-d.stderr
rename to src/test/ui/issues/issue-3021-d.stderr
diff --git a/src/test/ui/issue-3021.rs b/src/test/ui/issues/issue-3021.rs
similarity index 100%
rename from src/test/ui/issue-3021.rs
rename to src/test/ui/issues/issue-3021.rs
diff --git a/src/test/ui/issue-3021.stderr b/src/test/ui/issues/issue-3021.stderr
similarity index 100%
rename from src/test/ui/issue-3021.stderr
rename to src/test/ui/issues/issue-3021.stderr
diff --git a/src/test/ui/issue-30225.rs b/src/test/ui/issues/issue-30225.rs
similarity index 100%
rename from src/test/ui/issue-30225.rs
rename to src/test/ui/issues/issue-30225.rs
diff --git a/src/test/ui/issue-30225.stderr b/src/test/ui/issues/issue-30225.stderr
similarity index 100%
rename from src/test/ui/issue-30225.stderr
rename to src/test/ui/issues/issue-30225.stderr
diff --git a/src/test/ui/issue-30236.rs b/src/test/ui/issues/issue-30236.rs
similarity index 100%
rename from src/test/ui/issue-30236.rs
rename to src/test/ui/issues/issue-30236.rs
diff --git a/src/test/ui/issue-30236.stderr b/src/test/ui/issues/issue-30236.stderr
similarity index 100%
rename from src/test/ui/issue-30236.stderr
rename to src/test/ui/issues/issue-30236.stderr
diff --git a/src/test/ui/issue-30240-b.rs b/src/test/ui/issues/issue-30240-b.rs
similarity index 100%
rename from src/test/ui/issue-30240-b.rs
rename to src/test/ui/issues/issue-30240-b.rs
diff --git a/src/test/ui/issue-30240-b.stderr b/src/test/ui/issues/issue-30240-b.stderr
similarity index 100%
rename from src/test/ui/issue-30240-b.stderr
rename to src/test/ui/issues/issue-30240-b.stderr
diff --git a/src/test/ui/issue-30240.rs b/src/test/ui/issues/issue-30240.rs
similarity index 100%
rename from src/test/ui/issue-30240.rs
rename to src/test/ui/issues/issue-30240.rs
diff --git a/src/test/ui/issue-30240.stderr b/src/test/ui/issues/issue-30240.stderr
similarity index 100%
rename from src/test/ui/issue-30240.stderr
rename to src/test/ui/issues/issue-30240.stderr
diff --git a/src/test/ui/issue-30255.rs b/src/test/ui/issues/issue-30255.rs
similarity index 100%
rename from src/test/ui/issue-30255.rs
rename to src/test/ui/issues/issue-30255.rs
diff --git a/src/test/ui/issue-30255.stderr b/src/test/ui/issues/issue-30255.stderr
similarity index 100%
rename from src/test/ui/issue-30255.stderr
rename to src/test/ui/issues/issue-30255.stderr
diff --git a/src/test/ui/issue-30302.rs b/src/test/ui/issues/issue-30302.rs
similarity index 100%
rename from src/test/ui/issue-30302.rs
rename to src/test/ui/issues/issue-30302.rs
diff --git a/src/test/ui/issue-30302.stderr b/src/test/ui/issues/issue-30302.stderr
similarity index 100%
rename from src/test/ui/issue-30302.stderr
rename to src/test/ui/issues/issue-30302.stderr
diff --git a/src/test/ui/issue-30355.nll.stderr b/src/test/ui/issues/issue-30355.nll.stderr
similarity index 100%
rename from src/test/ui/issue-30355.nll.stderr
rename to src/test/ui/issues/issue-30355.nll.stderr
diff --git a/src/test/ui/issue-30355.rs b/src/test/ui/issues/issue-30355.rs
similarity index 100%
rename from src/test/ui/issue-30355.rs
rename to src/test/ui/issues/issue-30355.rs
diff --git a/src/test/ui/issue-30355.stderr b/src/test/ui/issues/issue-30355.stderr
similarity index 100%
rename from src/test/ui/issue-30355.stderr
rename to src/test/ui/issues/issue-30355.stderr
diff --git a/src/test/ui/issue-3038.rs b/src/test/ui/issues/issue-3038.rs
similarity index 100%
rename from src/test/ui/issue-3038.rs
rename to src/test/ui/issues/issue-3038.rs
diff --git a/src/test/ui/issue-3038.stderr b/src/test/ui/issues/issue-3038.stderr
similarity index 100%
rename from src/test/ui/issue-3038.stderr
rename to src/test/ui/issues/issue-3038.stderr
diff --git a/src/test/ui/issue-30438-a.nll.stderr b/src/test/ui/issues/issue-30438-a.nll.stderr
similarity index 100%
rename from src/test/ui/issue-30438-a.nll.stderr
rename to src/test/ui/issues/issue-30438-a.nll.stderr
diff --git a/src/test/ui/issue-30438-a.rs b/src/test/ui/issues/issue-30438-a.rs
similarity index 100%
rename from src/test/ui/issue-30438-a.rs
rename to src/test/ui/issues/issue-30438-a.rs
diff --git a/src/test/ui/issue-30438-a.stderr b/src/test/ui/issues/issue-30438-a.stderr
similarity index 100%
rename from src/test/ui/issue-30438-a.stderr
rename to src/test/ui/issues/issue-30438-a.stderr
diff --git a/src/test/ui/issue-30438-b.rs b/src/test/ui/issues/issue-30438-b.rs
similarity index 100%
rename from src/test/ui/issue-30438-b.rs
rename to src/test/ui/issues/issue-30438-b.rs
diff --git a/src/test/ui/issue-30438-b.stderr b/src/test/ui/issues/issue-30438-b.stderr
similarity index 100%
rename from src/test/ui/issue-30438-b.stderr
rename to src/test/ui/issues/issue-30438-b.stderr
diff --git a/src/test/ui/issue-30438-c.nll.stderr b/src/test/ui/issues/issue-30438-c.nll.stderr
similarity index 100%
rename from src/test/ui/issue-30438-c.nll.stderr
rename to src/test/ui/issues/issue-30438-c.nll.stderr
diff --git a/src/test/ui/issue-30438-c.rs b/src/test/ui/issues/issue-30438-c.rs
similarity index 100%
rename from src/test/ui/issue-30438-c.rs
rename to src/test/ui/issues/issue-30438-c.rs
diff --git a/src/test/ui/issue-30438-c.stderr b/src/test/ui/issues/issue-30438-c.stderr
similarity index 100%
rename from src/test/ui/issue-30438-c.stderr
rename to src/test/ui/issues/issue-30438-c.stderr
diff --git a/src/test/ui/issue-3044.rs b/src/test/ui/issues/issue-3044.rs
similarity index 100%
rename from src/test/ui/issue-3044.rs
rename to src/test/ui/issues/issue-3044.rs
diff --git a/src/test/ui/issue-3044.stderr b/src/test/ui/issues/issue-3044.stderr
similarity index 100%
rename from src/test/ui/issue-3044.stderr
rename to src/test/ui/issues/issue-3044.stderr
diff --git a/src/test/compile-fail/issue-30535.rs b/src/test/ui/issues/issue-30535.rs
similarity index 100%
rename from src/test/compile-fail/issue-30535.rs
rename to src/test/ui/issues/issue-30535.rs
diff --git a/src/test/ui/issues/issue-30535.stderr b/src/test/ui/issues/issue-30535.stderr
new file mode 100644
index 0000000..c3838fd
--- /dev/null
+++ b/src/test/ui/issues/issue-30535.stderr
@@ -0,0 +1,11 @@
+error[E0573]: expected type, found variant `foo::Foo::FooV`
+ --> $DIR/issue-30535.rs:16:8
+ |
+LL | _: foo::Foo::FooV //~ ERROR expected type, found variant `foo::Foo::FooV`
+ | ^^^^^^^^^^^^^^ not a type
+ |
+ = help: there is an enum variant `foo::Foo::FooV`, try using `foo::Foo`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0573`.
diff --git a/src/test/ui/issue-30560.rs b/src/test/ui/issues/issue-30560.rs
similarity index 100%
rename from src/test/ui/issue-30560.rs
rename to src/test/ui/issues/issue-30560.rs
diff --git a/src/test/ui/issue-30560.stderr b/src/test/ui/issues/issue-30560.stderr
similarity index 100%
rename from src/test/ui/issue-30560.stderr
rename to src/test/ui/issues/issue-30560.stderr
diff --git a/src/test/ui/issue-30589.rs b/src/test/ui/issues/issue-30589.rs
similarity index 100%
rename from src/test/ui/issue-30589.rs
rename to src/test/ui/issues/issue-30589.rs
diff --git a/src/test/ui/issue-30589.stderr b/src/test/ui/issues/issue-30589.stderr
similarity index 100%
rename from src/test/ui/issue-30589.stderr
rename to src/test/ui/issues/issue-30589.stderr
diff --git a/src/test/ui/issue-30730.rs b/src/test/ui/issues/issue-30730.rs
similarity index 100%
rename from src/test/ui/issue-30730.rs
rename to src/test/ui/issues/issue-30730.rs
diff --git a/src/test/ui/issue-30730.stderr b/src/test/ui/issues/issue-30730.stderr
similarity index 100%
rename from src/test/ui/issue-30730.stderr
rename to src/test/ui/issues/issue-30730.stderr
diff --git a/src/test/ui/issue-3080.rs b/src/test/ui/issues/issue-3080.rs
similarity index 100%
rename from src/test/ui/issue-3080.rs
rename to src/test/ui/issues/issue-3080.rs
diff --git a/src/test/ui/issue-3080.stderr b/src/test/ui/issues/issue-3080.stderr
similarity index 100%
rename from src/test/ui/issue-3080.stderr
rename to src/test/ui/issues/issue-3080.stderr
diff --git a/src/test/ui/issue-3096-1.rs b/src/test/ui/issues/issue-3096-1.rs
similarity index 100%
rename from src/test/ui/issue-3096-1.rs
rename to src/test/ui/issues/issue-3096-1.rs
diff --git a/src/test/ui/issue-3096-1.stderr b/src/test/ui/issues/issue-3096-1.stderr
similarity index 100%
rename from src/test/ui/issue-3096-1.stderr
rename to src/test/ui/issues/issue-3096-1.stderr
diff --git a/src/test/ui/issue-3096-2.rs b/src/test/ui/issues/issue-3096-2.rs
similarity index 100%
rename from src/test/ui/issue-3096-2.rs
rename to src/test/ui/issues/issue-3096-2.rs
diff --git a/src/test/ui/issue-3096-2.stderr b/src/test/ui/issues/issue-3096-2.stderr
similarity index 100%
rename from src/test/ui/issue-3096-2.stderr
rename to src/test/ui/issues/issue-3096-2.stderr
diff --git a/src/test/ui/issue-3099-a.rs b/src/test/ui/issues/issue-3099-a.rs
similarity index 100%
rename from src/test/ui/issue-3099-a.rs
rename to src/test/ui/issues/issue-3099-a.rs
diff --git a/src/test/ui/issue-3099-a.stderr b/src/test/ui/issues/issue-3099-a.stderr
similarity index 100%
rename from src/test/ui/issue-3099-a.stderr
rename to src/test/ui/issues/issue-3099-a.stderr
diff --git a/src/test/ui/issue-3099-b.rs b/src/test/ui/issues/issue-3099-b.rs
similarity index 100%
rename from src/test/ui/issue-3099-b.rs
rename to src/test/ui/issues/issue-3099-b.rs
diff --git a/src/test/ui/issue-3099-b.stderr b/src/test/ui/issues/issue-3099-b.stderr
similarity index 100%
rename from src/test/ui/issue-3099-b.stderr
rename to src/test/ui/issues/issue-3099-b.stderr
diff --git a/src/test/ui/issue-3099.rs b/src/test/ui/issues/issue-3099.rs
similarity index 100%
rename from src/test/ui/issue-3099.rs
rename to src/test/ui/issues/issue-3099.rs
diff --git a/src/test/ui/issue-3099.stderr b/src/test/ui/issues/issue-3099.stderr
similarity index 100%
rename from src/test/ui/issue-3099.stderr
rename to src/test/ui/issues/issue-3099.stderr
diff --git a/src/test/ui/issue-31011.rs b/src/test/ui/issues/issue-31011.rs
similarity index 100%
rename from src/test/ui/issue-31011.rs
rename to src/test/ui/issues/issue-31011.rs
diff --git a/src/test/ui/issue-31011.stderr b/src/test/ui/issues/issue-31011.stderr
similarity index 100%
rename from src/test/ui/issue-31011.stderr
rename to src/test/ui/issues/issue-31011.stderr
diff --git a/src/test/ui/issue-31109.rs b/src/test/ui/issues/issue-31109.rs
similarity index 100%
rename from src/test/ui/issue-31109.rs
rename to src/test/ui/issues/issue-31109.rs
diff --git a/src/test/ui/issue-31109.stderr b/src/test/ui/issues/issue-31109.stderr
similarity index 100%
rename from src/test/ui/issue-31109.stderr
rename to src/test/ui/issues/issue-31109.stderr
diff --git a/src/test/ui/issue-31173.rs b/src/test/ui/issues/issue-31173.rs
similarity index 100%
rename from src/test/ui/issue-31173.rs
rename to src/test/ui/issues/issue-31173.rs
diff --git a/src/test/ui/issue-31173.stderr b/src/test/ui/issues/issue-31173.stderr
similarity index 100%
rename from src/test/ui/issue-31173.stderr
rename to src/test/ui/issues/issue-31173.stderr
diff --git a/src/test/ui/issue-31212.rs b/src/test/ui/issues/issue-31212.rs
similarity index 100%
rename from src/test/ui/issue-31212.rs
rename to src/test/ui/issues/issue-31212.rs
diff --git a/src/test/ui/issue-31212.stderr b/src/test/ui/issues/issue-31212.stderr
similarity index 100%
rename from src/test/ui/issue-31212.stderr
rename to src/test/ui/issues/issue-31212.stderr
diff --git a/src/test/ui/issue-31221.rs b/src/test/ui/issues/issue-31221.rs
similarity index 100%
rename from src/test/ui/issue-31221.rs
rename to src/test/ui/issues/issue-31221.rs
diff --git a/src/test/ui/issue-31221.stderr b/src/test/ui/issues/issue-31221.stderr
similarity index 100%
rename from src/test/ui/issue-31221.stderr
rename to src/test/ui/issues/issue-31221.stderr
diff --git a/src/test/ui/issue-31495.rs b/src/test/ui/issues/issue-31495.rs
similarity index 100%
rename from src/test/ui/issue-31495.rs
rename to src/test/ui/issues/issue-31495.rs
diff --git a/src/test/ui/issue-31511.rs b/src/test/ui/issues/issue-31511.rs
similarity index 100%
rename from src/test/ui/issue-31511.rs
rename to src/test/ui/issues/issue-31511.rs
diff --git a/src/test/ui/issue-31511.stderr b/src/test/ui/issues/issue-31511.stderr
similarity index 100%
rename from src/test/ui/issue-31511.stderr
rename to src/test/ui/issues/issue-31511.stderr
diff --git a/src/test/ui/issues/issue-3154.nll.stderr b/src/test/ui/issues/issue-3154.nll.stderr
new file mode 100644
index 0000000..3cd7ce8
--- /dev/null
+++ b/src/test/ui/issues/issue-3154.nll.stderr
@@ -0,0 +1,23 @@
+warning: not reporting region error due to nll
+ --> $DIR/issue-3154.rs:16:15
+ |
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/issue-3154.rs:16:5
+ |
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^^^^^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/issue-3154.rs:16:5
+ |
+LL | fn thing<'a,Q>(x: &Q) -> thing<'a,Q> {
+ | -- help: add explicit lifetime `'a` to the type of `x`: `&'a Q`
+LL | thing{ x: x } //~ ERROR 16:5: 16:18: explicit lifetime required in the type of `x` [E0621]
+ | ^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/issue-3154.rs b/src/test/ui/issues/issue-3154.rs
similarity index 100%
rename from src/test/ui/issue-3154.rs
rename to src/test/ui/issues/issue-3154.rs
diff --git a/src/test/ui/issue-3154.stderr b/src/test/ui/issues/issue-3154.stderr
similarity index 100%
rename from src/test/ui/issue-3154.stderr
rename to src/test/ui/issues/issue-3154.stderr
diff --git a/src/test/ui/issue-31561.rs b/src/test/ui/issues/issue-31561.rs
similarity index 100%
rename from src/test/ui/issue-31561.rs
rename to src/test/ui/issues/issue-31561.rs
diff --git a/src/test/ui/issue-31561.stderr b/src/test/ui/issues/issue-31561.stderr
similarity index 100%
rename from src/test/ui/issue-31561.stderr
rename to src/test/ui/issues/issue-31561.stderr
diff --git a/src/test/ui/issue-31769.rs b/src/test/ui/issues/issue-31769.rs
similarity index 100%
rename from src/test/ui/issue-31769.rs
rename to src/test/ui/issues/issue-31769.rs
diff --git a/src/test/ui/issue-31769.stderr b/src/test/ui/issues/issue-31769.stderr
similarity index 100%
rename from src/test/ui/issue-31769.stderr
rename to src/test/ui/issues/issue-31769.stderr
diff --git a/src/test/ui/issue-31804.rs b/src/test/ui/issues/issue-31804.rs
similarity index 100%
rename from src/test/ui/issue-31804.rs
rename to src/test/ui/issues/issue-31804.rs
diff --git a/src/test/ui/issue-31804.stderr b/src/test/ui/issues/issue-31804.stderr
similarity index 100%
rename from src/test/ui/issue-31804.stderr
rename to src/test/ui/issues/issue-31804.stderr
diff --git a/src/test/ui/issue-31845.rs b/src/test/ui/issues/issue-31845.rs
similarity index 100%
rename from src/test/ui/issue-31845.rs
rename to src/test/ui/issues/issue-31845.rs
diff --git a/src/test/ui/issue-31845.stderr b/src/test/ui/issues/issue-31845.stderr
similarity index 100%
rename from src/test/ui/issue-31845.stderr
rename to src/test/ui/issues/issue-31845.stderr
diff --git a/src/test/ui/issue-31910.rs b/src/test/ui/issues/issue-31910.rs
similarity index 100%
rename from src/test/ui/issue-31910.rs
rename to src/test/ui/issues/issue-31910.rs
diff --git a/src/test/ui/issue-31910.stderr b/src/test/ui/issues/issue-31910.stderr
similarity index 100%
rename from src/test/ui/issue-31910.stderr
rename to src/test/ui/issues/issue-31910.stderr
diff --git a/src/test/ui/issue-31924-non-snake-ffi.rs b/src/test/ui/issues/issue-31924-non-snake-ffi.rs
similarity index 100%
rename from src/test/ui/issue-31924-non-snake-ffi.rs
rename to src/test/ui/issues/issue-31924-non-snake-ffi.rs
diff --git a/src/test/ui/issue-31924-non-snake-ffi.stderr b/src/test/ui/issues/issue-31924-non-snake-ffi.stderr
similarity index 100%
rename from src/test/ui/issue-31924-non-snake-ffi.stderr
rename to src/test/ui/issues/issue-31924-non-snake-ffi.stderr
diff --git a/src/test/ui/issue-32004.rs b/src/test/ui/issues/issue-32004.rs
similarity index 100%
rename from src/test/ui/issue-32004.rs
rename to src/test/ui/issues/issue-32004.rs
diff --git a/src/test/ui/issue-32004.stderr b/src/test/ui/issues/issue-32004.stderr
similarity index 100%
rename from src/test/ui/issue-32004.stderr
rename to src/test/ui/issues/issue-32004.stderr
diff --git a/src/test/ui/issue-32086.rs b/src/test/ui/issues/issue-32086.rs
similarity index 100%
rename from src/test/ui/issue-32086.rs
rename to src/test/ui/issues/issue-32086.rs
diff --git a/src/test/ui/issue-32086.stderr b/src/test/ui/issues/issue-32086.stderr
similarity index 100%
rename from src/test/ui/issue-32086.stderr
rename to src/test/ui/issues/issue-32086.stderr
diff --git a/src/test/ui/issue-32119.rs b/src/test/ui/issues/issue-32119.rs
similarity index 100%
rename from src/test/ui/issue-32119.rs
rename to src/test/ui/issues/issue-32119.rs
diff --git a/src/test/ui/issue-32119.stderr b/src/test/ui/issues/issue-32119.stderr
similarity index 100%
rename from src/test/ui/issue-32119.stderr
rename to src/test/ui/issues/issue-32119.stderr
diff --git a/src/test/ui/issue-3214.rs b/src/test/ui/issues/issue-3214.rs
similarity index 100%
rename from src/test/ui/issue-3214.rs
rename to src/test/ui/issues/issue-3214.rs
diff --git a/src/test/ui/issue-3214.stderr b/src/test/ui/issues/issue-3214.stderr
similarity index 100%
rename from src/test/ui/issue-3214.stderr
rename to src/test/ui/issues/issue-3214.stderr
diff --git a/src/test/ui/issue-32201.rs b/src/test/ui/issues/issue-32201.rs
similarity index 100%
rename from src/test/ui/issue-32201.rs
rename to src/test/ui/issues/issue-32201.rs
diff --git a/src/test/ui/issue-32201.stderr b/src/test/ui/issues/issue-32201.stderr
similarity index 100%
rename from src/test/ui/issue-32201.stderr
rename to src/test/ui/issues/issue-32201.stderr
diff --git a/src/test/ui/issue-32222.rs b/src/test/ui/issues/issue-32222.rs
similarity index 100%
rename from src/test/ui/issue-32222.rs
rename to src/test/ui/issues/issue-32222.rs
diff --git a/src/test/ui/issue-32222.stderr b/src/test/ui/issues/issue-32222.stderr
similarity index 100%
rename from src/test/ui/issue-32222.stderr
rename to src/test/ui/issues/issue-32222.stderr
diff --git a/src/test/ui/issue-32323.rs b/src/test/ui/issues/issue-32323.rs
similarity index 100%
rename from src/test/ui/issue-32323.rs
rename to src/test/ui/issues/issue-32323.rs
diff --git a/src/test/ui/issue-32323.stderr b/src/test/ui/issues/issue-32323.stderr
similarity index 100%
rename from src/test/ui/issue-32323.stderr
rename to src/test/ui/issues/issue-32323.stderr
diff --git a/src/test/ui/issue-32326.rs b/src/test/ui/issues/issue-32326.rs
similarity index 100%
rename from src/test/ui/issue-32326.rs
rename to src/test/ui/issues/issue-32326.rs
diff --git a/src/test/ui/issue-32326.stderr b/src/test/ui/issues/issue-32326.stderr
similarity index 100%
rename from src/test/ui/issue-32326.stderr
rename to src/test/ui/issues/issue-32326.stderr
diff --git a/src/test/ui/issue-32354-suggest-import-rename.fixed b/src/test/ui/issues/issue-32354-suggest-import-rename.fixed
similarity index 100%
rename from src/test/ui/issue-32354-suggest-import-rename.fixed
rename to src/test/ui/issues/issue-32354-suggest-import-rename.fixed
diff --git a/src/test/ui/issue-32354-suggest-import-rename.rs b/src/test/ui/issues/issue-32354-suggest-import-rename.rs
similarity index 100%
rename from src/test/ui/issue-32354-suggest-import-rename.rs
rename to src/test/ui/issues/issue-32354-suggest-import-rename.rs
diff --git a/src/test/ui/issue-32354-suggest-import-rename.stderr b/src/test/ui/issues/issue-32354-suggest-import-rename.stderr
similarity index 100%
rename from src/test/ui/issue-32354-suggest-import-rename.stderr
rename to src/test/ui/issues/issue-32354-suggest-import-rename.stderr
diff --git a/src/test/ui/issues/issue-32377.rs b/src/test/ui/issues/issue-32377.rs
new file mode 100644
index 0000000..425dcc6
--- /dev/null
+++ b/src/test/ui/issues/issue-32377.rs
@@ -0,0 +1,29 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// normalize-stderr-test "\d+ bits" -> "N bits"
+
+use std::mem;
+use std::marker::PhantomData;
+
+trait Foo {
+ type Error;
+}
+
+struct Bar<U: Foo> {
+ stream: PhantomData<U::Error>,
+}
+
+fn foo<U: Foo>(x: [usize; 2]) -> Bar<U> {
+ unsafe { mem::transmute(x) }
+ //~^ ERROR transmute called with types of different sizes
+}
+
+fn main() {}
diff --git a/src/test/ui/issues/issue-32377.stderr b/src/test/ui/issues/issue-32377.stderr
new file mode 100644
index 0000000..7168a00
--- /dev/null
+++ b/src/test/ui/issues/issue-32377.stderr
@@ -0,0 +1,12 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/issue-32377.rs:25:14
+ |
+LL | unsafe { mem::transmute(x) }
+ | ^^^^^^^^^^^^^^
+ |
+ = note: source type: [usize; 2] (N bits)
+ = note: target type: Bar<U> (N bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/ui/issue-32655.rs b/src/test/ui/issues/issue-32655.rs
similarity index 100%
rename from src/test/ui/issue-32655.rs
rename to src/test/ui/issues/issue-32655.rs
diff --git a/src/test/ui/issue-32655.stderr b/src/test/ui/issues/issue-32655.stderr
similarity index 100%
rename from src/test/ui/issue-32655.stderr
rename to src/test/ui/issues/issue-32655.stderr
diff --git a/src/test/ui/issue-32709.rs b/src/test/ui/issues/issue-32709.rs
similarity index 100%
rename from src/test/ui/issue-32709.rs
rename to src/test/ui/issues/issue-32709.rs
diff --git a/src/test/ui/issue-32709.stderr b/src/test/ui/issues/issue-32709.stderr
similarity index 100%
rename from src/test/ui/issue-32709.stderr
rename to src/test/ui/issues/issue-32709.stderr
diff --git a/src/test/ui/issue-32782.rs b/src/test/ui/issues/issue-32782.rs
similarity index 100%
rename from src/test/ui/issue-32782.rs
rename to src/test/ui/issues/issue-32782.rs
diff --git a/src/test/ui/issue-32782.stderr b/src/test/ui/issues/issue-32782.stderr
similarity index 100%
rename from src/test/ui/issue-32782.stderr
rename to src/test/ui/issues/issue-32782.stderr
diff --git a/src/test/ui/issue-32797.rs b/src/test/ui/issues/issue-32797.rs
similarity index 100%
rename from src/test/ui/issue-32797.rs
rename to src/test/ui/issues/issue-32797.rs
diff --git a/src/test/ui/issue-32797.stderr b/src/test/ui/issues/issue-32797.stderr
similarity index 100%
rename from src/test/ui/issue-32797.stderr
rename to src/test/ui/issues/issue-32797.stderr
diff --git a/src/test/ui/issue-32829.rs b/src/test/ui/issues/issue-32829.rs
similarity index 100%
rename from src/test/ui/issue-32829.rs
rename to src/test/ui/issues/issue-32829.rs
diff --git a/src/test/ui/issue-32829.stderr b/src/test/ui/issues/issue-32829.stderr
similarity index 100%
rename from src/test/ui/issue-32829.stderr
rename to src/test/ui/issues/issue-32829.stderr
diff --git a/src/test/ui/issue-32833.rs b/src/test/ui/issues/issue-32833.rs
similarity index 100%
rename from src/test/ui/issue-32833.rs
rename to src/test/ui/issues/issue-32833.rs
diff --git a/src/test/ui/issue-32833.stderr b/src/test/ui/issues/issue-32833.stderr
similarity index 100%
rename from src/test/ui/issue-32833.stderr
rename to src/test/ui/issues/issue-32833.stderr
diff --git a/src/test/ui/issue-32922.rs b/src/test/ui/issues/issue-32922.rs
similarity index 100%
rename from src/test/ui/issue-32922.rs
rename to src/test/ui/issues/issue-32922.rs
diff --git a/src/test/ui/issue-32922.stderr b/src/test/ui/issues/issue-32922.stderr
similarity index 100%
rename from src/test/ui/issue-32922.stderr
rename to src/test/ui/issues/issue-32922.stderr
diff --git a/src/test/ui/issue-32950.rs b/src/test/ui/issues/issue-32950.rs
similarity index 100%
rename from src/test/ui/issue-32950.rs
rename to src/test/ui/issues/issue-32950.rs
diff --git a/src/test/ui/issue-32950.stderr b/src/test/ui/issues/issue-32950.stderr
similarity index 100%
rename from src/test/ui/issue-32950.stderr
rename to src/test/ui/issues/issue-32950.stderr
diff --git a/src/test/ui/issue-32963.rs b/src/test/ui/issues/issue-32963.rs
similarity index 100%
rename from src/test/ui/issue-32963.rs
rename to src/test/ui/issues/issue-32963.rs
diff --git a/src/test/ui/issue-32963.stderr b/src/test/ui/issues/issue-32963.stderr
similarity index 100%
rename from src/test/ui/issue-32963.stderr
rename to src/test/ui/issues/issue-32963.stderr
diff --git a/src/test/ui/issue-32995-2.rs b/src/test/ui/issues/issue-32995-2.rs
similarity index 100%
rename from src/test/ui/issue-32995-2.rs
rename to src/test/ui/issues/issue-32995-2.rs
diff --git a/src/test/ui/issue-32995-2.stderr b/src/test/ui/issues/issue-32995-2.stderr
similarity index 100%
rename from src/test/ui/issue-32995-2.stderr
rename to src/test/ui/issues/issue-32995-2.stderr
diff --git a/src/test/ui/issue-32995.rs b/src/test/ui/issues/issue-32995.rs
similarity index 100%
rename from src/test/ui/issue-32995.rs
rename to src/test/ui/issues/issue-32995.rs
diff --git a/src/test/ui/issue-32995.stderr b/src/test/ui/issues/issue-32995.stderr
similarity index 100%
rename from src/test/ui/issue-32995.stderr
rename to src/test/ui/issues/issue-32995.stderr
diff --git a/src/test/ui/issue-33241.rs b/src/test/ui/issues/issue-33241.rs
similarity index 100%
rename from src/test/ui/issue-33241.rs
rename to src/test/ui/issues/issue-33241.rs
diff --git a/src/test/ui/issue-33241.stderr b/src/test/ui/issues/issue-33241.stderr
similarity index 100%
rename from src/test/ui/issue-33241.stderr
rename to src/test/ui/issues/issue-33241.stderr
diff --git a/src/test/ui/issue-33293.rs b/src/test/ui/issues/issue-33293.rs
similarity index 100%
rename from src/test/ui/issue-33293.rs
rename to src/test/ui/issues/issue-33293.rs
diff --git a/src/test/ui/issue-33293.stderr b/src/test/ui/issues/issue-33293.stderr
similarity index 100%
rename from src/test/ui/issue-33293.stderr
rename to src/test/ui/issues/issue-33293.stderr
diff --git a/src/test/ui/issue-3344.rs b/src/test/ui/issues/issue-3344.rs
similarity index 100%
rename from src/test/ui/issue-3344.rs
rename to src/test/ui/issues/issue-3344.rs
diff --git a/src/test/ui/issue-3344.stderr b/src/test/ui/issues/issue-3344.stderr
similarity index 100%
rename from src/test/ui/issue-3344.stderr
rename to src/test/ui/issues/issue-3344.stderr
diff --git a/src/test/ui/issue-33464.rs b/src/test/ui/issues/issue-33464.rs
similarity index 100%
rename from src/test/ui/issue-33464.rs
rename to src/test/ui/issues/issue-33464.rs
diff --git a/src/test/ui/issue-33464.stderr b/src/test/ui/issues/issue-33464.stderr
similarity index 100%
rename from src/test/ui/issue-33464.stderr
rename to src/test/ui/issues/issue-33464.stderr
diff --git a/src/test/ui/issue-33504.rs b/src/test/ui/issues/issue-33504.rs
similarity index 100%
rename from src/test/ui/issue-33504.rs
rename to src/test/ui/issues/issue-33504.rs
diff --git a/src/test/ui/issue-33504.stderr b/src/test/ui/issues/issue-33504.stderr
similarity index 100%
rename from src/test/ui/issue-33504.stderr
rename to src/test/ui/issues/issue-33504.stderr
diff --git a/src/test/ui/issue-33525.rs b/src/test/ui/issues/issue-33525.rs
similarity index 100%
rename from src/test/ui/issue-33525.rs
rename to src/test/ui/issues/issue-33525.rs
diff --git a/src/test/ui/issue-33525.stderr b/src/test/ui/issues/issue-33525.stderr
similarity index 100%
rename from src/test/ui/issue-33525.stderr
rename to src/test/ui/issues/issue-33525.stderr
diff --git a/src/test/ui/issue-33571.rs b/src/test/ui/issues/issue-33571.rs
similarity index 100%
rename from src/test/ui/issue-33571.rs
rename to src/test/ui/issues/issue-33571.rs
diff --git a/src/test/ui/issue-33571.stderr b/src/test/ui/issues/issue-33571.stderr
similarity index 100%
rename from src/test/ui/issue-33571.stderr
rename to src/test/ui/issues/issue-33571.stderr
diff --git a/src/test/ui/issue-33819.nll.stderr b/src/test/ui/issues/issue-33819.nll.stderr
similarity index 100%
rename from src/test/ui/issue-33819.nll.stderr
rename to src/test/ui/issues/issue-33819.nll.stderr
diff --git a/src/test/ui/issue-33819.rs b/src/test/ui/issues/issue-33819.rs
similarity index 100%
rename from src/test/ui/issue-33819.rs
rename to src/test/ui/issues/issue-33819.rs
diff --git a/src/test/ui/issue-33819.stderr b/src/test/ui/issues/issue-33819.stderr
similarity index 100%
rename from src/test/ui/issue-33819.stderr
rename to src/test/ui/issues/issue-33819.stderr
diff --git a/src/test/ui/issue-33941.rs b/src/test/ui/issues/issue-33941.rs
similarity index 100%
rename from src/test/ui/issue-33941.rs
rename to src/test/ui/issues/issue-33941.rs
diff --git a/src/test/ui/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr
similarity index 100%
rename from src/test/ui/issue-33941.stderr
rename to src/test/ui/issues/issue-33941.stderr
diff --git a/src/test/ui/issue-34028.rs b/src/test/ui/issues/issue-34028.rs
similarity index 100%
rename from src/test/ui/issue-34028.rs
rename to src/test/ui/issues/issue-34028.rs
diff --git a/src/test/ui/issue-34028.stderr b/src/test/ui/issues/issue-34028.stderr
similarity index 100%
rename from src/test/ui/issue-34028.stderr
rename to src/test/ui/issues/issue-34028.stderr
diff --git a/src/test/ui/issue-34047.rs b/src/test/ui/issues/issue-34047.rs
similarity index 100%
rename from src/test/ui/issue-34047.rs
rename to src/test/ui/issues/issue-34047.rs
diff --git a/src/test/ui/issue-34047.stderr b/src/test/ui/issues/issue-34047.stderr
similarity index 100%
rename from src/test/ui/issue-34047.stderr
rename to src/test/ui/issues/issue-34047.stderr
diff --git a/src/test/ui/issue-34171.rs b/src/test/ui/issues/issue-34171.rs
similarity index 100%
rename from src/test/ui/issue-34171.rs
rename to src/test/ui/issues/issue-34171.rs
diff --git a/src/test/ui/issue-34171.stderr b/src/test/ui/issues/issue-34171.stderr
similarity index 100%
rename from src/test/ui/issue-34171.stderr
rename to src/test/ui/issues/issue-34171.stderr
diff --git a/src/test/ui/issue-34209.rs b/src/test/ui/issues/issue-34209.rs
similarity index 100%
rename from src/test/ui/issue-34209.rs
rename to src/test/ui/issues/issue-34209.rs
diff --git a/src/test/ui/issue-34209.stderr b/src/test/ui/issues/issue-34209.stderr
similarity index 100%
rename from src/test/ui/issue-34209.stderr
rename to src/test/ui/issues/issue-34209.stderr
diff --git a/src/test/ui/issue-34222-1.rs b/src/test/ui/issues/issue-34222-1.rs
similarity index 100%
rename from src/test/ui/issue-34222-1.rs
rename to src/test/ui/issues/issue-34222-1.rs
diff --git a/src/test/ui/issue-34222-1.stderr b/src/test/ui/issues/issue-34222-1.stderr
similarity index 100%
rename from src/test/ui/issue-34222-1.stderr
rename to src/test/ui/issues/issue-34222-1.stderr
diff --git a/src/test/ui/issue-34334.rs b/src/test/ui/issues/issue-34334.rs
similarity index 100%
rename from src/test/ui/issue-34334.rs
rename to src/test/ui/issues/issue-34334.rs
diff --git a/src/test/ui/issue-34334.stderr b/src/test/ui/issues/issue-34334.stderr
similarity index 100%
rename from src/test/ui/issue-34334.stderr
rename to src/test/ui/issues/issue-34334.stderr
diff --git a/src/test/ui/issue-34349.rs b/src/test/ui/issues/issue-34349.rs
similarity index 100%
rename from src/test/ui/issue-34349.rs
rename to src/test/ui/issues/issue-34349.rs
diff --git a/src/test/ui/issue-34349.stderr b/src/test/ui/issues/issue-34349.stderr
similarity index 100%
rename from src/test/ui/issue-34349.stderr
rename to src/test/ui/issues/issue-34349.stderr
diff --git a/src/test/ui/issue-34373.rs b/src/test/ui/issues/issue-34373.rs
similarity index 100%
rename from src/test/ui/issue-34373.rs
rename to src/test/ui/issues/issue-34373.rs
diff --git a/src/test/ui/issue-34373.stderr b/src/test/ui/issues/issue-34373.stderr
similarity index 100%
rename from src/test/ui/issue-34373.stderr
rename to src/test/ui/issues/issue-34373.stderr
diff --git a/src/test/ui/issue-34418.rs b/src/test/ui/issues/issue-34418.rs
similarity index 100%
rename from src/test/ui/issue-34418.rs
rename to src/test/ui/issues/issue-34418.rs
diff --git a/src/test/ui/issue-34418.stderr b/src/test/ui/issues/issue-34418.stderr
similarity index 100%
rename from src/test/ui/issue-34418.stderr
rename to src/test/ui/issues/issue-34418.stderr
diff --git a/src/test/ui/issue-3477.rs b/src/test/ui/issues/issue-3477.rs
similarity index 100%
rename from src/test/ui/issue-3477.rs
rename to src/test/ui/issues/issue-3477.rs
diff --git a/src/test/ui/issue-3477.stderr b/src/test/ui/issues/issue-3477.stderr
similarity index 100%
rename from src/test/ui/issue-3477.stderr
rename to src/test/ui/issues/issue-3477.stderr
diff --git a/src/test/ui/issue-34839.rs b/src/test/ui/issues/issue-34839.rs
similarity index 100%
rename from src/test/ui/issue-34839.rs
rename to src/test/ui/issues/issue-34839.rs
diff --git a/src/test/ui/issue-34839.stderr b/src/test/ui/issues/issue-34839.stderr
similarity index 100%
rename from src/test/ui/issue-34839.stderr
rename to src/test/ui/issues/issue-34839.stderr
diff --git a/src/test/ui/issue-35075.rs b/src/test/ui/issues/issue-35075.rs
similarity index 100%
rename from src/test/ui/issue-35075.rs
rename to src/test/ui/issues/issue-35075.rs
diff --git a/src/test/ui/issue-35075.stderr b/src/test/ui/issues/issue-35075.stderr
similarity index 100%
rename from src/test/ui/issue-35075.stderr
rename to src/test/ui/issues/issue-35075.stderr
diff --git a/src/test/ui/issue-35139.rs b/src/test/ui/issues/issue-35139.rs
similarity index 100%
rename from src/test/ui/issue-35139.rs
rename to src/test/ui/issues/issue-35139.rs
diff --git a/src/test/ui/issue-35139.stderr b/src/test/ui/issues/issue-35139.stderr
similarity index 100%
rename from src/test/ui/issue-35139.stderr
rename to src/test/ui/issues/issue-35139.stderr
diff --git a/src/test/ui/issue-3521-2.rs b/src/test/ui/issues/issue-3521-2.rs
similarity index 100%
rename from src/test/ui/issue-3521-2.rs
rename to src/test/ui/issues/issue-3521-2.rs
diff --git a/src/test/ui/issue-3521-2.stderr b/src/test/ui/issues/issue-3521-2.stderr
similarity index 100%
rename from src/test/ui/issue-3521-2.stderr
rename to src/test/ui/issues/issue-3521-2.stderr
diff --git a/src/test/ui/issue-3521.rs b/src/test/ui/issues/issue-3521.rs
similarity index 100%
rename from src/test/ui/issue-3521.rs
rename to src/test/ui/issues/issue-3521.rs
diff --git a/src/test/ui/issue-3521.stderr b/src/test/ui/issues/issue-3521.stderr
similarity index 100%
rename from src/test/ui/issue-3521.stderr
rename to src/test/ui/issues/issue-3521.stderr
diff --git a/src/test/ui/issue-35241.rs b/src/test/ui/issues/issue-35241.rs
similarity index 100%
rename from src/test/ui/issue-35241.rs
rename to src/test/ui/issues/issue-35241.rs
diff --git a/src/test/ui/issue-35241.stderr b/src/test/ui/issues/issue-35241.stderr
similarity index 100%
rename from src/test/ui/issue-35241.stderr
rename to src/test/ui/issues/issue-35241.stderr
diff --git a/src/test/ui/issue-35450.rs b/src/test/ui/issues/issue-35450.rs
similarity index 100%
rename from src/test/ui/issue-35450.rs
rename to src/test/ui/issues/issue-35450.rs
diff --git a/src/test/ui/issue-35450.stderr b/src/test/ui/issues/issue-35450.stderr
similarity index 100%
rename from src/test/ui/issue-35450.stderr
rename to src/test/ui/issues/issue-35450.stderr
diff --git a/src/test/ui/issue-35570.rs b/src/test/ui/issues/issue-35570.rs
similarity index 100%
rename from src/test/ui/issue-35570.rs
rename to src/test/ui/issues/issue-35570.rs
diff --git a/src/test/ui/issue-35570.stderr b/src/test/ui/issues/issue-35570.stderr
similarity index 100%
rename from src/test/ui/issue-35570.stderr
rename to src/test/ui/issues/issue-35570.stderr
diff --git a/src/test/ui/issue-35668.rs b/src/test/ui/issues/issue-35668.rs
similarity index 100%
rename from src/test/ui/issue-35668.rs
rename to src/test/ui/issues/issue-35668.rs
diff --git a/src/test/ui/issue-35668.stderr b/src/test/ui/issues/issue-35668.stderr
similarity index 100%
rename from src/test/ui/issue-35668.stderr
rename to src/test/ui/issues/issue-35668.stderr
diff --git a/src/test/ui/issue-35675.rs b/src/test/ui/issues/issue-35675.rs
similarity index 100%
rename from src/test/ui/issue-35675.rs
rename to src/test/ui/issues/issue-35675.rs
diff --git a/src/test/ui/issue-35675.stderr b/src/test/ui/issues/issue-35675.stderr
similarity index 100%
rename from src/test/ui/issue-35675.stderr
rename to src/test/ui/issues/issue-35675.stderr
diff --git a/src/test/ui/issue-35869.rs b/src/test/ui/issues/issue-35869.rs
similarity index 100%
rename from src/test/ui/issue-35869.rs
rename to src/test/ui/issues/issue-35869.rs
diff --git a/src/test/ui/issue-35869.stderr b/src/test/ui/issues/issue-35869.stderr
similarity index 100%
rename from src/test/ui/issue-35869.stderr
rename to src/test/ui/issues/issue-35869.stderr
diff --git a/src/test/ui/issue-35976.rs b/src/test/ui/issues/issue-35976.rs
similarity index 100%
rename from src/test/ui/issue-35976.rs
rename to src/test/ui/issues/issue-35976.rs
diff --git a/src/test/ui/issue-35976.stderr b/src/test/ui/issues/issue-35976.stderr
similarity index 100%
rename from src/test/ui/issue-35976.stderr
rename to src/test/ui/issues/issue-35976.stderr
diff --git a/src/test/ui/issue-35988.rs b/src/test/ui/issues/issue-35988.rs
similarity index 100%
rename from src/test/ui/issue-35988.rs
rename to src/test/ui/issues/issue-35988.rs
diff --git a/src/test/ui/issues/issue-35988.stderr b/src/test/ui/issues/issue-35988.stderr
new file mode 100644
index 0000000..0b9d846
--- /dev/null
+++ b/src/test/ui/issues/issue-35988.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[std::boxed::Box<E>]` cannot be known at compilation time
+ --> $DIR/issue-35988.rs:12:7
+ |
+LL | V([Box<E>]),
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[std::boxed::Box<E>]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-3601.rs b/src/test/ui/issues/issue-3601.rs
similarity index 100%
rename from src/test/ui/issue-3601.rs
rename to src/test/ui/issues/issue-3601.rs
diff --git a/src/test/ui/issue-3601.stderr b/src/test/ui/issues/issue-3601.stderr
similarity index 100%
rename from src/test/ui/issue-3601.stderr
rename to src/test/ui/issues/issue-3601.stderr
diff --git a/src/test/ui/issue-36082.ast.nll.stderr b/src/test/ui/issues/issue-36082.ast.nll.stderr
similarity index 100%
rename from src/test/ui/issue-36082.ast.nll.stderr
rename to src/test/ui/issues/issue-36082.ast.nll.stderr
diff --git a/src/test/ui/issue-36082.ast.stderr b/src/test/ui/issues/issue-36082.ast.stderr
similarity index 100%
rename from src/test/ui/issue-36082.ast.stderr
rename to src/test/ui/issues/issue-36082.ast.stderr
diff --git a/src/test/ui/issue-36082.mir.stderr b/src/test/ui/issues/issue-36082.mir.stderr
similarity index 100%
rename from src/test/ui/issue-36082.mir.stderr
rename to src/test/ui/issues/issue-36082.mir.stderr
diff --git a/src/test/ui/issue-36082.rs b/src/test/ui/issues/issue-36082.rs
similarity index 100%
rename from src/test/ui/issue-36082.rs
rename to src/test/ui/issues/issue-36082.rs
diff --git a/src/test/ui/issue-36116.rs b/src/test/ui/issues/issue-36116.rs
similarity index 100%
rename from src/test/ui/issue-36116.rs
rename to src/test/ui/issues/issue-36116.rs
diff --git a/src/test/ui/issue-36116.stderr b/src/test/ui/issues/issue-36116.stderr
similarity index 100%
rename from src/test/ui/issue-36116.stderr
rename to src/test/ui/issues/issue-36116.stderr
diff --git a/src/test/ui/issue-36163.rs b/src/test/ui/issues/issue-36163.rs
similarity index 100%
rename from src/test/ui/issue-36163.rs
rename to src/test/ui/issues/issue-36163.rs
diff --git a/src/test/ui/issue-36163.stderr b/src/test/ui/issues/issue-36163.stderr
similarity index 100%
rename from src/test/ui/issue-36163.stderr
rename to src/test/ui/issues/issue-36163.stderr
diff --git a/src/test/ui/issue-36299.rs b/src/test/ui/issues/issue-36299.rs
similarity index 100%
rename from src/test/ui/issue-36299.rs
rename to src/test/ui/issues/issue-36299.rs
diff --git a/src/test/ui/issue-36299.stderr b/src/test/ui/issues/issue-36299.stderr
similarity index 100%
rename from src/test/ui/issue-36299.stderr
rename to src/test/ui/issues/issue-36299.stderr
diff --git a/src/test/ui/issue-36379.rs b/src/test/ui/issues/issue-36379.rs
similarity index 100%
rename from src/test/ui/issue-36379.rs
rename to src/test/ui/issues/issue-36379.rs
diff --git a/src/test/ui/issue-36379.stderr b/src/test/ui/issues/issue-36379.stderr
similarity index 100%
rename from src/test/ui/issue-36379.stderr
rename to src/test/ui/issues/issue-36379.stderr
diff --git a/src/test/ui/issue-36400.nll.stderr b/src/test/ui/issues/issue-36400.nll.stderr
similarity index 100%
rename from src/test/ui/issue-36400.nll.stderr
rename to src/test/ui/issues/issue-36400.nll.stderr
diff --git a/src/test/ui/issue-36400.rs b/src/test/ui/issues/issue-36400.rs
similarity index 100%
rename from src/test/ui/issue-36400.rs
rename to src/test/ui/issues/issue-36400.rs
diff --git a/src/test/ui/issue-36400.stderr b/src/test/ui/issues/issue-36400.stderr
similarity index 100%
rename from src/test/ui/issue-36400.stderr
rename to src/test/ui/issues/issue-36400.stderr
diff --git a/src/test/ui/issue-36617.rs b/src/test/ui/issues/issue-36617.rs
similarity index 100%
rename from src/test/ui/issue-36617.rs
rename to src/test/ui/issues/issue-36617.rs
diff --git a/src/test/ui/issue-36617.stderr b/src/test/ui/issues/issue-36617.stderr
similarity index 100%
rename from src/test/ui/issue-36617.stderr
rename to src/test/ui/issues/issue-36617.stderr
diff --git a/src/test/ui/issue-36638.rs b/src/test/ui/issues/issue-36638.rs
similarity index 100%
rename from src/test/ui/issue-36638.rs
rename to src/test/ui/issues/issue-36638.rs
diff --git a/src/test/ui/issue-36638.stderr b/src/test/ui/issues/issue-36638.stderr
similarity index 100%
rename from src/test/ui/issue-36638.stderr
rename to src/test/ui/issues/issue-36638.stderr
diff --git a/src/test/ui/issue-3668-2.rs b/src/test/ui/issues/issue-3668-2.rs
similarity index 100%
rename from src/test/ui/issue-3668-2.rs
rename to src/test/ui/issues/issue-3668-2.rs
diff --git a/src/test/ui/issue-3668-2.stderr b/src/test/ui/issues/issue-3668-2.stderr
similarity index 100%
rename from src/test/ui/issue-3668-2.stderr
rename to src/test/ui/issues/issue-3668-2.stderr
diff --git a/src/test/ui/issue-3668.rs b/src/test/ui/issues/issue-3668.rs
similarity index 100%
rename from src/test/ui/issue-3668.rs
rename to src/test/ui/issues/issue-3668.rs
diff --git a/src/test/ui/issue-3668.stderr b/src/test/ui/issues/issue-3668.stderr
similarity index 100%
rename from src/test/ui/issue-3668.stderr
rename to src/test/ui/issues/issue-3668.stderr
diff --git a/src/test/ui/issue-36708.rs b/src/test/ui/issues/issue-36708.rs
similarity index 100%
rename from src/test/ui/issue-36708.rs
rename to src/test/ui/issues/issue-36708.rs
diff --git a/src/test/ui/issue-36708.stderr b/src/test/ui/issues/issue-36708.stderr
similarity index 100%
rename from src/test/ui/issue-36708.stderr
rename to src/test/ui/issues/issue-36708.stderr
diff --git a/src/test/ui/issue-3680.rs b/src/test/ui/issues/issue-3680.rs
similarity index 100%
rename from src/test/ui/issue-3680.rs
rename to src/test/ui/issues/issue-3680.rs
diff --git a/src/test/ui/issue-3680.stderr b/src/test/ui/issues/issue-3680.stderr
similarity index 100%
rename from src/test/ui/issue-3680.stderr
rename to src/test/ui/issues/issue-3680.stderr
diff --git a/src/test/ui/issue-36839.rs b/src/test/ui/issues/issue-36839.rs
similarity index 100%
rename from src/test/ui/issue-36839.rs
rename to src/test/ui/issues/issue-36839.rs
diff --git a/src/test/ui/issue-36839.stderr b/src/test/ui/issues/issue-36839.stderr
similarity index 100%
rename from src/test/ui/issue-36839.stderr
rename to src/test/ui/issues/issue-36839.stderr
diff --git a/src/test/compile-fail/issue-36881.rs b/src/test/ui/issues/issue-36881.rs
similarity index 100%
rename from src/test/compile-fail/issue-36881.rs
rename to src/test/ui/issues/issue-36881.rs
diff --git a/src/test/ui/issues/issue-36881.stderr b/src/test/ui/issues/issue-36881.stderr
new file mode 100644
index 0000000..39132fde
--- /dev/null
+++ b/src/test/ui/issues/issue-36881.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `issue_36881_aux`
+ --> $DIR/issue-36881.rs:16:9
+ |
+LL | use issue_36881_aux::Foo; //~ ERROR unresolved import
+ | ^^^^^^^^^^^^^^^ Maybe a missing `extern crate issue_36881_aux;`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/ui/issue-3702-2.rs b/src/test/ui/issues/issue-3702-2.rs
similarity index 100%
rename from src/test/ui/issue-3702-2.rs
rename to src/test/ui/issues/issue-3702-2.rs
diff --git a/src/test/ui/issue-3702-2.stderr b/src/test/ui/issues/issue-3702-2.stderr
similarity index 100%
rename from src/test/ui/issue-3702-2.stderr
rename to src/test/ui/issues/issue-3702-2.stderr
diff --git a/src/test/ui/issue-37026.rs b/src/test/ui/issues/issue-37026.rs
similarity index 100%
rename from src/test/ui/issue-37026.rs
rename to src/test/ui/issues/issue-37026.rs
diff --git a/src/test/ui/issue-37026.stderr b/src/test/ui/issues/issue-37026.stderr
similarity index 100%
rename from src/test/ui/issue-37026.stderr
rename to src/test/ui/issues/issue-37026.stderr
diff --git a/src/test/ui/issue-37051.rs b/src/test/ui/issues/issue-37051.rs
similarity index 100%
rename from src/test/ui/issue-37051.rs
rename to src/test/ui/issues/issue-37051.rs
diff --git a/src/test/ui/issue-37051.stderr b/src/test/ui/issues/issue-37051.stderr
similarity index 100%
rename from src/test/ui/issue-37051.stderr
rename to src/test/ui/issues/issue-37051.stderr
diff --git a/src/test/ui/issue-3707.rs b/src/test/ui/issues/issue-3707.rs
similarity index 100%
rename from src/test/ui/issue-3707.rs
rename to src/test/ui/issues/issue-3707.rs
diff --git a/src/test/ui/issue-3707.stderr b/src/test/ui/issues/issue-3707.stderr
similarity index 100%
rename from src/test/ui/issue-3707.stderr
rename to src/test/ui/issues/issue-3707.stderr
diff --git a/src/test/compile-fail/issue-37131.rs b/src/test/ui/issues/issue-37131.rs
similarity index 100%
rename from src/test/compile-fail/issue-37131.rs
rename to src/test/ui/issues/issue-37131.rs
diff --git a/src/test/ui/issues/issue-37131.stderr b/src/test/ui/issues/issue-37131.stderr
new file mode 100644
index 0000000..660a693
--- /dev/null
+++ b/src/test/ui/issues/issue-37131.stderr
@@ -0,0 +1,7 @@
+error[E0463]: can't find crate for `std`
+ |
+ = note: the `thumbv6m-none-eabi` target may not be installed
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/ui/issue-37311-type-length-limit/issue-37311.rs b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs
similarity index 100%
rename from src/test/ui/issue-37311-type-length-limit/issue-37311.rs
rename to src/test/ui/issues/issue-37311-type-length-limit/issue-37311.rs
diff --git a/src/test/ui/issue-37311-type-length-limit/issue-37311.stderr b/src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr
similarity index 100%
rename from src/test/ui/issue-37311-type-length-limit/issue-37311.stderr
rename to src/test/ui/issues/issue-37311-type-length-limit/issue-37311.stderr
diff --git a/src/test/ui/issue-37323.rs b/src/test/ui/issues/issue-37323.rs
similarity index 100%
rename from src/test/ui/issue-37323.rs
rename to src/test/ui/issues/issue-37323.rs
diff --git a/src/test/ui/issue-37323.stderr b/src/test/ui/issues/issue-37323.stderr
similarity index 100%
rename from src/test/ui/issue-37323.stderr
rename to src/test/ui/issues/issue-37323.stderr
diff --git a/src/test/ui/issue-37366.rs b/src/test/ui/issues/issue-37366.rs
similarity index 100%
rename from src/test/ui/issue-37366.rs
rename to src/test/ui/issues/issue-37366.rs
diff --git a/src/test/ui/issue-37366.stderr b/src/test/ui/issues/issue-37366.stderr
similarity index 100%
rename from src/test/ui/issue-37366.stderr
rename to src/test/ui/issues/issue-37366.stderr
diff --git a/src/test/ui/issue-37510.rs b/src/test/ui/issues/issue-37510.rs
similarity index 100%
rename from src/test/ui/issue-37510.rs
rename to src/test/ui/issues/issue-37510.rs
diff --git a/src/test/ui/issue-37510.stderr b/src/test/ui/issues/issue-37510.stderr
similarity index 100%
rename from src/test/ui/issue-37510.stderr
rename to src/test/ui/issues/issue-37510.stderr
diff --git a/src/test/ui/issue-37515.rs b/src/test/ui/issues/issue-37515.rs
similarity index 100%
rename from src/test/ui/issue-37515.rs
rename to src/test/ui/issues/issue-37515.rs
diff --git a/src/test/ui/issue-37515.stderr b/src/test/ui/issues/issue-37515.stderr
similarity index 100%
rename from src/test/ui/issue-37515.stderr
rename to src/test/ui/issues/issue-37515.stderr
diff --git a/src/test/ui/issue-37534.rs b/src/test/ui/issues/issue-37534.rs
similarity index 100%
rename from src/test/ui/issue-37534.rs
rename to src/test/ui/issues/issue-37534.rs
diff --git a/src/test/ui/issue-37534.stderr b/src/test/ui/issues/issue-37534.stderr
similarity index 100%
rename from src/test/ui/issue-37534.stderr
rename to src/test/ui/issues/issue-37534.stderr
diff --git a/src/test/ui/issue-37550.rs b/src/test/ui/issues/issue-37550.rs
similarity index 100%
rename from src/test/ui/issue-37550.rs
rename to src/test/ui/issues/issue-37550.rs
diff --git a/src/test/ui/issue-37550.stderr b/src/test/ui/issues/issue-37550.stderr
similarity index 100%
rename from src/test/ui/issue-37550.stderr
rename to src/test/ui/issues/issue-37550.stderr
diff --git a/src/test/ui/issue-37576.rs b/src/test/ui/issues/issue-37576.rs
similarity index 100%
rename from src/test/ui/issue-37576.rs
rename to src/test/ui/issues/issue-37576.rs
diff --git a/src/test/ui/issue-37576.stderr b/src/test/ui/issues/issue-37576.stderr
similarity index 100%
rename from src/test/ui/issue-37576.stderr
rename to src/test/ui/issues/issue-37576.stderr
diff --git a/src/test/ui/issue-3763.rs b/src/test/ui/issues/issue-3763.rs
similarity index 100%
rename from src/test/ui/issue-3763.rs
rename to src/test/ui/issues/issue-3763.rs
diff --git a/src/test/ui/issue-3763.stderr b/src/test/ui/issues/issue-3763.stderr
similarity index 100%
rename from src/test/ui/issue-3763.stderr
rename to src/test/ui/issues/issue-3763.stderr
diff --git a/src/test/ui/issue-37665.rs b/src/test/ui/issues/issue-37665.rs
similarity index 100%
rename from src/test/ui/issue-37665.rs
rename to src/test/ui/issues/issue-37665.rs
diff --git a/src/test/ui/issue-37665.stderr b/src/test/ui/issues/issue-37665.stderr
similarity index 100%
rename from src/test/ui/issue-37665.stderr
rename to src/test/ui/issues/issue-37665.stderr
diff --git a/src/test/ui/issue-3779.rs b/src/test/ui/issues/issue-3779.rs
similarity index 100%
rename from src/test/ui/issue-3779.rs
rename to src/test/ui/issues/issue-3779.rs
diff --git a/src/test/ui/issue-3779.stderr b/src/test/ui/issues/issue-3779.stderr
similarity index 100%
rename from src/test/ui/issue-3779.stderr
rename to src/test/ui/issues/issue-3779.stderr
diff --git a/src/test/ui/issue-37884.rs b/src/test/ui/issues/issue-37884.rs
similarity index 100%
rename from src/test/ui/issue-37884.rs
rename to src/test/ui/issues/issue-37884.rs
diff --git a/src/test/ui/issue-37884.stderr b/src/test/ui/issues/issue-37884.stderr
similarity index 100%
rename from src/test/ui/issue-37884.stderr
rename to src/test/ui/issues/issue-37884.stderr
diff --git a/src/test/ui/issue-37887.rs b/src/test/ui/issues/issue-37887.rs
similarity index 100%
rename from src/test/ui/issue-37887.rs
rename to src/test/ui/issues/issue-37887.rs
diff --git a/src/test/ui/issue-37887.stderr b/src/test/ui/issues/issue-37887.stderr
similarity index 100%
rename from src/test/ui/issue-37887.stderr
rename to src/test/ui/issues/issue-37887.stderr
diff --git a/src/test/ui/issue-38160.rs b/src/test/ui/issues/issue-38160.rs
similarity index 100%
rename from src/test/ui/issue-38160.rs
rename to src/test/ui/issues/issue-38160.rs
diff --git a/src/test/ui/issue-38160.stderr b/src/test/ui/issues/issue-38160.stderr
similarity index 100%
rename from src/test/ui/issue-38160.stderr
rename to src/test/ui/issues/issue-38160.stderr
diff --git a/src/test/ui/issue-3820.rs b/src/test/ui/issues/issue-3820.rs
similarity index 100%
rename from src/test/ui/issue-3820.rs
rename to src/test/ui/issues/issue-3820.rs
diff --git a/src/test/ui/issue-3820.stderr b/src/test/ui/issues/issue-3820.stderr
similarity index 100%
rename from src/test/ui/issue-3820.stderr
rename to src/test/ui/issues/issue-3820.stderr
diff --git a/src/test/ui/issue-38293.rs b/src/test/ui/issues/issue-38293.rs
similarity index 100%
rename from src/test/ui/issue-38293.rs
rename to src/test/ui/issues/issue-38293.rs
diff --git a/src/test/ui/issue-38293.stderr b/src/test/ui/issues/issue-38293.stderr
similarity index 100%
rename from src/test/ui/issue-38293.stderr
rename to src/test/ui/issues/issue-38293.stderr
diff --git a/src/test/ui/issue-38381.rs b/src/test/ui/issues/issue-38381.rs
similarity index 100%
rename from src/test/ui/issue-38381.rs
rename to src/test/ui/issues/issue-38381.rs
diff --git a/src/test/ui/issue-38381.stderr b/src/test/ui/issues/issue-38381.stderr
similarity index 100%
rename from src/test/ui/issue-38381.stderr
rename to src/test/ui/issues/issue-38381.stderr
diff --git a/src/test/ui/issue-38404.rs b/src/test/ui/issues/issue-38404.rs
similarity index 100%
rename from src/test/ui/issue-38404.rs
rename to src/test/ui/issues/issue-38404.rs
diff --git a/src/test/ui/issue-38404.stderr b/src/test/ui/issues/issue-38404.stderr
similarity index 100%
rename from src/test/ui/issue-38404.stderr
rename to src/test/ui/issues/issue-38404.stderr
diff --git a/src/test/ui/issue-38412.rs b/src/test/ui/issues/issue-38412.rs
similarity index 100%
rename from src/test/ui/issue-38412.rs
rename to src/test/ui/issues/issue-38412.rs
diff --git a/src/test/ui/issue-38412.stderr b/src/test/ui/issues/issue-38412.stderr
similarity index 100%
rename from src/test/ui/issue-38412.stderr
rename to src/test/ui/issues/issue-38412.stderr
diff --git a/src/test/ui/issue-38458.rs b/src/test/ui/issues/issue-38458.rs
similarity index 100%
rename from src/test/ui/issue-38458.rs
rename to src/test/ui/issues/issue-38458.rs
diff --git a/src/test/ui/issue-38458.stderr b/src/test/ui/issues/issue-38458.stderr
similarity index 100%
rename from src/test/ui/issue-38458.stderr
rename to src/test/ui/issues/issue-38458.stderr
diff --git a/src/test/ui/issue-38604.rs b/src/test/ui/issues/issue-38604.rs
similarity index 100%
rename from src/test/ui/issue-38604.rs
rename to src/test/ui/issues/issue-38604.rs
diff --git a/src/test/ui/issue-38604.stderr b/src/test/ui/issues/issue-38604.stderr
similarity index 100%
rename from src/test/ui/issue-38604.stderr
rename to src/test/ui/issues/issue-38604.stderr
diff --git a/src/test/ui/issue-38715.rs b/src/test/ui/issues/issue-38715.rs
similarity index 100%
rename from src/test/ui/issue-38715.rs
rename to src/test/ui/issues/issue-38715.rs
diff --git a/src/test/ui/issue-38715.stderr b/src/test/ui/issues/issue-38715.stderr
similarity index 100%
rename from src/test/ui/issue-38715.stderr
rename to src/test/ui/issues/issue-38715.stderr
diff --git a/src/test/compile-fail/isssue-38821.rs b/src/test/ui/issues/issue-38821.rs
similarity index 100%
rename from src/test/compile-fail/isssue-38821.rs
rename to src/test/ui/issues/issue-38821.rs
diff --git a/src/test/ui/issues/issue-38821.stderr b/src/test/ui/issues/issue-38821.stderr
new file mode 100644
index 0000000..f23f0ae
--- /dev/null
+++ b/src/test/ui/issues/issue-38821.stderr
@@ -0,0 +1,12 @@
+error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
+ --> $DIR/issue-38821.rs:33:17
+ |
+LL | #[derive(Debug, Copy, Clone)]
+ | ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
+ |
+ = help: consider adding a `where <Col as Expression>::SqlType: NotNull` bound
+ = note: required because of the requirements on the impl of `IntoNullable` for `<Col as Expression>::SqlType`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-38857.rs b/src/test/ui/issues/issue-38857.rs
similarity index 100%
rename from src/test/ui/issue-38857.rs
rename to src/test/ui/issues/issue-38857.rs
diff --git a/src/test/ui/issue-38857.stderr b/src/test/ui/issues/issue-38857.stderr
similarity index 100%
rename from src/test/ui/issue-38857.stderr
rename to src/test/ui/issues/issue-38857.stderr
diff --git a/src/test/ui/issue-38868.rs b/src/test/ui/issues/issue-38868.rs
similarity index 100%
rename from src/test/ui/issue-38868.rs
rename to src/test/ui/issues/issue-38868.rs
diff --git a/src/test/ui/issue-38868.stderr b/src/test/ui/issues/issue-38868.stderr
similarity index 100%
rename from src/test/ui/issue-38868.stderr
rename to src/test/ui/issues/issue-38868.stderr
diff --git a/src/test/ui/issue-38875/auxiliary/issue_38875_b.rs b/src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs
similarity index 100%
rename from src/test/ui/issue-38875/auxiliary/issue_38875_b.rs
rename to src/test/ui/issues/issue-38875/auxiliary/issue_38875_b.rs
diff --git a/src/test/ui/issue-38875/issue_38875.rs b/src/test/ui/issues/issue-38875/issue_38875.rs
similarity index 100%
rename from src/test/ui/issue-38875/issue_38875.rs
rename to src/test/ui/issues/issue-38875/issue_38875.rs
diff --git a/src/test/ui/issue-38919.rs b/src/test/ui/issues/issue-38919.rs
similarity index 100%
rename from src/test/ui/issue-38919.rs
rename to src/test/ui/issues/issue-38919.rs
diff --git a/src/test/ui/issue-38919.stderr b/src/test/ui/issues/issue-38919.stderr
similarity index 100%
rename from src/test/ui/issue-38919.stderr
rename to src/test/ui/issues/issue-38919.stderr
diff --git a/src/test/ui/issue-38954.rs b/src/test/ui/issues/issue-38954.rs
similarity index 100%
rename from src/test/ui/issue-38954.rs
rename to src/test/ui/issues/issue-38954.rs
diff --git a/src/test/ui/issues/issue-38954.stderr b/src/test/ui/issues/issue-38954.stderr
new file mode 100644
index 0000000..9bc937b
--- /dev/null
+++ b/src/test/ui/issues/issue-38954.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/issue-38954.rs:11:23
+ |
+LL | fn _test(ref _p: str) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all function arguments must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-39211.rs b/src/test/ui/issues/issue-39211.rs
similarity index 100%
rename from src/test/ui/issue-39211.rs
rename to src/test/ui/issues/issue-39211.rs
diff --git a/src/test/ui/issue-39211.stderr b/src/test/ui/issues/issue-39211.stderr
similarity index 100%
rename from src/test/ui/issue-39211.stderr
rename to src/test/ui/issues/issue-39211.stderr
diff --git a/src/test/ui/issue-39362.rs b/src/test/ui/issues/issue-39362.rs
similarity index 100%
rename from src/test/ui/issue-39362.rs
rename to src/test/ui/issues/issue-39362.rs
diff --git a/src/test/ui/issue-39362.stderr b/src/test/ui/issues/issue-39362.stderr
similarity index 100%
rename from src/test/ui/issue-39362.stderr
rename to src/test/ui/issues/issue-39362.stderr
diff --git a/src/test/ui/issue-39388.rs b/src/test/ui/issues/issue-39388.rs
similarity index 100%
rename from src/test/ui/issue-39388.rs
rename to src/test/ui/issues/issue-39388.rs
diff --git a/src/test/ui/issue-39388.stderr b/src/test/ui/issues/issue-39388.stderr
similarity index 100%
rename from src/test/ui/issue-39388.stderr
rename to src/test/ui/issues/issue-39388.stderr
diff --git a/src/test/ui/issue-39404.rs b/src/test/ui/issues/issue-39404.rs
similarity index 100%
rename from src/test/ui/issue-39404.rs
rename to src/test/ui/issues/issue-39404.rs
diff --git a/src/test/ui/issue-39404.stderr b/src/test/ui/issues/issue-39404.stderr
similarity index 100%
rename from src/test/ui/issue-39404.stderr
rename to src/test/ui/issues/issue-39404.stderr
diff --git a/src/test/ui/issue-39559-2.rs b/src/test/ui/issues/issue-39559-2.rs
similarity index 100%
rename from src/test/ui/issue-39559-2.rs
rename to src/test/ui/issues/issue-39559-2.rs
diff --git a/src/test/ui/issue-39559-2.stderr b/src/test/ui/issues/issue-39559-2.stderr
similarity index 100%
rename from src/test/ui/issue-39559-2.stderr
rename to src/test/ui/issues/issue-39559-2.stderr
diff --git a/src/test/ui/issue-39559.rs b/src/test/ui/issues/issue-39559.rs
similarity index 100%
rename from src/test/ui/issue-39559.rs
rename to src/test/ui/issues/issue-39559.rs
diff --git a/src/test/ui/issue-39559.stderr b/src/test/ui/issues/issue-39559.stderr
similarity index 100%
rename from src/test/ui/issue-39559.stderr
rename to src/test/ui/issues/issue-39559.stderr
diff --git a/src/test/ui/issue-39616.rs b/src/test/ui/issues/issue-39616.rs
similarity index 100%
rename from src/test/ui/issue-39616.rs
rename to src/test/ui/issues/issue-39616.rs
diff --git a/src/test/ui/issue-39616.stderr b/src/test/ui/issues/issue-39616.stderr
similarity index 100%
rename from src/test/ui/issue-39616.stderr
rename to src/test/ui/issues/issue-39616.stderr
diff --git a/src/test/ui/issue-39687.rs b/src/test/ui/issues/issue-39687.rs
similarity index 100%
rename from src/test/ui/issue-39687.rs
rename to src/test/ui/issues/issue-39687.rs
diff --git a/src/test/ui/issue-39687.stderr b/src/test/ui/issues/issue-39687.stderr
similarity index 100%
rename from src/test/ui/issue-39687.stderr
rename to src/test/ui/issues/issue-39687.stderr
diff --git a/src/test/ui/issue-3973.rs b/src/test/ui/issues/issue-3973.rs
similarity index 100%
rename from src/test/ui/issue-3973.rs
rename to src/test/ui/issues/issue-3973.rs
diff --git a/src/test/ui/issue-3973.stderr b/src/test/ui/issues/issue-3973.stderr
similarity index 100%
rename from src/test/ui/issue-3973.stderr
rename to src/test/ui/issues/issue-3973.stderr
diff --git a/src/test/ui/issue-39848.rs b/src/test/ui/issues/issue-39848.rs
similarity index 100%
rename from src/test/ui/issue-39848.rs
rename to src/test/ui/issues/issue-39848.rs
diff --git a/src/test/ui/issue-39848.stderr b/src/test/ui/issues/issue-39848.stderr
similarity index 100%
rename from src/test/ui/issue-39848.stderr
rename to src/test/ui/issues/issue-39848.stderr
diff --git a/src/test/ui/issue-3993.rs b/src/test/ui/issues/issue-3993.rs
similarity index 100%
rename from src/test/ui/issue-3993.rs
rename to src/test/ui/issues/issue-3993.rs
diff --git a/src/test/ui/issue-3993.stderr b/src/test/ui/issues/issue-3993.stderr
similarity index 100%
rename from src/test/ui/issue-3993.stderr
rename to src/test/ui/issues/issue-3993.stderr
diff --git a/src/test/ui/issue-39970.rs b/src/test/ui/issues/issue-39970.rs
similarity index 100%
rename from src/test/ui/issue-39970.rs
rename to src/test/ui/issues/issue-39970.rs
diff --git a/src/test/ui/issue-39970.stderr b/src/test/ui/issues/issue-39970.stderr
similarity index 100%
rename from src/test/ui/issue-39970.stderr
rename to src/test/ui/issues/issue-39970.stderr
diff --git a/src/test/ui/issue-39974.rs b/src/test/ui/issues/issue-39974.rs
similarity index 100%
rename from src/test/ui/issue-39974.rs
rename to src/test/ui/issues/issue-39974.rs
diff --git a/src/test/ui/issue-39974.stderr b/src/test/ui/issues/issue-39974.stderr
similarity index 100%
rename from src/test/ui/issue-39974.stderr
rename to src/test/ui/issues/issue-39974.stderr
diff --git a/src/test/ui/issue-40000.rs b/src/test/ui/issues/issue-40000.rs
similarity index 100%
rename from src/test/ui/issue-40000.rs
rename to src/test/ui/issues/issue-40000.rs
diff --git a/src/test/ui/issue-40000.stderr b/src/test/ui/issues/issue-40000.stderr
similarity index 100%
rename from src/test/ui/issue-40000.stderr
rename to src/test/ui/issues/issue-40000.stderr
diff --git a/src/test/ui/issue-40288-2.nll.stderr b/src/test/ui/issues/issue-40288-2.nll.stderr
similarity index 100%
rename from src/test/ui/issue-40288-2.nll.stderr
rename to src/test/ui/issues/issue-40288-2.nll.stderr
diff --git a/src/test/ui/issue-40288-2.rs b/src/test/ui/issues/issue-40288-2.rs
similarity index 100%
rename from src/test/ui/issue-40288-2.rs
rename to src/test/ui/issues/issue-40288-2.rs
diff --git a/src/test/ui/issue-40288-2.stderr b/src/test/ui/issues/issue-40288-2.stderr
similarity index 100%
rename from src/test/ui/issue-40288-2.stderr
rename to src/test/ui/issues/issue-40288-2.stderr
diff --git a/src/test/ui/issue-40288.nll.stderr b/src/test/ui/issues/issue-40288.nll.stderr
similarity index 100%
rename from src/test/ui/issue-40288.nll.stderr
rename to src/test/ui/issues/issue-40288.nll.stderr
diff --git a/src/test/ui/issue-40288.rs b/src/test/ui/issues/issue-40288.rs
similarity index 100%
rename from src/test/ui/issue-40288.rs
rename to src/test/ui/issues/issue-40288.rs
diff --git a/src/test/ui/issue-40288.stderr b/src/test/ui/issues/issue-40288.stderr
similarity index 100%
rename from src/test/ui/issue-40288.stderr
rename to src/test/ui/issues/issue-40288.stderr
diff --git a/src/test/ui/issue-40350.rs b/src/test/ui/issues/issue-40350.rs
similarity index 100%
rename from src/test/ui/issue-40350.rs
rename to src/test/ui/issues/issue-40350.rs
diff --git a/src/test/ui/issue-40350.stderr b/src/test/ui/issues/issue-40350.stderr
similarity index 100%
rename from src/test/ui/issue-40350.stderr
rename to src/test/ui/issues/issue-40350.stderr
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr
new file mode 100644
index 0000000..9020d37
--- /dev/null
+++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr
@@ -0,0 +1,12 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-40402-1.rs:19:13
+ |
+LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content
+ | ^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&f.v[0]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-1.rs b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
similarity index 100%
rename from src/test/ui/issue-40402-ref-hints/issue-40402-1.rs
rename to src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.rs
diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr
similarity index 100%
rename from src/test/ui/issue-40402-ref-hints/issue-40402-1.stderr
rename to src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.stderr
diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr
new file mode 100644
index 0000000..a80e9a5
--- /dev/null
+++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr
@@ -0,0 +1,20 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/issue-40402-2.rs:15:18
+ |
+LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
+ | - - ^^^^
+ | | | |
+ | | | cannot move out of borrowed content
+ | | | help: consider borrowing here: `&x[0]`
+ | | ...and here
+ | data moved here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/issue-40402-2.rs:15:10
+ |
+LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content
+ | ^ ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-2.rs b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs
similarity index 100%
rename from src/test/ui/issue-40402-ref-hints/issue-40402-2.rs
rename to src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.rs
diff --git a/src/test/ui/issue-40402-ref-hints/issue-40402-2.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr
similarity index 100%
rename from src/test/ui/issue-40402-ref-hints/issue-40402-2.stderr
rename to src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.stderr
diff --git a/src/test/ui/issues/issue-40510-1.nll.stderr b/src/test/ui/issues/issue-40510-1.nll.stderr
new file mode 100644
index 0000000..3a579c0
--- /dev/null
+++ b/src/test/ui/issues/issue-40510-1.nll.stderr
@@ -0,0 +1,15 @@
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-40510-1.rs:18:9
+ |
+LL | || {
+ | --
+ | ||
+ | |return type of closure is &'2 mut std::boxed::Box<()>
+ | lifetime `'1` represents this closure's body
+LL | &mut x
+ | ^^^^^^ returning this value requires that `'1` must outlive `'2`
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-40510-1.rs b/src/test/ui/issues/issue-40510-1.rs
similarity index 100%
rename from src/test/ui/issue-40510-1.rs
rename to src/test/ui/issues/issue-40510-1.rs
diff --git a/src/test/ui/issue-40510-1.stderr b/src/test/ui/issues/issue-40510-1.stderr
similarity index 100%
rename from src/test/ui/issue-40510-1.stderr
rename to src/test/ui/issues/issue-40510-1.stderr
diff --git a/src/test/ui/issue-40510-2.rs b/src/test/ui/issues/issue-40510-2.rs
similarity index 100%
rename from src/test/ui/issue-40510-2.rs
rename to src/test/ui/issues/issue-40510-2.rs
diff --git a/src/test/ui/issue-40510-2.stderr b/src/test/ui/issues/issue-40510-2.stderr
similarity index 100%
rename from src/test/ui/issue-40510-2.stderr
rename to src/test/ui/issues/issue-40510-2.stderr
diff --git a/src/test/ui/issues/issue-40510-3.nll.stderr b/src/test/ui/issues/issue-40510-3.nll.stderr
new file mode 100644
index 0000000..84ab2a8
--- /dev/null
+++ b/src/test/ui/issues/issue-40510-3.nll.stderr
@@ -0,0 +1,17 @@
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-40510-3.rs:18:9
+ |
+LL | || {
+ | --
+ | ||
+ | |return type of closure is [closure@$DIR/issue-40510-3.rs:18:9: 20:10 x:&'2 mut std::vec::Vec<()>]
+ | lifetime `'1` represents this closure's body
+LL | / || {
+LL | | x.push(())
+LL | | }
+ | |_________^ returning this value requires that `'1` must outlive `'2`
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-40510-3.rs b/src/test/ui/issues/issue-40510-3.rs
similarity index 100%
rename from src/test/ui/issue-40510-3.rs
rename to src/test/ui/issues/issue-40510-3.rs
diff --git a/src/test/ui/issue-40510-3.stderr b/src/test/ui/issues/issue-40510-3.stderr
similarity index 100%
rename from src/test/ui/issue-40510-3.stderr
rename to src/test/ui/issues/issue-40510-3.stderr
diff --git a/src/test/ui/issue-40510-4.rs b/src/test/ui/issues/issue-40510-4.rs
similarity index 100%
rename from src/test/ui/issue-40510-4.rs
rename to src/test/ui/issues/issue-40510-4.rs
diff --git a/src/test/ui/issue-40510-4.stderr b/src/test/ui/issues/issue-40510-4.stderr
similarity index 100%
rename from src/test/ui/issue-40510-4.stderr
rename to src/test/ui/issues/issue-40510-4.stderr
diff --git a/src/test/ui/issue-40610.rs b/src/test/ui/issues/issue-40610.rs
similarity index 100%
rename from src/test/ui/issue-40610.rs
rename to src/test/ui/issues/issue-40610.rs
diff --git a/src/test/ui/issue-40610.stderr b/src/test/ui/issues/issue-40610.stderr
similarity index 100%
rename from src/test/ui/issue-40610.stderr
rename to src/test/ui/issues/issue-40610.stderr
diff --git a/src/test/ui/issue-40749.rs b/src/test/ui/issues/issue-40749.rs
similarity index 100%
rename from src/test/ui/issue-40749.rs
rename to src/test/ui/issues/issue-40749.rs
diff --git a/src/test/ui/issue-40749.stderr b/src/test/ui/issues/issue-40749.stderr
similarity index 100%
rename from src/test/ui/issue-40749.stderr
rename to src/test/ui/issues/issue-40749.stderr
diff --git a/src/test/ui/issue-40782.rs b/src/test/ui/issues/issue-40782.rs
similarity index 100%
rename from src/test/ui/issue-40782.rs
rename to src/test/ui/issues/issue-40782.rs
diff --git a/src/test/ui/issue-40782.stderr b/src/test/ui/issues/issue-40782.stderr
similarity index 100%
rename from src/test/ui/issue-40782.stderr
rename to src/test/ui/issues/issue-40782.stderr
diff --git a/src/test/ui/issue-40845.rs b/src/test/ui/issues/issue-40845.rs
similarity index 100%
rename from src/test/ui/issue-40845.rs
rename to src/test/ui/issues/issue-40845.rs
diff --git a/src/test/ui/issue-40845.stderr b/src/test/ui/issues/issue-40845.stderr
similarity index 100%
rename from src/test/ui/issue-40845.stderr
rename to src/test/ui/issues/issue-40845.stderr
diff --git a/src/test/ui/issue-40861.rs b/src/test/ui/issues/issue-40861.rs
similarity index 100%
rename from src/test/ui/issue-40861.rs
rename to src/test/ui/issues/issue-40861.rs
diff --git a/src/test/ui/issue-40861.stderr b/src/test/ui/issues/issue-40861.stderr
similarity index 100%
rename from src/test/ui/issue-40861.stderr
rename to src/test/ui/issues/issue-40861.stderr
diff --git a/src/test/ui/issue-41139.nll.stderr b/src/test/ui/issues/issue-41139.nll.stderr
similarity index 100%
rename from src/test/ui/issue-41139.nll.stderr
rename to src/test/ui/issues/issue-41139.nll.stderr
diff --git a/src/test/ui/issue-41139.rs b/src/test/ui/issues/issue-41139.rs
similarity index 100%
rename from src/test/ui/issue-41139.rs
rename to src/test/ui/issues/issue-41139.rs
diff --git a/src/test/ui/issue-41139.stderr b/src/test/ui/issues/issue-41139.stderr
similarity index 100%
rename from src/test/ui/issue-41139.stderr
rename to src/test/ui/issues/issue-41139.stderr
diff --git a/src/test/ui/issue-41229-ref-str.rs b/src/test/ui/issues/issue-41229-ref-str.rs
similarity index 100%
rename from src/test/ui/issue-41229-ref-str.rs
rename to src/test/ui/issues/issue-41229-ref-str.rs
diff --git a/src/test/ui/issues/issue-41229-ref-str.stderr b/src/test/ui/issues/issue-41229-ref-str.stderr
new file mode 100644
index 0000000..e4a34fd
--- /dev/null
+++ b/src/test/ui/issues/issue-41229-ref-str.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/issue-41229-ref-str.rs:11:28
+ |
+LL | pub fn example(ref s: str) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all function arguments must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-41255.rs b/src/test/ui/issues/issue-41255.rs
similarity index 100%
rename from src/test/ui/issue-41255.rs
rename to src/test/ui/issues/issue-41255.rs
diff --git a/src/test/ui/issue-41255.stderr b/src/test/ui/issues/issue-41255.stderr
similarity index 100%
rename from src/test/ui/issue-41255.stderr
rename to src/test/ui/issues/issue-41255.stderr
diff --git a/src/test/ui/issue-41394.rs b/src/test/ui/issues/issue-41394.rs
similarity index 100%
rename from src/test/ui/issue-41394.rs
rename to src/test/ui/issues/issue-41394.rs
diff --git a/src/test/ui/issue-41394.stderr b/src/test/ui/issues/issue-41394.stderr
similarity index 100%
rename from src/test/ui/issue-41394.stderr
rename to src/test/ui/issues/issue-41394.stderr
diff --git a/src/test/compile-fail/issue-41549.rs b/src/test/ui/issues/issue-41549.rs
similarity index 100%
rename from src/test/compile-fail/issue-41549.rs
rename to src/test/ui/issues/issue-41549.rs
diff --git a/src/test/ui/issues/issue-41549.stderr b/src/test/ui/issues/issue-41549.stderr
new file mode 100644
index 0000000..e536272
--- /dev/null
+++ b/src/test/ui/issues/issue-41549.stderr
@@ -0,0 +1,12 @@
+error[E0326]: implemented const `CONST` has an incompatible type for trait
+ --> $DIR/issue-41549.rs:19:18
+ |
+LL | const CONST: () = (); //~ ERROR incompatible type for trait
+ | ^^ expected u32, found ()
+ |
+ = note: expected type `u32`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0326`.
diff --git a/src/test/ui/issue-41652/auxiliary/issue_41652_b.rs b/src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs
similarity index 100%
rename from src/test/ui/issue-41652/auxiliary/issue_41652_b.rs
rename to src/test/ui/issues/issue-41652/auxiliary/issue_41652_b.rs
diff --git a/src/test/ui/issue-41652/issue_41652.rs b/src/test/ui/issues/issue-41652/issue_41652.rs
similarity index 100%
rename from src/test/ui/issue-41652/issue_41652.rs
rename to src/test/ui/issues/issue-41652/issue_41652.rs
diff --git a/src/test/ui/issue-41652/issue_41652.stderr b/src/test/ui/issues/issue-41652/issue_41652.stderr
similarity index 100%
rename from src/test/ui/issue-41652/issue_41652.stderr
rename to src/test/ui/issues/issue-41652/issue_41652.stderr
diff --git a/src/test/ui/issue-41726.nll.stderr b/src/test/ui/issues/issue-41726.nll.stderr
similarity index 100%
rename from src/test/ui/issue-41726.nll.stderr
rename to src/test/ui/issues/issue-41726.nll.stderr
diff --git a/src/test/ui/issue-41726.rs b/src/test/ui/issues/issue-41726.rs
similarity index 100%
rename from src/test/ui/issue-41726.rs
rename to src/test/ui/issues/issue-41726.rs
diff --git a/src/test/ui/issues/issue-41726.stderr b/src/test/ui/issues/issue-41726.stderr
new file mode 100644
index 0000000..c79196e
--- /dev/null
+++ b/src/test/ui/issues/issue-41726.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable indexed content as mutable
+ --> $DIR/issue-41726.rs:15:9
+ |
+LL | things[src.as_str()].sort(); //~ ERROR cannot borrow immutable
+ | ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
+ |
+ = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<std::string::String, std::vec::Vec<std::string::String>>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/issue-41742.rs b/src/test/ui/issues/issue-41742.rs
similarity index 100%
rename from src/test/ui/issue-41742.rs
rename to src/test/ui/issues/issue-41742.rs
diff --git a/src/test/ui/issue-41742.stderr b/src/test/ui/issues/issue-41742.stderr
similarity index 100%
rename from src/test/ui/issue-41742.stderr
rename to src/test/ui/issues/issue-41742.stderr
diff --git a/src/test/ui/issue-41776.rs b/src/test/ui/issues/issue-41776.rs
similarity index 100%
rename from src/test/ui/issue-41776.rs
rename to src/test/ui/issues/issue-41776.rs
diff --git a/src/test/ui/issue-41776.stderr b/src/test/ui/issues/issue-41776.stderr
similarity index 100%
rename from src/test/ui/issue-41776.stderr
rename to src/test/ui/issues/issue-41776.stderr
diff --git a/src/test/ui/issue-41880.rs b/src/test/ui/issues/issue-41880.rs
similarity index 100%
rename from src/test/ui/issue-41880.rs
rename to src/test/ui/issues/issue-41880.rs
diff --git a/src/test/ui/issue-41880.stderr b/src/test/ui/issues/issue-41880.stderr
similarity index 100%
rename from src/test/ui/issue-41880.stderr
rename to src/test/ui/issues/issue-41880.stderr
diff --git a/src/test/ui/issue-41974.rs b/src/test/ui/issues/issue-41974.rs
similarity index 100%
rename from src/test/ui/issue-41974.rs
rename to src/test/ui/issues/issue-41974.rs
diff --git a/src/test/ui/issue-41974.stderr b/src/test/ui/issues/issue-41974.stderr
similarity index 100%
rename from src/test/ui/issue-41974.stderr
rename to src/test/ui/issues/issue-41974.stderr
diff --git a/src/test/ui/issue-41998.rs b/src/test/ui/issues/issue-41998.rs
similarity index 100%
rename from src/test/ui/issue-41998.rs
rename to src/test/ui/issues/issue-41998.rs
diff --git a/src/test/ui/issue-41998.stderr b/src/test/ui/issues/issue-41998.stderr
similarity index 100%
rename from src/test/ui/issue-41998.stderr
rename to src/test/ui/issues/issue-41998.stderr
diff --git a/src/test/ui/issue-4201.rs b/src/test/ui/issues/issue-4201.rs
similarity index 100%
rename from src/test/ui/issue-4201.rs
rename to src/test/ui/issues/issue-4201.rs
diff --git a/src/test/ui/issue-4201.stderr b/src/test/ui/issues/issue-4201.stderr
similarity index 100%
rename from src/test/ui/issue-4201.stderr
rename to src/test/ui/issues/issue-4201.stderr
diff --git a/src/test/ui/issue-42060.rs b/src/test/ui/issues/issue-42060.rs
similarity index 100%
rename from src/test/ui/issue-42060.rs
rename to src/test/ui/issues/issue-42060.rs
diff --git a/src/test/ui/issue-42060.stderr b/src/test/ui/issues/issue-42060.stderr
similarity index 100%
rename from src/test/ui/issue-42060.stderr
rename to src/test/ui/issues/issue-42060.stderr
diff --git a/src/test/ui/issue-42106.nll.stderr b/src/test/ui/issues/issue-42106.nll.stderr
similarity index 100%
rename from src/test/ui/issue-42106.nll.stderr
rename to src/test/ui/issues/issue-42106.nll.stderr
diff --git a/src/test/ui/issue-42106.rs b/src/test/ui/issues/issue-42106.rs
similarity index 100%
rename from src/test/ui/issue-42106.rs
rename to src/test/ui/issues/issue-42106.rs
diff --git a/src/test/ui/issue-42106.stderr b/src/test/ui/issues/issue-42106.stderr
similarity index 100%
rename from src/test/ui/issue-42106.stderr
rename to src/test/ui/issues/issue-42106.stderr
diff --git a/src/test/ui/issue-42312.rs b/src/test/ui/issues/issue-42312.rs
similarity index 100%
rename from src/test/ui/issue-42312.rs
rename to src/test/ui/issues/issue-42312.rs
diff --git a/src/test/ui/issues/issue-42312.stderr b/src/test/ui/issues/issue-42312.stderr
new file mode 100644
index 0000000..912d791
--- /dev/null
+++ b/src/test/ui/issues/issue-42312.stderr
@@ -0,0 +1,26 @@
+error[E0277]: the size for values of type `<Self as std::ops::Deref>::Target` cannot be known at compilation time
+ --> $DIR/issue-42312.rs:14:29
+ |
+LL | fn baz(_: Self::Target) where Self: Deref {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `<Self as std::ops::Deref>::Target`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where <Self as std::ops::Deref>::Target: std::marker::Sized` bound
+ = note: all function arguments must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `(dyn std::string::ToString + 'static)` cannot be known at compilation time
+ --> $DIR/issue-42312.rs:18:23
+ |
+LL | pub fn f(_: ToString) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn std::string::ToString + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all function arguments must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-42344.nll.stderr b/src/test/ui/issues/issue-42344.nll.stderr
similarity index 100%
rename from src/test/ui/issue-42344.nll.stderr
rename to src/test/ui/issues/issue-42344.nll.stderr
diff --git a/src/test/ui/issue-42344.rs b/src/test/ui/issues/issue-42344.rs
similarity index 100%
rename from src/test/ui/issue-42344.rs
rename to src/test/ui/issues/issue-42344.rs
diff --git a/src/test/ui/issue-42344.stderr b/src/test/ui/issues/issue-42344.stderr
similarity index 100%
rename from src/test/ui/issue-42344.stderr
rename to src/test/ui/issues/issue-42344.stderr
diff --git a/src/test/ui/issue-4265.rs b/src/test/ui/issues/issue-4265.rs
similarity index 100%
rename from src/test/ui/issue-4265.rs
rename to src/test/ui/issues/issue-4265.rs
diff --git a/src/test/ui/issue-4265.stderr b/src/test/ui/issues/issue-4265.stderr
similarity index 100%
rename from src/test/ui/issue-4265.stderr
rename to src/test/ui/issues/issue-4265.stderr
diff --git a/src/test/ui/issue-42755.rs b/src/test/ui/issues/issue-42755.rs
similarity index 100%
rename from src/test/ui/issue-42755.rs
rename to src/test/ui/issues/issue-42755.rs
diff --git a/src/test/ui/issue-42755.stderr b/src/test/ui/issues/issue-42755.stderr
similarity index 100%
rename from src/test/ui/issue-42755.stderr
rename to src/test/ui/issues/issue-42755.stderr
diff --git a/src/test/ui/issue-42796.nll.stderr b/src/test/ui/issues/issue-42796.nll.stderr
similarity index 100%
rename from src/test/ui/issue-42796.nll.stderr
rename to src/test/ui/issues/issue-42796.nll.stderr
diff --git a/src/test/ui/issue-42796.rs b/src/test/ui/issues/issue-42796.rs
similarity index 100%
rename from src/test/ui/issue-42796.rs
rename to src/test/ui/issues/issue-42796.rs
diff --git a/src/test/ui/issue-42796.stderr b/src/test/ui/issues/issue-42796.stderr
similarity index 100%
rename from src/test/ui/issue-42796.stderr
rename to src/test/ui/issues/issue-42796.stderr
diff --git a/src/test/ui/issue-42880.rs b/src/test/ui/issues/issue-42880.rs
similarity index 100%
rename from src/test/ui/issue-42880.rs
rename to src/test/ui/issues/issue-42880.rs
diff --git a/src/test/ui/issue-42880.stderr b/src/test/ui/issues/issue-42880.stderr
similarity index 100%
rename from src/test/ui/issue-42880.stderr
rename to src/test/ui/issues/issue-42880.stderr
diff --git a/src/test/ui/issue-42954.fixed b/src/test/ui/issues/issue-42954.fixed
similarity index 100%
rename from src/test/ui/issue-42954.fixed
rename to src/test/ui/issues/issue-42954.fixed
diff --git a/src/test/ui/issue-42954.rs b/src/test/ui/issues/issue-42954.rs
similarity index 100%
rename from src/test/ui/issue-42954.rs
rename to src/test/ui/issues/issue-42954.rs
diff --git a/src/test/ui/issue-42954.stderr b/src/test/ui/issues/issue-42954.stderr
similarity index 100%
rename from src/test/ui/issue-42954.stderr
rename to src/test/ui/issues/issue-42954.stderr
diff --git a/src/test/ui/issue-43023.rs b/src/test/ui/issues/issue-43023.rs
similarity index 100%
rename from src/test/ui/issue-43023.rs
rename to src/test/ui/issues/issue-43023.rs
diff --git a/src/test/ui/issue-43023.stderr b/src/test/ui/issues/issue-43023.stderr
similarity index 100%
rename from src/test/ui/issue-43023.stderr
rename to src/test/ui/issues/issue-43023.stderr
diff --git a/src/test/ui/issue-43105.rs b/src/test/ui/issues/issue-43105.rs
similarity index 100%
rename from src/test/ui/issue-43105.rs
rename to src/test/ui/issues/issue-43105.rs
diff --git a/src/test/ui/issue-43105.stderr b/src/test/ui/issues/issue-43105.stderr
similarity index 100%
rename from src/test/ui/issue-43105.stderr
rename to src/test/ui/issues/issue-43105.stderr
diff --git a/src/test/ui/issue-43162.rs b/src/test/ui/issues/issue-43162.rs
similarity index 100%
rename from src/test/ui/issue-43162.rs
rename to src/test/ui/issues/issue-43162.rs
diff --git a/src/test/ui/issue-43162.stderr b/src/test/ui/issues/issue-43162.stderr
similarity index 100%
rename from src/test/ui/issue-43162.stderr
rename to src/test/ui/issues/issue-43162.stderr
diff --git a/src/test/ui/issue-43189.rs b/src/test/ui/issues/issue-43189.rs
similarity index 100%
rename from src/test/ui/issue-43189.rs
rename to src/test/ui/issues/issue-43189.rs
diff --git a/src/test/ui/issue-43189.stderr b/src/test/ui/issues/issue-43189.stderr
similarity index 100%
rename from src/test/ui/issue-43189.stderr
rename to src/test/ui/issues/issue-43189.stderr
diff --git a/src/test/ui/issue-43196.rs b/src/test/ui/issues/issue-43196.rs
similarity index 100%
rename from src/test/ui/issue-43196.rs
rename to src/test/ui/issues/issue-43196.rs
diff --git a/src/test/ui/issue-43196.stderr b/src/test/ui/issues/issue-43196.stderr
similarity index 100%
rename from src/test/ui/issue-43196.stderr
rename to src/test/ui/issues/issue-43196.stderr
diff --git a/src/test/ui/issue-4321.rs b/src/test/ui/issues/issue-4321.rs
similarity index 100%
rename from src/test/ui/issue-4321.rs
rename to src/test/ui/issues/issue-4321.rs
diff --git a/src/test/ui/issue-4321.stderr b/src/test/ui/issues/issue-4321.stderr
similarity index 100%
rename from src/test/ui/issue-4321.stderr
rename to src/test/ui/issues/issue-4321.stderr
diff --git a/src/test/ui/issue-43250.rs b/src/test/ui/issues/issue-43250.rs
similarity index 100%
rename from src/test/ui/issue-43250.rs
rename to src/test/ui/issues/issue-43250.rs
diff --git a/src/test/ui/issue-43250.stderr b/src/test/ui/issues/issue-43250.stderr
similarity index 100%
rename from src/test/ui/issue-43250.stderr
rename to src/test/ui/issues/issue-43250.stderr
diff --git a/src/test/ui/issues/issue-4335.nll.stderr b/src/test/ui/issues/issue-4335.nll.stderr
new file mode 100644
index 0000000..a9345e8
--- /dev/null
+++ b/src/test/ui/issues/issue-4335.nll.stderr
@@ -0,0 +1,29 @@
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/issue-4335.rs:16:20
+ |
+LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
+ | - captured outer variable
+LL | id(Box::new(|| *v))
+ | ^^ cannot move out of captured variable in an `FnMut` closure
+
+error[E0597]: `v` does not live long enough
+ --> $DIR/issue-4335.rs:16:21
+ |
+LL | id(Box::new(|| *v))
+ | -- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+...
+LL | }
+ | - `v` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'r as defined on the function body at 15:6...
+ --> $DIR/issue-4335.rs:15:6
+ |
+LL | fn f<'r, T>(v: &'r T) -> Box<FnMut() -> T + 'r> {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0507, E0597.
+For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-4335.rs b/src/test/ui/issues/issue-4335.rs
similarity index 100%
rename from src/test/ui/issue-4335.rs
rename to src/test/ui/issues/issue-4335.rs
diff --git a/src/test/ui/issue-4335.stderr b/src/test/ui/issues/issue-4335.stderr
similarity index 100%
rename from src/test/ui/issue-4335.stderr
rename to src/test/ui/issues/issue-4335.stderr
diff --git a/src/test/ui/issue-43355.rs b/src/test/ui/issues/issue-43355.rs
similarity index 100%
rename from src/test/ui/issue-43355.rs
rename to src/test/ui/issues/issue-43355.rs
diff --git a/src/test/ui/issue-43355.stderr b/src/test/ui/issues/issue-43355.stderr
similarity index 100%
rename from src/test/ui/issue-43355.stderr
rename to src/test/ui/issues/issue-43355.stderr
diff --git a/src/test/ui/issue-43420-no-over-suggest.rs b/src/test/ui/issues/issue-43420-no-over-suggest.rs
similarity index 100%
rename from src/test/ui/issue-43420-no-over-suggest.rs
rename to src/test/ui/issues/issue-43420-no-over-suggest.rs
diff --git a/src/test/ui/issue-43420-no-over-suggest.stderr b/src/test/ui/issues/issue-43420-no-over-suggest.stderr
similarity index 100%
rename from src/test/ui/issue-43420-no-over-suggest.stderr
rename to src/test/ui/issues/issue-43420-no-over-suggest.stderr
diff --git a/src/test/ui/issue-43424.rs b/src/test/ui/issues/issue-43424.rs
similarity index 100%
rename from src/test/ui/issue-43424.rs
rename to src/test/ui/issues/issue-43424.rs
diff --git a/src/test/ui/issue-43424.stderr b/src/test/ui/issues/issue-43424.stderr
similarity index 100%
rename from src/test/ui/issue-43424.stderr
rename to src/test/ui/issues/issue-43424.stderr
diff --git a/src/test/ui/issue-43431.rs b/src/test/ui/issues/issue-43431.rs
similarity index 100%
rename from src/test/ui/issue-43431.rs
rename to src/test/ui/issues/issue-43431.rs
diff --git a/src/test/ui/issue-43431.stderr b/src/test/ui/issues/issue-43431.stderr
similarity index 100%
rename from src/test/ui/issue-43431.stderr
rename to src/test/ui/issues/issue-43431.stderr
diff --git a/src/test/ui/issue-4366-2.rs b/src/test/ui/issues/issue-4366-2.rs
similarity index 100%
rename from src/test/ui/issue-4366-2.rs
rename to src/test/ui/issues/issue-4366-2.rs
diff --git a/src/test/ui/issue-4366-2.stderr b/src/test/ui/issues/issue-4366-2.stderr
similarity index 100%
rename from src/test/ui/issue-4366-2.stderr
rename to src/test/ui/issues/issue-4366-2.stderr
diff --git a/src/test/ui/issue-4366.rs b/src/test/ui/issues/issue-4366.rs
similarity index 100%
rename from src/test/ui/issue-4366.rs
rename to src/test/ui/issues/issue-4366.rs
diff --git a/src/test/ui/issue-4366.stderr b/src/test/ui/issues/issue-4366.stderr
similarity index 100%
rename from src/test/ui/issue-4366.stderr
rename to src/test/ui/issues/issue-4366.stderr
diff --git a/src/test/ui/issue-43733.rs b/src/test/ui/issues/issue-43733.rs
similarity index 100%
rename from src/test/ui/issue-43733.rs
rename to src/test/ui/issues/issue-43733.rs
diff --git a/src/test/ui/issue-43733.stderr b/src/test/ui/issues/issue-43733.stderr
similarity index 100%
rename from src/test/ui/issue-43733.stderr
rename to src/test/ui/issues/issue-43733.stderr
diff --git a/src/test/ui/issue-43784-associated-type.rs b/src/test/ui/issues/issue-43784-associated-type.rs
similarity index 100%
rename from src/test/ui/issue-43784-associated-type.rs
rename to src/test/ui/issues/issue-43784-associated-type.rs
diff --git a/src/test/ui/issue-43784-associated-type.stderr b/src/test/ui/issues/issue-43784-associated-type.stderr
similarity index 100%
rename from src/test/ui/issue-43784-associated-type.stderr
rename to src/test/ui/issues/issue-43784-associated-type.stderr
diff --git a/src/test/ui/issue-43784-supertrait.rs b/src/test/ui/issues/issue-43784-supertrait.rs
similarity index 100%
rename from src/test/ui/issue-43784-supertrait.rs
rename to src/test/ui/issues/issue-43784-supertrait.rs
diff --git a/src/test/ui/issue-43784-supertrait.stderr b/src/test/ui/issues/issue-43784-supertrait.stderr
similarity index 100%
rename from src/test/ui/issue-43784-supertrait.stderr
rename to src/test/ui/issues/issue-43784-supertrait.stderr
diff --git a/src/test/ui/issue-43806.rs b/src/test/ui/issues/issue-43806.rs
similarity index 100%
rename from src/test/ui/issue-43806.rs
rename to src/test/ui/issues/issue-43806.rs
diff --git a/src/test/ui/issue-43925.rs b/src/test/ui/issues/issue-43925.rs
similarity index 100%
rename from src/test/ui/issue-43925.rs
rename to src/test/ui/issues/issue-43925.rs
diff --git a/src/test/ui/issue-43925.stderr b/src/test/ui/issues/issue-43925.stderr
similarity index 100%
rename from src/test/ui/issue-43925.stderr
rename to src/test/ui/issues/issue-43925.stderr
diff --git a/src/test/ui/issue-43926.rs b/src/test/ui/issues/issue-43926.rs
similarity index 100%
rename from src/test/ui/issue-43926.rs
rename to src/test/ui/issues/issue-43926.rs
diff --git a/src/test/ui/issue-43926.stderr b/src/test/ui/issues/issue-43926.stderr
similarity index 100%
rename from src/test/ui/issue-43926.stderr
rename to src/test/ui/issues/issue-43926.stderr
diff --git a/src/test/ui/issue-43988.rs b/src/test/ui/issues/issue-43988.rs
similarity index 100%
rename from src/test/ui/issue-43988.rs
rename to src/test/ui/issues/issue-43988.rs
diff --git a/src/test/ui/issue-43988.stderr b/src/test/ui/issues/issue-43988.stderr
similarity index 100%
rename from src/test/ui/issue-43988.stderr
rename to src/test/ui/issues/issue-43988.stderr
diff --git a/src/test/ui/issue-44021.rs b/src/test/ui/issues/issue-44021.rs
similarity index 100%
rename from src/test/ui/issue-44021.rs
rename to src/test/ui/issues/issue-44021.rs
diff --git a/src/test/ui/issue-44021.stderr b/src/test/ui/issues/issue-44021.stderr
similarity index 100%
rename from src/test/ui/issue-44021.stderr
rename to src/test/ui/issues/issue-44021.stderr
diff --git a/src/test/ui/issue-44023.rs b/src/test/ui/issues/issue-44023.rs
similarity index 100%
rename from src/test/ui/issue-44023.rs
rename to src/test/ui/issues/issue-44023.rs
diff --git a/src/test/ui/issue-44023.stderr b/src/test/ui/issues/issue-44023.stderr
similarity index 100%
rename from src/test/ui/issue-44023.stderr
rename to src/test/ui/issues/issue-44023.stderr
diff --git a/src/test/ui/issue-44078.rs b/src/test/ui/issues/issue-44078.rs
similarity index 100%
rename from src/test/ui/issue-44078.rs
rename to src/test/ui/issues/issue-44078.rs
diff --git a/src/test/ui/issue-44078.stderr b/src/test/ui/issues/issue-44078.stderr
similarity index 100%
rename from src/test/ui/issue-44078.stderr
rename to src/test/ui/issues/issue-44078.stderr
diff --git a/src/test/ui/issue-44239.rs b/src/test/ui/issues/issue-44239.rs
similarity index 100%
rename from src/test/ui/issue-44239.rs
rename to src/test/ui/issues/issue-44239.rs
diff --git a/src/test/ui/issue-44239.stderr b/src/test/ui/issues/issue-44239.stderr
similarity index 100%
rename from src/test/ui/issue-44239.stderr
rename to src/test/ui/issues/issue-44239.stderr
diff --git a/src/test/ui/issue-44373.rs b/src/test/ui/issues/issue-44373.rs
similarity index 100%
rename from src/test/ui/issue-44373.rs
rename to src/test/ui/issues/issue-44373.rs
diff --git a/src/test/ui/issue-44373.stderr b/src/test/ui/issues/issue-44373.stderr
similarity index 100%
rename from src/test/ui/issue-44373.stderr
rename to src/test/ui/issues/issue-44373.stderr
diff --git a/src/test/ui/issue-44406.rs b/src/test/ui/issues/issue-44406.rs
similarity index 100%
rename from src/test/ui/issue-44406.rs
rename to src/test/ui/issues/issue-44406.rs
diff --git a/src/test/ui/issue-44406.stderr b/src/test/ui/issues/issue-44406.stderr
similarity index 100%
rename from src/test/ui/issue-44406.stderr
rename to src/test/ui/issues/issue-44406.stderr
diff --git a/src/test/ui/issue-44415.rs b/src/test/ui/issues/issue-44415.rs
similarity index 100%
rename from src/test/ui/issue-44415.rs
rename to src/test/ui/issues/issue-44415.rs
diff --git a/src/test/ui/issue-44415.stderr b/src/test/ui/issues/issue-44415.stderr
similarity index 100%
rename from src/test/ui/issue-44415.stderr
rename to src/test/ui/issues/issue-44415.stderr
diff --git a/src/test/ui/issue-45087-unreachable-unsafe.rs b/src/test/ui/issues/issue-45087-unreachable-unsafe.rs
similarity index 100%
rename from src/test/ui/issue-45087-unreachable-unsafe.rs
rename to src/test/ui/issues/issue-45087-unreachable-unsafe.rs
diff --git a/src/test/ui/issue-45087-unreachable-unsafe.stderr b/src/test/ui/issues/issue-45087-unreachable-unsafe.stderr
similarity index 100%
rename from src/test/ui/issue-45087-unreachable-unsafe.stderr
rename to src/test/ui/issues/issue-45087-unreachable-unsafe.stderr
diff --git a/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.rs b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.rs
similarity index 100%
rename from src/test/ui/issue-45107-unnecessary-unsafe-in-closure.rs
rename to src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.rs
diff --git a/src/test/ui/issue-45107-unnecessary-unsafe-in-closure.stderr b/src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr
similarity index 100%
rename from src/test/ui/issue-45107-unnecessary-unsafe-in-closure.stderr
rename to src/test/ui/issues/issue-45107-unnecessary-unsafe-in-closure.stderr
diff --git a/src/test/ui/issue-45157.rs b/src/test/ui/issues/issue-45157.rs
similarity index 100%
rename from src/test/ui/issue-45157.rs
rename to src/test/ui/issues/issue-45157.rs
diff --git a/src/test/ui/issue-45157.stderr b/src/test/ui/issues/issue-45157.stderr
similarity index 100%
rename from src/test/ui/issue-45157.stderr
rename to src/test/ui/issues/issue-45157.stderr
diff --git a/src/test/ui/issue-4517.rs b/src/test/ui/issues/issue-4517.rs
similarity index 100%
rename from src/test/ui/issue-4517.rs
rename to src/test/ui/issues/issue-4517.rs
diff --git a/src/test/ui/issue-4517.stderr b/src/test/ui/issues/issue-4517.stderr
similarity index 100%
rename from src/test/ui/issue-4517.stderr
rename to src/test/ui/issues/issue-4517.stderr
diff --git a/src/test/ui/issue-45199.ast.nll.stderr b/src/test/ui/issues/issue-45199.ast.nll.stderr
similarity index 100%
rename from src/test/ui/issue-45199.ast.nll.stderr
rename to src/test/ui/issues/issue-45199.ast.nll.stderr
diff --git a/src/test/ui/issue-45199.ast.stderr b/src/test/ui/issues/issue-45199.ast.stderr
similarity index 100%
rename from src/test/ui/issue-45199.ast.stderr
rename to src/test/ui/issues/issue-45199.ast.stderr
diff --git a/src/test/ui/issue-45199.mir.stderr b/src/test/ui/issues/issue-45199.mir.stderr
similarity index 100%
rename from src/test/ui/issue-45199.mir.stderr
rename to src/test/ui/issues/issue-45199.mir.stderr
diff --git a/src/test/ui/issue-45199.rs b/src/test/ui/issues/issue-45199.rs
similarity index 100%
rename from src/test/ui/issue-45199.rs
rename to src/test/ui/issues/issue-45199.rs
diff --git a/src/test/ui/issue-45296.rs b/src/test/ui/issues/issue-45296.rs
similarity index 100%
rename from src/test/ui/issue-45296.rs
rename to src/test/ui/issues/issue-45296.rs
diff --git a/src/test/ui/issue-45296.stderr b/src/test/ui/issues/issue-45296.stderr
similarity index 100%
rename from src/test/ui/issue-45296.stderr
rename to src/test/ui/issues/issue-45296.stderr
diff --git a/src/test/ui/issue-45562.fixed b/src/test/ui/issues/issue-45562.fixed
similarity index 100%
rename from src/test/ui/issue-45562.fixed
rename to src/test/ui/issues/issue-45562.fixed
diff --git a/src/test/ui/issue-45562.rs b/src/test/ui/issues/issue-45562.rs
similarity index 100%
rename from src/test/ui/issue-45562.rs
rename to src/test/ui/issues/issue-45562.rs
diff --git a/src/test/ui/issue-45562.stderr b/src/test/ui/issues/issue-45562.stderr
similarity index 100%
rename from src/test/ui/issue-45562.stderr
rename to src/test/ui/issues/issue-45562.stderr
diff --git a/src/test/ui/issue-45696-long-live-borrows-in-boxes.rs b/src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs
similarity index 100%
rename from src/test/ui/issue-45696-long-live-borrows-in-boxes.rs
rename to src/test/ui/issues/issue-45696-long-live-borrows-in-boxes.rs
diff --git a/src/test/ui/issue-45696-no-variant-box-recur.rs b/src/test/ui/issues/issue-45696-no-variant-box-recur.rs
similarity index 100%
rename from src/test/ui/issue-45696-no-variant-box-recur.rs
rename to src/test/ui/issues/issue-45696-no-variant-box-recur.rs
diff --git a/src/test/ui/issue-45696-scribble-on-boxed-borrow.ast.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr
similarity index 100%
rename from src/test/ui/issue-45696-scribble-on-boxed-borrow.ast.stderr
rename to src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.ast.stderr
diff --git a/src/test/ui/issue-45696-scribble-on-boxed-borrow.migrate.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr
similarity index 100%
rename from src/test/ui/issue-45696-scribble-on-boxed-borrow.migrate.stderr
rename to src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.migrate.stderr
diff --git a/src/test/ui/issue-45696-scribble-on-boxed-borrow.nll.stderr b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr
similarity index 100%
rename from src/test/ui/issue-45696-scribble-on-boxed-borrow.nll.stderr
rename to src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.nll.stderr
diff --git a/src/test/ui/issue-45696-scribble-on-boxed-borrow.rs b/src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs
similarity index 100%
rename from src/test/ui/issue-45696-scribble-on-boxed-borrow.rs
rename to src/test/ui/issues/issue-45696-scribble-on-boxed-borrow.rs
diff --git a/src/test/ui/issue-45697-1.rs b/src/test/ui/issues/issue-45697-1.rs
similarity index 100%
rename from src/test/ui/issue-45697-1.rs
rename to src/test/ui/issues/issue-45697-1.rs
diff --git a/src/test/ui/issue-45697-1.stderr b/src/test/ui/issues/issue-45697-1.stderr
similarity index 100%
rename from src/test/ui/issue-45697-1.stderr
rename to src/test/ui/issues/issue-45697-1.stderr
diff --git a/src/test/ui/issue-45697.rs b/src/test/ui/issues/issue-45697.rs
similarity index 100%
rename from src/test/ui/issue-45697.rs
rename to src/test/ui/issues/issue-45697.rs
diff --git a/src/test/ui/issue-45697.stderr b/src/test/ui/issues/issue-45697.stderr
similarity index 100%
rename from src/test/ui/issue-45697.stderr
rename to src/test/ui/issues/issue-45697.stderr
diff --git a/src/test/ui/issue-45729-unsafe-in-generator.rs b/src/test/ui/issues/issue-45729-unsafe-in-generator.rs
similarity index 100%
rename from src/test/ui/issue-45729-unsafe-in-generator.rs
rename to src/test/ui/issues/issue-45729-unsafe-in-generator.rs
diff --git a/src/test/ui/issue-45729-unsafe-in-generator.stderr b/src/test/ui/issues/issue-45729-unsafe-in-generator.stderr
similarity index 100%
rename from src/test/ui/issue-45729-unsafe-in-generator.stderr
rename to src/test/ui/issues/issue-45729-unsafe-in-generator.stderr
diff --git a/src/test/ui/issue-45730.rs b/src/test/ui/issues/issue-45730.rs
similarity index 100%
rename from src/test/ui/issue-45730.rs
rename to src/test/ui/issues/issue-45730.rs
diff --git a/src/test/ui/issue-45730.stderr b/src/test/ui/issues/issue-45730.stderr
similarity index 100%
rename from src/test/ui/issue-45730.stderr
rename to src/test/ui/issues/issue-45730.stderr
diff --git a/src/test/ui/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed
similarity index 100%
rename from src/test/ui/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed
rename to src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.fixed
diff --git a/src/test/ui/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs
similarity index 100%
rename from src/test/ui/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs
rename to src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.rs
diff --git a/src/test/ui/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr b/src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
similarity index 100%
rename from src/test/ui/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
rename to src/test/ui/issues/issue-45799-bad-extern-crate-rename-suggestion-formatting.stderr
diff --git a/src/test/ui/issue-45801.rs b/src/test/ui/issues/issue-45801.rs
similarity index 100%
rename from src/test/ui/issue-45801.rs
rename to src/test/ui/issues/issue-45801.rs
diff --git a/src/test/ui/issue-45801.stderr b/src/test/ui/issues/issue-45801.stderr
similarity index 100%
rename from src/test/ui/issue-45801.stderr
rename to src/test/ui/issues/issue-45801.stderr
diff --git a/src/test/ui/issue-45965.rs b/src/test/ui/issues/issue-45965.rs
similarity index 100%
rename from src/test/ui/issue-45965.rs
rename to src/test/ui/issues/issue-45965.rs
diff --git a/src/test/ui/issue-45965.stderr b/src/test/ui/issues/issue-45965.stderr
similarity index 100%
rename from src/test/ui/issue-45965.stderr
rename to src/test/ui/issues/issue-45965.stderr
diff --git a/src/test/ui/issue-46023.ast.nll.stderr b/src/test/ui/issues/issue-46023.ast.nll.stderr
similarity index 100%
rename from src/test/ui/issue-46023.ast.nll.stderr
rename to src/test/ui/issues/issue-46023.ast.nll.stderr
diff --git a/src/test/ui/issue-46023.ast.stderr b/src/test/ui/issues/issue-46023.ast.stderr
similarity index 100%
rename from src/test/ui/issue-46023.ast.stderr
rename to src/test/ui/issues/issue-46023.ast.stderr
diff --git a/src/test/ui/issue-46023.mir.stderr b/src/test/ui/issues/issue-46023.mir.stderr
similarity index 100%
rename from src/test/ui/issue-46023.mir.stderr
rename to src/test/ui/issues/issue-46023.mir.stderr
diff --git a/src/test/ui/issue-46023.rs b/src/test/ui/issues/issue-46023.rs
similarity index 100%
rename from src/test/ui/issue-46023.rs
rename to src/test/ui/issues/issue-46023.rs
diff --git a/src/test/ui/issue-46036.rs b/src/test/ui/issues/issue-46036.rs
similarity index 100%
rename from src/test/ui/issue-46036.rs
rename to src/test/ui/issues/issue-46036.rs
diff --git a/src/test/ui/issue-46036.stderr b/src/test/ui/issues/issue-46036.stderr
similarity index 100%
rename from src/test/ui/issue-46036.stderr
rename to src/test/ui/issues/issue-46036.stderr
diff --git a/src/test/ui/issue-46112.rs b/src/test/ui/issues/issue-46112.rs
similarity index 100%
rename from src/test/ui/issue-46112.rs
rename to src/test/ui/issues/issue-46112.rs
diff --git a/src/test/ui/issue-46112.stderr b/src/test/ui/issues/issue-46112.stderr
similarity index 100%
rename from src/test/ui/issue-46112.stderr
rename to src/test/ui/issues/issue-46112.stderr
diff --git a/src/test/ui/issue-46186.rs b/src/test/ui/issues/issue-46186.rs
similarity index 100%
rename from src/test/ui/issue-46186.rs
rename to src/test/ui/issues/issue-46186.rs
diff --git a/src/test/ui/issue-46186.stderr b/src/test/ui/issues/issue-46186.stderr
similarity index 100%
rename from src/test/ui/issue-46186.stderr
rename to src/test/ui/issues/issue-46186.stderr
diff --git a/src/test/ui/issue-46302.rs b/src/test/ui/issues/issue-46302.rs
similarity index 100%
rename from src/test/ui/issue-46302.rs
rename to src/test/ui/issues/issue-46302.rs
diff --git a/src/test/ui/issue-46302.stderr b/src/test/ui/issues/issue-46302.stderr
similarity index 100%
rename from src/test/ui/issue-46302.stderr
rename to src/test/ui/issues/issue-46302.stderr
diff --git a/src/test/ui/issue-46311.rs b/src/test/ui/issues/issue-46311.rs
similarity index 100%
rename from src/test/ui/issue-46311.rs
rename to src/test/ui/issues/issue-46311.rs
diff --git a/src/test/ui/issue-46311.stderr b/src/test/ui/issues/issue-46311.stderr
similarity index 100%
rename from src/test/ui/issue-46311.stderr
rename to src/test/ui/issues/issue-46311.stderr
diff --git a/src/test/ui/issue-46332.rs b/src/test/ui/issues/issue-46332.rs
similarity index 100%
rename from src/test/ui/issue-46332.rs
rename to src/test/ui/issues/issue-46332.rs
diff --git a/src/test/ui/issue-46332.stderr b/src/test/ui/issues/issue-46332.stderr
similarity index 100%
rename from src/test/ui/issue-46332.stderr
rename to src/test/ui/issues/issue-46332.stderr
diff --git a/src/test/ui/issue-46438.rs b/src/test/ui/issues/issue-46438.rs
similarity index 100%
rename from src/test/ui/issue-46438.rs
rename to src/test/ui/issues/issue-46438.rs
diff --git a/src/test/ui/issue-46438.stderr b/src/test/ui/issues/issue-46438.stderr
similarity index 100%
rename from src/test/ui/issue-46438.stderr
rename to src/test/ui/issues/issue-46438.stderr
diff --git a/src/test/ui/issue-46471-1.rs b/src/test/ui/issues/issue-46471-1.rs
similarity index 100%
rename from src/test/ui/issue-46471-1.rs
rename to src/test/ui/issues/issue-46471-1.rs
diff --git a/src/test/ui/issue-46471-1.stderr b/src/test/ui/issues/issue-46471-1.stderr
similarity index 100%
rename from src/test/ui/issue-46471-1.stderr
rename to src/test/ui/issues/issue-46471-1.stderr
diff --git a/src/test/ui/issue-46471.rs b/src/test/ui/issues/issue-46471.rs
similarity index 100%
rename from src/test/ui/issue-46471.rs
rename to src/test/ui/issues/issue-46471.rs
diff --git a/src/test/ui/issue-46471.stderr b/src/test/ui/issues/issue-46471.stderr
similarity index 100%
rename from src/test/ui/issue-46471.stderr
rename to src/test/ui/issues/issue-46471.stderr
diff --git a/src/test/ui/issue-46472.rs b/src/test/ui/issues/issue-46472.rs
similarity index 100%
rename from src/test/ui/issue-46472.rs
rename to src/test/ui/issues/issue-46472.rs
diff --git a/src/test/ui/issue-46472.stderr b/src/test/ui/issues/issue-46472.stderr
similarity index 100%
rename from src/test/ui/issue-46472.stderr
rename to src/test/ui/issues/issue-46472.stderr
diff --git a/src/test/ui/issue-46576.rs b/src/test/ui/issues/issue-46576.rs
similarity index 100%
rename from src/test/ui/issue-46576.rs
rename to src/test/ui/issues/issue-46576.rs
diff --git a/src/test/ui/issue-46576.stderr b/src/test/ui/issues/issue-46576.stderr
similarity index 100%
rename from src/test/ui/issue-46576.stderr
rename to src/test/ui/issues/issue-46576.stderr
diff --git a/src/test/ui/issue-46604.ast.nll.stderr b/src/test/ui/issues/issue-46604.ast.nll.stderr
similarity index 100%
rename from src/test/ui/issue-46604.ast.nll.stderr
rename to src/test/ui/issues/issue-46604.ast.nll.stderr
diff --git a/src/test/ui/issue-46604.ast.stderr b/src/test/ui/issues/issue-46604.ast.stderr
similarity index 100%
rename from src/test/ui/issue-46604.ast.stderr
rename to src/test/ui/issues/issue-46604.ast.stderr
diff --git a/src/test/ui/issue-46604.mir.stderr b/src/test/ui/issues/issue-46604.mir.stderr
similarity index 100%
rename from src/test/ui/issue-46604.mir.stderr
rename to src/test/ui/issues/issue-46604.mir.stderr
diff --git a/src/test/ui/issue-46604.rs b/src/test/ui/issues/issue-46604.rs
similarity index 100%
rename from src/test/ui/issue-46604.rs
rename to src/test/ui/issues/issue-46604.rs
diff --git a/src/test/ui/issue-46756-consider-borrowing-cast-or-binexpr.fixed b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed
similarity index 100%
rename from src/test/ui/issue-46756-consider-borrowing-cast-or-binexpr.fixed
rename to src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed
diff --git a/src/test/ui/issue-46756-consider-borrowing-cast-or-binexpr.rs b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs
similarity index 100%
rename from src/test/ui/issue-46756-consider-borrowing-cast-or-binexpr.rs
rename to src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs
diff --git a/src/test/ui/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr
similarity index 100%
rename from src/test/ui/issue-46756-consider-borrowing-cast-or-binexpr.stderr
rename to src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr
diff --git a/src/test/ui/issue-46771.rs b/src/test/ui/issues/issue-46771.rs
similarity index 100%
rename from src/test/ui/issue-46771.rs
rename to src/test/ui/issues/issue-46771.rs
diff --git a/src/test/ui/issue-46771.stderr b/src/test/ui/issues/issue-46771.stderr
similarity index 100%
rename from src/test/ui/issue-46771.stderr
rename to src/test/ui/issues/issue-46771.stderr
diff --git a/src/test/ui/issue-46843.rs b/src/test/ui/issues/issue-46843.rs
similarity index 100%
rename from src/test/ui/issue-46843.rs
rename to src/test/ui/issues/issue-46843.rs
diff --git a/src/test/ui/issue-46843.stderr b/src/test/ui/issues/issue-46843.stderr
similarity index 100%
rename from src/test/ui/issue-46843.stderr
rename to src/test/ui/issues/issue-46843.stderr
diff --git a/src/test/ui/issue-46983.rs b/src/test/ui/issues/issue-46983.rs
similarity index 100%
rename from src/test/ui/issue-46983.rs
rename to src/test/ui/issues/issue-46983.rs
diff --git a/src/test/ui/issue-46983.stderr b/src/test/ui/issues/issue-46983.stderr
similarity index 100%
rename from src/test/ui/issue-46983.stderr
rename to src/test/ui/issues/issue-46983.stderr
diff --git a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs
similarity index 100%
rename from src/test/ui/issue-47073-zero-padded-tuple-struct-indices.rs
rename to src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.rs
diff --git a/src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr b/src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr
similarity index 100%
rename from src/test/ui/issue-47073-zero-padded-tuple-struct-indices.stderr
rename to src/test/ui/issues/issue-47073-zero-padded-tuple-struct-indices.stderr
diff --git a/src/test/ui/issue-47094.rs b/src/test/ui/issues/issue-47094.rs
similarity index 100%
rename from src/test/ui/issue-47094.rs
rename to src/test/ui/issues/issue-47094.rs
diff --git a/src/test/ui/issue-47094.stderr b/src/test/ui/issues/issue-47094.stderr
similarity index 100%
rename from src/test/ui/issue-47094.stderr
rename to src/test/ui/issues/issue-47094.stderr
diff --git a/src/test/ui/issue-47184.rs b/src/test/ui/issues/issue-47184.rs
similarity index 100%
rename from src/test/ui/issue-47184.rs
rename to src/test/ui/issues/issue-47184.rs
diff --git a/src/test/ui/issue-47184.stderr b/src/test/ui/issues/issue-47184.stderr
similarity index 100%
rename from src/test/ui/issue-47184.stderr
rename to src/test/ui/issues/issue-47184.stderr
diff --git a/src/test/ui/issue-47309.rs b/src/test/ui/issues/issue-47309.rs
similarity index 100%
rename from src/test/ui/issue-47309.rs
rename to src/test/ui/issues/issue-47309.rs
diff --git a/src/test/ui/issue-4736.rs b/src/test/ui/issues/issue-4736.rs
similarity index 100%
rename from src/test/ui/issue-4736.rs
rename to src/test/ui/issues/issue-4736.rs
diff --git a/src/test/ui/issue-4736.stderr b/src/test/ui/issues/issue-4736.stderr
similarity index 100%
rename from src/test/ui/issue-4736.stderr
rename to src/test/ui/issues/issue-4736.stderr
diff --git a/src/test/ui/issue-47377.rs b/src/test/ui/issues/issue-47377.rs
similarity index 100%
rename from src/test/ui/issue-47377.rs
rename to src/test/ui/issues/issue-47377.rs
diff --git a/src/test/ui/issue-47377.stderr b/src/test/ui/issues/issue-47377.stderr
similarity index 100%
rename from src/test/ui/issue-47377.stderr
rename to src/test/ui/issues/issue-47377.stderr
diff --git a/src/test/ui/issue-47380.rs b/src/test/ui/issues/issue-47380.rs
similarity index 100%
rename from src/test/ui/issue-47380.rs
rename to src/test/ui/issues/issue-47380.rs
diff --git a/src/test/ui/issue-47380.stderr b/src/test/ui/issues/issue-47380.stderr
similarity index 100%
rename from src/test/ui/issue-47380.stderr
rename to src/test/ui/issues/issue-47380.stderr
diff --git a/src/test/ui/issue-47412.rs b/src/test/ui/issues/issue-47412.rs
similarity index 100%
rename from src/test/ui/issue-47412.rs
rename to src/test/ui/issues/issue-47412.rs
diff --git a/src/test/ui/issue-47412.stderr b/src/test/ui/issues/issue-47412.stderr
similarity index 100%
rename from src/test/ui/issue-47412.stderr
rename to src/test/ui/issues/issue-47412.stderr
diff --git a/src/test/ui/issue-47511.rs b/src/test/ui/issues/issue-47511.rs
similarity index 100%
rename from src/test/ui/issue-47511.rs
rename to src/test/ui/issues/issue-47511.rs
diff --git a/src/test/ui/issue-47511.stderr b/src/test/ui/issues/issue-47511.stderr
similarity index 100%
rename from src/test/ui/issue-47511.stderr
rename to src/test/ui/issues/issue-47511.stderr
diff --git a/src/test/ui/issue-47623.rs b/src/test/ui/issues/issue-47623.rs
similarity index 100%
rename from src/test/ui/issue-47623.rs
rename to src/test/ui/issues/issue-47623.rs
diff --git a/src/test/ui/issue-47623.stderr b/src/test/ui/issues/issue-47623.stderr
similarity index 100%
rename from src/test/ui/issue-47623.stderr
rename to src/test/ui/issues/issue-47623.stderr
diff --git a/src/test/ui/issue-47646.rs b/src/test/ui/issues/issue-47646.rs
similarity index 100%
rename from src/test/ui/issue-47646.rs
rename to src/test/ui/issues/issue-47646.rs
diff --git a/src/test/ui/issue-47646.stderr b/src/test/ui/issues/issue-47646.stderr
similarity index 100%
rename from src/test/ui/issue-47646.stderr
rename to src/test/ui/issues/issue-47646.stderr
diff --git a/src/test/ui/issue-47706-trait.rs b/src/test/ui/issues/issue-47706-trait.rs
similarity index 100%
rename from src/test/ui/issue-47706-trait.rs
rename to src/test/ui/issues/issue-47706-trait.rs
diff --git a/src/test/ui/issue-47706-trait.stderr b/src/test/ui/issues/issue-47706-trait.stderr
similarity index 100%
rename from src/test/ui/issue-47706-trait.stderr
rename to src/test/ui/issues/issue-47706-trait.stderr
diff --git a/src/test/ui/issue-47706.rs b/src/test/ui/issues/issue-47706.rs
similarity index 100%
rename from src/test/ui/issue-47706.rs
rename to src/test/ui/issues/issue-47706.rs
diff --git a/src/test/ui/issue-47706.stderr b/src/test/ui/issues/issue-47706.stderr
similarity index 100%
rename from src/test/ui/issue-47706.stderr
rename to src/test/ui/issues/issue-47706.stderr
diff --git a/src/test/ui/issue-47715.rs b/src/test/ui/issues/issue-47715.rs
similarity index 100%
rename from src/test/ui/issue-47715.rs
rename to src/test/ui/issues/issue-47715.rs
diff --git a/src/test/ui/issue-47715.stderr b/src/test/ui/issues/issue-47715.stderr
similarity index 100%
rename from src/test/ui/issue-47715.stderr
rename to src/test/ui/issues/issue-47715.stderr
diff --git a/src/test/ui/issue-48131.rs b/src/test/ui/issues/issue-48131.rs
similarity index 100%
rename from src/test/ui/issue-48131.rs
rename to src/test/ui/issues/issue-48131.rs
diff --git a/src/test/ui/issue-48131.stderr b/src/test/ui/issues/issue-48131.stderr
similarity index 100%
rename from src/test/ui/issue-48131.stderr
rename to src/test/ui/issues/issue-48131.stderr
diff --git a/src/test/ui/issue-48132.rs b/src/test/ui/issues/issue-48132.rs
similarity index 100%
rename from src/test/ui/issue-48132.rs
rename to src/test/ui/issues/issue-48132.rs
diff --git a/src/test/ui/issue-48179.rs b/src/test/ui/issues/issue-48179.rs
similarity index 100%
rename from src/test/ui/issue-48179.rs
rename to src/test/ui/issues/issue-48179.rs
diff --git a/src/test/ui/issue-48276.rs b/src/test/ui/issues/issue-48276.rs
similarity index 100%
rename from src/test/ui/issue-48276.rs
rename to src/test/ui/issues/issue-48276.rs
diff --git a/src/test/ui/issue-48276.stderr b/src/test/ui/issues/issue-48276.stderr
similarity index 100%
rename from src/test/ui/issue-48276.stderr
rename to src/test/ui/issues/issue-48276.stderr
diff --git a/src/test/ui/issue-48364.rs b/src/test/ui/issues/issue-48364.rs
similarity index 100%
rename from src/test/ui/issue-48364.rs
rename to src/test/ui/issues/issue-48364.rs
diff --git a/src/test/ui/issue-48364.stderr b/src/test/ui/issues/issue-48364.stderr
similarity index 100%
rename from src/test/ui/issue-48364.stderr
rename to src/test/ui/issues/issue-48364.stderr
diff --git a/src/test/ui/issue-48636.fixed b/src/test/ui/issues/issue-48636.fixed
similarity index 100%
rename from src/test/ui/issue-48636.fixed
rename to src/test/ui/issues/issue-48636.fixed
diff --git a/src/test/ui/issue-48636.rs b/src/test/ui/issues/issue-48636.rs
similarity index 100%
rename from src/test/ui/issue-48636.rs
rename to src/test/ui/issues/issue-48636.rs
diff --git a/src/test/ui/issue-48636.stderr b/src/test/ui/issues/issue-48636.stderr
similarity index 100%
rename from src/test/ui/issue-48636.stderr
rename to src/test/ui/issues/issue-48636.stderr
diff --git a/src/test/ui/issue-48728.rs b/src/test/ui/issues/issue-48728.rs
similarity index 100%
rename from src/test/ui/issue-48728.rs
rename to src/test/ui/issues/issue-48728.rs
diff --git a/src/test/ui/issue-48728.stderr b/src/test/ui/issues/issue-48728.stderr
similarity index 100%
rename from src/test/ui/issue-48728.stderr
rename to src/test/ui/issues/issue-48728.stderr
diff --git a/src/test/ui/issue-48803.rs b/src/test/ui/issues/issue-48803.rs
similarity index 100%
rename from src/test/ui/issue-48803.rs
rename to src/test/ui/issues/issue-48803.rs
diff --git a/src/test/ui/issue-48803.stderr b/src/test/ui/issues/issue-48803.stderr
similarity index 100%
rename from src/test/ui/issue-48803.stderr
rename to src/test/ui/issues/issue-48803.stderr
diff --git a/src/test/ui/issue-48838.rs b/src/test/ui/issues/issue-48838.rs
similarity index 100%
rename from src/test/ui/issue-48838.rs
rename to src/test/ui/issues/issue-48838.rs
diff --git a/src/test/ui/issue-48838.stderr b/src/test/ui/issues/issue-48838.stderr
similarity index 100%
rename from src/test/ui/issue-48838.stderr
rename to src/test/ui/issues/issue-48838.stderr
diff --git a/src/test/ui/issue-49040.rs b/src/test/ui/issues/issue-49040.rs
similarity index 100%
rename from src/test/ui/issue-49040.rs
rename to src/test/ui/issues/issue-49040.rs
diff --git a/src/test/ui/issue-49040.stderr b/src/test/ui/issues/issue-49040.stderr
similarity index 100%
rename from src/test/ui/issue-49040.stderr
rename to src/test/ui/issues/issue-49040.stderr
diff --git a/src/test/ui/issues/issue-49074.rs b/src/test/ui/issues/issue-49074.rs
new file mode 100644
index 0000000..d255fac
--- /dev/null
+++ b/src/test/ui/issues/issue-49074.rs
@@ -0,0 +1,23 @@
+// 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.
+
+// Check that unknown attribute error is shown even if there are unresolved macros.
+
+#[marco_use] // typo
+//~^ ERROR The attribute `marco_use` is currently unknown to the compiler
+mod foo {
+ macro_rules! bar {
+ () => ();
+ }
+}
+
+fn main() {
+ bar!();
+}
diff --git a/src/test/ui/issues/issue-49074.stderr b/src/test/ui/issues/issue-49074.stderr
new file mode 100644
index 0000000..888222b
--- /dev/null
+++ b/src/test/ui/issues/issue-49074.stderr
@@ -0,0 +1,11 @@
+error[E0658]: The attribute `marco_use` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/issue-49074.rs:13:1
+ |
+LL | #[marco_use] // typo
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issue-49257.rs b/src/test/ui/issues/issue-49257.rs
similarity index 100%
rename from src/test/ui/issue-49257.rs
rename to src/test/ui/issues/issue-49257.rs
diff --git a/src/test/ui/issue-49257.stderr b/src/test/ui/issues/issue-49257.stderr
similarity index 100%
rename from src/test/ui/issue-49257.stderr
rename to src/test/ui/issues/issue-49257.stderr
diff --git a/src/test/ui/issue-4935.rs b/src/test/ui/issues/issue-4935.rs
similarity index 100%
rename from src/test/ui/issue-4935.rs
rename to src/test/ui/issues/issue-4935.rs
diff --git a/src/test/ui/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr
similarity index 100%
rename from src/test/ui/issue-4935.stderr
rename to src/test/ui/issues/issue-4935.stderr
diff --git a/src/test/ui/issue-49579.rs b/src/test/ui/issues/issue-49579.rs
similarity index 100%
rename from src/test/ui/issue-49579.rs
rename to src/test/ui/issues/issue-49579.rs
diff --git a/src/test/ui/issue-4968.rs b/src/test/ui/issues/issue-4968.rs
similarity index 100%
rename from src/test/ui/issue-4968.rs
rename to src/test/ui/issues/issue-4968.rs
diff --git a/src/test/ui/issue-4968.stderr b/src/test/ui/issues/issue-4968.stderr
similarity index 100%
rename from src/test/ui/issue-4968.stderr
rename to src/test/ui/issues/issue-4968.stderr
diff --git a/src/test/ui/issue-4972.rs b/src/test/ui/issues/issue-4972.rs
similarity index 100%
rename from src/test/ui/issue-4972.rs
rename to src/test/ui/issues/issue-4972.rs
diff --git a/src/test/ui/issue-4972.stderr b/src/test/ui/issues/issue-4972.stderr
similarity index 100%
rename from src/test/ui/issue-4972.stderr
rename to src/test/ui/issues/issue-4972.stderr
diff --git a/src/test/ui/issues/issue-49824.nll.stderr b/src/test/ui/issues/issue-49824.nll.stderr
new file mode 100644
index 0000000..df43158
--- /dev/null
+++ b/src/test/ui/issues/issue-49824.nll.stderr
@@ -0,0 +1,17 @@
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-49824.rs:22:9
+ |
+LL | || {
+ | --
+ | ||
+ | |return type of closure is [closure@$DIR/issue-49824.rs:22:9: 24:10 x:&'2 mut i32]
+ | lifetime `'1` represents this closure's body
+LL | / || {
+LL | | let _y = &mut x;
+LL | | }
+ | |_________^ returning this value requires that `'1` must outlive `'2`
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-49824.rs b/src/test/ui/issues/issue-49824.rs
similarity index 100%
rename from src/test/ui/issue-49824.rs
rename to src/test/ui/issues/issue-49824.rs
diff --git a/src/test/ui/issue-49824.stderr b/src/test/ui/issues/issue-49824.stderr
similarity index 100%
rename from src/test/ui/issue-49824.stderr
rename to src/test/ui/issues/issue-49824.stderr
diff --git a/src/test/ui/issue-49851/compiler-builtins-error.rs b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs
similarity index 100%
rename from src/test/ui/issue-49851/compiler-builtins-error.rs
rename to src/test/ui/issues/issue-49851/compiler-builtins-error.rs
diff --git a/src/test/ui/issue-49851/compiler-builtins-error.stderr b/src/test/ui/issues/issue-49851/compiler-builtins-error.stderr
similarity index 100%
rename from src/test/ui/issue-49851/compiler-builtins-error.stderr
rename to src/test/ui/issues/issue-49851/compiler-builtins-error.stderr
diff --git a/src/test/ui/issue-49934.rs b/src/test/ui/issues/issue-49934.rs
similarity index 100%
rename from src/test/ui/issue-49934.rs
rename to src/test/ui/issues/issue-49934.rs
diff --git a/src/test/ui/issue-49934.stderr b/src/test/ui/issues/issue-49934.stderr
similarity index 100%
rename from src/test/ui/issue-49934.stderr
rename to src/test/ui/issues/issue-49934.stderr
diff --git a/src/test/ui/issue-50187.rs b/src/test/ui/issues/issue-50187.rs
similarity index 100%
rename from src/test/ui/issue-50187.rs
rename to src/test/ui/issues/issue-50187.rs
diff --git a/src/test/compile-fail/issue-50264-inner-deref-trait/option_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs
similarity index 100%
rename from src/test/compile-fail/issue-50264-inner-deref-trait/option_deref.rs
rename to src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.rs
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr
new file mode 100644
index 0000000..a56cd6e
--- /dev/null
+++ b/src/test/ui/issues/issue-50264-inner-deref-trait/option_deref.stderr
@@ -0,0 +1,12 @@
+error[E0599]: no method named `deref` found for type `std::option::Option<{integer}>` in the current scope
+ --> $DIR/option_deref.rs:14:29
+ |
+LL | let _result = &Some(42).deref();
+ | ^^^^^
+ |
+ = note: the method `deref` exists but the following trait bounds were not satisfied:
+ `{integer} : std::ops::Deref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/issue-50264-inner-deref-trait/result_deref.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs
similarity index 100%
rename from src/test/compile-fail/issue-50264-inner-deref-trait/result_deref.rs
rename to src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.rs
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr
new file mode 100644
index 0000000..d3d7c19
--- /dev/null
+++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref.stderr
@@ -0,0 +1,12 @@
+error[E0599]: no method named `deref` found for type `std::result::Result<{integer}, _>` in the current scope
+ --> $DIR/result_deref.rs:14:27
+ |
+LL | let _result = &Ok(42).deref();
+ | ^^^^^
+ |
+ = note: the method `deref` exists but the following trait bounds were not satisfied:
+ `{integer} : std::ops::Deref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/issue-50264-inner-deref-trait/result_deref_err.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs
similarity index 100%
rename from src/test/compile-fail/issue-50264-inner-deref-trait/result_deref_err.rs
rename to src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.rs
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr
new file mode 100644
index 0000000..bf75687
--- /dev/null
+++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_err.stderr
@@ -0,0 +1,13 @@
+error[E0599]: no method named `deref_err` found for type `std::result::Result<_, {integer}>` in the current scope
+ --> $DIR/result_deref_err.rs:14:28
+ |
+LL | let _result = &Err(41).deref_err();
+ | ^^^^^^^^^
+ |
+ = note: the method `deref_err` exists but the following trait bounds were not satisfied:
+ `{integer} : std::ops::Deref`
+ = help: did you mean `deref_ok`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/issue-50264-inner-deref-trait/result_deref_ok.rs b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs
similarity index 100%
rename from src/test/compile-fail/issue-50264-inner-deref-trait/result_deref_ok.rs
rename to src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.rs
diff --git a/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr
new file mode 100644
index 0000000..a77333a
--- /dev/null
+++ b/src/test/ui/issues/issue-50264-inner-deref-trait/result_deref_ok.stderr
@@ -0,0 +1,12 @@
+error[E0599]: no method named `deref_ok` found for type `std::result::Result<{integer}, _>` in the current scope
+ --> $DIR/result_deref_ok.rs:14:27
+ |
+LL | let _result = &Ok(42).deref_ok();
+ | ^^^^^^^^
+ |
+ = note: the method `deref_ok` exists but the following trait bounds were not satisfied:
+ `{integer} : std::ops::Deref`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/issue-50403.rs b/src/test/ui/issues/issue-50403.rs
similarity index 100%
rename from src/test/ui/issue-50403.rs
rename to src/test/ui/issues/issue-50403.rs
diff --git a/src/test/ui/issue-50403.stderr b/src/test/ui/issues/issue-50403.stderr
similarity index 100%
rename from src/test/ui/issue-50403.stderr
rename to src/test/ui/issues/issue-50403.stderr
diff --git a/src/test/ui/issue-50471.rs b/src/test/ui/issues/issue-50471.rs
similarity index 100%
rename from src/test/ui/issue-50471.rs
rename to src/test/ui/issues/issue-50471.rs
diff --git a/src/test/ui/issue-50480.rs b/src/test/ui/issues/issue-50480.rs
similarity index 100%
rename from src/test/ui/issue-50480.rs
rename to src/test/ui/issues/issue-50480.rs
diff --git a/src/test/ui/issue-50480.stderr b/src/test/ui/issues/issue-50480.stderr
similarity index 100%
rename from src/test/ui/issue-50480.stderr
rename to src/test/ui/issues/issue-50480.stderr
diff --git a/src/test/ui/issue-50576.rs b/src/test/ui/issues/issue-50576.rs
similarity index 100%
rename from src/test/ui/issue-50576.rs
rename to src/test/ui/issues/issue-50576.rs
diff --git a/src/test/ui/issue-50576.stderr b/src/test/ui/issues/issue-50576.stderr
similarity index 100%
rename from src/test/ui/issue-50576.stderr
rename to src/test/ui/issues/issue-50576.stderr
diff --git a/src/test/ui/issue-50577.rs b/src/test/ui/issues/issue-50577.rs
similarity index 100%
rename from src/test/ui/issue-50577.rs
rename to src/test/ui/issues/issue-50577.rs
diff --git a/src/test/ui/issue-50577.stderr b/src/test/ui/issues/issue-50577.stderr
similarity index 100%
rename from src/test/ui/issue-50577.stderr
rename to src/test/ui/issues/issue-50577.stderr
diff --git a/src/test/ui/issue-50581.rs b/src/test/ui/issues/issue-50581.rs
similarity index 100%
rename from src/test/ui/issue-50581.rs
rename to src/test/ui/issues/issue-50581.rs
diff --git a/src/test/ui/issue-50581.stderr b/src/test/ui/issues/issue-50581.stderr
similarity index 100%
rename from src/test/ui/issue-50581.stderr
rename to src/test/ui/issues/issue-50581.stderr
diff --git a/src/test/ui/issue-50585.rs b/src/test/ui/issues/issue-50585.rs
similarity index 100%
rename from src/test/ui/issue-50585.rs
rename to src/test/ui/issues/issue-50585.rs
diff --git a/src/test/ui/issue-50585.stderr b/src/test/ui/issues/issue-50585.stderr
similarity index 100%
rename from src/test/ui/issue-50585.stderr
rename to src/test/ui/issues/issue-50585.stderr
diff --git a/src/test/ui/issue-50599.rs b/src/test/ui/issues/issue-50599.rs
similarity index 100%
rename from src/test/ui/issue-50599.rs
rename to src/test/ui/issues/issue-50599.rs
diff --git a/src/test/ui/issue-50599.stderr b/src/test/ui/issues/issue-50599.stderr
similarity index 100%
rename from src/test/ui/issue-50599.stderr
rename to src/test/ui/issues/issue-50599.stderr
diff --git a/src/test/ui/issue-50600.rs b/src/test/ui/issues/issue-50600.rs
similarity index 100%
rename from src/test/ui/issue-50600.rs
rename to src/test/ui/issues/issue-50600.rs
diff --git a/src/test/ui/issue-50600.stderr b/src/test/ui/issues/issue-50600.stderr
similarity index 100%
rename from src/test/ui/issue-50600.stderr
rename to src/test/ui/issues/issue-50600.stderr
diff --git a/src/test/ui/issue-50618.rs b/src/test/ui/issues/issue-50618.rs
similarity index 100%
rename from src/test/ui/issue-50618.rs
rename to src/test/ui/issues/issue-50618.rs
diff --git a/src/test/ui/issue-50618.stderr b/src/test/ui/issues/issue-50618.stderr
similarity index 100%
rename from src/test/ui/issue-50618.stderr
rename to src/test/ui/issues/issue-50618.stderr
diff --git a/src/test/ui/issue-5062.rs b/src/test/ui/issues/issue-5062.rs
similarity index 100%
rename from src/test/ui/issue-5062.rs
rename to src/test/ui/issues/issue-5062.rs
diff --git a/src/test/ui/issue-5062.stderr b/src/test/ui/issues/issue-5062.stderr
similarity index 100%
rename from src/test/ui/issue-5062.stderr
rename to src/test/ui/issues/issue-5062.stderr
diff --git a/src/test/ui/issue-5067.rs b/src/test/ui/issues/issue-5067.rs
similarity index 100%
rename from src/test/ui/issue-5067.rs
rename to src/test/ui/issues/issue-5067.rs
diff --git a/src/test/ui/issue-5067.stderr b/src/test/ui/issues/issue-5067.stderr
similarity index 100%
rename from src/test/ui/issue-5067.stderr
rename to src/test/ui/issues/issue-5067.stderr
diff --git a/src/test/ui/issue-50688.rs b/src/test/ui/issues/issue-50688.rs
similarity index 100%
rename from src/test/ui/issue-50688.rs
rename to src/test/ui/issues/issue-50688.rs
diff --git a/src/test/ui/issue-50688.stderr b/src/test/ui/issues/issue-50688.stderr
similarity index 100%
rename from src/test/ui/issue-50688.stderr
rename to src/test/ui/issues/issue-50688.stderr
diff --git a/src/test/ui/issue-50714-1.rs b/src/test/ui/issues/issue-50714-1.rs
similarity index 100%
rename from src/test/ui/issue-50714-1.rs
rename to src/test/ui/issues/issue-50714-1.rs
diff --git a/src/test/ui/issue-50714-1.stderr b/src/test/ui/issues/issue-50714-1.stderr
similarity index 100%
rename from src/test/ui/issue-50714-1.stderr
rename to src/test/ui/issues/issue-50714-1.stderr
diff --git a/src/test/ui/issue-50714.rs b/src/test/ui/issues/issue-50714.rs
similarity index 100%
rename from src/test/ui/issue-50714.rs
rename to src/test/ui/issues/issue-50714.rs
diff --git a/src/test/ui/issue-50714.stderr b/src/test/ui/issues/issue-50714.stderr
similarity index 100%
rename from src/test/ui/issue-50714.stderr
rename to src/test/ui/issues/issue-50714.stderr
diff --git a/src/test/ui/issue-50761.rs b/src/test/ui/issues/issue-50761.rs
similarity index 100%
rename from src/test/ui/issue-50761.rs
rename to src/test/ui/issues/issue-50761.rs
diff --git a/src/test/ui/issue-50781.rs b/src/test/ui/issues/issue-50781.rs
similarity index 100%
rename from src/test/ui/issue-50781.rs
rename to src/test/ui/issues/issue-50781.rs
diff --git a/src/test/ui/issue-50781.stderr b/src/test/ui/issues/issue-50781.stderr
similarity index 100%
rename from src/test/ui/issue-50781.stderr
rename to src/test/ui/issues/issue-50781.stderr
diff --git a/src/test/ui/issue-50802.rs b/src/test/ui/issues/issue-50802.rs
similarity index 100%
rename from src/test/ui/issue-50802.rs
rename to src/test/ui/issues/issue-50802.rs
diff --git a/src/test/ui/issue-50802.stderr b/src/test/ui/issues/issue-50802.stderr
similarity index 100%
rename from src/test/ui/issue-50802.stderr
rename to src/test/ui/issues/issue-50802.stderr
diff --git a/src/test/ui/issue-50825-1.rs b/src/test/ui/issues/issue-50825-1.rs
similarity index 100%
rename from src/test/ui/issue-50825-1.rs
rename to src/test/ui/issues/issue-50825-1.rs
diff --git a/src/test/ui/issue-50825.rs b/src/test/ui/issues/issue-50825.rs
similarity index 100%
rename from src/test/ui/issue-50825.rs
rename to src/test/ui/issues/issue-50825.rs
diff --git a/src/test/ui/issue-5099.rs b/src/test/ui/issues/issue-5099.rs
similarity index 100%
rename from src/test/ui/issue-5099.rs
rename to src/test/ui/issues/issue-5099.rs
diff --git a/src/test/ui/issue-5099.stderr b/src/test/ui/issues/issue-5099.stderr
similarity index 100%
rename from src/test/ui/issue-5099.stderr
rename to src/test/ui/issues/issue-5099.stderr
diff --git a/src/test/ui/issue-50993.rs b/src/test/ui/issues/issue-50993.rs
similarity index 100%
rename from src/test/ui/issue-50993.rs
rename to src/test/ui/issues/issue-50993.rs
diff --git a/src/test/ui/issue-50993.stderr b/src/test/ui/issues/issue-50993.stderr
similarity index 100%
rename from src/test/ui/issue-50993.stderr
rename to src/test/ui/issues/issue-50993.stderr
diff --git a/src/test/ui/issue-5100.rs b/src/test/ui/issues/issue-5100.rs
similarity index 100%
rename from src/test/ui/issue-5100.rs
rename to src/test/ui/issues/issue-5100.rs
diff --git a/src/test/ui/issue-5100.stderr b/src/test/ui/issues/issue-5100.stderr
similarity index 100%
rename from src/test/ui/issue-5100.stderr
rename to src/test/ui/issues/issue-5100.stderr
diff --git a/src/test/ui/issue-51022.rs b/src/test/ui/issues/issue-51022.rs
similarity index 100%
rename from src/test/ui/issue-51022.rs
rename to src/test/ui/issues/issue-51022.rs
diff --git a/src/test/ui/issue-51022.stderr b/src/test/ui/issues/issue-51022.stderr
similarity index 100%
rename from src/test/ui/issue-51022.stderr
rename to src/test/ui/issues/issue-51022.stderr
diff --git a/src/test/ui/issue-51044.rs b/src/test/ui/issues/issue-51044.rs
similarity index 100%
rename from src/test/ui/issue-51044.rs
rename to src/test/ui/issues/issue-51044.rs
diff --git a/src/test/ui/issue-51102.rs b/src/test/ui/issues/issue-51102.rs
similarity index 100%
rename from src/test/ui/issue-51102.rs
rename to src/test/ui/issues/issue-51102.rs
diff --git a/src/test/ui/issue-51102.stderr b/src/test/ui/issues/issue-51102.stderr
similarity index 100%
rename from src/test/ui/issue-51102.stderr
rename to src/test/ui/issues/issue-51102.stderr
diff --git a/src/test/ui/issue-51116.rs b/src/test/ui/issues/issue-51116.rs
similarity index 100%
rename from src/test/ui/issue-51116.rs
rename to src/test/ui/issues/issue-51116.rs
diff --git a/src/test/ui/issue-51116.stderr b/src/test/ui/issues/issue-51116.stderr
similarity index 100%
rename from src/test/ui/issue-51116.stderr
rename to src/test/ui/issues/issue-51116.stderr
diff --git a/src/test/ui/issue-51244.nll.stderr b/src/test/ui/issues/issue-51244.nll.stderr
similarity index 100%
rename from src/test/ui/issue-51244.nll.stderr
rename to src/test/ui/issues/issue-51244.nll.stderr
diff --git a/src/test/ui/issue-51244.rs b/src/test/ui/issues/issue-51244.rs
similarity index 100%
rename from src/test/ui/issue-51244.rs
rename to src/test/ui/issues/issue-51244.rs
diff --git a/src/test/ui/issue-51244.stderr b/src/test/ui/issues/issue-51244.stderr
similarity index 100%
rename from src/test/ui/issue-51244.stderr
rename to src/test/ui/issues/issue-51244.stderr
diff --git a/src/test/ui/issue-51279.rs b/src/test/ui/issues/issue-51279.rs
similarity index 100%
rename from src/test/ui/issue-51279.rs
rename to src/test/ui/issues/issue-51279.rs
diff --git a/src/test/ui/issue-51279.stderr b/src/test/ui/issues/issue-51279.stderr
similarity index 100%
rename from src/test/ui/issue-51279.stderr
rename to src/test/ui/issues/issue-51279.stderr
diff --git a/src/test/ui/issue-51515.rs b/src/test/ui/issues/issue-51515.rs
similarity index 100%
rename from src/test/ui/issue-51515.rs
rename to src/test/ui/issues/issue-51515.rs
diff --git a/src/test/ui/issue-51515.stderr b/src/test/ui/issues/issue-51515.stderr
similarity index 100%
rename from src/test/ui/issue-51515.stderr
rename to src/test/ui/issues/issue-51515.stderr
diff --git a/src/test/ui/issue-5153.rs b/src/test/ui/issues/issue-5153.rs
similarity index 100%
rename from src/test/ui/issue-5153.rs
rename to src/test/ui/issues/issue-5153.rs
diff --git a/src/test/ui/issue-5153.stderr b/src/test/ui/issues/issue-5153.stderr
similarity index 100%
rename from src/test/ui/issue-5153.stderr
rename to src/test/ui/issues/issue-5153.stderr
diff --git a/src/test/ui/issue-51632-try-desugar-incompatible-types.fixed b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.fixed
similarity index 100%
rename from src/test/ui/issue-51632-try-desugar-incompatible-types.fixed
rename to src/test/ui/issues/issue-51632-try-desugar-incompatible-types.fixed
diff --git a/src/test/ui/issue-51632-try-desugar-incompatible-types.rs b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.rs
similarity index 100%
rename from src/test/ui/issue-51632-try-desugar-incompatible-types.rs
rename to src/test/ui/issues/issue-51632-try-desugar-incompatible-types.rs
diff --git a/src/test/ui/issue-51632-try-desugar-incompatible-types.stderr b/src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
similarity index 100%
rename from src/test/ui/issue-51632-try-desugar-incompatible-types.stderr
rename to src/test/ui/issues/issue-51632-try-desugar-incompatible-types.stderr
diff --git a/src/test/ui/issue-51714.rs b/src/test/ui/issues/issue-51714.rs
similarity index 100%
rename from src/test/ui/issue-51714.rs
rename to src/test/ui/issues/issue-51714.rs
diff --git a/src/test/ui/issue-51714.stderr b/src/test/ui/issues/issue-51714.stderr
similarity index 100%
rename from src/test/ui/issue-51714.stderr
rename to src/test/ui/issues/issue-51714.stderr
diff --git a/src/test/ui/issue-51848.rs b/src/test/ui/issues/issue-51848.rs
similarity index 100%
rename from src/test/ui/issue-51848.rs
rename to src/test/ui/issues/issue-51848.rs
diff --git a/src/test/ui/issue-51848.stderr b/src/test/ui/issues/issue-51848.stderr
similarity index 100%
rename from src/test/ui/issue-51848.stderr
rename to src/test/ui/issues/issue-51848.stderr
diff --git a/src/test/ui/issue-51874.rs b/src/test/ui/issues/issue-51874.rs
similarity index 100%
rename from src/test/ui/issue-51874.rs
rename to src/test/ui/issues/issue-51874.rs
diff --git a/src/test/ui/issue-51874.stderr b/src/test/ui/issues/issue-51874.stderr
similarity index 100%
rename from src/test/ui/issue-51874.stderr
rename to src/test/ui/issues/issue-51874.stderr
diff --git a/src/test/ui/issue-52023-array-size-pointer-cast.rs b/src/test/ui/issues/issue-52023-array-size-pointer-cast.rs
similarity index 100%
rename from src/test/ui/issue-52023-array-size-pointer-cast.rs
rename to src/test/ui/issues/issue-52023-array-size-pointer-cast.rs
diff --git a/src/test/ui/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr
similarity index 100%
rename from src/test/ui/issue-52023-array-size-pointer-cast.stderr
rename to src/test/ui/issues/issue-52023-array-size-pointer-cast.stderr
diff --git a/src/test/ui/issue-52049.nll.stderr b/src/test/ui/issues/issue-52049.nll.stderr
similarity index 100%
rename from src/test/ui/issue-52049.nll.stderr
rename to src/test/ui/issues/issue-52049.nll.stderr
diff --git a/src/test/ui/issue-52049.rs b/src/test/ui/issues/issue-52049.rs
similarity index 100%
rename from src/test/ui/issue-52049.rs
rename to src/test/ui/issues/issue-52049.rs
diff --git a/src/test/ui/issue-52049.stderr b/src/test/ui/issues/issue-52049.stderr
similarity index 100%
rename from src/test/ui/issue-52049.stderr
rename to src/test/ui/issues/issue-52049.stderr
diff --git a/src/test/ui/issue-52057.rs b/src/test/ui/issues/issue-52057.rs
similarity index 100%
rename from src/test/ui/issue-52057.rs
rename to src/test/ui/issues/issue-52057.rs
diff --git a/src/test/ui/issue-52126-assign-op-invariance.nll.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
similarity index 100%
rename from src/test/ui/issue-52126-assign-op-invariance.nll.stderr
rename to src/test/ui/issues/issue-52126-assign-op-invariance.nll.stderr
diff --git a/src/test/ui/issue-52126-assign-op-invariance.rs b/src/test/ui/issues/issue-52126-assign-op-invariance.rs
similarity index 100%
rename from src/test/ui/issue-52126-assign-op-invariance.rs
rename to src/test/ui/issues/issue-52126-assign-op-invariance.rs
diff --git a/src/test/ui/issue-52126-assign-op-invariance.stderr b/src/test/ui/issues/issue-52126-assign-op-invariance.stderr
similarity index 100%
rename from src/test/ui/issue-52126-assign-op-invariance.stderr
rename to src/test/ui/issues/issue-52126-assign-op-invariance.stderr
diff --git a/src/test/ui/issue-5216.rs b/src/test/ui/issues/issue-5216.rs
similarity index 100%
rename from src/test/ui/issue-5216.rs
rename to src/test/ui/issues/issue-5216.rs
diff --git a/src/test/ui/issue-5216.stderr b/src/test/ui/issues/issue-5216.stderr
similarity index 100%
rename from src/test/ui/issue-5216.stderr
rename to src/test/ui/issues/issue-5216.stderr
diff --git a/src/test/ui/issues/issue-52213.nll.stderr b/src/test/ui/issues/issue-52213.nll.stderr
new file mode 100644
index 0000000..7a04aeb
--- /dev/null
+++ b/src/test/ui/issues/issue-52213.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/issue-52213.rs:12:11
+ |
+LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-52213.rs:13:20
+ |
+LL | fn transmute_lifetime<'a, 'b, T>(t: &'a (T,)) -> &'b T {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | match (&t,) { //~ ERROR cannot infer an appropriate lifetime
+LL | ((u,),) => u,
+ | ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-52213.rs b/src/test/ui/issues/issue-52213.rs
similarity index 100%
rename from src/test/ui/issue-52213.rs
rename to src/test/ui/issues/issue-52213.rs
diff --git a/src/test/ui/issue-52213.stderr b/src/test/ui/issues/issue-52213.stderr
similarity index 100%
rename from src/test/ui/issue-52213.stderr
rename to src/test/ui/issues/issue-52213.stderr
diff --git a/src/test/ui/issue-5239-1.rs b/src/test/ui/issues/issue-5239-1.rs
similarity index 100%
rename from src/test/ui/issue-5239-1.rs
rename to src/test/ui/issues/issue-5239-1.rs
diff --git a/src/test/ui/issue-5239-1.stderr b/src/test/ui/issues/issue-5239-1.stderr
similarity index 100%
rename from src/test/ui/issue-5239-1.stderr
rename to src/test/ui/issues/issue-5239-1.stderr
diff --git a/src/test/compile-fail/issue-52489.rs b/src/test/ui/issues/issue-52489.rs
similarity index 100%
rename from src/test/compile-fail/issue-52489.rs
rename to src/test/ui/issues/issue-52489.rs
diff --git a/src/test/ui/issues/issue-52489.stderr b/src/test/ui/issues/issue-52489.stderr
new file mode 100644
index 0000000..5b38a07
--- /dev/null
+++ b/src/test/ui/issues/issue-52489.stderr
@@ -0,0 +1,11 @@
+error[E0658]: use of unstable library feature 'issue_52489_unstable'
+ --> $DIR/issue-52489.rs:14:5
+ |
+LL | use issue_52489;
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(issue_52489_unstable)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/issues/issue-52533-1.nll.stderr b/src/test/ui/issues/issue-52533-1.nll.stderr
new file mode 100644
index 0000000..2dfa46d
--- /dev/null
+++ b/src/test/ui/issues/issue-52533-1.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/issue-52533-1.rs:19:18
+ |
+LL | gimme(|x, y| y)
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-52533-1.rs:19:18
+ |
+LL | gimme(|x, y| y)
+ | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+ | | |
+ | | has type `&Foo<'_, '1, u32>`
+ | has type `&Foo<'_, '2, u32>`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-52533-1.rs b/src/test/ui/issues/issue-52533-1.rs
similarity index 100%
rename from src/test/ui/issue-52533-1.rs
rename to src/test/ui/issues/issue-52533-1.rs
diff --git a/src/test/ui/issue-52533-1.stderr b/src/test/ui/issues/issue-52533-1.stderr
similarity index 100%
rename from src/test/ui/issue-52533-1.stderr
rename to src/test/ui/issues/issue-52533-1.stderr
diff --git a/src/test/ui/issues/issue-52533.nll.stderr b/src/test/ui/issues/issue-52533.nll.stderr
new file mode 100644
index 0000000..1721842
--- /dev/null
+++ b/src/test/ui/issues/issue-52533.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/issue-52533.rs:15:16
+ |
+LL | foo(|a, b| b)
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-52533.rs:15:16
+ |
+LL | foo(|a, b| b)
+ | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+ | | |
+ | | has type `&'1 u32`
+ | has type `&'2 u32`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/issue-52533.rs b/src/test/ui/issues/issue-52533.rs
similarity index 100%
rename from src/test/ui/issue-52533.rs
rename to src/test/ui/issues/issue-52533.rs
diff --git a/src/test/ui/issue-52533.stderr b/src/test/ui/issues/issue-52533.stderr
similarity index 100%
rename from src/test/ui/issue-52533.stderr
rename to src/test/ui/issues/issue-52533.stderr
diff --git a/src/test/ui/issues/issue-53348.rs b/src/test/ui/issues/issue-53348.rs
new file mode 100644
index 0000000..46ab07d
--- /dev/null
+++ b/src/test/ui/issues/issue-53348.rs
@@ -0,0 +1,26 @@
+// 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.
+
+fn main() {
+ let mut v = vec!["hello", "this", "is", "a", "test"];
+
+ let v2 = Vec::new();
+
+ v.into_iter().map(|s|s.to_owned()).collect::<Vec<_>>();
+
+ let mut a = String::new();
+ for i in v {
+ a = *i.to_string();
+ //~^ ERROR mismatched types
+ //~| NOTE expected struct `std::string::String`, found str
+ //~| NOTE expected type
+ v2.push(a);
+ }
+}
diff --git a/src/test/ui/issues/issue-53348.stderr b/src/test/ui/issues/issue-53348.stderr
new file mode 100644
index 0000000..9aab492
--- /dev/null
+++ b/src/test/ui/issues/issue-53348.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/issue-53348.rs:20:13
+ |
+LL | a = *i.to_string();
+ | ^^^^^^^^^^^^^^ expected struct `std::string::String`, found str
+ |
+ = note: expected type `std::string::String`
+ found type `str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issue-5358-1.rs b/src/test/ui/issues/issue-5358-1.rs
similarity index 100%
rename from src/test/ui/issue-5358-1.rs
rename to src/test/ui/issues/issue-5358-1.rs
diff --git a/src/test/ui/issue-5358-1.stderr b/src/test/ui/issues/issue-5358-1.stderr
similarity index 100%
rename from src/test/ui/issue-5358-1.stderr
rename to src/test/ui/issues/issue-5358-1.stderr
diff --git a/src/test/ui/issue-5439.rs b/src/test/ui/issues/issue-5439.rs
similarity index 100%
rename from src/test/ui/issue-5439.rs
rename to src/test/ui/issues/issue-5439.rs
diff --git a/src/test/ui/issue-5439.stderr b/src/test/ui/issues/issue-5439.stderr
similarity index 100%
rename from src/test/ui/issue-5439.stderr
rename to src/test/ui/issues/issue-5439.stderr
diff --git a/src/test/ui/issues/issue-5500-1.ast.stderr b/src/test/ui/issues/issue-5500-1.ast.stderr
new file mode 100644
index 0000000..611eea5
--- /dev/null
+++ b/src/test/ui/issues/issue-5500-1.ast.stderr
@@ -0,0 +1,15 @@
+error[E0594]: cannot assign to field `_iter.node` of immutable binding
+ --> $DIR/issue-5500-1.rs:22:5
+ |
+LL | let _iter = TrieMapIterator{node: &a};
+ | ----- consider changing this to `mut _iter`
+LL | / _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
+LL | | //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
+LL | | // MIR doesn't generate an error because the code isn't reachable. This is OK
+LL | | // because the test is here to check that the compiler doesn't ICE (cf. #5500).
+LL | | panic!()
+ | |____________^ cannot mutably borrow field of immutable binding
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/issues/issue-5500-1.mir.stderr b/src/test/ui/issues/issue-5500-1.mir.stderr
new file mode 100644
index 0000000..465485e
--- /dev/null
+++ b/src/test/ui/issues/issue-5500-1.mir.stderr
@@ -0,0 +1,15 @@
+error[E0594]: cannot assign to field `_iter.node` of immutable binding (Ast)
+ --> $DIR/issue-5500-1.rs:22:5
+ |
+LL | let _iter = TrieMapIterator{node: &a};
+ | ----- consider changing this to `mut _iter`
+LL | / _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
+LL | | //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
+LL | | // MIR doesn't generate an error because the code isn't reachable. This is OK
+LL | | // because the test is here to check that the compiler doesn't ICE (cf. #5500).
+LL | | panic!()
+ | |____________^ cannot mutably borrow field of immutable binding
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/issues/issue-5500-1.rs b/src/test/ui/issues/issue-5500-1.rs
new file mode 100644
index 0000000..8d6efa7
--- /dev/null
+++ b/src/test/ui/issues/issue-5500-1.rs
@@ -0,0 +1,27 @@
+// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-compare-mode-nll
+// revisions: ast mir
+//[mir]compile-flags: -Z borrowck=compare
+
+struct TrieMapIterator<'a> {
+ node: &'a usize
+}
+
+fn main() {
+ let a = 5;
+ let _iter = TrieMapIterator{node: &a};
+ _iter.node = & //[ast]~ ERROR cannot assign to field `_iter.node` of immutable binding
+ //[mir]~^ ERROR cannot assign to field `_iter.node` of immutable binding (Ast)
+ // MIR doesn't generate an error because the code isn't reachable. This is OK
+ // because the test is here to check that the compiler doesn't ICE (cf. #5500).
+ panic!()
+}
diff --git a/src/test/compile-fail/issue-5844.rs b/src/test/ui/issues/issue-5844.rs
similarity index 100%
rename from src/test/compile-fail/issue-5844.rs
rename to src/test/ui/issues/issue-5844.rs
diff --git a/src/test/ui/issues/issue-5844.stderr b/src/test/ui/issues/issue-5844.stderr
new file mode 100644
index 0000000..05b0b63
--- /dev/null
+++ b/src/test/ui/issues/issue-5844.stderr
@@ -0,0 +1,11 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/issue-5844.rs:16:5
+ |
+LL | issue_5844_aux::rand(); //~ ERROR: requires unsafe
+ | ^^^^^^^^^^^^^^^^^^^^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/ui/issue-5883.rs b/src/test/ui/issues/issue-5883.rs
similarity index 100%
rename from src/test/ui/issue-5883.rs
rename to src/test/ui/issues/issue-5883.rs
diff --git a/src/test/ui/issues/issue-5883.stderr b/src/test/ui/issues/issue-5883.stderr
new file mode 100644
index 0000000..63dabd8
--- /dev/null
+++ b/src/test/ui/issues/issue-5883.stderr
@@ -0,0 +1,25 @@
+error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
+ --> $DIR/issue-5883.rs:17:15
+ |
+LL | fn new_struct(r: A+'static)
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `(dyn A + 'static)` cannot be known at compilation time
+ --> $DIR/issue-5883.rs:18:8
+ |
+LL | -> Struct { //~^ ERROR the size for values of type
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Struct`, the trait `std::marker::Sized` is not implemented for `(dyn A + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Struct`
+ = note: the return type of a function must have a statically known size
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/issue-5927.rs b/src/test/ui/issues/issue-5927.rs
similarity index 100%
rename from src/test/ui/issue-5927.rs
rename to src/test/ui/issues/issue-5927.rs
diff --git a/src/test/ui/issue-5927.stderr b/src/test/ui/issues/issue-5927.stderr
similarity index 100%
rename from src/test/ui/issue-5927.stderr
rename to src/test/ui/issues/issue-5927.stderr
diff --git a/src/test/ui/issue-5997-enum.rs b/src/test/ui/issues/issue-5997-enum.rs
similarity index 100%
rename from src/test/ui/issue-5997-enum.rs
rename to src/test/ui/issues/issue-5997-enum.rs
diff --git a/src/test/ui/issue-5997-enum.stderr b/src/test/ui/issues/issue-5997-enum.stderr
similarity index 100%
rename from src/test/ui/issue-5997-enum.stderr
rename to src/test/ui/issues/issue-5997-enum.stderr
diff --git a/src/test/ui/issue-5997-struct.rs b/src/test/ui/issues/issue-5997-struct.rs
similarity index 100%
rename from src/test/ui/issue-5997-struct.rs
rename to src/test/ui/issues/issue-5997-struct.rs
diff --git a/src/test/ui/issue-5997-struct.stderr b/src/test/ui/issues/issue-5997-struct.stderr
similarity index 100%
rename from src/test/ui/issue-5997-struct.stderr
rename to src/test/ui/issues/issue-5997-struct.stderr
diff --git a/src/test/ui/issue-6458-2.rs b/src/test/ui/issues/issue-6458-2.rs
similarity index 100%
rename from src/test/ui/issue-6458-2.rs
rename to src/test/ui/issues/issue-6458-2.rs
diff --git a/src/test/ui/issue-6458-2.stderr b/src/test/ui/issues/issue-6458-2.stderr
similarity index 100%
rename from src/test/ui/issue-6458-2.stderr
rename to src/test/ui/issues/issue-6458-2.stderr
diff --git a/src/test/ui/issue-6458-3.rs b/src/test/ui/issues/issue-6458-3.rs
similarity index 100%
rename from src/test/ui/issue-6458-3.rs
rename to src/test/ui/issues/issue-6458-3.rs
diff --git a/src/test/ui/issue-6458-3.stderr b/src/test/ui/issues/issue-6458-3.stderr
similarity index 100%
rename from src/test/ui/issue-6458-3.stderr
rename to src/test/ui/issues/issue-6458-3.stderr
diff --git a/src/test/ui/issue-6458-4.rs b/src/test/ui/issues/issue-6458-4.rs
similarity index 100%
rename from src/test/ui/issue-6458-4.rs
rename to src/test/ui/issues/issue-6458-4.rs
diff --git a/src/test/ui/issue-6458-4.stderr b/src/test/ui/issues/issue-6458-4.stderr
similarity index 100%
rename from src/test/ui/issue-6458-4.stderr
rename to src/test/ui/issues/issue-6458-4.stderr
diff --git a/src/test/ui/issue-6458.rs b/src/test/ui/issues/issue-6458.rs
similarity index 100%
rename from src/test/ui/issue-6458.rs
rename to src/test/ui/issues/issue-6458.rs
diff --git a/src/test/ui/issue-6458.stderr b/src/test/ui/issues/issue-6458.stderr
similarity index 100%
rename from src/test/ui/issue-6458.stderr
rename to src/test/ui/issues/issue-6458.stderr
diff --git a/src/test/ui/issue-6596-1.rs b/src/test/ui/issues/issue-6596-1.rs
similarity index 100%
rename from src/test/ui/issue-6596-1.rs
rename to src/test/ui/issues/issue-6596-1.rs
diff --git a/src/test/ui/issue-6596-1.stderr b/src/test/ui/issues/issue-6596-1.stderr
similarity index 100%
rename from src/test/ui/issue-6596-1.stderr
rename to src/test/ui/issues/issue-6596-1.stderr
diff --git a/src/test/ui/issue-6596-2.rs b/src/test/ui/issues/issue-6596-2.rs
similarity index 100%
rename from src/test/ui/issue-6596-2.rs
rename to src/test/ui/issues/issue-6596-2.rs
diff --git a/src/test/ui/issue-6596-2.stderr b/src/test/ui/issues/issue-6596-2.stderr
similarity index 100%
rename from src/test/ui/issue-6596-2.stderr
rename to src/test/ui/issues/issue-6596-2.stderr
diff --git a/src/test/ui/issue-6642.rs b/src/test/ui/issues/issue-6642.rs
similarity index 100%
rename from src/test/ui/issue-6642.rs
rename to src/test/ui/issues/issue-6642.rs
diff --git a/src/test/ui/issue-6642.stderr b/src/test/ui/issues/issue-6642.stderr
similarity index 100%
rename from src/test/ui/issue-6642.stderr
rename to src/test/ui/issues/issue-6642.stderr
diff --git a/src/test/ui/issue-6738.rs b/src/test/ui/issues/issue-6738.rs
similarity index 100%
rename from src/test/ui/issue-6738.rs
rename to src/test/ui/issues/issue-6738.rs
diff --git a/src/test/ui/issue-6738.stderr b/src/test/ui/issues/issue-6738.stderr
similarity index 100%
rename from src/test/ui/issue-6738.stderr
rename to src/test/ui/issues/issue-6738.stderr
diff --git a/src/test/ui/issue-6801.nll.stderr b/src/test/ui/issues/issue-6801.nll.stderr
similarity index 100%
rename from src/test/ui/issue-6801.nll.stderr
rename to src/test/ui/issues/issue-6801.nll.stderr
diff --git a/src/test/ui/issue-6801.rs b/src/test/ui/issues/issue-6801.rs
similarity index 100%
rename from src/test/ui/issue-6801.rs
rename to src/test/ui/issues/issue-6801.rs
diff --git a/src/test/ui/issue-6801.stderr b/src/test/ui/issues/issue-6801.stderr
similarity index 100%
rename from src/test/ui/issue-6801.stderr
rename to src/test/ui/issues/issue-6801.stderr
diff --git a/src/test/ui/issue-6804.rs b/src/test/ui/issues/issue-6804.rs
similarity index 100%
rename from src/test/ui/issue-6804.rs
rename to src/test/ui/issues/issue-6804.rs
diff --git a/src/test/ui/issue-6804.stderr b/src/test/ui/issues/issue-6804.stderr
similarity index 100%
rename from src/test/ui/issue-6804.stderr
rename to src/test/ui/issues/issue-6804.stderr
diff --git a/src/test/ui/issue-6936.rs b/src/test/ui/issues/issue-6936.rs
similarity index 100%
rename from src/test/ui/issue-6936.rs
rename to src/test/ui/issues/issue-6936.rs
diff --git a/src/test/ui/issue-6936.stderr b/src/test/ui/issues/issue-6936.stderr
similarity index 100%
rename from src/test/ui/issue-6936.stderr
rename to src/test/ui/issues/issue-6936.stderr
diff --git a/src/test/ui/issue-7013.rs b/src/test/ui/issues/issue-7013.rs
similarity index 100%
rename from src/test/ui/issue-7013.rs
rename to src/test/ui/issues/issue-7013.rs
diff --git a/src/test/ui/issue-7013.stderr b/src/test/ui/issues/issue-7013.stderr
similarity index 100%
rename from src/test/ui/issue-7013.stderr
rename to src/test/ui/issues/issue-7013.stderr
diff --git a/src/test/ui/issue-7044.rs b/src/test/ui/issues/issue-7044.rs
similarity index 100%
rename from src/test/ui/issue-7044.rs
rename to src/test/ui/issues/issue-7044.rs
diff --git a/src/test/ui/issue-7044.stderr b/src/test/ui/issues/issue-7044.stderr
similarity index 100%
rename from src/test/ui/issue-7044.stderr
rename to src/test/ui/issues/issue-7044.stderr
diff --git a/src/test/ui/issue-7061.rs b/src/test/ui/issues/issue-7061.rs
similarity index 100%
rename from src/test/ui/issue-7061.rs
rename to src/test/ui/issues/issue-7061.rs
diff --git a/src/test/ui/issue-7061.stderr b/src/test/ui/issues/issue-7061.stderr
similarity index 100%
rename from src/test/ui/issue-7061.stderr
rename to src/test/ui/issues/issue-7061.stderr
diff --git a/src/test/ui/issue-7092.rs b/src/test/ui/issues/issue-7092.rs
similarity index 100%
rename from src/test/ui/issue-7092.rs
rename to src/test/ui/issues/issue-7092.rs
diff --git a/src/test/ui/issue-7092.stderr b/src/test/ui/issues/issue-7092.stderr
similarity index 100%
rename from src/test/ui/issue-7092.stderr
rename to src/test/ui/issues/issue-7092.stderr
diff --git a/src/test/ui/issue-7246.rs b/src/test/ui/issues/issue-7246.rs
similarity index 100%
rename from src/test/ui/issue-7246.rs
rename to src/test/ui/issues/issue-7246.rs
diff --git a/src/test/ui/issue-7246.stderr b/src/test/ui/issues/issue-7246.stderr
similarity index 100%
rename from src/test/ui/issue-7246.stderr
rename to src/test/ui/issues/issue-7246.stderr
diff --git a/src/test/ui/issue-7364.rs b/src/test/ui/issues/issue-7364.rs
similarity index 100%
rename from src/test/ui/issue-7364.rs
rename to src/test/ui/issues/issue-7364.rs
diff --git a/src/test/ui/issue-7364.stderr b/src/test/ui/issues/issue-7364.stderr
similarity index 100%
rename from src/test/ui/issue-7364.stderr
rename to src/test/ui/issues/issue-7364.stderr
diff --git a/src/test/ui/issue-7607-1.rs b/src/test/ui/issues/issue-7607-1.rs
similarity index 100%
rename from src/test/ui/issue-7607-1.rs
rename to src/test/ui/issues/issue-7607-1.rs
diff --git a/src/test/ui/issue-7607-1.stderr b/src/test/ui/issues/issue-7607-1.stderr
similarity index 100%
rename from src/test/ui/issue-7607-1.stderr
rename to src/test/ui/issues/issue-7607-1.stderr
diff --git a/src/test/ui/issue-7813.rs b/src/test/ui/issues/issue-7813.rs
similarity index 100%
rename from src/test/ui/issue-7813.rs
rename to src/test/ui/issues/issue-7813.rs
diff --git a/src/test/ui/issue-7813.stderr b/src/test/ui/issues/issue-7813.stderr
similarity index 100%
rename from src/test/ui/issue-7813.stderr
rename to src/test/ui/issues/issue-7813.stderr
diff --git a/src/test/ui/issue-7867.rs b/src/test/ui/issues/issue-7867.rs
similarity index 100%
rename from src/test/ui/issue-7867.rs
rename to src/test/ui/issues/issue-7867.rs
diff --git a/src/test/ui/issue-7867.stderr b/src/test/ui/issues/issue-7867.stderr
similarity index 100%
rename from src/test/ui/issue-7867.stderr
rename to src/test/ui/issues/issue-7867.stderr
diff --git a/src/test/ui/issue-7950.rs b/src/test/ui/issues/issue-7950.rs
similarity index 100%
rename from src/test/ui/issue-7950.rs
rename to src/test/ui/issues/issue-7950.rs
diff --git a/src/test/ui/issue-7950.stderr b/src/test/ui/issues/issue-7950.stderr
similarity index 100%
rename from src/test/ui/issue-7950.stderr
rename to src/test/ui/issues/issue-7950.stderr
diff --git a/src/test/ui/issue-7970a.rs b/src/test/ui/issues/issue-7970a.rs
similarity index 100%
rename from src/test/ui/issue-7970a.rs
rename to src/test/ui/issues/issue-7970a.rs
diff --git a/src/test/ui/issue-7970a.stderr b/src/test/ui/issues/issue-7970a.stderr
similarity index 100%
rename from src/test/ui/issue-7970a.stderr
rename to src/test/ui/issues/issue-7970a.stderr
diff --git a/src/test/ui/issue-7970b.rs b/src/test/ui/issues/issue-7970b.rs
similarity index 100%
rename from src/test/ui/issue-7970b.rs
rename to src/test/ui/issues/issue-7970b.rs
diff --git a/src/test/ui/issue-7970b.stderr b/src/test/ui/issues/issue-7970b.stderr
similarity index 100%
rename from src/test/ui/issue-7970b.stderr
rename to src/test/ui/issues/issue-7970b.stderr
diff --git a/src/test/ui/issue-8153.rs b/src/test/ui/issues/issue-8153.rs
similarity index 100%
rename from src/test/ui/issue-8153.rs
rename to src/test/ui/issues/issue-8153.rs
diff --git a/src/test/ui/issue-8153.stderr b/src/test/ui/issues/issue-8153.stderr
similarity index 100%
rename from src/test/ui/issue-8153.stderr
rename to src/test/ui/issues/issue-8153.stderr
diff --git a/src/test/ui/issue-8208.rs b/src/test/ui/issues/issue-8208.rs
similarity index 100%
rename from src/test/ui/issue-8208.rs
rename to src/test/ui/issues/issue-8208.rs
diff --git a/src/test/ui/issue-8208.stderr b/src/test/ui/issues/issue-8208.stderr
similarity index 100%
rename from src/test/ui/issue-8208.stderr
rename to src/test/ui/issues/issue-8208.stderr
diff --git a/src/test/ui/issue-8460-const.rs b/src/test/ui/issues/issue-8460-const.rs
similarity index 100%
rename from src/test/ui/issue-8460-const.rs
rename to src/test/ui/issues/issue-8460-const.rs
diff --git a/src/test/ui/issue-8460-const.stderr b/src/test/ui/issues/issue-8460-const.stderr
similarity index 100%
rename from src/test/ui/issue-8460-const.stderr
rename to src/test/ui/issues/issue-8460-const.stderr
diff --git a/src/test/ui/issue-8640.rs b/src/test/ui/issues/issue-8640.rs
similarity index 100%
rename from src/test/ui/issue-8640.rs
rename to src/test/ui/issues/issue-8640.rs
diff --git a/src/test/ui/issue-8640.stderr b/src/test/ui/issues/issue-8640.stderr
similarity index 100%
rename from src/test/ui/issue-8640.stderr
rename to src/test/ui/issues/issue-8640.stderr
diff --git a/src/test/ui/issue-8727.rs b/src/test/ui/issues/issue-8727.rs
similarity index 100%
rename from src/test/ui/issue-8727.rs
rename to src/test/ui/issues/issue-8727.rs
diff --git a/src/test/ui/issue-8727.stderr b/src/test/ui/issues/issue-8727.stderr
similarity index 100%
rename from src/test/ui/issue-8727.stderr
rename to src/test/ui/issues/issue-8727.stderr
diff --git a/src/test/ui/issue-8761.rs b/src/test/ui/issues/issue-8761.rs
similarity index 100%
rename from src/test/ui/issue-8761.rs
rename to src/test/ui/issues/issue-8761.rs
diff --git a/src/test/ui/issue-8761.stderr b/src/test/ui/issues/issue-8761.stderr
similarity index 100%
rename from src/test/ui/issue-8761.stderr
rename to src/test/ui/issues/issue-8761.stderr
diff --git a/src/test/ui/issue-8767.rs b/src/test/ui/issues/issue-8767.rs
similarity index 100%
rename from src/test/ui/issue-8767.rs
rename to src/test/ui/issues/issue-8767.rs
diff --git a/src/test/ui/issue-8767.stderr b/src/test/ui/issues/issue-8767.stderr
similarity index 100%
rename from src/test/ui/issue-8767.stderr
rename to src/test/ui/issues/issue-8767.stderr
diff --git a/src/test/ui/issue-9575.rs b/src/test/ui/issues/issue-9575.rs
similarity index 100%
rename from src/test/ui/issue-9575.rs
rename to src/test/ui/issues/issue-9575.rs
diff --git a/src/test/ui/issue-9575.stderr b/src/test/ui/issues/issue-9575.stderr
similarity index 100%
rename from src/test/ui/issue-9575.stderr
rename to src/test/ui/issues/issue-9575.stderr
diff --git a/src/test/ui/issue-9725.rs b/src/test/ui/issues/issue-9725.rs
similarity index 100%
rename from src/test/ui/issue-9725.rs
rename to src/test/ui/issues/issue-9725.rs
diff --git a/src/test/ui/issue-9725.stderr b/src/test/ui/issues/issue-9725.stderr
similarity index 100%
rename from src/test/ui/issue-9725.stderr
rename to src/test/ui/issues/issue-9725.stderr
diff --git a/src/test/ui/issue-9814.rs b/src/test/ui/issues/issue-9814.rs
similarity index 100%
rename from src/test/ui/issue-9814.rs
rename to src/test/ui/issues/issue-9814.rs
diff --git a/src/test/ui/issue-9814.stderr b/src/test/ui/issues/issue-9814.stderr
similarity index 100%
rename from src/test/ui/issue-9814.stderr
rename to src/test/ui/issues/issue-9814.stderr
diff --git a/src/test/ui/issue-pr29383.rs b/src/test/ui/issues/issue-pr29383.rs
similarity index 100%
rename from src/test/ui/issue-pr29383.rs
rename to src/test/ui/issues/issue-pr29383.rs
diff --git a/src/test/ui/issue-pr29383.stderr b/src/test/ui/issues/issue-pr29383.stderr
similarity index 100%
rename from src/test/ui/issue-pr29383.stderr
rename to src/test/ui/issues/issue-pr29383.stderr
diff --git a/src/test/compile-fail/issue32829.rs b/src/test/ui/issues/issue32829.rs
similarity index 100%
rename from src/test/compile-fail/issue32829.rs
rename to src/test/ui/issues/issue32829.rs
diff --git a/src/test/ui/issues/issue32829.stderr b/src/test/ui/issues/issue32829.stderr
new file mode 100644
index 0000000..dad0880
--- /dev/null
+++ b/src/test/ui/issues/issue32829.stderr
@@ -0,0 +1,94 @@
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:17:9
+ |
+LL | 5;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue32829.rs:25:9
+ |
+LL | invalid();
+ | ^^^^^^^^^
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:25:9
+ |
+LL | invalid();
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in constants are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:34:9
+ |
+LL | valid();
+ | ^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:42:9
+ |
+LL | 5;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue32829.rs:50:9
+ |
+LL | invalid();
+ | ^^^^^^^^^
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:50:9
+ |
+LL | invalid();
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:59:9
+ |
+LL | valid();
+ | ^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:67:9
+ |
+LL | 5;
+ | ^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/issue32829.rs:75:9
+ |
+LL | invalid();
+ | ^^^^^^^^^
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:75:9
+ |
+LL | invalid();
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/issue32829.rs:84:9
+ |
+LL | valid();
+ | ^^^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0015, E0658.
+For more information about an error, try `rustc --explain E0015`.
diff --git a/src/test/ui/keyword/keyword-extern-as-identifier.rs b/src/test/ui/keyword/keyword-extern-as-identifier.rs
new file mode 100644
index 0000000..3e44585
--- /dev/null
+++ b/src/test/ui/keyword/keyword-extern-as-identifier.rs
@@ -0,0 +1,15 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(extern_in_paths)]
+
+fn main() {
+ let extern = 0; //~ ERROR cannot find unit struct/variant or constant `extern` in this scope
+}
diff --git a/src/test/ui/keyword/keyword-extern-as-identifier.stderr b/src/test/ui/keyword/keyword-extern-as-identifier.stderr
new file mode 100644
index 0000000..523da8d
--- /dev/null
+++ b/src/test/ui/keyword/keyword-extern-as-identifier.stderr
@@ -0,0 +1,9 @@
+error[E0531]: cannot find unit struct/variant or constant `extern` in this scope
+ --> $DIR/keyword-extern-as-identifier.rs:14:9
+ |
+LL | let extern = 0; //~ ERROR cannot find unit struct/variant or constant `extern` in this scope
+ | ^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0531`.
diff --git a/src/test/compile-fail/keyword-false-as-identifier.rs b/src/test/ui/keyword/keyword-false-as-identifier.rs
similarity index 100%
rename from src/test/compile-fail/keyword-false-as-identifier.rs
rename to src/test/ui/keyword/keyword-false-as-identifier.rs
diff --git a/src/test/ui/keyword/keyword-false-as-identifier.stderr b/src/test/ui/keyword/keyword-false-as-identifier.stderr
new file mode 100644
index 0000000..13f6754
--- /dev/null
+++ b/src/test/ui/keyword/keyword-false-as-identifier.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/keyword-false-as-identifier.rs:12:9
+ |
+LL | let false = 22; //~ error: mismatched types
+ | ^^^^^ expected integral variable, found bool
+ |
+ = note: expected type `{integer}`
+ found type `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/keyword-self-as-identifier.rs b/src/test/ui/keyword/keyword-self-as-identifier.rs
similarity index 100%
rename from src/test/compile-fail/keyword-self-as-identifier.rs
rename to src/test/ui/keyword/keyword-self-as-identifier.rs
diff --git a/src/test/ui/keyword/keyword-self-as-identifier.stderr b/src/test/ui/keyword/keyword-self-as-identifier.stderr
new file mode 100644
index 0000000..c47f4ae
--- /dev/null
+++ b/src/test/ui/keyword/keyword-self-as-identifier.stderr
@@ -0,0 +1,9 @@
+error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
+ --> $DIR/keyword-self-as-identifier.rs:12:9
+ |
+LL | let Self = 22; //~ ERROR cannot find unit struct/variant or constant `Self` in this scope
+ | ^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0531`.
diff --git a/src/test/compile-fail/keyword-super-as-identifier.rs b/src/test/ui/keyword/keyword-super-as-identifier.rs
similarity index 100%
rename from src/test/compile-fail/keyword-super-as-identifier.rs
rename to src/test/ui/keyword/keyword-super-as-identifier.rs
diff --git a/src/test/ui/keyword/keyword-super-as-identifier.stderr b/src/test/ui/keyword/keyword-super-as-identifier.stderr
new file mode 100644
index 0000000..649be45c
--- /dev/null
+++ b/src/test/ui/keyword/keyword-super-as-identifier.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. There are too many initial `super`s.
+ --> $DIR/keyword-super-as-identifier.rs:12:9
+ |
+LL | let super = 22; //~ ERROR failed to resolve. There are too many initial `super`s
+ | ^^^^^ There are too many initial `super`s.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/keyword-super.rs b/src/test/ui/keyword/keyword-super.rs
similarity index 100%
rename from src/test/compile-fail/keyword-super.rs
rename to src/test/ui/keyword/keyword-super.rs
diff --git a/src/test/ui/keyword/keyword-super.stderr b/src/test/ui/keyword/keyword-super.stderr
new file mode 100644
index 0000000..ac692ad
--- /dev/null
+++ b/src/test/ui/keyword/keyword-super.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. There are too many initial `super`s.
+ --> $DIR/keyword-super.rs:12:9
+ |
+LL | let super: isize; //~ ERROR failed to resolve. There are too many initial `super`s
+ | ^^^^^ There are too many initial `super`s.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/keyword-true-as-identifier.rs b/src/test/ui/keyword/keyword-true-as-identifier.rs
similarity index 100%
rename from src/test/compile-fail/keyword-true-as-identifier.rs
rename to src/test/ui/keyword/keyword-true-as-identifier.rs
diff --git a/src/test/ui/keyword/keyword-true-as-identifier.stderr b/src/test/ui/keyword/keyword-true-as-identifier.stderr
new file mode 100644
index 0000000..776470b
--- /dev/null
+++ b/src/test/ui/keyword/keyword-true-as-identifier.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/keyword-true-as-identifier.rs:12:9
+ |
+LL | let true = 22; //~ error: mismatched types
+ | ^^^^ expected integral variable, found bool
+ |
+ = note: expected type `{integer}`
+ found type `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/ui/kindck/kindck-copy.rs
similarity index 100%
rename from src/test/compile-fail/kindck-copy.rs
rename to src/test/ui/kindck/kindck-copy.rs
diff --git a/src/test/ui/kindck/kindck-copy.stderr b/src/test/ui/kindck/kindck-copy.stderr
new file mode 100644
index 0000000..8d72d91
--- /dev/null
+++ b/src/test/ui/kindck/kindck-copy.stderr
@@ -0,0 +1,139 @@
+error[E0277]: the trait bound `&'static mut isize: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:37:5
+ |
+LL | assert_copy::<&'static mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'static mut isize`
+ |
+ = help: the following implementations were found:
+ <isize as std::marker::Copy>
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `&'a mut isize: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:38:5
+ |
+LL | assert_copy::<&'a mut isize>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut isize`
+ |
+ = help: the following implementations were found:
+ <isize as std::marker::Copy>
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::boxed::Box<isize>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:41:5
+ |
+LL | assert_copy::<Box<isize>>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<isize>`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:42:5
+ |
+LL | assert_copy::<String>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::string::String`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::vec::Vec<isize>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:43:5
+ |
+LL | assert_copy::<Vec<isize> >(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::vec::Vec<isize>`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::boxed::Box<&'a mut isize>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:44:5
+ |
+LL | assert_copy::<Box<&'a mut isize>>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<&'a mut isize>`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::boxed::Box<dyn Dummy>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:52:5
+ |
+LL | assert_copy::<Box<Dummy>>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<dyn Dummy>`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::boxed::Box<dyn Dummy + std::marker::Send>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:53:5
+ |
+LL | assert_copy::<Box<Dummy+Send>>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<dyn Dummy + std::marker::Send>`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `&'a mut (dyn Dummy + std::marker::Send + 'a): std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:56:5
+ |
+LL | assert_copy::<&'a mut (Dummy+Send)>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `&'a mut (dyn Dummy + std::marker::Send + 'a)`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `MyNoncopyStruct: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:74:5
+ |
+LL | assert_copy::<MyNoncopyStruct>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `MyNoncopyStruct`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::rc::Rc<isize>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-copy.rs:77:5
+ |
+LL | assert_copy::<Rc<isize>>(); //~ ERROR : std::marker::Copy` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc<isize>`
+ |
+note: required by `assert_copy`
+ --> $DIR/kindck-copy.rs:15:1
+ |
+LL | fn assert_copy<T:Copy>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-impl-type-params-2.rs b/src/test/ui/kindck/kindck-impl-type-params-2.rs
similarity index 100%
rename from src/test/compile-fail/kindck-impl-type-params-2.rs
rename to src/test/ui/kindck/kindck-impl-type-params-2.rs
diff --git a/src/test/ui/kindck/kindck-impl-type-params-2.stderr b/src/test/ui/kindck/kindck-impl-type-params-2.stderr
new file mode 100644
index 0000000..e4c0208
--- /dev/null
+++ b/src/test/ui/kindck/kindck-impl-type-params-2.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params-2.rs:23:5
+ |
+LL | take_param(&x);
+ | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>`
+ |
+ = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>`
+note: required by `take_param`
+ --> $DIR/kindck-impl-type-params-2.rs:19:1
+ |
+LL | fn take_param<T:Foo>(foo: &T) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/kindck/kindck-impl-type-params.nll.stderr b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr
new file mode 100644
index 0000000..8f24baf
--- /dev/null
+++ b/src/test/ui/kindck/kindck-impl-type-params.nll.stderr
@@ -0,0 +1,69 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/kindck-impl-type-params.rs:28:13
+ |
+LL | let a = &t as &Gettable<T>;
+ | ^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:28:13
+ |
+LL | let a = &t as &Gettable<T>;
+ | ^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/kindck-impl-type-params.rs:35:27
+ |
+LL | let a: &Gettable<T> = &t;
+ | ^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:35:27
+ |
+LL | let a: &Gettable<T> = &t;
+ | ^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+warning: not reporting region error due to nll
+ --> $DIR/kindck-impl-type-params.rs:42:13
+ |
+LL | let a = &t as &Gettable<&'a isize>;
+ | ^^
+
+error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:48:13
+ |
+LL | let a = t as Box<Gettable<String>>;
+ | ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
+ |
+ = note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
+ = note: required for the cast to the object type `dyn Gettable<std::string::String>`
+
+error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:56:33
+ |
+LL | let a: Box<Gettable<Foo>> = t;
+ | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
+ |
+ = note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
+ = note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-impl-type-params.rs b/src/test/ui/kindck/kindck-impl-type-params.rs
similarity index 100%
rename from src/test/compile-fail/kindck-impl-type-params.rs
rename to src/test/ui/kindck/kindck-impl-type-params.rs
diff --git a/src/test/ui/kindck/kindck-impl-type-params.stderr b/src/test/ui/kindck/kindck-impl-type-params.stderr
new file mode 100644
index 0000000..b938d40
--- /dev/null
+++ b/src/test/ui/kindck/kindck-impl-type-params.stderr
@@ -0,0 +1,72 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/kindck-impl-type-params.rs:28:13
+ |
+LL | let a = &t as &Gettable<T>;
+ | ^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:28:13
+ |
+LL | let a = &t as &Gettable<T>;
+ | ^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/kindck-impl-type-params.rs:35:27
+ |
+LL | let a: &Gettable<T> = &t;
+ | ^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:35:27
+ |
+LL | let a: &Gettable<T> = &t;
+ | ^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+ = note: required because of the requirements on the impl of `Gettable<T>` for `S<T>`
+ = note: required for the cast to the object type `dyn Gettable<T>`
+
+error[E0477]: the type `&'a isize` does not fulfill the required lifetime
+ --> $DIR/kindck-impl-type-params.rs:42:13
+ |
+LL | let a = &t as &Gettable<&'a isize>;
+ | ^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0277]: the trait bound `std::string::String: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:48:13
+ |
+LL | let a = t as Box<Gettable<String>>;
+ | ^ the trait `std::marker::Copy` is not implemented for `std::string::String`
+ |
+ = note: required because of the requirements on the impl of `Gettable<std::string::String>` for `S<std::string::String>`
+ = note: required for the cast to the object type `dyn Gettable<std::string::String>`
+
+error[E0277]: the trait bound `foo3::Foo: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-impl-type-params.rs:56:33
+ |
+LL | let a: Box<Gettable<Foo>> = t;
+ | ^ the trait `std::marker::Copy` is not implemented for `foo3::Foo`
+ |
+ = note: required because of the requirements on the impl of `Gettable<foo3::Foo>` for `S<foo3::Foo>`
+ = note: required for the cast to the object type `dyn Gettable<foo3::Foo>`
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0277, E0477.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-inherited-copy-bound.rs b/src/test/ui/kindck/kindck-inherited-copy-bound.rs
similarity index 100%
rename from src/test/compile-fail/kindck-inherited-copy-bound.rs
rename to src/test/ui/kindck/kindck-inherited-copy-bound.rs
diff --git a/src/test/ui/kindck/kindck-inherited-copy-bound.stderr b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr
new file mode 100644
index 0000000..542ecc0
--- /dev/null
+++ b/src/test/ui/kindck/kindck-inherited-copy-bound.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the trait bound `std::boxed::Box<{integer}>: std::marker::Copy` is not satisfied
+ --> $DIR/kindck-inherited-copy-bound.rs:28:5
+ |
+LL | take_param(&x); //~ ERROR E0277
+ | ^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::boxed::Box<{integer}>`
+ |
+ = note: required because of the requirements on the impl of `Foo` for `std::boxed::Box<{integer}>`
+note: required by `take_param`
+ --> $DIR/kindck-inherited-copy-bound.rs:24:1
+ |
+LL | fn take_param<T:Foo>(foo: &T) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/kindck-inherited-copy-bound.rs:34:19
+ |
+LL | let z = &x as &Foo;
+ | ^^^^ the trait `Foo` cannot be made into an object
+ |
+ = note: the trait cannot require that `Self : Sized`
+
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/kindck-inherited-copy-bound.rs:34:13
+ |
+LL | let z = &x as &Foo;
+ | ^^ the trait `Foo` cannot be made into an object
+ |
+ = note: the trait cannot require that `Self : Sized`
+ = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Foo>` for `&std::boxed::Box<{integer}>`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0038, E0277.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/kindck-nonsendable-1.rs b/src/test/ui/kindck/kindck-nonsendable-1.rs
similarity index 100%
rename from src/test/compile-fail/kindck-nonsendable-1.rs
rename to src/test/ui/kindck/kindck-nonsendable-1.rs
diff --git a/src/test/ui/kindck/kindck-nonsendable-1.stderr b/src/test/ui/kindck/kindck-nonsendable-1.stderr
new file mode 100644
index 0000000..a8aa02e
--- /dev/null
+++ b/src/test/ui/kindck/kindck-nonsendable-1.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `std::rc::Rc<usize>` cannot be sent between threads safely
+ --> $DIR/kindck-nonsendable-1.rs:20:5
+ |
+LL | bar(move|| foo(x));
+ | ^^^ `std::rc::Rc<usize>` cannot be sent between threads safely
+ |
+ = help: within `[closure@$DIR/kindck-nonsendable-1.rs:20:9: 20:22 x:std::rc::Rc<usize>]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<usize>`
+ = note: required because it appears within the type `[closure@$DIR/kindck-nonsendable-1.rs:20:9: 20:22 x:std::rc::Rc<usize>]`
+note: required by `bar`
+ --> $DIR/kindck-nonsendable-1.rs:16:1
+ |
+LL | fn bar<F:FnOnce() + Send>(_: F) { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/ui/kindck/kindck-send-object.rs
similarity index 100%
rename from src/test/compile-fail/kindck-send-object.rs
rename to src/test/ui/kindck/kindck-send-object.rs
diff --git a/src/test/ui/kindck/kindck-send-object.stderr b/src/test/ui/kindck/kindck-send-object.stderr
new file mode 100644
index 0000000..e342352
--- /dev/null
+++ b/src/test/ui/kindck/kindck-send-object.stderr
@@ -0,0 +1,32 @@
+error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely
+ --> $DIR/kindck-send-object.rs:22:5
+ |
+LL | assert_send::<&'static (Dummy+'static)>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object.rs:15:1
+ |
+LL | fn assert_send<T:Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dyn Dummy` cannot be sent between threads safely
+ --> $DIR/kindck-send-object.rs:27:5
+ |
+LL | assert_send::<Box<Dummy>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `dyn Dummy`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<dyn Dummy>`
+ = note: required because it appears within the type `std::boxed::Box<dyn Dummy>`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object.rs:15:1
+ |
+LL | fn assert_send<T:Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/kindck/kindck-send-object1.nll.stderr b/src/test/ui/kindck/kindck-send-object1.nll.stderr
new file mode 100644
index 0000000..6613a29
--- /dev/null
+++ b/src/test/ui/kindck/kindck-send-object1.nll.stderr
@@ -0,0 +1,38 @@
+error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
+ --> $DIR/kindck-send-object1.rs:20:5
+ |
+LL | assert_send::<&'a Dummy>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object1.rs:15:1
+ |
+LL | fn assert_send<T:Send+'static>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/kindck-send-object1.rs:24:5
+ |
+LL | assert_send::<&'a (Dummy+Sync)>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
+ --> $DIR/kindck-send-object1.rs:39:5
+ |
+LL | assert_send::<Box<Dummy+'a>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>`
+ = note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object1.rs:15:1
+ |
+LL | fn assert_send<T:Send+'static>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/ui/kindck/kindck-send-object1.rs
similarity index 100%
rename from src/test/compile-fail/kindck-send-object1.rs
rename to src/test/ui/kindck/kindck-send-object1.rs
diff --git a/src/test/ui/kindck/kindck-send-object1.stderr b/src/test/ui/kindck/kindck-send-object1.stderr
new file mode 100644
index 0000000..d906b7d
--- /dev/null
+++ b/src/test/ui/kindck/kindck-send-object1.stderr
@@ -0,0 +1,41 @@
+error[E0277]: `(dyn Dummy + 'a)` cannot be shared between threads safely
+ --> $DIR/kindck-send-object1.rs:20:5
+ |
+LL | assert_send::<&'a Dummy>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'a)`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `&'a (dyn Dummy + 'a)`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object1.rs:15:1
+ |
+LL | fn assert_send<T:Send+'static>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0477]: the type `&'a (dyn Dummy + std::marker::Sync + 'a)` does not fulfill the required lifetime
+ --> $DIR/kindck-send-object1.rs:24:5
+ |
+LL | assert_send::<&'a (Dummy+Sync)>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0277]: `(dyn Dummy + 'a)` cannot be sent between threads safely
+ --> $DIR/kindck-send-object1.rs:39:5
+ |
+LL | assert_send::<Box<Dummy+'a>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'a)` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `(dyn Dummy + 'a)`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<(dyn Dummy + 'a)>`
+ = note: required because it appears within the type `std::boxed::Box<(dyn Dummy + 'a)>`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object1.rs:15:1
+ |
+LL | fn assert_send<T:Send+'static>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0277, E0477.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/ui/kindck/kindck-send-object2.rs
similarity index 100%
rename from src/test/compile-fail/kindck-send-object2.rs
rename to src/test/ui/kindck/kindck-send-object2.rs
diff --git a/src/test/ui/kindck/kindck-send-object2.stderr b/src/test/ui/kindck/kindck-send-object2.stderr
new file mode 100644
index 0000000..475159c
--- /dev/null
+++ b/src/test/ui/kindck/kindck-send-object2.stderr
@@ -0,0 +1,32 @@
+error[E0277]: `(dyn Dummy + 'static)` cannot be shared between threads safely
+ --> $DIR/kindck-send-object2.rs:17:5
+ |
+LL | assert_send::<&'static Dummy>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `(dyn Dummy + 'static)` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `(dyn Dummy + 'static)`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `&'static (dyn Dummy + 'static)`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object2.rs:13:1
+ |
+LL | fn assert_send<T:Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dyn Dummy` cannot be sent between threads safely
+ --> $DIR/kindck-send-object2.rs:22:5
+ |
+LL | assert_send::<Box<Dummy>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ `dyn Dummy` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `dyn Dummy`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<dyn Dummy>`
+ = note: required because it appears within the type `std::boxed::Box<dyn Dummy>`
+note: required by `assert_send`
+ --> $DIR/kindck-send-object2.rs:13:1
+ |
+LL | fn assert_send<T:Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-send-owned.rs b/src/test/ui/kindck/kindck-send-owned.rs
similarity index 100%
rename from src/test/compile-fail/kindck-send-owned.rs
rename to src/test/ui/kindck/kindck-send-owned.rs
diff --git a/src/test/ui/kindck/kindck-send-owned.stderr b/src/test/ui/kindck/kindck-send-owned.stderr
new file mode 100644
index 0000000..f5781bd
--- /dev/null
+++ b/src/test/ui/kindck/kindck-send-owned.stderr
@@ -0,0 +1,18 @@
+error[E0277]: `*mut u8` cannot be sent between threads safely
+ --> $DIR/kindck-send-owned.rs:22:5
+ |
+LL | assert_send::<Box<*mut u8>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut u8` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `*mut u8`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<*mut u8>`
+ = note: required because it appears within the type `std::boxed::Box<*mut u8>`
+note: required by `assert_send`
+ --> $DIR/kindck-send-owned.rs:13:1
+ |
+LL | fn assert_send<T:Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/kindck-send-unsafe.rs b/src/test/ui/kindck/kindck-send-unsafe.rs
similarity index 100%
rename from src/test/compile-fail/kindck-send-unsafe.rs
rename to src/test/ui/kindck/kindck-send-unsafe.rs
diff --git a/src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master b/src/test/ui/kindck/kindck-send-unsafe.rs~rust-lang_master
similarity index 100%
rename from src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master
rename to src/test/ui/kindck/kindck-send-unsafe.rs~rust-lang_master
diff --git a/src/test/ui/kindck/kindck-send-unsafe.stderr b/src/test/ui/kindck/kindck-send-unsafe.stderr
new file mode 100644
index 0000000..846de09
--- /dev/null
+++ b/src/test/ui/kindck/kindck-send-unsafe.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `*mut &'a isize` cannot be sent between threads safely
+ --> $DIR/kindck-send-unsafe.rs:16:5
+ |
+LL | assert_send::<*mut &'a isize>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `*mut &'a isize` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `*mut &'a isize`
+note: required by `assert_send`
+ --> $DIR/kindck-send-unsafe.rs:13:1
+ |
+LL | fn assert_send<T:Send>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/label-static.rs b/src/test/ui/label/label-static.rs
similarity index 100%
rename from src/test/compile-fail/label-static.rs
rename to src/test/ui/label/label-static.rs
diff --git a/src/test/ui/label/label-static.stderr b/src/test/ui/label/label-static.stderr
new file mode 100644
index 0000000..f5b6eba
--- /dev/null
+++ b/src/test/ui/label/label-static.stderr
@@ -0,0 +1,14 @@
+error: invalid label name `'static`
+ --> $DIR/label-static.rs:12:5
+ |
+LL | 'static: loop { //~ ERROR invalid label name `'static`
+ | ^^^^^^^
+
+error: invalid label name `'static`
+ --> $DIR/label-static.rs:13:15
+ |
+LL | break 'static //~ ERROR invalid label name `'static`
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/label-underscore.rs b/src/test/ui/label/label-underscore.rs
similarity index 100%
rename from src/test/compile-fail/label-underscore.rs
rename to src/test/ui/label/label-underscore.rs
diff --git a/src/test/ui/label/label-underscore.stderr b/src/test/ui/label/label-underscore.stderr
new file mode 100644
index 0000000..9a56709
--- /dev/null
+++ b/src/test/ui/label/label-underscore.stderr
@@ -0,0 +1,14 @@
+error: invalid label name `'_`
+ --> $DIR/label-underscore.rs:12:5
+ |
+LL | '_: loop { //~ ERROR invalid label name `'_`
+ | ^^
+
+error: invalid label name `'_`
+ --> $DIR/label-underscore.rs:13:15
+ |
+LL | break '_ //~ ERROR invalid label name `'_`
+ | ^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/label_break_value_continue.rs b/src/test/ui/label/label_break_value_continue.rs
similarity index 100%
rename from src/test/ui/label_break_value_continue.rs
rename to src/test/ui/label/label_break_value_continue.rs
diff --git a/src/test/ui/label_break_value_continue.stderr b/src/test/ui/label/label_break_value_continue.stderr
similarity index 100%
rename from src/test/ui/label_break_value_continue.stderr
rename to src/test/ui/label/label_break_value_continue.stderr
diff --git a/src/test/ui/label_break_value_illegal_uses.rs b/src/test/ui/label/label_break_value_illegal_uses.rs
similarity index 100%
rename from src/test/ui/label_break_value_illegal_uses.rs
rename to src/test/ui/label/label_break_value_illegal_uses.rs
diff --git a/src/test/ui/label_break_value_illegal_uses.stderr b/src/test/ui/label/label_break_value_illegal_uses.stderr
similarity index 100%
rename from src/test/ui/label_break_value_illegal_uses.stderr
rename to src/test/ui/label/label_break_value_illegal_uses.stderr
diff --git a/src/test/ui/label_break_value_unlabeled_break.rs b/src/test/ui/label/label_break_value_unlabeled_break.rs
similarity index 100%
rename from src/test/ui/label_break_value_unlabeled_break.rs
rename to src/test/ui/label/label_break_value_unlabeled_break.rs
diff --git a/src/test/ui/label_break_value_unlabeled_break.stderr b/src/test/ui/label/label_break_value_unlabeled_break.stderr
similarity index 100%
rename from src/test/ui/label_break_value_unlabeled_break.stderr
rename to src/test/ui/label/label_break_value_unlabeled_break.stderr
diff --git a/src/test/compile-fail/lang-item-missing.rs b/src/test/ui/lang-item-missing.rs
similarity index 100%
rename from src/test/compile-fail/lang-item-missing.rs
rename to src/test/ui/lang-item-missing.rs
diff --git a/src/test/ui/lang-item-missing.stderr b/src/test/ui/lang-item-missing.stderr
new file mode 100644
index 0000000..f7516c7
--- /dev/null
+++ b/src/test/ui/lang-item-missing.stderr
@@ -0,0 +1,4 @@
+error: requires `sized` lang_item
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lexical-scopes.rs b/src/test/ui/lexical-scopes.rs
similarity index 100%
rename from src/test/compile-fail/lexical-scopes.rs
rename to src/test/ui/lexical-scopes.rs
diff --git a/src/test/ui/lexical-scopes.stderr b/src/test/ui/lexical-scopes.stderr
new file mode 100644
index 0000000..3a6ae52
--- /dev/null
+++ b/src/test/ui/lexical-scopes.stderr
@@ -0,0 +1,20 @@
+error[E0574]: expected struct, variant or union type, found type parameter `T`
+ --> $DIR/lexical-scopes.rs:13:13
+ |
+LL | let t = T { i: 0 }; //~ ERROR expected struct, variant or union type, found type parameter `T`
+ | ^ not a struct, variant or union type
+help: possible better candidate is found in another module, you can import it into scope
+ |
+LL | use T;
+ |
+
+error[E0599]: no function or associated item named `f` found for type `Foo` in the current scope
+ --> $DIR/lexical-scopes.rs:20:5
+ |
+LL | Foo::f(); //~ ERROR no function or associated item named `f`
+ | ^^^^^^ function or associated item not found in `Foo`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0574, E0599.
+For more information about an error, try `rustc --explain E0574`.
diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr
deleted file mode 100644
index 89313f8..0000000
--- a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr
+++ /dev/null
@@ -1,22 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/42701_one_named_and_one_anonymous.rs:20:9
- |
-LL | &*x //~ ERROR explicit lifetime
- | ^^^
-
-error[E0621]: explicit lifetime required in the type of `x`
- --> $DIR/42701_one_named_and_one_anonymous.rs:16:5
- |
-LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 {
- | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
-LL | / if true {
-LL | | let p: &i32 = &a.field;
-LL | | &*p
-LL | | } else {
-LL | | &*x //~ ERROR explicit lifetime
-LL | | }
- | |_____^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr
deleted file mode 100644
index 3976cb3..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:21:21
- |
-LL | other //~ ERROR explicit lifetime
- | ^^^^^
-
-error[E0621]: explicit lifetime required in the type of `other`
- --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:18:15
- |
-LL | fn bar(&self, other: Foo) -> Foo<'a> {
- | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>`
-LL | match *self {
- | ^^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr
deleted file mode 100644
index 00eff2f..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:16
- |
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^
-
-error[E0621]: explicit lifetime required in the type of `x`
- --> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:8
- |
-LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
- | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr
deleted file mode 100644
index a3b46aa..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-if-else-3.rs:12:27
- |
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^
-
-error[E0621]: explicit lifetime required in parameter type
- --> $DIR/ex1-return-one-existing-name-if-else-3.rs:11:16
- |
-LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 {
- | ^ --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)`
- | |
- | lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr
deleted file mode 100644
index 465b33b..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:15
- |
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^
-
-error[E0621]: explicit lifetime required in the type of `x`
- --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:7
- |
-LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
- | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr
deleted file mode 100644
index a62d7cc..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:36
- |
-LL | if true { &self.field } else { x } //~ ERROR explicit lifetime
- | ^
-
-error[E0621]: explicit lifetime required in the type of `x`
- --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:5
- |
-LL | fn foo<'a>(&'a self, x: &i32) -> &i32 {
- | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
-LL |
-LL | if true { &self.field } else { x } //~ ERROR explicit lifetime
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
deleted file mode 100644
index b6bf646..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20
- |
-LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:12
- |
-LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
- | -- - let's call the lifetime of this reference `'1`
- | |
- | lifetime `'a` defined here
-LL |
-LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
- | ^^^^^ requires that `'1` must outlive `'a`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr
deleted file mode 100644
index 93f8254..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr
+++ /dev/null
@@ -1,17 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-if-else.rs:12:27
- |
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^
-
-error[E0621]: explicit lifetime required in the type of `y`
- --> $DIR/ex1-return-one-existing-name-if-else.rs:12:8
- |
-LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
- | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32`
-LL | if x > y { x } else { y } //~ ERROR explicit lifetime
- | ^^^^^ lifetime `'a` required
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr
deleted file mode 100644
index 93eac05..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5
- |
-LL | x //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5
- |
-LL | fn foo<'a>(&self, x: &'a i32) -> &i32 {
- | -- - let's call the lifetime of this reference `'1`
- | |
- | lifetime `'a` defined here
-LL |
-LL | x //~ ERROR lifetime mismatch
- | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr
deleted file mode 100644
index c5b4fd1..0000000
--- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30
- |
-LL | if true { x } else { self } //~ ERROR lifetime mismatch
- | ^^^^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:9
- |
-LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
- | -- - let's call the lifetime of this reference `'1`
- | |
- | lifetime `'a` defined here
-LL |
-LL | if true { x } else { self } //~ ERROR lifetime mismatch
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'a`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr
deleted file mode 100644
index 6140347..0000000
--- a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex2b-push-no-existing-names.rs:16:12
- |
-LL | x.push(y); //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex2b-push-no-existing-names.rs:16:5
- |
-LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
- | -------- -------- lifetime `'1` appears in this type
- | |
- | lifetime `'2` appears in this type
-LL | x.push(y); //~ ERROR lifetime mismatch
- | ^^^^^^^^^ argument requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr
deleted file mode 100644
index 2829fbcd..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:11
- |
-LL | x.b = y.b; //~ ERROR lifetime mismatch
- | ^^^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:5
- |
-LL | fn foo(mut x: Ref, y: Ref) {
- | --- --- lifetime `'1` appears in this type
- | |
- | lifetime `'2` appears in this type
-LL | x.b = y.b; //~ ERROR lifetime mismatch
- | ^^^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr
deleted file mode 100644
index 8171ee7..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:11
- |
-LL | x.a = x.b; //~ ERROR lifetime mismatch
- | ^^^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:5
- |
-LL | fn foo(mut x: Ref) {
- | ---
- | |
- | lifetime `'1` appears in this type
- | lifetime `'2` appears in this type
-LL | x.a = x.b; //~ ERROR lifetime mismatch
- | ^^^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr
deleted file mode 100644
index 99b6460..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr
+++ /dev/null
@@ -1,19 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11
- |
-LL | x.a = x.b; //~ ERROR lifetime mismatch
- | ^^^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:5
- |
-LL | fn foo(mut x: Ref) {
- | ---
- | |
- | lifetime `'1` appears in this type
- | lifetime `'2` appears in this type
-LL | x.a = x.b; //~ ERROR lifetime mismatch
- | ^^^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr
deleted file mode 100644
index c9542d3..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12
- |
-LL | x.push(y); //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:5
- |
-LL | fn foo(mut x: Vec<Ref>, y: Ref) {
- | --- --- lifetime `'1` appears in this type
- | |
- | lifetime `'2` appears in this type
-LL | x.push(y); //~ ERROR lifetime mismatch
- | ^^^^^^^^^ argument requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
deleted file mode 100644
index 4597967..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:9
- |
-LL | y = x.b; //~ ERROR lifetime mismatch
- | ^^^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
- |
-LL | fn foo(mut x: Ref, y: &u32) {
- | --- - let's call the lifetime of this reference `'2`
- | |
- | lifetime `'1` appears in this type
-LL | y = x.b; //~ ERROR lifetime mismatch
- | ^^^^^^^ requires that `'1` must outlive `'2`
-
-error[E0384]: cannot assign to immutable argument `y`
- --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
- |
-LL | fn foo(mut x: Ref, y: &u32) {
- | - consider changing this to `mut y`
-LL | y = x.b; //~ ERROR lifetime mismatch
- | ^^^^^^^ cannot assign to immutable argument
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr
deleted file mode 100644
index 5fc1755..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:11
- |
-LL | y.b = x; //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:5
- |
-LL | fn foo(mut y: Ref, x: &u32) {
- | --- - let's call the lifetime of this reference `'1`
- | |
- | lifetime `'2` appears in this type
-LL | y.b = x; //~ ERROR lifetime mismatch
- | ^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr
deleted file mode 100644
index 835f958..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11
- |
-LL | y.b = x; //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:5
- |
-LL | fn foo(mut y: Ref, x: &u32) {
- | --- - let's call the lifetime of this reference `'1`
- | |
- | lifetime `'2` appears in this type
-LL | y.b = x; //~ ERROR lifetime mismatch
- | ^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr
deleted file mode 100644
index 7aed5fe..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:11
- |
-LL | x.b = y; //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:5
- |
-LL | fn foo(mut x: Ref, y: &u32) {
- | --- - let's call the lifetime of this reference `'1`
- | |
- | lifetime `'2` appears in this type
-LL | x.b = y; //~ ERROR lifetime mismatch
- | ^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr
deleted file mode 100644
index 22581d9..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
- |
-LL | x //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
- |
-LL | fn foo<'a>(&self, x: &i32) -> &i32 {
- | - - let's call the lifetime of this reference `'1`
- | |
- | let's call the lifetime of this reference `'2`
-LL | x //~ ERROR lifetime mismatch
- | ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr
deleted file mode 100644
index 908526d..0000000
--- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr
+++ /dev/null
@@ -1,18 +0,0 @@
-warning: not reporting region error due to nll
- --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19
- |
-LL | if true { x } else { self } //~ ERROR lifetime mismatch
- | ^
-
-error: unsatisfied lifetime constraints
- --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:9
- |
-LL | fn foo<'a>(&self, x: &Foo) -> &Foo {
- | - - let's call the lifetime of this reference `'1`
- | |
- | let's call the lifetime of this reference `'2`
-LL | if true { x } else { self } //~ ERROR lifetime mismatch
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'2`
-
-error: aborting due to previous error
-
diff --git a/src/test/compile-fail/auxiliary/lifetime_bound_will_change_warning_lib.rs b/src/test/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lifetime_bound_will_change_warning_lib.rs
rename to src/test/ui/lifetimes/auxiliary/lifetime_bound_will_change_warning_lib.rs
diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr
new file mode 100644
index 0000000..ab9bb19
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.nll.stderr
@@ -0,0 +1,32 @@
+warning: not reporting region error due to nll
+ --> $DIR/lifetime-bound-will-change-warning.rs:44:13
+ |
+LL | ref_obj(x) //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/lifetime-bound-will-change-warning.rs:49:18
+ |
+LL | lib::ref_obj(x) //~ ERROR mismatched types
+ | ^
+
+error: borrowed data escapes outside of function
+ --> $DIR/lifetime-bound-will-change-warning.rs:44:5
+ |
+LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
+ | - `x` is a reference that is only valid in the function body
+LL | // but ref_obj will not, so warn.
+LL | ref_obj(x) //~ ERROR mismatched types
+ | ^^^^^^^^^^ `x` escapes the function body here
+
+error: borrowed data escapes outside of function
+ --> $DIR/lifetime-bound-will-change-warning.rs:49:5
+ |
+LL | fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
+ | - `x` is a reference that is only valid in the function body
+LL | // same as test2, but cross crate
+LL | lib::ref_obj(x) //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lifetime-bound-will-change-warning.rs b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs
similarity index 100%
rename from src/test/compile-fail/lifetime-bound-will-change-warning.rs
rename to src/test/ui/lifetimes/lifetime-bound-will-change-warning.rs
diff --git a/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr
new file mode 100644
index 0000000..01f215c
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-bound-will-change-warning.stderr
@@ -0,0 +1,33 @@
+error[E0308]: mismatched types
+ --> $DIR/lifetime-bound-will-change-warning.rs:44:13
+ |
+LL | ref_obj(x) //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>`
+ found type `&std::boxed::Box<(dyn std::ops::Fn() + 'a)>`
+note: the lifetime 'a as defined on the function body at 42:10...
+ --> $DIR/lifetime-bound-will-change-warning.rs:42:10
+ |
+LL | fn test2<'a>(x: &'a Box<Fn()+'a>) {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/lifetime-bound-will-change-warning.rs:49:18
+ |
+LL | lib::ref_obj(x) //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `&std::boxed::Box<(dyn std::ops::Fn() + 'static)>`
+ found type `&std::boxed::Box<(dyn std::ops::Fn() + 'a)>`
+note: the lifetime 'a as defined on the function body at 47:12...
+ --> $DIR/lifetime-bound-will-change-warning.rs:47:12
+ |
+LL | fn test2cc<'a>(x: &'a Box<Fn()+'a>) {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs
similarity index 100%
rename from src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.rs
rename to src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs
diff --git a/src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr
similarity index 100%
rename from src/test/ui/lifetime-elision-return-type-requires-explicit-lifetime.stderr
rename to src/test/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr
new file mode 100644
index 0000000..3fb0252
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/42701_one_named_and_one_anonymous.rs:20:9
+ |
+LL | &*x //~ ERROR explicit lifetime
+ | ^^^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/42701_one_named_and_one_anonymous.rs:20:9
+ |
+LL | fn foo2<'a>(a: &'a Foo, x: &i32) -> &'a i32 {
+ | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
+...
+LL | &*x //~ ERROR explicit lifetime
+ | ^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.rs b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.rs
rename to src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.rs
diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr
rename to src/test/ui/lifetimes/lifetime-errors/42701_one_named_and_one_anonymous.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr
new file mode 100644
index 0000000..817d7c8
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:21:21
+ |
+LL | other //~ ERROR explicit lifetime
+ | ^^^^^
+
+error[E0621]: explicit lifetime required in the type of `other`
+ --> $DIR/ex1-return-one-existing-name-early-bound-in-struct.rs:21:21
+ |
+LL | fn bar(&self, other: Foo) -> Foo<'a> {
+ | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>`
+...
+LL | other //~ ERROR explicit lifetime
+ | ^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr
new file mode 100644
index 0000000..a10c38a
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:16
+ |
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/ex1-return-one-existing-name-if-else-2.rs:12:16
+ |
+LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
+ | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr
new file mode 100644
index 0000000..e33b89c
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-if-else-3.rs:12:27
+ |
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^
+
+error[E0621]: explicit lifetime required in parameter type
+ --> $DIR/ex1-return-one-existing-name-if-else-3.rs:12:27
+ |
+LL | fn foo<'a>((x, y): (&'a i32, &i32)) -> &'a i32 {
+ | --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)`
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr
new file mode 100644
index 0000000..a3b2c3f
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:15
+ |
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/ex1-return-one-existing-name-if-else-using-impl-2.rs:14:15
+ |
+LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
+ | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr
new file mode 100644
index 0000000..e13a710
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:36
+ |
+LL | if true { &self.field } else { x } //~ ERROR explicit lifetime
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:18:36
+ |
+LL | fn foo<'a>(&'a self, x: &i32) -> &i32 {
+ | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
+LL |
+LL | if true { &self.field } else { x } //~ ERROR explicit lifetime
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
new file mode 100644
index 0000000..4ce3a61
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20
+ |
+LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex1-return-one-existing-name-if-else-using-impl.rs:21:20
+ |
+LL | fn foo<'a>(x: &i32, y: &'a i32) -> &'a i32 {
+ | -- - let's call the lifetime of this reference `'1`
+ | |
+ | lifetime `'a` defined here
+LL |
+LL | if x > y { x } else { y } //~ ERROR lifetime mismatch
+ | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr
new file mode 100644
index 0000000..5b4b28a
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-if-else.rs:12:27
+ |
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `y`
+ --> $DIR/ex1-return-one-existing-name-if-else.rs:12:27
+ |
+LL | fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 {
+ | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a i32`
+LL | if x > y { x } else { y } //~ ERROR explicit lifetime
+ | ^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr
new file mode 100644
index 0000000..272ae0b
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5
+ |
+LL | x //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex1-return-one-existing-name-return-type-is-anon.rs:18:5
+ |
+LL | fn foo<'a>(&self, x: &'a i32) -> &i32 {
+ | -- - let's call the lifetime of this reference `'1`
+ | |
+ | lifetime `'a` defined here
+LL |
+LL | x //~ ERROR lifetime mismatch
+ | ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-return-type-is-anon.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr
new file mode 100644
index 0000000..2106546
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30
+ |
+LL | if true { x } else { self } //~ ERROR lifetime mismatch
+ | ^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex1-return-one-existing-name-self-is-anon.rs:18:30
+ |
+LL | fn foo<'a>(&self, x: &'a Foo) -> &'a Foo {
+ | -- - let's call the lifetime of this reference `'1`
+ | |
+ | lifetime `'a` defined here
+LL |
+LL | if true { x } else { self } //~ ERROR lifetime mismatch
+ | ^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.rs
diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-self-is-anon.stderr
diff --git a/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.rs b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.rs
diff --git a/src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.stderr b/src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex1b-return-no-names-if-else.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex1b-return-no-names-if-else.stderr
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.rs
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-2.stderr
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.rs
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.rs b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.rs
diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2a-push-one-existing-name.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr
new file mode 100644
index 0000000..b7c252c
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex2b-push-no-existing-names.rs:16:12
+ |
+LL | x.push(y); //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex2b-push-no-existing-names.rs:16:5
+ |
+LL | fn foo(x: &mut Vec<Ref<i32>>, y: Ref<i32>) {
+ | - - has type `Ref<'1, i32>`
+ | |
+ | has type `&mut std::vec::Vec<Ref<'2, i32>>`
+LL | x.push(y); //~ ERROR lifetime mismatch
+ | ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.rs b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2b-push-no-existing-names.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.rs
diff --git a/src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2b-push-no-existing-names.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2b-push-no-existing-names.stderr
diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.rs b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2c-push-inference-variable.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.rs
diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2c-push-inference-variable.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2c-push-inference-variable.stderr
diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.rs
diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2d-push-inference-variable-2.stderr
diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.rs
diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex2e-push-inference-variable-3.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-2.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-3.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-3.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-3.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr
new file mode 100644
index 0000000..618817f
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:11
+ |
+LL | x.b = y.b; //~ ERROR lifetime mismatch
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-both-are-structs-2.rs:16:5
+ |
+LL | fn foo(mut x: Ref, y: Ref) {
+ | ----- - has type `Ref<'_, '1>`
+ | |
+ | has type `Ref<'_, '2>`
+LL | x.b = y.b; //~ ERROR lifetime mismatch
+ | ^^^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-2.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr
new file mode 100644
index 0000000..b4767af
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:11
+ |
+LL | x.a = x.b; //~ ERROR lifetime mismatch
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:5
+ |
+LL | fn foo(mut x: Ref) {
+ | -----
+ | |
+ | has type `Ref<'_, '1>`
+ | has type `Ref<'2, '_>`
+LL | x.a = x.b; //~ ERROR lifetime mismatch
+ | ^^^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-3.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr
new file mode 100644
index 0000000..e2fcbaa
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11
+ |
+LL | x.a = x.b; //~ ERROR lifetime mismatch
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:5
+ |
+LL | fn foo(mut x: Ref) {
+ | -----
+ | |
+ | has type `Ref<'_, '1>`
+ | has type `Ref<'2, '_>`
+LL | x.a = x.b; //~ ERROR lifetime mismatch
+ | ^^^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr
new file mode 100644
index 0000000..79f1a8c
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:12
+ |
+LL | x.push(y); //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:5
+ |
+LL | fn foo(mut x: Vec<Ref>, y: Ref) {
+ | ----- - has type `Ref<'1>`
+ | |
+ | has type `std::vec::Vec<Ref<'2>>`
+LL | x.push(y); //~ ERROR lifetime mismatch
+ | ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-latebound-regions.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
new file mode 100644
index 0000000..0bacd89
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.nll.stderr
@@ -0,0 +1,27 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:9
+ |
+LL | y = x.b; //~ ERROR lifetime mismatch
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
+ |
+LL | fn foo(mut x: Ref, y: &u32) {
+ | ----- - let's call the lifetime of this reference `'2`
+ | |
+ | has type `Ref<'_, '1>`
+LL | y = x.b; //~ ERROR lifetime mismatch
+ | ^^^^^^^ requires that `'1` must outlive `'2`
+
+error[E0384]: cannot assign to immutable argument `y`
+ --> $DIR/ex3-both-anon-regions-one-is-struct-2.rs:14:5
+ |
+LL | fn foo(mut x: Ref, y: &u32) {
+ | - consider changing this to `mut y`
+LL | y = x.b; //~ ERROR lifetime mismatch
+ | ^^^^^^^ cannot assign to immutable argument
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-2.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr
new file mode 100644
index 0000000..f40c67b
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:11
+ |
+LL | y.b = x; //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-one-is-struct-3.rs:14:5
+ |
+LL | fn foo(mut y: Ref, x: &u32) {
+ | ----- - let's call the lifetime of this reference `'1`
+ | |
+ | has type `Ref<'_, '2>`
+LL | y.b = x; //~ ERROR lifetime mismatch
+ | ^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-3.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr
new file mode 100644
index 0000000..f9168dc
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:11
+ |
+LL | y.b = x; //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-one-is-struct-4.rs:14:5
+ |
+LL | fn foo(mut y: Ref, x: &u32) {
+ | ----- - let's call the lifetime of this reference `'1`
+ | |
+ | has type `Ref<'_, '2>`
+LL | y.b = x; //~ ERROR lifetime mismatch
+ | ^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct-4.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr
new file mode 100644
index 0000000..c43f847
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:11
+ |
+LL | x.b = y; //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-one-is-struct.rs:17:5
+ |
+LL | fn foo(mut x: Ref, y: &u32) {
+ | ----- - let's call the lifetime of this reference `'1`
+ | |
+ | has type `Ref<'_, '2>`
+LL | x.b = y; //~ ERROR lifetime mismatch
+ | ^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-one-is-struct.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr
new file mode 100644
index 0000000..9680e8c
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
+ |
+LL | x //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-return-type-is-anon.rs:17:5
+ |
+LL | fn foo<'a>(&self, x: &i32) -> &i32 {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | x //~ ERROR lifetime mismatch
+ | ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-return-type-is-anon.stderr
diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr
new file mode 100644
index 0000000..6fbe8e9
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19
+ |
+LL | if true { x } else { self } //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/ex3-both-anon-regions-self-is-anon.rs:17:19
+ |
+LL | fn foo<'a>(&self, x: &Foo) -> &Foo {
+ | - - let's call the lifetime of this reference `'1`
+ | |
+ | let's call the lifetime of this reference `'2`
+LL | if true { x } else { self } //~ ERROR lifetime mismatch
+ | ^ function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-self-is-anon.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-fn-items.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-impl-items.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-using-trait-objects.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.nll.stderr
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.rs b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions.rs
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.rs
diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/ex3-both-anon-regions.stderr
rename to src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions.stderr
diff --git a/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.rs b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs
similarity index 100%
rename from src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.rs
rename to src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.rs
diff --git a/src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr b/src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr
similarity index 100%
rename from src/test/ui/lifetime-errors/liveness-assign-imm-local-notes.stderr
rename to src/test/ui/lifetimes/lifetime-errors/liveness-assign-imm-local-notes.stderr
diff --git a/src/test/compile-fail/lifetime-no-keyword.rs b/src/test/ui/lifetimes/lifetime-no-keyword.rs
similarity index 100%
rename from src/test/compile-fail/lifetime-no-keyword.rs
rename to src/test/ui/lifetimes/lifetime-no-keyword.rs
diff --git a/src/test/ui/lifetimes/lifetime-no-keyword.stderr b/src/test/ui/lifetimes/lifetime-no-keyword.stderr
new file mode 100644
index 0000000..1dcbe33
--- /dev/null
+++ b/src/test/ui/lifetimes/lifetime-no-keyword.stderr
@@ -0,0 +1,26 @@
+error: lifetimes cannot use keyword names
+ --> $DIR/lifetime-no-keyword.rs:13:8
+ |
+LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names
+ | ^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/lifetime-no-keyword.rs:13:18
+ |
+LL | fn baz<'let>(a: &'let isize) { } //~ ERROR lifetimes cannot use keyword names
+ | ^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/lifetime-no-keyword.rs:15:8
+ |
+LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: lifetimes cannot use keyword names
+ --> $DIR/lifetime-no-keyword.rs:15:19
+ |
+LL | fn zab<'self>(a: &'self isize) { } //~ ERROR lifetimes cannot use keyword names
+ | ^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/linkage2.rs b/src/test/ui/linkage2.rs
similarity index 100%
rename from src/test/compile-fail/linkage2.rs
rename to src/test/ui/linkage2.rs
diff --git a/src/test/ui/linkage2.stderr b/src/test/ui/linkage2.stderr
new file mode 100644
index 0000000..d9edac1
--- /dev/null
+++ b/src/test/ui/linkage2.stderr
@@ -0,0 +1,8 @@
+error: must have type `*const T` or `*mut T`
+ --> $DIR/linkage2.rs:14:32
+ |
+LL | #[linkage = "extern_weak"] static foo: i32;
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/linkage3.rs b/src/test/ui/linkage3.rs
similarity index 100%
rename from src/test/compile-fail/linkage3.rs
rename to src/test/ui/linkage3.rs
diff --git a/src/test/ui/linkage3.stderr b/src/test/ui/linkage3.stderr
new file mode 100644
index 0000000..3429ced
--- /dev/null
+++ b/src/test/ui/linkage3.stderr
@@ -0,0 +1,8 @@
+error: invalid linkage specified
+ --> $DIR/linkage3.rs:14:24
+ |
+LL | #[linkage = "foo"] static foo: *const i32;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/linkage4.rs b/src/test/ui/linkage4.rs
similarity index 100%
rename from src/test/compile-fail/linkage4.rs
rename to src/test/ui/linkage4.rs
diff --git a/src/test/ui/linkage4.stderr b/src/test/ui/linkage4.stderr
new file mode 100644
index 0000000..c04f88d
--- /dev/null
+++ b/src/test/ui/linkage4.stderr
@@ -0,0 +1,11 @@
+error[E0658]: the `linkage` attribute is experimental and not portable across platforms (see issue #29603)
+ --> $DIR/linkage4.rs:11:1
+ |
+LL | #[linkage = "external"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(linkage)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/auxiliary/inherited_stability.rs b/src/test/ui/lint/auxiliary/inherited_stability.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/inherited_stability.rs
rename to src/test/ui/lint/auxiliary/inherited_stability.rs
diff --git a/src/test/ui/auxiliary/lint_output_format.rs b/src/test/ui/lint/auxiliary/lint_output_format.rs
similarity index 100%
rename from src/test/ui/auxiliary/lint_output_format.rs
rename to src/test/ui/lint/auxiliary/lint_output_format.rs
diff --git a/src/test/compile-fail/auxiliary/lint_stability.rs b/src/test/ui/lint/auxiliary/lint_stability.rs
similarity index 100%
copy from src/test/compile-fail/auxiliary/lint_stability.rs
copy to src/test/ui/lint/auxiliary/lint_stability.rs
diff --git a/src/test/compile-fail/auxiliary/lint_stability_fields.rs b/src/test/ui/lint/auxiliary/lint_stability_fields.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_stability_fields.rs
rename to src/test/ui/lint/auxiliary/lint_stability_fields.rs
diff --git a/src/test/compile-fail/auxiliary/lint_unused_extern_crate.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_unused_extern_crate.rs
rename to src/test/ui/lint/auxiliary/lint_unused_extern_crate.rs
diff --git a/src/test/compile-fail/auxiliary/lint_unused_extern_crate2.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate2.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_unused_extern_crate2.rs
rename to src/test/ui/lint/auxiliary/lint_unused_extern_crate2.rs
diff --git a/src/test/compile-fail/auxiliary/lint_unused_extern_crate3.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate3.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_unused_extern_crate3.rs
rename to src/test/ui/lint/auxiliary/lint_unused_extern_crate3.rs
diff --git a/src/test/compile-fail/auxiliary/lint_unused_extern_crate4.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate4.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_unused_extern_crate4.rs
rename to src/test/ui/lint/auxiliary/lint_unused_extern_crate4.rs
diff --git a/src/test/compile-fail/auxiliary/lint_unused_extern_crate5.rs b/src/test/ui/lint/auxiliary/lint_unused_extern_crate5.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/lint_unused_extern_crate5.rs
rename to src/test/ui/lint/auxiliary/lint_unused_extern_crate5.rs
diff --git a/src/test/compile-fail/auxiliary/stability_cfg1.rs b/src/test/ui/lint/auxiliary/stability_cfg1.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/stability_cfg1.rs
rename to src/test/ui/lint/auxiliary/stability_cfg1.rs
diff --git a/src/test/compile-fail/auxiliary/stability_cfg2.rs b/src/test/ui/lint/auxiliary/stability_cfg2.rs
similarity index 100%
copy from src/test/compile-fail/auxiliary/stability_cfg2.rs
copy to src/test/ui/lint/auxiliary/stability_cfg2.rs
diff --git a/src/test/ui/lint-anon-param-edition.fixed b/src/test/ui/lint/lint-anon-param-edition.fixed
similarity index 100%
rename from src/test/ui/lint-anon-param-edition.fixed
rename to src/test/ui/lint/lint-anon-param-edition.fixed
diff --git a/src/test/ui/lint-anon-param-edition.rs b/src/test/ui/lint/lint-anon-param-edition.rs
similarity index 100%
rename from src/test/ui/lint-anon-param-edition.rs
rename to src/test/ui/lint/lint-anon-param-edition.rs
diff --git a/src/test/ui/lint-anon-param-edition.stderr b/src/test/ui/lint/lint-anon-param-edition.stderr
similarity index 100%
rename from src/test/ui/lint-anon-param-edition.stderr
rename to src/test/ui/lint/lint-anon-param-edition.stderr
diff --git a/src/test/compile-fail/lint-attr-non-item-node.rs b/src/test/ui/lint/lint-attr-non-item-node.rs
similarity index 100%
rename from src/test/compile-fail/lint-attr-non-item-node.rs
rename to src/test/ui/lint/lint-attr-non-item-node.rs
diff --git a/src/test/ui/lint/lint-attr-non-item-node.stderr b/src/test/ui/lint/lint-attr-non-item-node.stderr
new file mode 100644
index 0000000..33d096c5
--- /dev/null
+++ b/src/test/ui/lint/lint-attr-non-item-node.stderr
@@ -0,0 +1,14 @@
+error: unreachable statement
+ --> $DIR/lint-attr-non-item-node.rs:17:9
+ |
+LL | "unreachable"; //~ ERROR unreachable statement
+ | ^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-attr-non-item-node.rs:14:12
+ |
+LL | #[deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-change-warnings.rs b/src/test/ui/lint/lint-change-warnings.rs
similarity index 100%
rename from src/test/compile-fail/lint-change-warnings.rs
rename to src/test/ui/lint/lint-change-warnings.rs
diff --git a/src/test/ui/lint/lint-change-warnings.stderr b/src/test/ui/lint/lint-change-warnings.stderr
new file mode 100644
index 0000000..353802f
--- /dev/null
+++ b/src/test/ui/lint/lint-change-warnings.stderr
@@ -0,0 +1,36 @@
+error: denote infinite loops with `loop { ... }`
+ --> $DIR/lint-change-warnings.rs:15:5
+ |
+LL | while true {} //~ ERROR: infinite
+ | ^^^^^^^^^^ help: use `loop`
+ |
+note: lint level defined here
+ --> $DIR/lint-change-warnings.rs:11:9
+ |
+LL | #![deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(while_true)] implied by #[deny(warnings)]
+
+warning: denote infinite loops with `loop { ... }`
+ --> $DIR/lint-change-warnings.rs:25:5
+ |
+LL | while true {} //~ WARNING: infinite
+ | ^^^^^^^^^^ help: use `loop`
+ |
+ = note: #[warn(while_true)] on by default
+
+error: denote infinite loops with `loop { ... }`
+ --> $DIR/lint-change-warnings.rs:30:5
+ |
+LL | while true {} //~ ERROR: infinite
+ | ^^^^^^^^^^ help: use `loop`
+ |
+note: lint level defined here
+ --> $DIR/lint-change-warnings.rs:28:10
+ |
+LL | #[forbid(warnings)]
+ | ^^^^^^^^
+ = note: #[forbid(while_true)] implied by #[forbid(warnings)]
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lint-ctypes-enum.rs b/src/test/ui/lint/lint-ctypes-enum.rs
similarity index 100%
rename from src/test/compile-fail/lint-ctypes-enum.rs
rename to src/test/ui/lint/lint-ctypes-enum.rs
diff --git a/src/test/ui/lint/lint-ctypes-enum.stderr b/src/test/ui/lint/lint-ctypes-enum.stderr
new file mode 100644
index 0000000..9b1c04b
--- /dev/null
+++ b/src/test/ui/lint/lint-ctypes-enum.stderr
@@ -0,0 +1,46 @@
+error: `extern` block uses type `U` which is not FFI-safe: enum has no representation hint
+ --> $DIR/lint-ctypes-enum.rs:30:13
+ |
+LL | fn uf(x: U); //~ ERROR enum has no representation hint
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/lint-ctypes-enum.rs:11:9
+ |
+LL | #![deny(improper_ctypes)]
+ | ^^^^^^^^^^^^^^^
+ = help: consider adding a #[repr(...)] attribute to this enum
+note: type defined here
+ --> $DIR/lint-ctypes-enum.rs:15:1
+ |
+LL | enum U { A }
+ | ^^^^^^^^^^^^
+
+error: `extern` block uses type `B` which is not FFI-safe: enum has no representation hint
+ --> $DIR/lint-ctypes-enum.rs:31:13
+ |
+LL | fn bf(x: B); //~ ERROR enum has no representation hint
+ | ^
+ |
+ = help: consider adding a #[repr(...)] attribute to this enum
+note: type defined here
+ --> $DIR/lint-ctypes-enum.rs:16:1
+ |
+LL | enum B { C, D }
+ | ^^^^^^^^^^^^^^^
+
+error: `extern` block uses type `T` which is not FFI-safe: enum has no representation hint
+ --> $DIR/lint-ctypes-enum.rs:32:13
+ |
+LL | fn tf(x: T); //~ ERROR enum has no representation hint
+ | ^
+ |
+ = help: consider adding a #[repr(...)] attribute to this enum
+note: type defined here
+ --> $DIR/lint-ctypes-enum.rs:17:1
+ |
+LL | enum T { E, F, G }
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/lint-ctypes.rs b/src/test/ui/lint/lint-ctypes.rs
similarity index 100%
rename from src/test/ui/lint-ctypes.rs
rename to src/test/ui/lint/lint-ctypes.rs
diff --git a/src/test/ui/lint-ctypes.stderr b/src/test/ui/lint/lint-ctypes.stderr
similarity index 100%
rename from src/test/ui/lint-ctypes.stderr
rename to src/test/ui/lint/lint-ctypes.stderr
diff --git a/src/test/compile-fail/lint-dead-code-1.rs b/src/test/ui/lint/lint-dead-code-1.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-1.rs
rename to src/test/ui/lint/lint-dead-code-1.rs
diff --git a/src/test/ui/lint/lint-dead-code-1.stderr b/src/test/ui/lint/lint-dead-code-1.stderr
new file mode 100644
index 0000000..9802b7e
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-1.stderr
@@ -0,0 +1,62 @@
+error: struct is never constructed: `Bar`
+ --> $DIR/lint-dead-code-1.rs:22:5
+ |
+LL | pub struct Bar; //~ ERROR: struct is never constructed
+ | ^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-1.rs:15:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: static item is never used: `priv_static`
+ --> $DIR/lint-dead-code-1.rs:30:1
+ |
+LL | static priv_static: isize = 0; //~ ERROR: static item is never used
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: constant item is never used: `priv_const`
+ --> $DIR/lint-dead-code-1.rs:37:1
+ |
+LL | const priv_const: isize = 0; //~ ERROR: constant item is never used
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: struct is never constructed: `PrivStruct`
+ --> $DIR/lint-dead-code-1.rs:45:1
+ |
+LL | struct PrivStruct; //~ ERROR: struct is never constructed
+ | ^^^^^^^^^^^^^^^^^^
+
+error: enum is never used: `priv_enum`
+ --> $DIR/lint-dead-code-1.rs:74:1
+ |
+LL | enum priv_enum { foo2, bar2 } //~ ERROR: enum is never used
+ | ^^^^^^^^^^^^^^
+
+error: variant is never constructed: `bar3`
+ --> $DIR/lint-dead-code-1.rs:77:5
+ |
+LL | bar3 //~ ERROR variant is never constructed
+ | ^^^^
+
+error: function is never used: `priv_fn`
+ --> $DIR/lint-dead-code-1.rs:98:1
+ |
+LL | fn priv_fn() { //~ ERROR: function is never used
+ | ^^^^^^^^^^^^
+
+error: function is never used: `foo`
+ --> $DIR/lint-dead-code-1.rs:103:1
+ |
+LL | fn foo() { //~ ERROR: function is never used
+ | ^^^^^^^^
+
+error: function is never used: `bar`
+ --> $DIR/lint-dead-code-1.rs:108:1
+ |
+LL | fn bar() { //~ ERROR: function is never used
+ | ^^^^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/src/test/compile-fail/lint-dead-code-2.rs b/src/test/ui/lint/lint-dead-code-2.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-2.rs
rename to src/test/ui/lint/lint-dead-code-2.rs
diff --git a/src/test/ui/lint/lint-dead-code-2.stderr b/src/test/ui/lint/lint-dead-code-2.stderr
new file mode 100644
index 0000000..6e713c8
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-2.stderr
@@ -0,0 +1,26 @@
+error: function is never used: `dead_fn`
+ --> $DIR/lint-dead-code-2.rs:32:1
+ |
+LL | fn dead_fn() {} //~ ERROR: function is never used
+ | ^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-2.rs:12:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: function is never used: `dead_fn2`
+ --> $DIR/lint-dead-code-2.rs:35:1
+ |
+LL | fn dead_fn2() {} //~ ERROR: function is never used
+ | ^^^^^^^^^^^^^
+
+error: function is never used: `main`
+ --> $DIR/lint-dead-code-2.rs:48:1
+ |
+LL | fn main() { //~ ERROR: function is never used
+ | ^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/lint-dead-code-3.rs b/src/test/ui/lint/lint-dead-code-3.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-3.rs
rename to src/test/ui/lint/lint-dead-code-3.rs
diff --git a/src/test/ui/lint/lint-dead-code-3.stderr b/src/test/ui/lint/lint-dead-code-3.stderr
new file mode 100644
index 0000000..994e93e
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-3.stderr
@@ -0,0 +1,38 @@
+error: struct is never constructed: `Foo`
+ --> $DIR/lint-dead-code-3.rs:23:1
+ |
+LL | struct Foo; //~ ERROR: struct is never constructed
+ | ^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-3.rs:13:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: method is never used: `foo`
+ --> $DIR/lint-dead-code-3.rs:25:5
+ |
+LL | fn foo(&self) { //~ ERROR: method is never used
+ | ^^^^^^^^^^^^^
+
+error: function is never used: `bar`
+ --> $DIR/lint-dead-code-3.rs:30:1
+ |
+LL | fn bar() { //~ ERROR: function is never used
+ | ^^^^^^^^
+
+error: enum is never used: `c_void`
+ --> $DIR/lint-dead-code-3.rs:69:1
+ |
+LL | enum c_void {} //~ ERROR: enum is never used
+ | ^^^^^^^^^^^
+
+error: foreign function is never used: `free`
+ --> $DIR/lint-dead-code-3.rs:71:5
+ |
+LL | fn free(p: *const c_void); //~ ERROR: foreign function is never used
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/lint-dead-code-4.rs b/src/test/ui/lint/lint-dead-code-4.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-4.rs
rename to src/test/ui/lint/lint-dead-code-4.rs
diff --git a/src/test/ui/lint/lint-dead-code-4.stderr b/src/test/ui/lint/lint-dead-code-4.stderr
new file mode 100644
index 0000000..fce2cf7
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-4.stderr
@@ -0,0 +1,72 @@
+error: field is never used: `b`
+ --> $DIR/lint-dead-code-4.rs:17:5
+ |
+LL | b: bool, //~ ERROR: field is never used
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-4.rs:13:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: variant is never constructed: `X`
+ --> $DIR/lint-dead-code-4.rs:25:5
+ |
+LL | X, //~ ERROR variant is never constructed
+ | ^
+
+error: variant is never constructed: `Y`
+ --> $DIR/lint-dead-code-4.rs:26:5
+ |
+LL | / Y { //~ ERROR variant is never constructed
+LL | | a: String,
+LL | | b: i32,
+LL | | c: i32,
+LL | | },
+ | |_____^
+
+error: enum is never used: `ABC`
+ --> $DIR/lint-dead-code-4.rs:34:1
+ |
+LL | enum ABC { //~ ERROR enum is never used
+ | ^^^^^^^^
+
+error: variant is never constructed: `I`
+ --> $DIR/lint-dead-code-4.rs:46:5
+ |
+LL | I, //~ ERROR variant is never constructed
+ | ^
+
+error: field is never used: `b`
+ --> $DIR/lint-dead-code-4.rs:49:9
+ |
+LL | b: i32, //~ ERROR field is never used
+ | ^^^^^^
+
+error: field is never used: `c`
+ --> $DIR/lint-dead-code-4.rs:50:9
+ |
+LL | c: i32, //~ ERROR field is never used
+ | ^^^^^^
+
+error: variant is never constructed: `K`
+ --> $DIR/lint-dead-code-4.rs:52:5
+ |
+LL | K //~ ERROR variant is never constructed
+ | ^
+
+error: field is never used: `x`
+ --> $DIR/lint-dead-code-4.rs:71:5
+ |
+LL | x: usize, //~ ERROR: field is never used
+ | ^^^^^^^^
+
+error: field is never used: `c`
+ --> $DIR/lint-dead-code-4.rs:73:5
+ |
+LL | c: bool, //~ ERROR: field is never used
+ | ^^^^^^^
+
+error: aborting due to 10 previous errors
+
diff --git a/src/test/compile-fail/lint-dead-code-5.rs b/src/test/ui/lint/lint-dead-code-5.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-5.rs
rename to src/test/ui/lint/lint-dead-code-5.rs
diff --git a/src/test/ui/lint/lint-dead-code-5.stderr b/src/test/ui/lint/lint-dead-code-5.stderr
new file mode 100644
index 0000000..37ca0f4
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-5.stderr
@@ -0,0 +1,32 @@
+error: variant is never constructed: `Variant2`
+ --> $DIR/lint-dead-code-5.rs:16:5
+ |
+LL | Variant2 //~ ERROR: variant is never constructed
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-5.rs:12:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: variant is never constructed: `Variant5`
+ --> $DIR/lint-dead-code-5.rs:23:5
+ |
+LL | Variant5 { _x: isize }, //~ ERROR: variant is never constructed: `Variant5`
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: variant is never constructed: `Variant6`
+ --> $DIR/lint-dead-code-5.rs:24:5
+ |
+LL | Variant6(isize), //~ ERROR: variant is never constructed: `Variant6`
+ | ^^^^^^^^^^^^^^^
+
+error: enum is never used: `Enum3`
+ --> $DIR/lint-dead-code-5.rs:28:1
+ |
+LL | enum Enum3 { //~ ERROR: enum is never used
+ | ^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/lint-dead-code-type-alias.rs b/src/test/ui/lint/lint-dead-code-type-alias.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-type-alias.rs
rename to src/test/ui/lint/lint-dead-code-type-alias.rs
diff --git a/src/test/ui/lint/lint-dead-code-type-alias.stderr b/src/test/ui/lint/lint-dead-code-type-alias.stderr
new file mode 100644
index 0000000..bd11e64
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-type-alias.stderr
@@ -0,0 +1,14 @@
+error: type alias is never used: `Unused`
+ --> $DIR/lint-dead-code-type-alias.rs:14:1
+ |
+LL | type Unused = u8; //~ ERROR type alias is never used
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-type-alias.rs:11:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-dead-code-variant.rs b/src/test/ui/lint/lint-dead-code-variant.rs
similarity index 100%
rename from src/test/compile-fail/lint-dead-code-variant.rs
rename to src/test/ui/lint/lint-dead-code-variant.rs
diff --git a/src/test/ui/lint/lint-dead-code-variant.stderr b/src/test/ui/lint/lint-dead-code-variant.stderr
new file mode 100644
index 0000000..05b7e35
--- /dev/null
+++ b/src/test/ui/lint/lint-dead-code-variant.stderr
@@ -0,0 +1,14 @@
+error: variant is never constructed: `Variant1`
+ --> $DIR/lint-dead-code-variant.rs:15:5
+ |
+LL | Variant1, //~ ERROR: variant is never constructed
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-dead-code-variant.rs:11:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.rs
similarity index 100%
rename from src/test/compile-fail/lint-directives-on-use-items-issue-10534.rs
rename to src/test/ui/lint/lint-directives-on-use-items-issue-10534.rs
diff --git a/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr
new file mode 100644
index 0000000..2c4602a
--- /dev/null
+++ b/src/test/ui/lint/lint-directives-on-use-items-issue-10534.stderr
@@ -0,0 +1,26 @@
+error: unused import: `a::x`
+ --> $DIR/lint-directives-on-use-items-issue-10534.rs:22:9
+ |
+LL | use a::x; //~ ERROR: unused import
+ | ^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-directives-on-use-items-issue-10534.rs:11:9
+ |
+LL | #![deny(unused_imports)]
+ | ^^^^^^^^^^^^^^
+
+error: unused import: `a::y`
+ --> $DIR/lint-directives-on-use-items-issue-10534.rs:31:9
+ |
+LL | use a::y; //~ ERROR: unused import
+ | ^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-directives-on-use-items-issue-10534.rs:30:12
+ |
+LL | #[deny(unused_imports)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lint-exceeding-bitshifts.rs b/src/test/ui/lint/lint-exceeding-bitshifts.rs
similarity index 100%
rename from src/test/compile-fail/lint-exceeding-bitshifts.rs
rename to src/test/ui/lint/lint-exceeding-bitshifts.rs
diff --git a/src/test/ui/lint/lint-exceeding-bitshifts.stderr b/src/test/ui/lint/lint-exceeding-bitshifts.stderr
new file mode 100644
index 0000000..5124a69
--- /dev/null
+++ b/src/test/ui/lint/lint-exceeding-bitshifts.stderr
@@ -0,0 +1,116 @@
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:17:15
+ |
+LL | let n = 1u8 << 8; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-exceeding-bitshifts.rs:11:9
+ |
+LL | #![deny(exceeding_bitshifts, const_err)]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:19:15
+ |
+LL | let n = 1u16 << 16; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:21:15
+ |
+LL | let n = 1u32 << 32; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:23:15
+ |
+LL | let n = 1u64 << 64; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:25:15
+ |
+LL | let n = 1i8 << 8; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:27:15
+ |
+LL | let n = 1i16 << 16; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:29:15
+ |
+LL | let n = 1i32 << 32; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:31:15
+ |
+LL | let n = 1i64 << 64; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:34:15
+ |
+LL | let n = 1u8 >> 8; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:36:15
+ |
+LL | let n = 1u16 >> 16; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:38:15
+ |
+LL | let n = 1u32 >> 32; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:40:15
+ |
+LL | let n = 1u64 >> 64; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:42:15
+ |
+LL | let n = 1i8 >> 8; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:44:15
+ |
+LL | let n = 1i16 >> 16; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:46:15
+ |
+LL | let n = 1i32 >> 32; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift right with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:48:15
+ |
+LL | let n = 1i64 >> 64; //~ ERROR: attempt to shift right with overflow
+ | ^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:52:15
+ |
+LL | let n = n << 8; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts.rs:54:15
+ |
+LL | let n = 1u8 << -8; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^
+
+error: aborting due to 18 previous errors
+
diff --git a/src/test/compile-fail/lint-exceeding-bitshifts2.rs b/src/test/ui/lint/lint-exceeding-bitshifts2.rs
similarity index 100%
rename from src/test/compile-fail/lint-exceeding-bitshifts2.rs
rename to src/test/ui/lint/lint-exceeding-bitshifts2.rs
diff --git a/src/test/ui/lint/lint-exceeding-bitshifts2.stderr b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr
new file mode 100644
index 0000000..17b4235
--- /dev/null
+++ b/src/test/ui/lint/lint-exceeding-bitshifts2.stderr
@@ -0,0 +1,26 @@
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts2.rs:17:15
+ |
+LL | let n = 1u8 << (4+4); //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-exceeding-bitshifts2.rs:11:9
+ |
+LL | #![deny(exceeding_bitshifts, const_err)]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts2.rs:25:15
+ |
+LL | let n = 1_isize << BITS; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^^^^^^
+
+error: attempt to shift left with overflow
+ --> $DIR/lint-exceeding-bitshifts2.rs:26:15
+ |
+LL | let n = 1_usize << BITS; //~ ERROR: attempt to shift left with overflow
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/lint-forbid-attr.rs b/src/test/ui/lint/lint-forbid-attr.rs
similarity index 100%
rename from src/test/ui/lint-forbid-attr.rs
rename to src/test/ui/lint/lint-forbid-attr.rs
diff --git a/src/test/ui/lint-forbid-attr.stderr b/src/test/ui/lint/lint-forbid-attr.stderr
similarity index 100%
rename from src/test/ui/lint-forbid-attr.stderr
rename to src/test/ui/lint/lint-forbid-attr.stderr
diff --git a/src/test/compile-fail/lint-forbid-cmdline.rs b/src/test/ui/lint/lint-forbid-cmdline.rs
similarity index 100%
rename from src/test/compile-fail/lint-forbid-cmdline.rs
rename to src/test/ui/lint/lint-forbid-cmdline.rs
diff --git a/src/test/ui/lint/lint-forbid-cmdline.stderr b/src/test/ui/lint/lint-forbid-cmdline.stderr
new file mode 100644
index 0000000..37a2699
--- /dev/null
+++ b/src/test/ui/lint/lint-forbid-cmdline.stderr
@@ -0,0 +1,11 @@
+error[E0453]: allow(deprecated) overruled by outer forbid(deprecated)
+ --> $DIR/lint-forbid-cmdline.rs:13:9
+ |
+LL | #[allow(deprecated)] //~ ERROR allow(deprecated) overruled by outer forbid(deprecated)
+ | ^^^^^^^^^^ overruled by previous forbid
+ |
+ = note: `forbid` lint level was set on command line
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0453`.
diff --git a/src/test/compile-fail/lint-impl-fn.rs b/src/test/ui/lint/lint-impl-fn.rs
similarity index 100%
rename from src/test/compile-fail/lint-impl-fn.rs
rename to src/test/ui/lint/lint-impl-fn.rs
diff --git a/src/test/ui/lint/lint-impl-fn.stderr b/src/test/ui/lint/lint-impl-fn.stderr
new file mode 100644
index 0000000..ed37e87
--- /dev/null
+++ b/src/test/ui/lint/lint-impl-fn.stderr
@@ -0,0 +1,38 @@
+error: denote infinite loops with `loop { ... }`
+ --> $DIR/lint-impl-fn.rs:20:21
+ |
+LL | fn bar(&self) { while true {} } //~ ERROR: infinite loops
+ | ^^^^^^^^^^ help: use `loop`
+ |
+note: lint level defined here
+ --> $DIR/lint-impl-fn.rs:19:12
+ |
+LL | #[deny(while_true)]
+ | ^^^^^^^^^^
+
+error: denote infinite loops with `loop { ... }`
+ --> $DIR/lint-impl-fn.rs:28:25
+ |
+LL | fn foo(&self) { while true {} } //~ ERROR: infinite loops
+ | ^^^^^^^^^^ help: use `loop`
+ |
+note: lint level defined here
+ --> $DIR/lint-impl-fn.rs:23:8
+ |
+LL | #[deny(while_true)]
+ | ^^^^^^^^^^
+
+error: denote infinite loops with `loop { ... }`
+ --> $DIR/lint-impl-fn.rs:37:5
+ |
+LL | while true {} //~ ERROR: infinite loops
+ | ^^^^^^^^^^ help: use `loop`
+ |
+note: lint level defined here
+ --> $DIR/lint-impl-fn.rs:35:8
+ |
+LL | #[deny(while_true)]
+ | ^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/lint-malformed.rs b/src/test/ui/lint/lint-malformed.rs
similarity index 100%
rename from src/test/compile-fail/lint-malformed.rs
rename to src/test/ui/lint/lint-malformed.rs
diff --git a/src/test/ui/lint/lint-malformed.stderr b/src/test/ui/lint/lint-malformed.stderr
new file mode 100644
index 0000000..7b8155c
--- /dev/null
+++ b/src/test/ui/lint/lint-malformed.stderr
@@ -0,0 +1,15 @@
+error[E0452]: malformed lint attribute
+ --> $DIR/lint-malformed.rs:11:1
+ |
+LL | #![deny = "foo"] //~ ERROR malformed lint attribute
+ | ^^^^^^^^^^^^^^^^
+
+error[E0452]: malformed lint attribute
+ --> $DIR/lint-malformed.rs:12:10
+ |
+LL | #![allow(bar = "baz")] //~ ERROR malformed lint attribute
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0452`.
diff --git a/src/test/compile-fail/lint-misplaced-attr.rs b/src/test/ui/lint/lint-misplaced-attr.rs
similarity index 100%
rename from src/test/compile-fail/lint-misplaced-attr.rs
rename to src/test/ui/lint/lint-misplaced-attr.rs
diff --git a/src/test/ui/lint/lint-misplaced-attr.stderr b/src/test/ui/lint/lint-misplaced-attr.stderr
new file mode 100644
index 0000000..17f29a6
--- /dev/null
+++ b/src/test/ui/lint/lint-misplaced-attr.stderr
@@ -0,0 +1,32 @@
+error: unused attribute
+ --> $DIR/lint-misplaced-attr.rs:17:5
+ |
+LL | #![crate_type = "bin"] //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-misplaced-attr.rs:14:9
+ |
+LL | #![deny(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: crate-level attribute should be in the root module
+ --> $DIR/lint-misplaced-attr.rs:17:5
+ |
+LL | #![crate_type = "bin"] //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+ --> $DIR/lint-misplaced-attr.rs:21:1
+ |
+LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo]
+ --> $DIR/lint-misplaced-attr.rs:21:1
+ |
+LL | #[crate_type = "bin"] fn main() {} //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/lint-missing-copy-implementations.rs b/src/test/ui/lint/lint-missing-copy-implementations.rs
similarity index 100%
rename from src/test/compile-fail/lint-missing-copy-implementations.rs
rename to src/test/ui/lint/lint-missing-copy-implementations.rs
diff --git a/src/test/ui/lint/lint-missing-copy-implementations.stderr b/src/test/ui/lint/lint-missing-copy-implementations.stderr
new file mode 100644
index 0000000..3cb89ef
--- /dev/null
+++ b/src/test/ui/lint/lint-missing-copy-implementations.stderr
@@ -0,0 +1,16 @@
+error: type could implement `Copy`; consider adding `impl Copy`
+ --> $DIR/lint-missing-copy-implementations.rs:16:5
+ |
+LL | / pub struct Foo { //~ ERROR type could implement `Copy`; consider adding `impl Copy`
+LL | | pub field: i32
+LL | | }
+ | |_____^
+ |
+note: lint level defined here
+ --> $DIR/lint-missing-copy-implementations.rs:13:9
+ |
+LL | #![deny(missing_copy_implementations)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-missing-doc.rs b/src/test/ui/lint/lint-missing-doc.rs
similarity index 100%
rename from src/test/compile-fail/lint-missing-doc.rs
rename to src/test/ui/lint/lint-missing-doc.rs
diff --git a/src/test/ui/lint/lint-missing-doc.stderr b/src/test/ui/lint/lint-missing-doc.stderr
new file mode 100644
index 0000000..e61d56d
--- /dev/null
+++ b/src/test/ui/lint/lint-missing-doc.stderr
@@ -0,0 +1,122 @@
+error: missing documentation for a type alias
+ --> $DIR/lint-missing-doc.rs:21:1
+ |
+LL | pub type PubTypedef = String; //~ ERROR: missing documentation for a type alias
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-missing-doc.rs:13:9
+ |
+LL | #![deny(missing_docs)]
+ | ^^^^^^^^^^^^
+
+error: missing documentation for a struct
+ --> $DIR/lint-missing-doc.rs:28:1
+ |
+LL | pub struct PubFoo { //~ ERROR: missing documentation for a struct
+ | ^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a struct field
+ --> $DIR/lint-missing-doc.rs:29:5
+ |
+LL | pub a: isize, //~ ERROR: missing documentation for a struct field
+ | ^^^^^^^^^^^^
+
+error: missing documentation for a module
+ --> $DIR/lint-missing-doc.rs:40:1
+ |
+LL | pub mod pub_module_no_dox {} //~ ERROR: missing documentation for a module
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:44:1
+ |
+LL | pub fn foo2() {} //~ ERROR: missing documentation for a function
+ | ^^^^^^^^^^^^^
+
+error: missing documentation for a trait
+ --> $DIR/lint-missing-doc.rs:62:1
+ |
+LL | pub trait C { //~ ERROR: missing documentation for a trait
+ | ^^^^^^^^^^^
+
+error: missing documentation for a trait method
+ --> $DIR/lint-missing-doc.rs:63:5
+ |
+LL | fn foo(&self); //~ ERROR: missing documentation for a trait method
+ | ^^^^^^^^^^^^^^
+
+error: missing documentation for a trait method
+ --> $DIR/lint-missing-doc.rs:64:5
+ |
+LL | fn foo_with_impl(&self) {} //~ ERROR: missing documentation for a trait method
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for an associated type
+ --> $DIR/lint-missing-doc.rs:74:5
+ |
+LL | type AssociatedType; //~ ERROR: missing documentation for an associated type
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for an associated type
+ --> $DIR/lint-missing-doc.rs:75:5
+ |
+LL | type AssociatedTypeDef = Self; //~ ERROR: missing documentation for an associated type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a method
+ --> $DIR/lint-missing-doc.rs:91:5
+ |
+LL | pub fn foo() {} //~ ERROR: missing documentation for a method
+ | ^^^^^^^^^^^^
+
+error: missing documentation for an enum
+ --> $DIR/lint-missing-doc.rs:128:1
+ |
+LL | pub enum PubBaz { //~ ERROR: missing documentation for an enum
+ | ^^^^^^^^^^^^^^^
+
+error: missing documentation for a variant
+ --> $DIR/lint-missing-doc.rs:129:5
+ |
+LL | PubBazA { //~ ERROR: missing documentation for a variant
+ | ^^^^^^^
+
+error: missing documentation for a struct field
+ --> $DIR/lint-missing-doc.rs:130:9
+ |
+LL | a: isize, //~ ERROR: missing documentation for a struct field
+ | ^^^^^^^^
+
+error: missing documentation for a constant
+ --> $DIR/lint-missing-doc.rs:161:1
+ |
+LL | pub const FOO4: u32 = 0; //~ ERROR: missing documentation for a const
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a static
+ --> $DIR/lint-missing-doc.rs:171:1
+ |
+LL | pub static BAR4: u32 = 0; //~ ERROR: missing documentation for a static
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:177:5
+ |
+LL | pub fn undocumented1() {} //~ ERROR: missing documentation for a function
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:178:5
+ |
+LL | pub fn undocumented2() {} //~ ERROR: missing documentation for a function
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: missing documentation for a function
+ --> $DIR/lint-missing-doc.rs:184:9
+ |
+LL | pub fn also_undocumented1() {} //~ ERROR: missing documentation for a function
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 19 previous errors
+
diff --git a/src/test/compile-fail/lint-non-camel-case-types.rs b/src/test/ui/lint/lint-non-camel-case-types.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-camel-case-types.rs
rename to src/test/ui/lint/lint-non-camel-case-types.rs
diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr
new file mode 100644
index 0000000..85610dc
--- /dev/null
+++ b/src/test/ui/lint/lint-non-camel-case-types.stderr
@@ -0,0 +1,88 @@
+error: type `ONE_TWO_THREE` should have a camel case name such as `OneTwoThree`
+ --> $DIR/lint-non-camel-case-types.rs:14:1
+ |
+LL | struct ONE_TWO_THREE;
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-non-camel-case-types.rs:11:11
+ |
+LL | #![forbid(non_camel_case_types)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: type `foo` should have a camel case name such as `Foo`
+ --> $DIR/lint-non-camel-case-types.rs:17:1
+ |
+LL | / struct foo { //~ ERROR type `foo` should have a camel case name such as `Foo`
+LL | | bar: isize,
+LL | | }
+ | |_^
+
+error: type `foo2` should have a camel case name such as `Foo2`
+ --> $DIR/lint-non-camel-case-types.rs:21:1
+ |
+LL | / enum foo2 { //~ ERROR type `foo2` should have a camel case name such as `Foo2`
+LL | | Bar
+LL | | }
+ | |_^
+
+error: type `foo3` should have a camel case name such as `Foo3`
+ --> $DIR/lint-non-camel-case-types.rs:25:1
+ |
+LL | / struct foo3 { //~ ERROR type `foo3` should have a camel case name such as `Foo3`
+LL | | bar: isize
+LL | | }
+ | |_^
+
+error: type `foo4` should have a camel case name such as `Foo4`
+ --> $DIR/lint-non-camel-case-types.rs:29:1
+ |
+LL | type foo4 = isize; //~ ERROR type `foo4` should have a camel case name such as `Foo4`
+ | ^^^^^^^^^^^^^^^^^^
+
+error: variant `bar` should have a camel case name such as `Bar`
+ --> $DIR/lint-non-camel-case-types.rs:32:5
+ |
+LL | bar //~ ERROR variant `bar` should have a camel case name such as `Bar`
+ | ^^^
+
+error: trait `foo6` should have a camel case name such as `Foo6`
+ --> $DIR/lint-non-camel-case-types.rs:35:1
+ |
+LL | / trait foo6 { //~ ERROR trait `foo6` should have a camel case name such as `Foo6`
+LL | | fn dummy(&self) { }
+LL | | }
+ | |_^
+
+error: type parameter `ty` should have a camel case name such as `Ty`
+ --> $DIR/lint-non-camel-case-types.rs:39:6
+ |
+LL | fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name such as `Ty`
+ | ^^
+
+error: type `__` should have a camel case name such as `CamelCase`
+ --> $DIR/lint-non-camel-case-types.rs:46:1
+ |
+LL | type __ = isize; //~ ERROR type `__` should have a camel case name such as `CamelCase`
+ | ^^^^^^^^^^^^^^^^
+
+error: type `X86__64` should have a camel case name such as `X86_64`
+ --> $DIR/lint-non-camel-case-types.rs:50:1
+ |
+LL | struct X86__64; //~ ERROR type `X86__64` should have a camel case name such as `X86_64`
+ | ^^^^^^^^^^^^^^^
+
+error: type `Abc_123` should have a camel case name such as `Abc123`
+ --> $DIR/lint-non-camel-case-types.rs:52:1
+ |
+LL | struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name such as `Abc123`
+ | ^^^^^^^^^^^^^^^
+
+error: type `A1_b2_c3` should have a camel case name such as `A1B2C3`
+ --> $DIR/lint-non-camel-case-types.rs:54:1
+ |
+LL | struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name such as `A1B2C3`
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/compile-fail/lint-non-snake-case-crate-2.rs b/src/test/ui/lint/lint-non-snake-case-crate-2.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-snake-case-crate-2.rs
rename to src/test/ui/lint/lint-non-snake-case-crate-2.rs
diff --git a/src/test/ui/lint/lint-non-snake-case-crate-2.stderr b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr
new file mode 100644
index 0000000..ce49d9a
--- /dev/null
+++ b/src/test/ui/lint/lint-non-snake-case-crate-2.stderr
@@ -0,0 +1,10 @@
+error: crate `NonSnakeCase` should have a snake case name such as `non_snake_case`
+ |
+note: lint level defined here
+ --> $DIR/lint-non-snake-case-crate-2.rs:14:9
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-non-snake-case-crate.rs b/src/test/ui/lint/lint-non-snake-case-crate.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-snake-case-crate.rs
rename to src/test/ui/lint/lint-non-snake-case-crate.rs
diff --git a/src/test/ui/lint/lint-non-snake-case-crate.stderr b/src/test/ui/lint/lint-non-snake-case-crate.stderr
new file mode 100644
index 0000000..4d55661
--- /dev/null
+++ b/src/test/ui/lint/lint-non-snake-case-crate.stderr
@@ -0,0 +1,14 @@
+error: crate `NonSnakeCase` should have a snake case name such as `non_snake_case`
+ --> $DIR/lint-non-snake-case-crate.rs:11:1
+ |
+LL | #![crate_name = "NonSnakeCase"]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-non-snake-case-crate.rs:13:9
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-non-snake-case-functions.rs b/src/test/ui/lint/lint-non-snake-case-functions.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-snake-case-functions.rs
rename to src/test/ui/lint/lint-non-snake-case-functions.rs
diff --git a/src/test/ui/lint/lint-non-snake-case-functions.stderr b/src/test/ui/lint/lint-non-snake-case-functions.stderr
new file mode 100644
index 0000000..f7ac48d
--- /dev/null
+++ b/src/test/ui/lint/lint-non-snake-case-functions.stderr
@@ -0,0 +1,62 @@
+error: method `Foo_Method` should have a snake case name such as `foo_method`
+ --> $DIR/lint-non-snake-case-functions.rs:17:5
+ |
+LL | fn Foo_Method() {}
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-non-snake-case-functions.rs:11:9
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: method `foo__method` should have a snake case name such as `foo_method`
+ --> $DIR/lint-non-snake-case-functions.rs:21:5
+ |
+LL | fn foo__method(&self) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: method `xyZ` should have a snake case name such as `xy_z`
+ --> $DIR/lint-non-snake-case-functions.rs:24:5
+ |
+LL | pub fn xyZ(&mut self) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: method `render_HTML` should have a snake case name such as `render_html`
+ --> $DIR/lint-non-snake-case-functions.rs:27:5
+ |
+LL | fn render_HTML() {}
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: trait method `ABC` should have a snake case name such as `abc`
+ --> $DIR/lint-non-snake-case-functions.rs:32:5
+ |
+LL | fn ABC();
+ | ^^^^^^^^^
+
+error: trait method `a_b_C` should have a snake case name such as `a_b_c`
+ --> $DIR/lint-non-snake-case-functions.rs:35:5
+ |
+LL | fn a_b_C(&self) {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: trait method `something__else` should have a snake case name such as `something_else`
+ --> $DIR/lint-non-snake-case-functions.rs:38:5
+ |
+LL | fn something__else(&mut self);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: function `Cookie` should have a snake case name such as `cookie`
+ --> $DIR/lint-non-snake-case-functions.rs:48:1
+ |
+LL | fn Cookie() {}
+ | ^^^^^^^^^^^^^^
+
+error: function `bi_S_Cuit` should have a snake case name such as `bi_s_cuit`
+ --> $DIR/lint-non-snake-case-functions.rs:51:1
+ |
+LL | pub fn bi_S_Cuit() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/src/test/compile-fail/lint-non-snake-case-lifetimes.rs b/src/test/ui/lint/lint-non-snake-case-lifetimes.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-snake-case-lifetimes.rs
rename to src/test/ui/lint/lint-non-snake-case-lifetimes.rs
diff --git a/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr
new file mode 100644
index 0000000..dc9b5b8
--- /dev/null
+++ b/src/test/ui/lint/lint-non-snake-case-lifetimes.stderr
@@ -0,0 +1,14 @@
+error: lifetime `'FooBar` should have a snake case name such as `'foo_bar`
+ --> $DIR/lint-non-snake-case-lifetimes.rs:14:6
+ |
+LL | fn f<'FooBar>( //~ ERROR lifetime `'FooBar` should have a snake case name such as `'foo_bar`
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-non-snake-case-lifetimes.rs:11:9
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-non-snake-case-modules.rs b/src/test/ui/lint/lint-non-snake-case-modules.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-snake-case-modules.rs
rename to src/test/ui/lint/lint-non-snake-case-modules.rs
diff --git a/src/test/ui/lint/lint-non-snake-case-modules.stderr b/src/test/ui/lint/lint-non-snake-case-modules.stderr
new file mode 100644
index 0000000..d55d80f
--- /dev/null
+++ b/src/test/ui/lint/lint-non-snake-case-modules.stderr
@@ -0,0 +1,16 @@
+error: module `FooBar` should have a snake case name such as `foo_bar`
+ --> $DIR/lint-non-snake-case-modules.rs:14:1
+ |
+LL | / mod FooBar { //~ ERROR module `FooBar` should have a snake case name such as `foo_bar`
+LL | | pub struct S;
+LL | | }
+ | |_^
+ |
+note: lint level defined here
+ --> $DIR/lint-non-snake-case-modules.rs:11:9
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-non-uppercase-statics.rs b/src/test/ui/lint/lint-non-uppercase-statics.rs
similarity index 100%
rename from src/test/compile-fail/lint-non-uppercase-statics.rs
rename to src/test/ui/lint/lint-non-uppercase-statics.rs
diff --git a/src/test/ui/lint/lint-non-uppercase-statics.stderr b/src/test/ui/lint/lint-non-uppercase-statics.stderr
new file mode 100644
index 0000000..0d56c57
--- /dev/null
+++ b/src/test/ui/lint/lint-non-uppercase-statics.stderr
@@ -0,0 +1,20 @@
+error: static variable `foo` should have an upper case name such as `FOO`
+ --> $DIR/lint-non-uppercase-statics.rs:14:1
+ |
+LL | static foo: isize = 1; //~ ERROR static variable `foo` should have an upper case name such as `FOO`
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-non-uppercase-statics.rs:11:11
+ |
+LL | #![forbid(non_upper_case_globals)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: static variable `bar` should have an upper case name such as `BAR`
+ --> $DIR/lint-non-uppercase-statics.rs:16:1
+ |
+LL | static mut bar: isize = 1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lint-obsolete-attr.rs b/src/test/ui/lint/lint-obsolete-attr.rs
similarity index 100%
rename from src/test/compile-fail/lint-obsolete-attr.rs
rename to src/test/ui/lint/lint-obsolete-attr.rs
diff --git a/src/test/ui/lint/lint-obsolete-attr.stderr b/src/test/ui/lint/lint-obsolete-attr.stderr
new file mode 100644
index 0000000..4a8a55e
--- /dev/null
+++ b/src/test/ui/lint/lint-obsolete-attr.stderr
@@ -0,0 +1,20 @@
+error: unused attribute
+ --> $DIR/lint-obsolete-attr.rs:18:1
+ |
+LL | #[ab_isize="stdcall"] extern {} //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-obsolete-attr.rs:14:9
+ |
+LL | #![deny(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+ --> $DIR/lint-obsolete-attr.rs:20:1
+ |
+LL | #[fixed_stack_segment] fn f() {} //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lint-output-format-2.rs b/src/test/ui/lint/lint-output-format-2.rs
similarity index 100%
rename from src/test/ui/lint-output-format-2.rs
rename to src/test/ui/lint/lint-output-format-2.rs
diff --git a/src/test/ui/lint-output-format-2.stderr b/src/test/ui/lint/lint-output-format-2.stderr
similarity index 100%
rename from src/test/ui/lint-output-format-2.stderr
rename to src/test/ui/lint/lint-output-format-2.stderr
diff --git a/src/test/compile-fail/lint-output-format.rs b/src/test/ui/lint/lint-output-format.rs
similarity index 100%
rename from src/test/compile-fail/lint-output-format.rs
rename to src/test/ui/lint/lint-output-format.rs
diff --git a/src/test/ui/lint/lint-output-format.stderr b/src/test/ui/lint/lint-output-format.stderr
new file mode 100644
index 0000000..bcc2799
--- /dev/null
+++ b/src/test/ui/lint/lint-output-format.stderr
@@ -0,0 +1,27 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-output-format.rs:16:1
+ |
+LL | extern crate lint_output_format; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-output-format.rs:17:31
+ |
+LL | use lint_output_format::{foo, bar}; //~ ERROR use of unstable library feature
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-output-format.rs:21:14
+ |
+LL | let _y = bar(); //~ ERROR use of unstable library feature
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/lint-owned-heap-memory.rs b/src/test/ui/lint/lint-owned-heap-memory.rs
similarity index 100%
rename from src/test/compile-fail/lint-owned-heap-memory.rs
rename to src/test/ui/lint/lint-owned-heap-memory.rs
diff --git a/src/test/ui/lint/lint-owned-heap-memory.stderr b/src/test/ui/lint/lint-owned-heap-memory.stderr
new file mode 100644
index 0000000..5b61d30
--- /dev/null
+++ b/src/test/ui/lint/lint-owned-heap-memory.stderr
@@ -0,0 +1,20 @@
+error: type uses owned (Box type) pointers: std::boxed::Box<isize>
+ --> $DIR/lint-owned-heap-memory.rs:16:5
+ |
+LL | x: Box<isize> //~ ERROR type uses owned
+ | ^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-owned-heap-memory.rs:12:11
+ |
+LL | #![forbid(box_pointers)]
+ | ^^^^^^^^^^^^
+
+error: type uses owned (Box type) pointers: std::boxed::Box<isize>
+ --> $DIR/lint-owned-heap-memory.rs:20:29
+ |
+LL | let _x : Foo = Foo {x : box 10};
+ | ^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lint-qualification.rs b/src/test/ui/lint/lint-qualification.rs
similarity index 100%
rename from src/test/compile-fail/lint-qualification.rs
rename to src/test/ui/lint/lint-qualification.rs
diff --git a/src/test/ui/lint/lint-qualification.stderr b/src/test/ui/lint/lint-qualification.stderr
new file mode 100644
index 0000000..f4c8186
--- /dev/null
+++ b/src/test/ui/lint/lint-qualification.stderr
@@ -0,0 +1,14 @@
+error: unnecessary qualification
+ --> $DIR/lint-qualification.rs:19:5
+ |
+LL | foo::bar(); //~ ERROR: unnecessary qualification
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-qualification.rs:11:9
+ |
+LL | #![deny(unused_qualifications)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-removed-allow.rs b/src/test/ui/lint/lint-removed-allow.rs
similarity index 100%
rename from src/test/compile-fail/lint-removed-allow.rs
rename to src/test/ui/lint/lint-removed-allow.rs
diff --git a/src/test/ui/lint/lint-removed-allow.stderr b/src/test/ui/lint/lint-removed-allow.stderr
new file mode 100644
index 0000000..8f4c757
--- /dev/null
+++ b/src/test/ui/lint/lint-removed-allow.stderr
@@ -0,0 +1,14 @@
+error: unused variable: `unused`
+ --> $DIR/lint-removed-allow.rs:18:17
+ |
+LL | fn main() { let unused = (); } //~ ERROR unused
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-removed-allow.rs:17:8
+ |
+LL | #[deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-removed-cmdline.rs b/src/test/ui/lint/lint-removed-cmdline.rs
similarity index 100%
rename from src/test/compile-fail/lint-removed-cmdline.rs
rename to src/test/ui/lint/lint-removed-cmdline.rs
diff --git a/src/test/ui/lint/lint-removed-cmdline.stderr b/src/test/ui/lint/lint-removed-cmdline.stderr
new file mode 100644
index 0000000..86faeec
--- /dev/null
+++ b/src/test/ui/lint/lint-removed-cmdline.stderr
@@ -0,0 +1,19 @@
+warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
+ |
+ = note: requested on the command line with `-D raw_pointer_derive`
+
+error: unused variable: `unused`
+ --> $DIR/lint-removed-cmdline.rs:22:17
+ |
+LL | fn main() { let unused = (); }
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-removed-cmdline.rs:21:8
+ |
+LL | #[deny(warnings)]
+ | ^^^^^^^^
+ = note: #[deny(unused_variables)] implied by #[deny(warnings)]
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-removed.rs b/src/test/ui/lint/lint-removed.rs
similarity index 100%
rename from src/test/compile-fail/lint-removed.rs
rename to src/test/ui/lint/lint-removed.rs
diff --git a/src/test/ui/lint/lint-removed.stderr b/src/test/ui/lint/lint-removed.stderr
new file mode 100644
index 0000000..7d66186
--- /dev/null
+++ b/src/test/ui/lint/lint-removed.stderr
@@ -0,0 +1,22 @@
+warning: lint `raw_pointer_derive` has been removed: `using derive with raw pointers is ok`
+ --> $DIR/lint-removed.rs:16:8
+ |
+LL | #[deny(raw_pointer_derive)] //~ WARN `raw_pointer_derive` has been removed
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = note: #[warn(renamed_and_removed_lints)] on by default
+
+error: unused variable: `unused`
+ --> $DIR/lint-removed.rs:18:17
+ |
+LL | fn main() { let unused = (); } //~ ERROR unused
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-removed.rs:17:8
+ |
+LL | #[deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-renamed-allow.rs b/src/test/ui/lint/lint-renamed-allow.rs
similarity index 100%
rename from src/test/compile-fail/lint-renamed-allow.rs
rename to src/test/ui/lint/lint-renamed-allow.rs
diff --git a/src/test/ui/lint/lint-renamed-allow.stderr b/src/test/ui/lint/lint-renamed-allow.stderr
new file mode 100644
index 0000000..6b2eb27
--- /dev/null
+++ b/src/test/ui/lint/lint-renamed-allow.stderr
@@ -0,0 +1,15 @@
+error: unused variable: `unused`
+ --> $DIR/lint-renamed-allow.rs:18:17
+ |
+LL | fn main() { let unused = (); } //~ ERROR unused
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-renamed-allow.rs:17:8
+ |
+LL | #[deny(unused)]
+ | ^^^^^^
+ = note: #[deny(unused_variables)] implied by #[deny(unused)]
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-renamed-cmdline.rs b/src/test/ui/lint/lint-renamed-cmdline.rs
similarity index 100%
rename from src/test/compile-fail/lint-renamed-cmdline.rs
rename to src/test/ui/lint/lint-renamed-cmdline.rs
diff --git a/src/test/ui/lint/lint-renamed-cmdline.stderr b/src/test/ui/lint/lint-renamed-cmdline.stderr
new file mode 100644
index 0000000..5e154a0
--- /dev/null
+++ b/src/test/ui/lint/lint-renamed-cmdline.stderr
@@ -0,0 +1,19 @@
+warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ |
+ = note: requested on the command line with `-D bare_trait_object`
+
+error: unused variable: `unused`
+ --> $DIR/lint-renamed-cmdline.rs:18:17
+ |
+LL | fn main() { let unused = (); }
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-renamed-cmdline.rs:17:8
+ |
+LL | #[deny(unused)]
+ | ^^^^^^
+ = note: #[deny(unused_variables)] implied by #[deny(unused)]
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-renamed.rs b/src/test/ui/lint/lint-renamed.rs
similarity index 100%
rename from src/test/compile-fail/lint-renamed.rs
rename to src/test/ui/lint/lint-renamed.rs
diff --git a/src/test/ui/lint/lint-renamed.stderr b/src/test/ui/lint/lint-renamed.stderr
new file mode 100644
index 0000000..a87efc9
--- /dev/null
+++ b/src/test/ui/lint/lint-renamed.stderr
@@ -0,0 +1,23 @@
+warning: lint `bare_trait_object` has been renamed to `bare_trait_objects`
+ --> $DIR/lint-renamed.rs:11:8
+ |
+LL | #[deny(bare_trait_object)]
+ | ^^^^^^^^^^^^^^^^^ help: use the new name: `bare_trait_objects`
+ |
+ = note: #[warn(renamed_and_removed_lints)] on by default
+
+error: unused variable: `unused`
+ --> $DIR/lint-renamed.rs:14:17
+ |
+LL | fn main() { let unused = (); } //~ ERROR unused
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-renamed.rs:13:8
+ |
+LL | #[deny(unused)]
+ | ^^^^^^
+ = note: #[deny(unused_variables)] implied by #[deny(unused)]
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-shorthand-field.rs b/src/test/ui/lint/lint-shorthand-field.rs
similarity index 100%
rename from src/test/compile-fail/lint-shorthand-field.rs
rename to src/test/ui/lint/lint-shorthand-field.rs
diff --git a/src/test/ui/lint/lint-shorthand-field.stderr b/src/test/ui/lint/lint-shorthand-field.stderr
new file mode 100644
index 0000000..516be53
--- /dev/null
+++ b/src/test/ui/lint/lint-shorthand-field.stderr
@@ -0,0 +1,24 @@
+error: the `x:` in this pattern is redundant
+ --> $DIR/lint-shorthand-field.rs:22:13
+ |
+LL | x: x, //~ ERROR the `x:` in this pattern is redundant
+ | --^^
+ | |
+ | help: remove this
+ |
+note: lint level defined here
+ --> $DIR/lint-shorthand-field.rs:12:9
+ |
+LL | #![deny(non_shorthand_field_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: the `y:` in this pattern is redundant
+ --> $DIR/lint-shorthand-field.rs:23:13
+ |
+LL | y: ref y, //~ ERROR the `y:` in this pattern is redundant
+ | --^^^^^^
+ | |
+ | help: remove this
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lint-stability-2.rs b/src/test/ui/lint/lint-stability-2.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability-2.rs
rename to src/test/ui/lint/lint-stability-2.rs
diff --git a/src/test/ui/lint/lint-stability-2.stderr b/src/test/ui/lint/lint-stability-2.stderr
new file mode 100644
index 0000000..e87e051
--- /dev/null
+++ b/src/test/ui/lint/lint-stability-2.stderr
@@ -0,0 +1,259 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:50:13
+ |
+LL | foo.method_deprecated_unstable();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:52:9
+ |
+LL | Foo::method_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:54:9
+ |
+LL | <Foo>::method_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:56:13
+ |
+LL | foo.trait_deprecated_unstable();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:58:9
+ |
+LL | <Foo>::trait_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:61:13
+ |
+LL | foo.method_deprecated_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:63:9
+ |
+LL | Foo::method_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:65:9
+ |
+LL | <Foo>::method_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:67:13
+ |
+LL | foo.trait_deprecated_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:69:9
+ |
+LL | <Foo>::trait_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:72:13
+ |
+LL | foo.method_unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:73:9
+ |
+LL | Foo::method_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:74:9
+ |
+LL | <Foo>::method_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:75:13
+ |
+LL | foo.trait_unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:76:9
+ |
+LL | <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:78:13
+ |
+LL | foo.method_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:80:9
+ |
+LL | Foo::method_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:82:9
+ |
+LL | <Foo>::method_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:84:13
+ |
+LL | foo.trait_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:86:9
+ |
+LL | <Foo>::trait_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:141:13
+ |
+LL | foo.trait_deprecated_unstable();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:143:9
+ |
+LL | <Foo>::trait_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:145:13
+ |
+LL | foo.trait_deprecated_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:147:9
+ |
+LL | <Foo>::trait_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:149:13
+ |
+LL | foo.trait_unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:150:9
+ |
+LL | <Foo>::trait_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:151:13
+ |
+LL | foo.trait_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:153:9
+ |
+LL | <Foo>::trait_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:164:13
+ |
+LL | foo.trait_deprecated_unstable();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:166:13
+ |
+LL | foo.trait_deprecated_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-2.rs:168:13
+ |
+LL | foo.trait_unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability-2.rs:169:13
+ |
+LL | foo.trait_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to 32 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/lint-stability-deprecated.rs b/src/test/ui/lint/lint-stability-deprecated.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability-deprecated.rs
rename to src/test/ui/lint/lint-stability-deprecated.rs
diff --git a/src/test/ui/lint/lint-stability-deprecated.stderr b/src/test/ui/lint/lint-stability-deprecated.stderr
new file mode 100644
index 0000000..afebb4f
--- /dev/null
+++ b/src/test/ui/lint/lint-stability-deprecated.stderr
@@ -0,0 +1,644 @@
+warning: use of deprecated item 'lint_stability::deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:36:9
+ |
+LL | deprecated(); //~ WARN use of deprecated item 'lint_stability::deprecated'
+ | ^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-stability-deprecated.rs:17:9
+ |
+LL | #![warn(deprecated)]
+ | ^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:41:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:43:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:45:9
+ |
+LL | deprecated_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:50:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:52:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:54:9
+ |
+LL | deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:59:9
+ |
+LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:61:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:63:9
+ |
+LL | deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:68:9
+ |
+LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:70:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedStruct': text
+ --> $DIR/lint-stability-deprecated.rs:117:17
+ |
+LL | let _ = DeprecatedStruct { //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct': text
+ --> $DIR/lint-stability-deprecated.rs:120:17
+ |
+LL | let _ = DeprecatedUnstableStruct {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedUnitStruct': text
+ --> $DIR/lint-stability-deprecated.rs:127:17
+ |
+LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnitStruct'
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct': text
+ --> $DIR/lint-stability-deprecated.rs:128:17
+ |
+LL | let _ = DeprecatedUnstableUnitStruct; //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableUnitStruct'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Enum::DeprecatedVariant': text
+ --> $DIR/lint-stability-deprecated.rs:132:17
+ |
+LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedVariant'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant': text
+ --> $DIR/lint-stability-deprecated.rs:133:17
+ |
+LL | let _ = Enum::DeprecatedUnstableVariant; //~ WARN use of deprecated item 'lint_stability::Enum::DeprecatedUnstableVariant'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedTupleStruct': text
+ --> $DIR/lint-stability-deprecated.rs:137:17
+ |
+LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedTupleStruct'
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct': text
+ --> $DIR/lint-stability-deprecated.rs:138:17
+ |
+LL | let _ = DeprecatedUnstableTupleStruct (1); //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableTupleStruct'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:147:25
+ |
+LL | macro_test_arg!(deprecated_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:148:25
+ |
+LL | macro_test_arg!(deprecated_unstable_text()); //~ WARN use of deprecated item 'lint_stability::deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:149:41
+ |
+LL | macro_test_arg!(macro_test_arg!(deprecated_text())); //~ WARN use of deprecated item 'lint_stability::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:154:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:156:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:158:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:160:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:162:9
+ |
+LL | Trait::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:164:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:166:9
+ |
+LL | Trait::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:168:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedTrait': text
+ --> $DIR/lint-stability-deprecated.rs:196:10
+ |
+LL | impl DeprecatedTrait for S {} //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedTrait': text
+ --> $DIR/lint-stability-deprecated.rs:198:25
+ |
+LL | trait LocalTrait2 : DeprecatedTrait { } //~ WARN use of deprecated item 'lint_stability::DeprecatedTrait': text
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:217:9
+ |
+LL | unstable_mod::deprecated(); //~ WARN use of deprecated item 'inheritance::inherited_stability::unstable_mod::deprecated': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:339:9
+ |
+LL | deprecated(); //~ WARN use of deprecated item 'this_crate::deprecated'
+ | ^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:344:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:346:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:348:9
+ |
+LL | deprecated_text(); //~ WARN use of deprecated item 'this_crate::deprecated_text': text
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:353:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:355:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::DeprecatedStruct': text
+ --> $DIR/lint-stability-deprecated.rs:393:17
+ |
+LL | let _ = DeprecatedStruct {
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::DeprecatedUnitStruct': text
+ --> $DIR/lint-stability-deprecated.rs:400:17
+ |
+LL | let _ = DeprecatedUnitStruct; //~ WARN use of deprecated item 'this_crate::DeprecatedUnitStruct'
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Enum::DeprecatedVariant': text
+ --> $DIR/lint-stability-deprecated.rs:404:17
+ |
+LL | let _ = Enum::DeprecatedVariant; //~ WARN use of deprecated item 'this_crate::Enum::DeprecatedVariant'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::DeprecatedTupleStruct': text
+ --> $DIR/lint-stability-deprecated.rs:408:17
+ |
+LL | let _ = DeprecatedTupleStruct (1); //~ WARN use of deprecated item 'this_crate::DeprecatedTupleStruct'
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:415:9
+ |
+LL | Trait::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:417:9
+ |
+LL | <Foo as Trait>::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:419:9
+ |
+LL | Trait::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:421:9
+ |
+LL | <Foo as Trait>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::test_fn_body::fn_in_body': text
+ --> $DIR/lint-stability-deprecated.rs:448:9
+ |
+LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::test_fn_body::fn_in_body': text
+ | ^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::DeprecatedTrait': text
+ --> $DIR/lint-stability-deprecated.rs:468:10
+ |
+LL | impl DeprecatedTrait for S { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait'
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::DeprecatedTrait': text
+ --> $DIR/lint-stability-deprecated.rs:470:24
+ |
+LL | trait LocalTrait : DeprecatedTrait { } //~ WARN use of deprecated item 'this_crate::DeprecatedTrait'
+ | ^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text
+ --> $DIR/lint-stability-deprecated.rs:456:13
+ |
+LL | fn_in_body(); //~ WARN use of deprecated item 'this_crate::MethodTester::test_method_body::fn_in_body': text
+ | ^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text
+ --> $DIR/lint-stability-deprecated.rs:109:48
+ |
+LL | struct S2<T: TraitWithAssociatedTypes>(T::TypeDeprecated);
+ | ^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::TraitWithAssociatedTypes::TypeDeprecated': text
+ --> $DIR/lint-stability-deprecated.rs:113:13
+ |
+LL | TypeDeprecated = u16,
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:37:13
+ |
+LL | foo.method_deprecated(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:38:9
+ |
+LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:39:9
+ |
+LL | <Foo>::method_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:40:13
+ |
+LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:42:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:46:13
+ |
+LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:47:9
+ |
+LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:48:9
+ |
+LL | <Foo>::method_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:49:13
+ |
+LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:51:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:55:13
+ |
+LL | foo.method_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:56:9
+ |
+LL | Foo::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:57:9
+ |
+LL | <Foo>::method_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:58:13
+ |
+LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:60:9
+ |
+LL | <Foo>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:64:13
+ |
+LL | foo.method_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:65:9
+ |
+LL | Foo::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:66:9
+ |
+LL | <Foo>::method_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::MethodTester::method_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:67:13
+ |
+LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:69:9
+ |
+LL | <Foo>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedStruct::i': text
+ --> $DIR/lint-stability-deprecated.rs:118:13
+ |
+LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedStruct::i'
+ | ^^^^
+
+warning: use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i': text
+ --> $DIR/lint-stability-deprecated.rs:122:13
+ |
+LL | i: 0 //~ WARN use of deprecated item 'lint_stability::DeprecatedUnstableStruct::i'
+ | ^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:153:13
+ |
+LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:155:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:157:13
+ |
+LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:159:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:161:13
+ |
+LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:163:9
+ |
+LL | <Foo>::trait_deprecated_unstable(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:165:13
+ |
+LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:167:9
+ |
+LL | <Foo>::trait_deprecated_unstable_text(&foo); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:184:13
+ |
+LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:185:13
+ |
+LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable': text
+ --> $DIR/lint-stability-deprecated.rs:186:13
+ |
+LL | foo.trait_deprecated_unstable(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ --> $DIR/lint-stability-deprecated.rs:187:13
+ |
+LL | foo.trait_deprecated_unstable_text(); //~ WARN use of deprecated item 'lint_stability::Trait::trait_deprecated_unstable_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:340:13
+ |
+LL | foo.method_deprecated(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:341:9
+ |
+LL | Foo::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::method_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:342:9
+ |
+LL | <Foo>::method_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:343:13
+ |
+LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:345:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:349:13
+ |
+LL | foo.method_deprecated_text(); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:350:9
+ |
+LL | Foo::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:351:9
+ |
+LL | <Foo>::method_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::MethodTester::method_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:352:13
+ |
+LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:354:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::DeprecatedStruct::i': text
+ --> $DIR/lint-stability-deprecated.rs:395:13
+ |
+LL | i: 0 //~ WARN use of deprecated item 'this_crate::DeprecatedStruct::i'
+ | ^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:414:13
+ |
+LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:416:9
+ |
+LL | <Foo>::trait_deprecated(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:418:13
+ |
+LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:420:9
+ |
+LL | <Foo>::trait_deprecated_text(&foo); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated': text
+ --> $DIR/lint-stability-deprecated.rs:437:13
+ |
+LL | foo.trait_deprecated(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated'
+ | ^^^^^^^^^^^^^^^^
+
+warning: use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ --> $DIR/lint-stability-deprecated.rs:438:13
+ |
+LL | foo.trait_deprecated_text(); //~ WARN use of deprecated item 'this_crate::Trait::trait_deprecated_text': text
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: compilation successful
+ --> $DIR/lint-stability-deprecated.rs:473:16
+ |
+LL | #[rustc_error] fn main() {} //~ ERROR: compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-stability-fields-deprecated.rs b/src/test/ui/lint/lint-stability-fields-deprecated.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability-fields-deprecated.rs
rename to src/test/ui/lint/lint-stability-fields-deprecated.rs
diff --git a/src/test/ui/lint/lint-stability-fields-deprecated.stderr b/src/test/ui/lint/lint-stability-fields-deprecated.stderr
new file mode 100644
index 0000000..f7bc87e
--- /dev/null
+++ b/src/test/ui/lint/lint-stability-fields-deprecated.stderr
@@ -0,0 +1,380 @@
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': text
+ --> $DIR/lint-stability-fields-deprecated.rs:104:17
+ |
+LL | let x = Deprecated {
+ | ^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-stability-fields-deprecated.rs:13:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': text
+ --> $DIR/lint-stability-fields-deprecated.rs:121:13
+ |
+LL | let Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated': text
+ --> $DIR/lint-stability-fields-deprecated.rs:131:13
+ |
+LL | let Deprecated
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:136:17
+ |
+LL | let x = Deprecated2(1, 2, 3);
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:146:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:155:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated': text
+ --> $DIR/lint-stability-fields-deprecated.rs:291:17
+ |
+LL | let x = Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated': text
+ --> $DIR/lint-stability-fields-deprecated.rs:308:13
+ |
+LL | let Deprecated {
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated': text
+ --> $DIR/lint-stability-fields-deprecated.rs:318:13
+ |
+LL | let Deprecated
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:323:17
+ |
+LL | let x = Deprecated2(1, 2, 3);
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:333:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:342:13
+ |
+LL | let Deprecated2
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Stable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:28:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Stable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:34:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Stable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:40:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Stable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:50:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Stable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:55:20
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:65:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:71:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:77:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:90:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Unstable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:96:14
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::inherit': text
+ --> $DIR/lint-stability-fields-deprecated.rs:106:13
+ |
+LL | inherit: 1,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:108:13
+ |
+LL | override1: 2,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:110:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::inherit': text
+ --> $DIR/lint-stability-fields-deprecated.rs:114:17
+ |
+LL | let _ = x.inherit;
+ | ^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:116:17
+ |
+LL | let _ = x.override1;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:118:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::inherit': text
+ --> $DIR/lint-stability-fields-deprecated.rs:123:13
+ |
+LL | inherit: _,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:125:13
+ |
+LL | override1: _,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:127:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::0': text
+ --> $DIR/lint-stability-fields-deprecated.rs:139:17
+ |
+LL | let _ = x.0;
+ | ^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:141:17
+ |
+LL | let _ = x.1;
+ | ^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:143:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::0': text
+ --> $DIR/lint-stability-fields-deprecated.rs:148:14
+ |
+LL | (_,
+ | ^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:150:14
+ |
+LL | _,
+ | ^
+
+error: use of deprecated item 'cross_crate::lint_stability_fields::Deprecated2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:152:14
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'this_crate::Stable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:215:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Stable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:221:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Stable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:227:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Stable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:237:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'this_crate::Stable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:242:20
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'this_crate::Unstable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:252:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Unstable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:258:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Unstable::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:264:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Unstable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:277:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'this_crate::Unstable2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:283:14
+ |
+LL | _)
+ | ^
+
+error: use of deprecated item 'this_crate::Deprecated::inherit': text
+ --> $DIR/lint-stability-fields-deprecated.rs:293:13
+ |
+LL | inherit: 1,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::override1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:295:13
+ |
+LL | override1: 2,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:297:13
+ |
+LL | override2: 3,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::inherit': text
+ --> $DIR/lint-stability-fields-deprecated.rs:301:17
+ |
+LL | let _ = x.inherit;
+ | ^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::override1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:303:17
+ |
+LL | let _ = x.override1;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:305:17
+ |
+LL | let _ = x.override2;
+ | ^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::inherit': text
+ --> $DIR/lint-stability-fields-deprecated.rs:310:13
+ |
+LL | inherit: _,
+ | ^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::override1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:312:13
+ |
+LL | override1: _,
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated::override2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:314:13
+ |
+LL | override2: _
+ | ^^^^^^^^^^^^
+
+error: use of deprecated item 'this_crate::Deprecated2::0': text
+ --> $DIR/lint-stability-fields-deprecated.rs:326:17
+ |
+LL | let _ = x.0;
+ | ^^^
+
+error: use of deprecated item 'this_crate::Deprecated2::1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:328:17
+ |
+LL | let _ = x.1;
+ | ^^^
+
+error: use of deprecated item 'this_crate::Deprecated2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:330:17
+ |
+LL | let _ = x.2;
+ | ^^^
+
+error: use of deprecated item 'this_crate::Deprecated2::0': text
+ --> $DIR/lint-stability-fields-deprecated.rs:335:14
+ |
+LL | (_,
+ | ^
+
+error: use of deprecated item 'this_crate::Deprecated2::1': text
+ --> $DIR/lint-stability-fields-deprecated.rs:337:14
+ |
+LL | _,
+ | ^
+
+error: use of deprecated item 'this_crate::Deprecated2::2': text
+ --> $DIR/lint-stability-fields-deprecated.rs:339:14
+ |
+LL | _)
+ | ^
+
+error: aborting due to 62 previous errors
+
diff --git a/src/test/compile-fail/lint-stability-fields.rs b/src/test/ui/lint/lint-stability-fields.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability-fields.rs
rename to src/test/ui/lint/lint-stability-fields.rs
diff --git a/src/test/ui/lint/lint-stability-fields.stderr b/src/test/ui/lint/lint-stability-fields.stderr
new file mode 100644
index 0000000..2f17606
--- /dev/null
+++ b/src/test/ui/lint/lint-stability-fields.stderr
@@ -0,0 +1,347 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:61:17
+ |
+LL | let x = Unstable { //~ ERROR use of unstable
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:71:13
+ |
+LL | let Unstable { //~ ERROR use of unstable
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:77:13
+ |
+LL | let Unstable //~ ERROR use of unstable
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:82:17
+ |
+LL | let x = reexport::Unstable2(1, 2, 3); //~ ERROR use of unstable
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:84:17
+ |
+LL | let x = Unstable2(1, 2, 3); //~ ERROR use of unstable
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:90:13
+ |
+LL | let Unstable2 //~ ERROR use of unstable
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:95:13
+ |
+LL | let Unstable2 //~ ERROR use of unstable
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:100:17
+ |
+LL | let x = Deprecated { //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:110:13
+ |
+LL | let Deprecated { //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:116:13
+ |
+LL | let Deprecated //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:120:17
+ |
+LL | let x = Deprecated2(1, 2, 3); //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:126:13
+ |
+LL | let Deprecated2 //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:131:13
+ |
+LL | let Deprecated2 //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:31:13
+ |
+LL | override1: 2, //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:32:13
+ |
+LL | override2: 3, //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:36:17
+ |
+LL | let _ = x.override1; //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:37:17
+ |
+LL | let _ = x.override2; //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:41:13
+ |
+LL | override1: _, //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:42:13
+ |
+LL | override2: _ //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:50:17
+ |
+LL | let _ = x.1; //~ ERROR use of unstable
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:51:17
+ |
+LL | let _ = x.2; //~ ERROR use of unstable
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:54:20
+ |
+LL | _, //~ ERROR use of unstable
+ | ^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:55:20
+ |
+LL | _) //~ ERROR use of unstable
+ | ^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:62:13
+ |
+LL | inherit: 1, //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:64:13
+ |
+LL | override2: 3, //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:67:17
+ |
+LL | let _ = x.inherit; //~ ERROR use of unstable
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:69:17
+ |
+LL | let _ = x.override2; //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:72:13
+ |
+LL | inherit: _, //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:74:13
+ |
+LL | override2: _ //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:86:17
+ |
+LL | let _ = x.0; //~ ERROR use of unstable
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:88:17
+ |
+LL | let _ = x.2; //~ ERROR use of unstable
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:91:14
+ |
+LL | (_, //~ ERROR use of unstable
+ | ^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:93:14
+ |
+LL | _) //~ ERROR use of unstable
+ | ^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:101:13
+ |
+LL | inherit: 1, //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:103:13
+ |
+LL | override2: 3, //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:106:17
+ |
+LL | let _ = x.inherit; //~ ERROR use of unstable
+ | ^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:108:17
+ |
+LL | let _ = x.override2; //~ ERROR use of unstable
+ | ^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:111:13
+ |
+LL | inherit: _, //~ ERROR use of unstable
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:113:13
+ |
+LL | override2: _ //~ ERROR use of unstable
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:122:17
+ |
+LL | let _ = x.0; //~ ERROR use of unstable
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:124:17
+ |
+LL | let _ = x.2; //~ ERROR use of unstable
+ | ^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:127:14
+ |
+LL | (_, //~ ERROR use of unstable
+ | ^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability-fields.rs:129:14
+ |
+LL | _) //~ ERROR use of unstable
+ | ^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to 43 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/ui/lint/lint-stability.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability.rs
rename to src/test/ui/lint/lint-stability.rs
diff --git a/src/test/ui/lint/lint-stability.stderr b/src/test/ui/lint/lint-stability.stderr
new file mode 100644
index 0000000..893c70f
--- /dev/null
+++ b/src/test/ui/lint/lint-stability.stderr
@@ -0,0 +1,331 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:27:5
+ |
+LL | extern crate stability_cfg2; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:55:9
+ |
+LL | deprecated_unstable();
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:57:9
+ |
+LL | Trait::trait_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:59:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:62:9
+ |
+LL | deprecated_unstable_text();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:64:9
+ |
+LL | Trait::trait_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:66:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:69:9
+ |
+LL | unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:70:9
+ |
+LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:71:9
+ |
+LL | <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability.rs:73:9
+ |
+LL | unstable_text();
+ | ^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability.rs:75:9
+ |
+LL | Trait::trait_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability.rs:77:9
+ |
+LL | <Foo as Trait>::trait_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:109:17
+ |
+LL | let _ = DeprecatedUnstableStruct {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:113:17
+ |
+LL | let _ = UnstableStruct { i: 0 }; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:117:17
+ |
+LL | let _ = DeprecatedUnstableUnitStruct;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:119:17
+ |
+LL | let _ = UnstableUnitStruct; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:123:17
+ |
+LL | let _ = Enum::DeprecatedUnstableVariant;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:125:17
+ |
+LL | let _ = Enum::UnstableVariant; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:129:17
+ |
+LL | let _ = DeprecatedUnstableTupleStruct (1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:131:17
+ |
+LL | let _ = UnstableTupleStruct (1); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:140:25
+ |
+LL | macro_test_arg!(deprecated_unstable_text());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:154:9
+ |
+LL | Trait::trait_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:156:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:158:9
+ |
+LL | Trait::trait_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:160:9
+ |
+LL | <Foo as Trait>::trait_deprecated_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:162:9
+ |
+LL | Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:163:9
+ |
+LL | <Foo as Trait>::trait_unstable(&foo); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability.rs:164:9
+ |
+LL | Trait::trait_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': text
+ --> $DIR/lint-stability.rs:166:9
+ |
+LL | <Foo as Trait>::trait_unstable_text(&foo);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:182:10
+ |
+LL | impl UnstableTrait for S { } //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:184:24
+ |
+LL | trait LocalTrait : UnstableTrait { } //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:189:9
+ |
+LL | fn trait_unstable(&self) {} //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:194:5
+ |
+LL | extern crate inherited_stability; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:195:9
+ |
+LL | use self::inherited_stability::*; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:198:9
+ |
+LL | unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:201:9
+ |
+LL | stable_mod::unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:205:9
+ |
+LL | unstable_mod::unstable(); //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:207:17
+ |
+LL | let _ = Unstable::UnstableVariant; //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:98:48
+ |
+LL | struct S1<T: TraitWithAssociatedTypes>(T::TypeUnstable);
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature'
+ --> $DIR/lint-stability.rs:102:13
+ |
+LL | TypeUnstable = u8, //~ ERROR use of unstable library feature
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to 41 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/lint-stability2.rs b/src/test/ui/lint/lint-stability2.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability2.rs
rename to src/test/ui/lint/lint-stability2.rs
diff --git a/src/test/ui/lint/lint-stability2.stderr b/src/test/ui/lint/lint-stability2.stderr
new file mode 100644
index 0000000..5585fc9
--- /dev/null
+++ b/src/test/ui/lint/lint-stability2.stderr
@@ -0,0 +1,15 @@
+error: use of deprecated item 'lint_stability::deprecated': text
+ --> $DIR/lint-stability2.rs:22:5
+ |
+LL | macro_test!();
+ | ^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-stability2.rs:14:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+ = 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: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-stability3.rs b/src/test/ui/lint/lint-stability3.rs
similarity index 100%
rename from src/test/compile-fail/lint-stability3.rs
rename to src/test/ui/lint/lint-stability3.rs
diff --git a/src/test/ui/lint/lint-stability3.stderr b/src/test/ui/lint/lint-stability3.stderr
new file mode 100644
index 0000000..722223f
--- /dev/null
+++ b/src/test/ui/lint/lint-stability3.stderr
@@ -0,0 +1,15 @@
+error: use of deprecated item 'lint_stability::deprecated_text': text
+ --> $DIR/lint-stability3.rs:23:5
+ |
+LL | macro_test_arg_nested!(deprecated_text);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-stability3.rs:14:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+ = 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: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-type-limits.rs b/src/test/ui/lint/lint-type-limits.rs
similarity index 100%
rename from src/test/compile-fail/lint-type-limits.rs
rename to src/test/ui/lint/lint-type-limits.rs
diff --git a/src/test/ui/lint/lint-type-limits.stderr b/src/test/ui/lint/lint-type-limits.stderr
new file mode 100644
index 0000000..49b379a
--- /dev/null
+++ b/src/test/ui/lint/lint-type-limits.stderr
@@ -0,0 +1,58 @@
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:18:11
+ |
+LL | while i >= 0 { //~ ERROR comparison is useless due to type limits
+ | ^^^^^^
+ |
+ = note: requested on the command line with `-D unused-comparisons`
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:29:13
+ |
+LL | let _ = u > 255; //~ ERROR comparison is useless due to type limits
+ | ^^^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:30:13
+ |
+LL | let _ = 255 < u; //~ ERROR comparison is useless due to type limits
+ | ^^^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:31:13
+ |
+LL | let _ = u < 0; //~ ERROR comparison is useless due to type limits
+ | ^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:32:13
+ |
+LL | let _ = 0 > u; //~ ERROR comparison is useless due to type limits
+ | ^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:33:13
+ |
+LL | let _ = u <= 255; //~ ERROR comparison is useless due to type limits
+ | ^^^^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:34:13
+ |
+LL | let _ = 255 >= u; //~ ERROR comparison is useless due to type limits
+ | ^^^^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:35:13
+ |
+LL | let _ = u >= 0; //~ ERROR comparison is useless due to type limits
+ | ^^^^^^
+
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits.rs:36:13
+ |
+LL | let _ = 0 <= u; //~ ERROR comparison is useless due to type limits
+ | ^^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/src/test/compile-fail/lint-type-limits2.rs b/src/test/ui/lint/lint-type-limits2.rs
similarity index 100%
rename from src/test/compile-fail/lint-type-limits2.rs
rename to src/test/ui/lint/lint-type-limits2.rs
diff --git a/src/test/ui/lint/lint-type-limits2.stderr b/src/test/ui/lint/lint-type-limits2.stderr
new file mode 100644
index 0000000..a7abf7a
--- /dev/null
+++ b/src/test/ui/lint/lint-type-limits2.stderr
@@ -0,0 +1,18 @@
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits2.rs:22:5
+ |
+LL | 128 > bar() //~ ERROR comparison is useless due to type limits
+ | ^^^^^^^^^^^
+ |
+ = note: requested on the command line with `-D unused-comparisons`
+
+warning: literal out of range for i8
+ --> $DIR/lint-type-limits2.rs:22:5
+ |
+LL | 128 > bar() //~ ERROR comparison is useless due to type limits
+ | ^^^
+ |
+ = note: #[warn(overflowing_literals)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-type-limits3.rs b/src/test/ui/lint/lint-type-limits3.rs
similarity index 100%
rename from src/test/compile-fail/lint-type-limits3.rs
rename to src/test/ui/lint/lint-type-limits3.rs
diff --git a/src/test/ui/lint/lint-type-limits3.stderr b/src/test/ui/lint/lint-type-limits3.stderr
new file mode 100644
index 0000000..b6e14ac
--- /dev/null
+++ b/src/test/ui/lint/lint-type-limits3.stderr
@@ -0,0 +1,18 @@
+error: comparison is useless due to type limits
+ --> $DIR/lint-type-limits3.rs:18:11
+ |
+LL | while 200 != i { //~ ERROR comparison is useless due to type limits
+ | ^^^^^^^^
+ |
+ = note: requested on the command line with `-D unused-comparisons`
+
+warning: literal out of range for i8
+ --> $DIR/lint-type-limits3.rs:18:11
+ |
+LL | while 200 != i { //~ ERROR comparison is useless due to type limits
+ | ^^^
+ |
+ = note: #[warn(overflowing_literals)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-type-overflow.rs b/src/test/ui/lint/lint-type-overflow.rs
similarity index 100%
rename from src/test/compile-fail/lint-type-overflow.rs
rename to src/test/ui/lint/lint-type-overflow.rs
diff --git a/src/test/ui/lint/lint-type-overflow.stderr b/src/test/ui/lint/lint-type-overflow.stderr
new file mode 100644
index 0000000..67f4537
--- /dev/null
+++ b/src/test/ui/lint/lint-type-overflow.stderr
@@ -0,0 +1,116 @@
+error: literal out of range for u8
+ --> $DIR/lint-type-overflow.rs:21:18
+ |
+LL | let x1: u8 = 256; //~ error: literal out of range for u8
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-type-overflow.rs:12:9
+ |
+LL | #![deny(overflowing_literals)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: literal out of range for u8
+ --> $DIR/lint-type-overflow.rs:24:14
+ |
+LL | let x1 = 256_u8; //~ error: literal out of range for u8
+ | ^^^^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:27:18
+ |
+LL | let x1: i8 = 128; //~ error: literal out of range for i8
+ | ^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:29:19
+ |
+LL | let x3: i8 = -129; //~ error: literal out of range for i8
+ | ^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:30:19
+ |
+LL | let x3: i8 = -(129); //~ error: literal out of range for i8
+ | ^^^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:31:20
+ |
+LL | let x3: i8 = -{129}; //~ error: literal out of range for i8
+ | ^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:33:10
+ |
+LL | test(1000); //~ error: literal out of range for i8
+ | ^^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:35:13
+ |
+LL | let x = 128_i8; //~ error: literal out of range for i8
+ | ^^^^^^
+
+error: literal out of range for i8
+ --> $DIR/lint-type-overflow.rs:39:14
+ |
+LL | let x = -129_i8; //~ error: literal out of range for i8
+ | ^^^^^^
+
+error: literal out of range for i32
+ --> $DIR/lint-type-overflow.rs:43:18
+ |
+LL | let x: i32 = 2147483648; //~ error: literal out of range for i32
+ | ^^^^^^^^^^
+
+error: literal out of range for i32
+ --> $DIR/lint-type-overflow.rs:44:13
+ |
+LL | let x = 2147483648_i32; //~ error: literal out of range for i32
+ | ^^^^^^^^^^^^^^
+
+error: literal out of range for i32
+ --> $DIR/lint-type-overflow.rs:47:19
+ |
+LL | let x: i32 = -2147483649; //~ error: literal out of range for i32
+ | ^^^^^^^^^^
+
+error: literal out of range for i32
+ --> $DIR/lint-type-overflow.rs:48:14
+ |
+LL | let x = -2147483649_i32; //~ error: literal out of range for i32
+ | ^^^^^^^^^^^^^^
+
+error: literal out of range for i32
+ --> $DIR/lint-type-overflow.rs:49:13
+ |
+LL | let x = 2147483648; //~ error: literal out of range for i32
+ | ^^^^^^^^^^
+
+error: literal out of range for i64
+ --> $DIR/lint-type-overflow.rs:51:13
+ |
+LL | let x = 9223372036854775808_i64; //~ error: literal out of range for i64
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: literal out of range for i64
+ --> $DIR/lint-type-overflow.rs:53:13
+ |
+LL | let x = 18446744073709551615_i64; //~ error: literal out of range for i64
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: literal out of range for i64
+ --> $DIR/lint-type-overflow.rs:54:19
+ |
+LL | let x: i64 = -9223372036854775809; //~ error: literal out of range for i64
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: literal out of range for i64
+ --> $DIR/lint-type-overflow.rs:55:14
+ |
+LL | let x = -9223372036854775809_i64; //~ error: literal out of range for i64
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 18 previous errors
+
diff --git a/src/test/compile-fail/lint-type-overflow2.rs b/src/test/ui/lint/lint-type-overflow2.rs
similarity index 100%
rename from src/test/compile-fail/lint-type-overflow2.rs
rename to src/test/ui/lint/lint-type-overflow2.rs
diff --git a/src/test/ui/lint/lint-type-overflow2.stderr b/src/test/ui/lint/lint-type-overflow2.stderr
new file mode 100644
index 0000000..ecfd258
--- /dev/null
+++ b/src/test/ui/lint/lint-type-overflow2.stderr
@@ -0,0 +1,50 @@
+warning: literal out of range for i8
+ --> $DIR/lint-type-overflow2.rs:19:20
+ |
+LL | let x2: i8 = --128; //~ warn: literal out of range for i8
+ | ^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-type-overflow2.rs:12:9
+ |
+LL | #![warn(overflowing_literals)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: literal out of range for f32
+ --> $DIR/lint-type-overflow2.rs:21:14
+ |
+LL | let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32
+ | ^^^^^^^^^^^^^^^^^^
+
+warning: literal out of range for f32
+ --> $DIR/lint-type-overflow2.rs:22:14
+ |
+LL | let x = 3.40282357e+38_f32; //~ warn: literal out of range for f32
+ | ^^^^^^^^^^^^^^^^^^
+
+warning: literal out of range for f64
+ --> $DIR/lint-type-overflow2.rs:23:14
+ |
+LL | let x = -1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: literal out of range for f64
+ --> $DIR/lint-type-overflow2.rs:24:14
+ |
+LL | let x = 1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: compilation successful
+ --> $DIR/lint-type-overflow2.rs:18:1
+ |
+LL | / fn main() { //~ ERROR: compilation successful
+LL | | let x2: i8 = --128; //~ warn: literal out of range for i8
+LL | |
+LL | | let x = -3.40282357e+38_f32; //~ warn: literal out of range for f32
+... |
+LL | | let x = 1.7976931348623159e+308_f64; //~ warn: literal out of range for f64
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lint-unconditional-recursion.rs b/src/test/ui/lint/lint-unconditional-recursion.rs
similarity index 100%
rename from src/test/ui/lint-unconditional-recursion.rs
rename to src/test/ui/lint/lint-unconditional-recursion.rs
diff --git a/src/test/ui/lint-unconditional-recursion.stderr b/src/test/ui/lint/lint-unconditional-recursion.stderr
similarity index 100%
rename from src/test/ui/lint-unconditional-recursion.stderr
rename to src/test/ui/lint/lint-unconditional-recursion.stderr
diff --git a/src/test/compile-fail/lint-unexported-no-mangle.rs b/src/test/ui/lint/lint-unexported-no-mangle.rs
similarity index 100%
rename from src/test/compile-fail/lint-unexported-no-mangle.rs
rename to src/test/ui/lint/lint-unexported-no-mangle.rs
diff --git a/src/test/ui/lint/lint-unexported-no-mangle.stderr b/src/test/ui/lint/lint-unexported-no-mangle.stderr
new file mode 100644
index 0000000..e7d49f3
--- /dev/null
+++ b/src/test/ui/lint/lint-unexported-no-mangle.stderr
@@ -0,0 +1,43 @@
+error: function is marked #[no_mangle], but not exported
+ --> $DIR/lint-unexported-no-mangle.rs:14:1
+ |
+LL | fn foo() { //~ ERROR function is marked #[no_mangle], but not exported
+ | ^
+ | |
+ | _help: try making it public: `pub`
+ | |
+LL | | }
+ | |_^
+ |
+ = note: requested on the command line with `-F private-no-mangle-fns`
+
+error: const items should never be #[no_mangle]
+ --> $DIR/lint-unexported-no-mangle.rs:19:1
+ |
+LL | const FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]
+ | -----^^^^^^^^^^^^^^
+ | |
+ | help: try a static value: `pub static`
+ |
+ = note: requested on the command line with `-F no-mangle-const-items`
+
+error: const items should never be #[no_mangle]
+ --> $DIR/lint-unexported-no-mangle.rs:22:1
+ |
+LL | pub const PUB_FOO: u64 = 1; //~ ERROR const items should never be #[no_mangle]
+ | ---------^^^^^^^^^^^^^^^^^^
+ | |
+ | help: try a static value: `pub static`
+
+error: static is marked #[no_mangle], but not exported
+ --> $DIR/lint-unexported-no-mangle.rs:33:1
+ |
+LL | static PRIVATE_BAR: u64 = 1; //~ ERROR static is marked #[no_mangle], but not exported
+ | -^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ | |
+ | help: try making it public: `pub`
+ |
+ = note: requested on the command line with `-F private-no-mangle-statics`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/lint-unknown-attr.rs b/src/test/ui/lint/lint-unknown-attr.rs
similarity index 100%
rename from src/test/compile-fail/lint-unknown-attr.rs
rename to src/test/ui/lint/lint-unknown-attr.rs
diff --git a/src/test/ui/lint/lint-unknown-attr.stderr b/src/test/ui/lint/lint-unknown-attr.stderr
new file mode 100644
index 0000000..5f91523
--- /dev/null
+++ b/src/test/ui/lint/lint-unknown-attr.stderr
@@ -0,0 +1,26 @@
+error: unused attribute
+ --> $DIR/lint-unknown-attr.rs:19:1
+ |
+LL | #[dance] mod a {} //~ ERROR unused attribute
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-unknown-attr.rs:15:9
+ |
+LL | #![deny(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+ --> $DIR/lint-unknown-attr.rs:21:1
+ |
+LL | #[dance] fn main() {} //~ ERROR unused attribute
+ | ^^^^^^^^
+
+error: unused attribute
+ --> $DIR/lint-unknown-attr.rs:17:1
+ |
+LL | #![mutable_doc] //~ ERROR unused attribute
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/lint-unknown-feature-default.rs b/src/test/ui/lint/lint-unknown-feature-default.rs
similarity index 100%
rename from src/test/compile-fail/lint-unknown-feature-default.rs
rename to src/test/ui/lint/lint-unknown-feature-default.rs
diff --git a/src/test/ui/lint/lint-unknown-feature-default.stderr b/src/test/ui/lint/lint-unknown-feature-default.stderr
new file mode 100644
index 0000000..bd4079f
--- /dev/null
+++ b/src/test/ui/lint/lint-unknown-feature-default.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/lint-unknown-feature-default.rs:20:1
+ |
+LL | fn main() { } //~ ERROR: compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-unknown-feature.rs b/src/test/ui/lint/lint-unknown-feature.rs
similarity index 100%
rename from src/test/compile-fail/lint-unknown-feature.rs
rename to src/test/ui/lint/lint-unknown-feature.rs
diff --git a/src/test/ui/lint/lint-unknown-feature.stderr b/src/test/ui/lint/lint-unknown-feature.stderr
new file mode 100644
index 0000000..e2744c03
--- /dev/null
+++ b/src/test/ui/lint/lint-unknown-feature.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/lint-unknown-feature.rs:20:1
+ |
+LL | fn main() {} //~ ERROR: compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-unknown-lint-cmdline.rs b/src/test/ui/lint/lint-unknown-lint-cmdline.rs
similarity index 100%
rename from src/test/compile-fail/lint-unknown-lint-cmdline.rs
rename to src/test/ui/lint/lint-unknown-lint-cmdline.rs
diff --git a/src/test/ui/lint/lint-unknown-lint-cmdline.stderr b/src/test/ui/lint/lint-unknown-lint-cmdline.stderr
new file mode 100644
index 0000000..8636004
--- /dev/null
+++ b/src/test/ui/lint/lint-unknown-lint-cmdline.stderr
@@ -0,0 +1,7 @@
+error[E0602]: unknown lint: `bogus`
+ |
+ = note: requested on the command line with `-D bogus`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0602`.
diff --git a/src/test/compile-fail/lint-unknown-lint.rs b/src/test/ui/lint/lint-unknown-lint.rs
similarity index 100%
rename from src/test/compile-fail/lint-unknown-lint.rs
rename to src/test/ui/lint/lint-unknown-lint.rs
diff --git a/src/test/ui/lint/lint-unknown-lint.stderr b/src/test/ui/lint/lint-unknown-lint.stderr
new file mode 100644
index 0000000..b398a2f
--- /dev/null
+++ b/src/test/ui/lint/lint-unknown-lint.stderr
@@ -0,0 +1,23 @@
+warning: unknown lint: `not_a_real_lint`
+ --> $DIR/lint-unknown-lint.rs:11:10
+ |
+LL | #![allow(not_a_real_lint)] //~ WARN unknown lint
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: #[warn(unknown_lints)] on by default
+
+error: unused variable: `unused`
+ --> $DIR/lint-unknown-lint.rs:13:17
+ |
+LL | fn main() { let unused = (); } //~ ERROR unused variable
+ | ^^^^^^ help: consider using `_unused` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-unknown-lint.rs:12:9
+ |
+LL | #![deny(unused)]
+ | ^^^^^^
+ = note: #[deny(unused_variables)] implied by #[deny(unused)]
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-unnecessary-import-braces.rs b/src/test/ui/lint/lint-unnecessary-import-braces.rs
similarity index 100%
rename from src/test/compile-fail/lint-unnecessary-import-braces.rs
rename to src/test/ui/lint/lint-unnecessary-import-braces.rs
diff --git a/src/test/ui/lint/lint-unnecessary-import-braces.stderr b/src/test/ui/lint/lint-unnecessary-import-braces.stderr
new file mode 100644
index 0000000..a4fd474
--- /dev/null
+++ b/src/test/ui/lint/lint-unnecessary-import-braces.stderr
@@ -0,0 +1,14 @@
+error: braces around A is unnecessary
+ --> $DIR/lint-unnecessary-import-braces.rs:13:1
+ |
+LL | use test::{A}; //~ ERROR braces around A is unnecessary
+ | ^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-unnecessary-import-braces.rs:11:9
+ |
+LL | #![deny(unused_import_braces)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/lint-unnecessary-parens.rs b/src/test/ui/lint/lint-unnecessary-parens.rs
similarity index 100%
rename from src/test/compile-fail/lint-unnecessary-parens.rs
rename to src/test/ui/lint/lint-unnecessary-parens.rs
diff --git a/src/test/ui/lint/lint-unnecessary-parens.stderr b/src/test/ui/lint/lint-unnecessary-parens.stderr
new file mode 100644
index 0000000..8861524
--- /dev/null
+++ b/src/test/ui/lint/lint-unnecessary-parens.stderr
@@ -0,0 +1,80 @@
+error: unnecessary parentheses around `return` value
+ --> $DIR/lint-unnecessary-parens.rs:20:12
+ |
+LL | return (1); //~ ERROR unnecessary parentheses around `return` value
+ | ^^^ help: remove these parentheses
+ |
+note: lint level defined here
+ --> $DIR/lint-unnecessary-parens.rs:11:9
+ |
+LL | #![deny(unused_parens)]
+ | ^^^^^^^^^^^^^
+
+error: unnecessary parentheses around `return` value
+ --> $DIR/lint-unnecessary-parens.rs:23:12
+ |
+LL | return (X { y }); //~ ERROR unnecessary parentheses around `return` value
+ | ^^^^^^^^^ help: remove these parentheses
+
+error: unnecessary parentheses around function argument
+ --> $DIR/lint-unnecessary-parens.rs:28:9
+ |
+LL | bar((true)); //~ ERROR unnecessary parentheses around function argument
+ | ^^^^^^ help: remove these parentheses
+
+error: unnecessary parentheses around `if` condition
+ --> $DIR/lint-unnecessary-parens.rs:30:8
+ |
+LL | if (true) {} //~ ERROR unnecessary parentheses around `if` condition
+ | ^^^^^^ help: remove these parentheses
+
+error: unnecessary parentheses around `while` condition
+ --> $DIR/lint-unnecessary-parens.rs:31:11
+ |
+LL | while (true) {} //~ ERROR unnecessary parentheses around `while` condition
+ | ^^^^^^ help: remove these parentheses
+
+error: unnecessary parentheses around `match` head expression
+ --> $DIR/lint-unnecessary-parens.rs:32:11
+ |
+LL | match (true) { //~ ERROR unnecessary parentheses around `match` head expression
+ | ^^^^^^ help: remove these parentheses
+
+error: unnecessary parentheses around `if let` head expression
+ --> $DIR/lint-unnecessary-parens.rs:35:16
+ |
+LL | if let 1 = (1) {} //~ ERROR unnecessary parentheses around `if let` head expression
+ | ^^^ help: remove these parentheses
+
+error: unnecessary parentheses around `while let` head expression
+ --> $DIR/lint-unnecessary-parens.rs:36:19
+ |
+LL | while let 1 = (2) {} //~ ERROR unnecessary parentheses around `while let` head expression
+ | ^^^ help: remove these parentheses
+
+error: unnecessary parentheses around method argument
+ --> $DIR/lint-unnecessary-parens.rs:50:24
+ |
+LL | X { y: false }.foo((true)); //~ ERROR unnecessary parentheses around method argument
+ | ^^^^^^ help: remove these parentheses
+
+error: unnecessary parentheses around assigned value
+ --> $DIR/lint-unnecessary-parens.rs:52:18
+ |
+LL | let mut _a = (0); //~ ERROR unnecessary parentheses around assigned value
+ | ^^^ help: remove these parentheses
+
+error: unnecessary parentheses around assigned value
+ --> $DIR/lint-unnecessary-parens.rs:53:10
+ |
+LL | _a = (0); //~ ERROR unnecessary parentheses around assigned value
+ | ^^^ help: remove these parentheses
+
+error: unnecessary parentheses around assigned value
+ --> $DIR/lint-unnecessary-parens.rs:54:11
+ |
+LL | _a += (1); //~ ERROR unnecessary parentheses around assigned value
+ | ^^^ help: remove these parentheses
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/compile-fail/lint-unsafe-code.rs b/src/test/ui/lint/lint-unsafe-code.rs
similarity index 100%
rename from src/test/compile-fail/lint-unsafe-code.rs
rename to src/test/ui/lint/lint-unsafe-code.rs
diff --git a/src/test/ui/lint/lint-unsafe-code.stderr b/src/test/ui/lint/lint-unsafe-code.stderr
new file mode 100644
index 0000000..ee2aba0
--- /dev/null
+++ b/src/test/ui/lint/lint-unsafe-code.stderr
@@ -0,0 +1,95 @@
+error: declaration of an `unsafe` function
+ --> $DIR/lint-unsafe-code.rs:33:1
+ |
+LL | unsafe fn baz() {} //~ ERROR: declaration of an `unsafe` function
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-unsafe-code.rs:13:9
+ |
+LL | #![deny(unsafe_code)]
+ | ^^^^^^^^^^^
+
+error: declaration of an `unsafe` trait
+ --> $DIR/lint-unsafe-code.rs:34:1
+ |
+LL | unsafe trait Foo {} //~ ERROR: declaration of an `unsafe` trait
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` trait
+ --> $DIR/lint-unsafe-code.rs:35:1
+ |
+LL | unsafe impl Foo for Bar {} //~ ERROR: implementation of an `unsafe` trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: declaration of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:38:5
+ |
+LL | unsafe fn baz(&self); //~ ERROR: declaration of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:39:5
+ |
+LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:40:5
+ |
+LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:44:5
+ |
+LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:45:5
+ |
+LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:64:5
+ |
+LL | unsafe fn provided_override(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:75:5
+ |
+LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:81:5
+ |
+LL | unsafe fn provided(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: implementation of an `unsafe` method
+ --> $DIR/lint-unsafe-code.rs:85:5
+ |
+LL | unsafe fn baz(&self) {} //~ ERROR: implementation of an `unsafe` method
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: usage of an `unsafe` block
+ --> $DIR/lint-unsafe-code.rs:96:5
+ |
+LL | unsafe {} //~ ERROR: usage of an `unsafe` block
+ | ^^^^^^^^^
+
+error: usage of an `unsafe` block
+ --> $DIR/lint-unsafe-code.rs:29:9
+ |
+LL | unsafe {} //~ ERROR: usage of an `unsafe` block
+ | ^^^^^^^^^
+...
+LL | unsafe_in_macro!()
+ | ------------------ in this macro invocation
+
+error: aborting due to 14 previous errors
+
diff --git a/src/test/compile-fail/lint-unused-extern-crate.rs b/src/test/ui/lint/lint-unused-extern-crate.rs
similarity index 100%
rename from src/test/compile-fail/lint-unused-extern-crate.rs
rename to src/test/ui/lint/lint-unused-extern-crate.rs
diff --git a/src/test/ui/lint/lint-unused-extern-crate.stderr b/src/test/ui/lint/lint-unused-extern-crate.stderr
new file mode 100644
index 0000000..3a488b1
--- /dev/null
+++ b/src/test/ui/lint/lint-unused-extern-crate.stderr
@@ -0,0 +1,20 @@
+error: unused extern crate
+ --> $DIR/lint-unused-extern-crate.rs:21:1
+ |
+LL | extern crate lint_unused_extern_crate5; //~ ERROR: unused extern crate
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-extern-crate.rs:17:9
+ |
+LL | #![deny(unused_extern_crates)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unused extern crate
+ --> $DIR/lint-unused-extern-crate.rs:39:5
+ |
+LL | extern crate lint_unused_extern_crate2; //~ ERROR unused extern crate
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lint-unused-imports.rs b/src/test/ui/lint/lint-unused-imports.rs
similarity index 100%
rename from src/test/compile-fail/lint-unused-imports.rs
rename to src/test/ui/lint/lint-unused-imports.rs
diff --git a/src/test/ui/lint/lint-unused-imports.stderr b/src/test/ui/lint/lint-unused-imports.stderr
new file mode 100644
index 0000000..a0292b6
--- /dev/null
+++ b/src/test/ui/lint/lint-unused-imports.stderr
@@ -0,0 +1,56 @@
+error: unused import: `use std::fmt::{};`
+ --> $DIR/lint-unused-imports.rs:18:1
+ |
+LL | use std::fmt::{};
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-imports.rs:11:9
+ |
+LL | #![deny(unused_imports)]
+ | ^^^^^^^^^^^^^^
+
+error: unused imports: `None`, `Some`
+ --> $DIR/lint-unused-imports.rs:22:27
+ |
+LL | use std::option::Option::{Some, None};
+ | ^^^^ ^^^^
+
+error: unused import: `test::A`
+ --> $DIR/lint-unused-imports.rs:25:5
+ |
+LL | use test::A; //~ ERROR unused import: `test::A`
+ | ^^^^^^^
+
+error: unused import: `bar`
+ --> $DIR/lint-unused-imports.rs:34:18
+ |
+LL | use test2::{foo, bar}; //~ ERROR unused import: `bar`
+ | ^^^
+
+error: unused import: `foo::Square`
+ --> $DIR/lint-unused-imports.rs:62:13
+ |
+LL | use foo::Square; //~ ERROR unused import: `foo::Square`
+ | ^^^^^^^^^^^
+
+error: unused import: `self::g`
+ --> $DIR/lint-unused-imports.rs:78:9
+ |
+LL | use self::g; //~ ERROR unused import: `self::g`
+ | ^^^^^^^
+
+error: unused import: `test2::foo`
+ --> $DIR/lint-unused-imports.rs:87:9
+ |
+LL | use test2::foo; //~ ERROR unused import: `test2::foo`
+ | ^^^^^^^^^^
+
+error: unused import: `test::B2`
+ --> $DIR/lint-unused-imports.rs:30:5
+ |
+LL | use test::B2; //~ ERROR unused import: `test::B2`
+ | ^^^^^^^^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/compile-fail/lint-unused-mut-self.rs b/src/test/ui/lint/lint-unused-mut-self.rs
similarity index 100%
rename from src/test/compile-fail/lint-unused-mut-self.rs
rename to src/test/ui/lint/lint-unused-mut-self.rs
diff --git a/src/test/ui/lint/lint-unused-mut-self.stderr b/src/test/ui/lint/lint-unused-mut-self.stderr
new file mode 100644
index 0000000..af2baaa
--- /dev/null
+++ b/src/test/ui/lint/lint-unused-mut-self.stderr
@@ -0,0 +1,24 @@
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-self.rs:18:12
+ |
+LL | fn foo(mut self) {} //~ ERROR: variable does not need to be mutable
+ | ----^^^^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-mut-self.rs:14:9
+ |
+LL | #![deny(unused_mut)]
+ | ^^^^^^^^^^
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-self.rs:19:12
+ |
+LL | fn bar(mut self: Box<Foo>) {} //~ ERROR: variable does not need to be mutable
+ | ----^^^^
+ | |
+ | help: remove this `mut`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/lint/lint-unused-mut-variables.lexical.stderr b/src/test/ui/lint/lint-unused-mut-variables.lexical.stderr
new file mode 100644
index 0000000..40f68c6
--- /dev/null
+++ b/src/test/ui/lint/lint-unused-mut-variables.lexical.stderr
@@ -0,0 +1,150 @@
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:59:14
+ |
+LL | let x = |mut y: isize| 10; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-mut-variables.rs:19:9
+ |
+LL | #![deny(unused_mut)]
+ | ^^^^^^^^^^
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:24:9
+ |
+LL | let mut a = 3; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:26:9
+ |
+LL | let mut a = 2; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:28:9
+ |
+LL | let mut b = 3; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:30:9
+ |
+LL | let mut a = vec![3]; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:32:10
+ |
+LL | let (mut a, b) = (1, 2); //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:34:9
+ |
+LL | let mut a; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:38:9
+ |
+LL | let mut b; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:47:9
+ |
+LL | mut x => {} //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:51:8
+ |
+LL | (mut x, 1) | //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:64:9
+ |
+LL | let mut a = &mut 5; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:69:9
+ |
+LL | let mut b = (&mut a,); //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:72:9
+ |
+LL | let mut x = &mut 1; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:84:9
+ |
+LL | let mut v : &mut Vec<()> = &mut vec![]; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:61:13
+ |
+LL | fn what(mut foo: isize) {} //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^^^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:79:20
+ |
+LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
+ | ----^^^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:143:9
+ |
+LL | let mut b = vec![2]; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-mut-variables.rs:139:8
+ |
+LL | #[deny(unused_mut)]
+ | ^^^^^^^^^^
+
+error: aborting due to 17 previous errors
+
diff --git a/src/test/ui/lint/lint-unused-mut-variables.nll.stderr b/src/test/ui/lint/lint-unused-mut-variables.nll.stderr
new file mode 100644
index 0000000..40f68c6
--- /dev/null
+++ b/src/test/ui/lint/lint-unused-mut-variables.nll.stderr
@@ -0,0 +1,150 @@
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:59:14
+ |
+LL | let x = |mut y: isize| 10; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-mut-variables.rs:19:9
+ |
+LL | #![deny(unused_mut)]
+ | ^^^^^^^^^^
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:24:9
+ |
+LL | let mut a = 3; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:26:9
+ |
+LL | let mut a = 2; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:28:9
+ |
+LL | let mut b = 3; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:30:9
+ |
+LL | let mut a = vec![3]; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:32:10
+ |
+LL | let (mut a, b) = (1, 2); //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:34:9
+ |
+LL | let mut a; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:38:9
+ |
+LL | let mut b; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:47:9
+ |
+LL | mut x => {} //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:51:8
+ |
+LL | (mut x, 1) | //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:64:9
+ |
+LL | let mut a = &mut 5; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:69:9
+ |
+LL | let mut b = (&mut a,); //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:72:9
+ |
+LL | let mut x = &mut 1; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:84:9
+ |
+LL | let mut v : &mut Vec<()> = &mut vec![]; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:61:13
+ |
+LL | fn what(mut foo: isize) {} //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^^^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:79:20
+ |
+LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
+ | ----^^^
+ | |
+ | help: remove this `mut`
+
+error: variable does not need to be mutable
+ --> $DIR/lint-unused-mut-variables.rs:143:9
+ |
+LL | let mut b = vec![2]; //[lexical]~ ERROR: variable does not need to be mutable
+ | ----^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/lint-unused-mut-variables.rs:139:8
+ |
+LL | #[deny(unused_mut)]
+ | ^^^^^^^^^^
+
+error: aborting due to 17 previous errors
+
diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/ui/lint/lint-unused-mut-variables.rs
similarity index 100%
rename from src/test/compile-fail/lint-unused-mut-variables.rs
rename to src/test/ui/lint/lint-unused-mut-variables.rs
diff --git a/src/test/compile-fail/lint-uppercase-variables.rs b/src/test/ui/lint/lint-uppercase-variables.rs
similarity index 100%
rename from src/test/compile-fail/lint-uppercase-variables.rs
rename to src/test/ui/lint/lint-uppercase-variables.rs
diff --git a/src/test/ui/lint/lint-uppercase-variables.stderr b/src/test/ui/lint/lint-uppercase-variables.stderr
new file mode 100644
index 0000000..c8381d8
--- /dev/null
+++ b/src/test/ui/lint/lint-uppercase-variables.stderr
@@ -0,0 +1,52 @@
+warning[E0170]: pattern binding `Foo` is named the same as one of the variants of the type `foo::Foo`
+ --> $DIR/lint-uppercase-variables.rs:32:9
+ |
+LL | Foo => {}
+ | ^^^ help: to match on the variant, qualify the path: `foo::Foo::Foo`
+
+warning: unused variable: `Foo`
+ --> $DIR/lint-uppercase-variables.rs:32:9
+ |
+LL | Foo => {}
+ | ^^^ help: consider using `_Foo` instead
+ |
+note: lint level defined here
+ --> $DIR/lint-uppercase-variables.rs:11:9
+ |
+LL | #![warn(unused)]
+ | ^^^^^^
+ = note: #[warn(unused_variables)] implied by #[warn(unused)]
+
+error: structure field `X` should have a snake case name such as `x`
+ --> $DIR/lint-uppercase-variables.rs:20:5
+ |
+LL | X: usize //~ ERROR structure field `X` should have a snake case name such as `x`
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/lint-uppercase-variables.rs:13:9
+ |
+LL | #![deny(non_snake_case)]
+ | ^^^^^^^^^^^^^^
+
+error: variable `Xx` should have a snake case name such as `xx`
+ --> $DIR/lint-uppercase-variables.rs:23:9
+ |
+LL | fn test(Xx: usize) { //~ ERROR variable `Xx` should have a snake case name such as `xx`
+ | ^^
+
+error: variable `Test` should have a snake case name such as `test`
+ --> $DIR/lint-uppercase-variables.rs:28:9
+ |
+LL | let Test: usize = 0; //~ ERROR variable `Test` should have a snake case name such as `test`
+ | ^^^^
+
+error: variable `Foo` should have a snake case name such as `foo`
+ --> $DIR/lint-uppercase-variables.rs:32:9
+ |
+LL | Foo => {}
+ | ^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0170`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr
new file mode 100644
index 0000000..58a76bd
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.nll.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-loop.rs:18:9
+ |
+LL | let v: isize;
+ | - consider changing this to `mut v`
+...
+LL | v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr
new file mode 100644
index 0000000..54419fd
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.ast.stderr
@@ -0,0 +1,9 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-loop.rs:18:9
+ |
+LL | v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr
new file mode 100644
index 0000000..58a76bd
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.mir.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-loop.rs:18:9
+ |
+LL | let v: isize;
+ | - consider changing this to `mut v`
+...
+LL | v = 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/liveness-assign-imm-local-in-loop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs
similarity index 100%
rename from src/test/compile-fail/liveness-assign-imm-local-in-loop.rs
rename to src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-loop.rs
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr
new file mode 100644
index 0000000..091547e
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-op-eq.rs:19:5
+ |
+LL | let v: isize;
+ | - consider changing this to `mut v`
+LL | //[mir]~^ NOTE consider changing this to `mut v`
+LL | v = 2; //[ast]~ NOTE first assignment
+ | ----- first assignment to `v`
+LL | //[mir]~^ NOTE first assignment
+LL | v += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr
new file mode 100644
index 0000000..a98c3c2
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.ast.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-op-eq.rs:19:5
+ |
+LL | v = 2; //[ast]~ NOTE first assignment
+ | ----- first assignment to `v`
+LL | //[mir]~^ NOTE first assignment
+LL | v += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr
new file mode 100644
index 0000000..091547e
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.mir.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-in-op-eq.rs:19:5
+ |
+LL | let v: isize;
+ | - consider changing this to `mut v`
+LL | //[mir]~^ NOTE consider changing this to `mut v`
+LL | v = 2; //[ast]~ NOTE first assignment
+ | ----- first assignment to `v`
+LL | //[mir]~^ NOTE first assignment
+LL | v += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs
similarity index 100%
rename from src/test/compile-fail/liveness-assign-imm-local-in-op-eq.rs
rename to src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-in-op-eq.rs
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr
new file mode 100644
index 0000000..e954b1f
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/liveness-assign-imm-local-with-drop.rs:19:5
+ |
+LL | let b = Box::new(1); //[ast]~ NOTE first assignment
+ | -
+ | |
+ | first assignment to `b`
+ | consider changing this to `mut b`
+...
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr
new file mode 100644
index 0000000..6abcf17
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.ast.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/liveness-assign-imm-local-with-drop.rs:19:5
+ |
+LL | let b = Box::new(1); //[ast]~ NOTE first assignment
+ | - first assignment to `b`
+...
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^^^^^^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr
new file mode 100644
index 0000000..e954b1f
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.mir.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `b`
+ --> $DIR/liveness-assign-imm-local-with-drop.rs:19:5
+ |
+LL | let b = Box::new(1); //[ast]~ NOTE first assignment
+ | -
+ | |
+ | first assignment to `b`
+ | consider changing this to `mut b`
+...
+LL | b = Box::new(2); //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/liveness-assign-imm-local-with-drop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
similarity index 100%
rename from src/test/compile-fail/liveness-assign-imm-local-with-drop.rs
rename to src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr
new file mode 100644
index 0000000..70a6ab3
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-with-init.rs:19:5
+ |
+LL | let v: isize = 1; //[ast]~ NOTE first assignment
+ | -
+ | |
+ | first assignment to `v`
+ | consider changing this to `mut v`
+...
+LL | v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr
new file mode 100644
index 0000000..47c780e
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.ast.stderr
@@ -0,0 +1,12 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-with-init.rs:19:5
+ |
+LL | let v: isize = 1; //[ast]~ NOTE first assignment
+ | - first assignment to `v`
+...
+LL | v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr
new file mode 100644
index 0000000..70a6ab3
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.mir.stderr
@@ -0,0 +1,15 @@
+error[E0384]: cannot assign twice to immutable variable `v`
+ --> $DIR/liveness-assign-imm-local-with-init.rs:19:5
+ |
+LL | let v: isize = 1; //[ast]~ NOTE first assignment
+ | -
+ | |
+ | first assignment to `v`
+ | consider changing this to `mut v`
+...
+LL | v = 2; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^ cannot assign twice to immutable variable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/liveness-assign-imm-local-with-init.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs
similarity index 100%
rename from src/test/compile-fail/liveness-assign-imm-local-with-init.rs
rename to src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-init.rs
diff --git a/src/test/compile-fail/liveness-closure-require-ret.rs b/src/test/ui/liveness/liveness-closure-require-ret.rs
similarity index 100%
rename from src/test/compile-fail/liveness-closure-require-ret.rs
rename to src/test/ui/liveness/liveness-closure-require-ret.rs
diff --git a/src/test/ui/liveness/liveness-closure-require-ret.stderr b/src/test/ui/liveness/liveness-closure-require-ret.stderr
new file mode 100644
index 0000000..569640c
--- /dev/null
+++ b/src/test/ui/liveness/liveness-closure-require-ret.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/liveness-closure-require-ret.rs:12:37
+ |
+LL | fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types
+ | ^^ expected isize, found ()
+ |
+ = note: expected type `isize`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/liveness-dead.rs b/src/test/ui/liveness/liveness-dead.rs
similarity index 100%
rename from src/test/compile-fail/liveness-dead.rs
rename to src/test/ui/liveness/liveness-dead.rs
diff --git a/src/test/ui/liveness/liveness-dead.stderr b/src/test/ui/liveness/liveness-dead.stderr
new file mode 100644
index 0000000..6709fee
--- /dev/null
+++ b/src/test/ui/liveness/liveness-dead.stderr
@@ -0,0 +1,32 @@
+error: value assigned to `x` is never read
+ --> $DIR/liveness-dead.rs:19:13
+ |
+LL | let mut x: isize = 3; //~ ERROR: value assigned to `x` is never read
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/liveness-dead.rs:12:9
+ |
+LL | #![deny(unused_assignments)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: value assigned to `x` is never read
+ --> $DIR/liveness-dead.rs:27:5
+ |
+LL | x = 4; //~ ERROR: value assigned to `x` is never read
+ | ^
+
+error: value passed to `x` is never read
+ --> $DIR/liveness-dead.rs:30:11
+ |
+LL | fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read
+ | ^
+
+error: value assigned to `x` is never read
+ --> $DIR/liveness-dead.rs:37:5
+ |
+LL | x = 4; //~ ERROR: value assigned to `x` is never read
+ | ^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/liveness-forgot-ret.rs b/src/test/ui/liveness/liveness-forgot-ret.rs
similarity index 100%
rename from src/test/compile-fail/liveness-forgot-ret.rs
rename to src/test/ui/liveness/liveness-forgot-ret.rs
diff --git a/src/test/ui/liveness/liveness-forgot-ret.stderr b/src/test/ui/liveness/liveness-forgot-ret.stderr
new file mode 100644
index 0000000..8da489b
--- /dev/null
+++ b/src/test/ui/liveness/liveness-forgot-ret.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/liveness-forgot-ret.rs:13:25
+ |
+LL | fn f(a: isize) -> isize { if god_exists(a) { return 5; }; }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected isize, found ()
+ |
+ = note: expected type `isize`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/liveness-issue-2163.rs b/src/test/ui/liveness/liveness-issue-2163.rs
similarity index 100%
rename from src/test/compile-fail/liveness-issue-2163.rs
rename to src/test/ui/liveness/liveness-issue-2163.rs
diff --git a/src/test/ui/liveness/liveness-issue-2163.stderr b/src/test/ui/liveness/liveness-issue-2163.stderr
new file mode 100644
index 0000000..66cd678
--- /dev/null
+++ b/src/test/ui/liveness/liveness-issue-2163.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/liveness-issue-2163.rs:15:30
+ |
+LL | a.iter().all(|_| -> bool {
+ | ______________________________^
+LL | | //~^ ERROR mismatched types
+LL | | });
+ | |_____^ expected bool, found ()
+ |
+ = note: expected type `bool`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/liveness-missing-ret2.rs b/src/test/ui/liveness/liveness-missing-ret2.rs
similarity index 100%
rename from src/test/compile-fail/liveness-missing-ret2.rs
rename to src/test/ui/liveness/liveness-missing-ret2.rs
diff --git a/src/test/ui/liveness/liveness-missing-ret2.stderr b/src/test/ui/liveness/liveness-missing-ret2.stderr
new file mode 100644
index 0000000..b7bbea6
--- /dev/null
+++ b/src/test/ui/liveness/liveness-missing-ret2.stderr
@@ -0,0 +1,17 @@
+error[E0308]: mismatched types
+ --> $DIR/liveness-missing-ret2.rs:11:17
+ |
+LL | fn f() -> isize { //~ ERROR mismatched types
+ | _________________^
+LL | | // Make sure typestate doesn't interpret this match expression as
+LL | | // the function result
+LL | | match true { true => { } _ => {} };
+LL | | }
+ | |_^ expected isize, found ()
+ |
+ = note: expected type `isize`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/liveness-move-call-arg.rs b/src/test/ui/liveness/liveness-move-call-arg.rs
similarity index 100%
rename from src/test/compile-fail/liveness-move-call-arg.rs
rename to src/test/ui/liveness/liveness-move-call-arg.rs
diff --git a/src/test/ui/liveness/liveness-move-call-arg.stderr b/src/test/ui/liveness/liveness-move-call-arg.stderr
new file mode 100644
index 0000000..f3423b8
--- /dev/null
+++ b/src/test/ui/liveness/liveness-move-call-arg.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/liveness-move-call-arg.rs:19:14
+ |
+LL | take(x); //~ ERROR use of moved value: `x`
+ | ^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/liveness-move-in-loop.rs b/src/test/ui/liveness/liveness-move-in-loop.rs
similarity index 100%
rename from src/test/compile-fail/liveness-move-in-loop.rs
rename to src/test/ui/liveness/liveness-move-in-loop.rs
diff --git a/src/test/ui/liveness/liveness-move-in-loop.stderr b/src/test/ui/liveness/liveness-move-in-loop.stderr
new file mode 100644
index 0000000..decc765
--- /dev/null
+++ b/src/test/ui/liveness/liveness-move-in-loop.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `y`
+ --> $DIR/liveness-move-in-loop.rs:21:25
+ |
+LL | x = y; //~ ERROR use of moved value
+ | ^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-move-in-while.nll.stderr b/src/test/ui/liveness/liveness-move-in-while.nll.stderr
new file mode 100644
index 0000000..5ca5dc6
--- /dev/null
+++ b/src/test/ui/liveness/liveness-move-in-while.nll.stderr
@@ -0,0 +1,21 @@
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/liveness-move-in-while.rs:17:24
+ |
+LL | println!("{}", y); //~ ERROR use of moved value: `y`
+ | ^ value borrowed here after move
+LL | while true { while true { while true { x = y; x.clone(); } } }
+ | - value moved here
+ |
+ = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `y`
+ --> $DIR/liveness-move-in-while.rs:18:52
+ |
+LL | while true { while true { while true { x = y; x.clone(); } } }
+ | ^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/liveness-move-in-while.rs b/src/test/ui/liveness/liveness-move-in-while.rs
similarity index 100%
rename from src/test/compile-fail/liveness-move-in-while.rs
rename to src/test/ui/liveness/liveness-move-in-while.rs
diff --git a/src/test/ui/liveness/liveness-move-in-while.stderr b/src/test/ui/liveness/liveness-move-in-while.stderr
new file mode 100644
index 0000000..7ac3ea3
--- /dev/null
+++ b/src/test/ui/liveness/liveness-move-in-while.stderr
@@ -0,0 +1,21 @@
+error[E0382]: use of moved value: `y`
+ --> $DIR/liveness-move-in-while.rs:17:24
+ |
+LL | println!("{}", y); //~ ERROR use of moved value: `y`
+ | ^ value used here after move
+LL | while true { while true { while true { x = y; x.clone(); } } }
+ | - value moved here
+ |
+ = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `y`
+ --> $DIR/liveness-move-in-while.rs:18:52
+ |
+LL | while true { while true { while true { x = y; x.clone(); } } }
+ | ^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `y` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness-return-last-stmt-semi.rs b/src/test/ui/liveness/liveness-return-last-stmt-semi.rs
similarity index 100%
rename from src/test/ui/liveness-return-last-stmt-semi.rs
rename to src/test/ui/liveness/liveness-return-last-stmt-semi.rs
diff --git a/src/test/ui/liveness-return-last-stmt-semi.stderr b/src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
similarity index 100%
rename from src/test/ui/liveness-return-last-stmt-semi.stderr
rename to src/test/ui/liveness/liveness-return-last-stmt-semi.stderr
diff --git a/src/test/compile-fail/liveness-unused.rs b/src/test/ui/liveness/liveness-unused.rs
similarity index 100%
rename from src/test/compile-fail/liveness-unused.rs
rename to src/test/ui/liveness/liveness-unused.rs
diff --git a/src/test/ui/liveness/liveness-unused.stderr b/src/test/ui/liveness/liveness-unused.stderr
new file mode 100644
index 0000000..2846f24
--- /dev/null
+++ b/src/test/ui/liveness/liveness-unused.stderr
@@ -0,0 +1,111 @@
+warning: unreachable statement
+ --> $DIR/liveness-unused.rs:102:9
+ |
+LL | drop(*x as i32); //~ WARNING unreachable statement
+ | ^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/liveness-unused.rs:11:9
+ |
+LL | #![warn(unused)]
+ | ^^^^^^
+ = note: #[warn(unreachable_code)] implied by #[warn(unused)]
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:18:7
+ |
+LL | fn f1(x: isize) {
+ | ^ help: consider using `_x` instead
+ |
+note: lint level defined here
+ --> $DIR/liveness-unused.rs:12:9
+ |
+LL | #![deny(unused_variables)]
+ | ^^^^^^^^^^^^^^^^
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:22:8
+ |
+LL | fn f1b(x: &mut isize) {
+ | ^ help: consider using `_x` instead
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:30:9
+ |
+LL | let x: isize;
+ | ^ help: consider using `_x` instead
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:35:9
+ |
+LL | let x = 3;
+ | ^ help: consider using `_x` instead
+
+error: variable `x` is assigned to, but never used
+ --> $DIR/liveness-unused.rs:40:13
+ |
+LL | let mut x = 3;
+ | ^
+ |
+ = note: consider using `_x` instead
+
+error: value assigned to `x` is never read
+ --> $DIR/liveness-unused.rs:42:5
+ |
+LL | x += 4;
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/liveness-unused.rs:13:9
+ |
+LL | #![deny(unused_assignments)]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: variable `z` is assigned to, but never used
+ --> $DIR/liveness-unused.rs:47:13
+ |
+LL | let mut z = 3;
+ | ^
+ |
+ = note: consider using `_z` instead
+
+error: unused variable: `i`
+ --> $DIR/liveness-unused.rs:69:12
+ |
+LL | Some(i) => {
+ | ^ help: consider using `_i` instead
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:89:9
+ |
+LL | for x in 1..10 { }
+ | ^ help: consider using `_x` instead
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:94:10
+ |
+LL | for (x, _) in [1, 2, 3].iter().enumerate() { }
+ | ^ help: consider using `_x` instead
+
+error: unused variable: `x`
+ --> $DIR/liveness-unused.rs:99:13
+ |
+LL | for (_, x) in [1, 2, 3].iter().enumerate() {
+ | ^ help: consider using `_x` instead
+
+error: variable `x` is assigned to, but never used
+ --> $DIR/liveness-unused.rs:122:9
+ |
+LL | let x;
+ | ^
+ |
+ = note: consider using `_x` instead
+
+error: value assigned to `x` is never read
+ --> $DIR/liveness-unused.rs:126:9
+ |
+LL | x = 0; //~ ERROR value assigned to `x` is never read
+ | ^
+
+error: aborting due to 13 previous errors
+
diff --git a/src/test/ui/liveness/liveness-use-after-move.nll.stderr b/src/test/ui/liveness/liveness-use-after-move.nll.stderr
new file mode 100644
index 0000000..62d9a8b
--- /dev/null
+++ b/src/test/ui/liveness/liveness-use-after-move.nll.stderr
@@ -0,0 +1,11 @@
+error[E0382]: borrow of moved value: `*x`
+ --> $DIR/liveness-use-after-move.rs:16:20
+ |
+LL | let y = x;
+ | - value moved here
+LL | println!("{}", *x); //~ ERROR use of moved value: `*x`
+ | ^^ value borrowed here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/liveness-use-after-move.rs b/src/test/ui/liveness/liveness-use-after-move.rs
similarity index 100%
rename from src/test/compile-fail/liveness-use-after-move.rs
rename to src/test/ui/liveness/liveness-use-after-move.rs
diff --git a/src/test/ui/liveness/liveness-use-after-move.stderr b/src/test/ui/liveness/liveness-use-after-move.stderr
new file mode 100644
index 0000000..be6f89c
--- /dev/null
+++ b/src/test/ui/liveness/liveness-use-after-move.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `*x`
+ --> $DIR/liveness-use-after-move.rs:16:20
+ |
+LL | let y = x;
+ | - value moved here
+LL | println!("{}", *x); //~ ERROR use of moved value: `*x`
+ | ^^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/liveness/liveness-use-after-send.nll.stderr b/src/test/ui/liveness/liveness-use-after-send.nll.stderr
new file mode 100644
index 0000000..dbffe6c
--- /dev/null
+++ b/src/test/ui/liveness/liveness-use-after-send.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: borrow of moved value: `message`
+ --> $DIR/liveness-use-after-send.rs:26:20
+ |
+LL | send(ch, message);
+ | ------- value moved here
+LL | println!("{}", message); //~ ERROR use of moved value: `message`
+ | ^^^^^^^ value borrowed here after move
+ |
+ = note: move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/liveness-use-after-send.rs b/src/test/ui/liveness/liveness-use-after-send.rs
similarity index 100%
rename from src/test/compile-fail/liveness-use-after-send.rs
rename to src/test/ui/liveness/liveness-use-after-send.rs
diff --git a/src/test/ui/liveness/liveness-use-after-send.stderr b/src/test/ui/liveness/liveness-use-after-send.stderr
new file mode 100644
index 0000000..94499aa
--- /dev/null
+++ b/src/test/ui/liveness/liveness-use-after-send.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `message`
+ --> $DIR/liveness-use-after-send.rs:26:20
+ |
+LL | send(ch, message);
+ | ------- value moved here
+LL | println!("{}", message); //~ ERROR use of moved value: `message`
+ | ^^^^^^^ value used here after move
+ |
+ = note: move occurs because `message` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/loop-break-value-no-repeat.rs b/src/test/ui/loops/loop-break-value-no-repeat.rs
similarity index 100%
rename from src/test/ui/loop-break-value-no-repeat.rs
rename to src/test/ui/loops/loop-break-value-no-repeat.rs
diff --git a/src/test/ui/loop-break-value-no-repeat.stderr b/src/test/ui/loops/loop-break-value-no-repeat.stderr
similarity index 100%
rename from src/test/ui/loop-break-value-no-repeat.stderr
rename to src/test/ui/loops/loop-break-value-no-repeat.stderr
diff --git a/src/test/compile-fail/loop-break-value.rs b/src/test/ui/loops/loop-break-value.rs
similarity index 100%
rename from src/test/compile-fail/loop-break-value.rs
rename to src/test/ui/loops/loop-break-value.rs
diff --git a/src/test/ui/loops/loop-break-value.stderr b/src/test/ui/loops/loop-break-value.stderr
new file mode 100644
index 0000000..ca28628
--- /dev/null
+++ b/src/test/ui/loops/loop-break-value.stderr
@@ -0,0 +1,156 @@
+error[E0571]: `break` with value from a `while` loop
+ --> $DIR/loop-break-value.rs:38:9
+ |
+LL | break (); //~ ERROR `break` with value from a `while` loop
+ | ^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `while` loop
+ |
+LL | break; //~ ERROR `break` with value from a `while` loop
+ | ^^^^^
+
+error[E0571]: `break` with value from a `while` loop
+ --> $DIR/loop-break-value.rs:40:13
+ |
+LL | break 'while_loop 123;
+ | ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `while` loop
+ |
+LL | break;
+ | ^^^^^
+
+error[E0571]: `break` with value from a `while let` loop
+ --> $DIR/loop-break-value.rs:48:12
+ |
+LL | if break () { //~ ERROR `break` with value from a `while let` loop
+ | ^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `while let` loop
+ |
+LL | if break { //~ ERROR `break` with value from a `while let` loop
+ | ^^^^^
+
+error[E0571]: `break` with value from a `while let` loop
+ --> $DIR/loop-break-value.rs:53:9
+ |
+LL | break None;
+ | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `while let` loop
+ |
+LL | break;
+ | ^^^^^
+
+error[E0571]: `break` with value from a `while let` loop
+ --> $DIR/loop-break-value.rs:59:13
+ |
+LL | break 'while_let_loop "nope";
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `while let` loop
+ |
+LL | break;
+ | ^^^^^
+
+error[E0571]: `break` with value from a `for` loop
+ --> $DIR/loop-break-value.rs:66:9
+ |
+LL | break (); //~ ERROR `break` with value from a `for` loop
+ | ^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `for` loop
+ |
+LL | break; //~ ERROR `break` with value from a `for` loop
+ | ^^^^^
+
+error[E0571]: `break` with value from a `for` loop
+ --> $DIR/loop-break-value.rs:67:9
+ |
+LL | break [()];
+ | ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `for` loop
+ |
+LL | break;
+ | ^^^^^
+
+error[E0571]: `break` with value from a `for` loop
+ --> $DIR/loop-break-value.rs:74:13
+ |
+LL | break 'for_loop Some(17);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
+help: instead, use `break` on its own without a value inside this `for` loop
+ |
+LL | break;
+ | ^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:14:31
+ |
+LL | let val: ! = loop { break break; };
+ | ^^^^^ expected (), found !
+ |
+ = note: expected type `()`
+ found type `!`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:21:19
+ |
+LL | break 123; //~ ERROR mismatched types
+ | ^^^ expected &str, found integral variable
+ |
+ = note: expected type `&str`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:26:15
+ |
+LL | break "asdf"; //~ ERROR mismatched types
+ | ^^^^^^ expected i32, found reference
+ |
+ = note: expected type `i32`
+ found type `&'static str`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:31:31
+ |
+LL | break 'outer_loop "nope"; //~ ERROR mismatched types
+ | ^^^^^^ expected i32, found reference
+ |
+ = note: expected type `i32`
+ found type `&'static str`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:83:26
+ |
+LL | break 'c 123; //~ ERROR mismatched types
+ | ^^^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:90:15
+ |
+LL | break (break, break); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^ expected (), found tuple
+ |
+ = note: expected type `()`
+ found type `(!, !)`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:95:15
+ |
+LL | break 2; //~ ERROR mismatched types
+ | ^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-break-value.rs:100:9
+ |
+LL | break; //~ ERROR mismatched types
+ | ^^^^^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error: aborting due to 16 previous errors
+
+Some errors occurred: E0308, E0571.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/loop-labeled-break-value.rs b/src/test/ui/loops/loop-labeled-break-value.rs
similarity index 100%
rename from src/test/compile-fail/loop-labeled-break-value.rs
rename to src/test/ui/loops/loop-labeled-break-value.rs
diff --git a/src/test/ui/loops/loop-labeled-break-value.stderr b/src/test/ui/loops/loop-labeled-break-value.stderr
new file mode 100644
index 0000000..7d140aa
--- /dev/null
+++ b/src/test/ui/loops/loop-labeled-break-value.stderr
@@ -0,0 +1,30 @@
+error[E0308]: mismatched types
+ --> $DIR/loop-labeled-break-value.rs:13:29
+ |
+LL | let _: i32 = loop { break }; //~ ERROR mismatched types
+ | ^^^^^ expected (), found i32
+ |
+ = note: expected type `()`
+ found type `i32`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-labeled-break-value.rs:16:37
+ |
+LL | let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^ expected (), found i32
+ |
+ = note: expected type `()`
+ found type `i32`
+
+error[E0308]: mismatched types
+ --> $DIR/loop-labeled-break-value.rs:19:45
+ |
+LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^ expected (), found i32
+ |
+ = note: expected type `()`
+ found type `i32`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/loops/loop-proper-liveness.nll.stderr b/src/test/ui/loops/loop-proper-liveness.nll.stderr
new file mode 100644
index 0000000..cbf7094
--- /dev/null
+++ b/src/test/ui/loops/loop-proper-liveness.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: borrow of possibly uninitialized variable: `x`
+ --> $DIR/loop-proper-liveness.rs:19:22
+ |
+LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/loop-proper-liveness.rs b/src/test/ui/loops/loop-proper-liveness.rs
similarity index 100%
rename from src/test/compile-fail/loop-proper-liveness.rs
rename to src/test/ui/loops/loop-proper-liveness.rs
diff --git a/src/test/ui/loops/loop-proper-liveness.stderr b/src/test/ui/loops/loop-proper-liveness.stderr
new file mode 100644
index 0000000..554abea
--- /dev/null
+++ b/src/test/ui/loops/loop-proper-liveness.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `x`
+ --> $DIR/loop-proper-liveness.rs:19:22
+ |
+LL | println!("{:?}", x); //~ ERROR use of possibly uninitialized variable
+ | ^ use of possibly uninitialized `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/loop-properly-diverging-2.rs b/src/test/ui/loops/loop-properly-diverging-2.rs
similarity index 100%
rename from src/test/compile-fail/loop-properly-diverging-2.rs
rename to src/test/ui/loops/loop-properly-diverging-2.rs
diff --git a/src/test/ui/loops/loop-properly-diverging-2.stderr b/src/test/ui/loops/loop-properly-diverging-2.stderr
new file mode 100644
index 0000000..f983653
--- /dev/null
+++ b/src/test/ui/loops/loop-properly-diverging-2.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/loop-properly-diverging-2.rs:12:23
+ |
+LL | let x: i32 = loop { break }; //~ ERROR mismatched types
+ | ^^^^^ expected (), found i32
+ |
+ = note: expected type `()`
+ found type `i32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/loops-reject-duplicate-labels-2.rs b/src/test/ui/loops/loops-reject-duplicate-labels-2.rs
similarity index 100%
rename from src/test/ui/loops-reject-duplicate-labels-2.rs
rename to src/test/ui/loops/loops-reject-duplicate-labels-2.rs
diff --git a/src/test/ui/loops-reject-duplicate-labels-2.stderr b/src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
similarity index 100%
rename from src/test/ui/loops-reject-duplicate-labels-2.stderr
rename to src/test/ui/loops/loops-reject-duplicate-labels-2.stderr
diff --git a/src/test/ui/loops-reject-duplicate-labels.rs b/src/test/ui/loops/loops-reject-duplicate-labels.rs
similarity index 100%
rename from src/test/ui/loops-reject-duplicate-labels.rs
rename to src/test/ui/loops/loops-reject-duplicate-labels.rs
diff --git a/src/test/ui/loops-reject-duplicate-labels.stderr b/src/test/ui/loops/loops-reject-duplicate-labels.stderr
similarity index 100%
rename from src/test/ui/loops-reject-duplicate-labels.stderr
rename to src/test/ui/loops/loops-reject-duplicate-labels.stderr
diff --git a/src/test/ui/loops-reject-labels-shadowing-lifetimes.rs b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs
similarity index 100%
rename from src/test/ui/loops-reject-labels-shadowing-lifetimes.rs
rename to src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.rs
diff --git a/src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr b/src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
similarity index 100%
rename from src/test/ui/loops-reject-labels-shadowing-lifetimes.stderr
rename to src/test/ui/loops/loops-reject-labels-shadowing-lifetimes.stderr
diff --git a/src/test/ui/loops-reject-lifetime-shadowing-label.rs b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs
similarity index 100%
rename from src/test/ui/loops-reject-lifetime-shadowing-label.rs
rename to src/test/ui/loops/loops-reject-lifetime-shadowing-label.rs
diff --git a/src/test/ui/loops-reject-lifetime-shadowing-label.stderr b/src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
similarity index 100%
rename from src/test/ui/loops-reject-lifetime-shadowing-label.stderr
rename to src/test/ui/loops/loops-reject-lifetime-shadowing-label.stderr
diff --git a/src/test/compile-fail/lto-duplicate-symbols.rs b/src/test/ui/lto-duplicate-symbols.rs
similarity index 100%
rename from src/test/compile-fail/lto-duplicate-symbols.rs
rename to src/test/ui/lto-duplicate-symbols.rs
diff --git a/src/test/ui/lto-duplicate-symbols.stderr b/src/test/ui/lto-duplicate-symbols.stderr
new file mode 100644
index 0000000..5760cb9
--- /dev/null
+++ b/src/test/ui/lto-duplicate-symbols.stderr
@@ -0,0 +1,6 @@
+warning: Linking globals named 'foo': symbol multiply defined!
+
+error: failed to load bc of "lto_duplicate_symbols1.3a1fbbbh-cgu.0":
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/lub-if.nll.stderr b/src/test/ui/lub-if.nll.stderr
new file mode 100644
index 0000000..d3f5cdc
--- /dev/null
+++ b/src/test/ui/lub-if.nll.stderr
@@ -0,0 +1,32 @@
+warning: not reporting region error due to nll
+ --> $DIR/lub-if.rs:38:9
+ |
+LL | s //~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/lub-if.rs:45:9
+ |
+LL | s //~ ERROR E0312
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/lub-if.rs:38:9
+ |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | -- lifetime `'a` defined here
+...
+LL | s //~ ERROR E0312
+ | ^ returning this value requires that `'a` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/lub-if.rs:45:9
+ |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | -- lifetime `'a` defined here
+...
+LL | s //~ ERROR E0312
+ | ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lub-if.rs b/src/test/ui/lub-if.rs
similarity index 100%
rename from src/test/compile-fail/lub-if.rs
rename to src/test/ui/lub-if.rs
diff --git a/src/test/ui/lub-if.stderr b/src/test/ui/lub-if.stderr
new file mode 100644
index 0000000..4a43681
--- /dev/null
+++ b/src/test/ui/lub-if.stderr
@@ -0,0 +1,29 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/lub-if.rs:38:9
+ |
+LL | s //~ ERROR E0312
+ | ^
+ |
+ = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 33:17
+ --> $DIR/lub-if.rs:33:17
+ |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | ^^
+
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/lub-if.rs:45:9
+ |
+LL | s //~ ERROR E0312
+ | ^
+ |
+ = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 42:17
+ --> $DIR/lub-if.rs:42:17
+ |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/ui/lub-match.nll.stderr b/src/test/ui/lub-match.nll.stderr
new file mode 100644
index 0000000..bbddcc7
--- /dev/null
+++ b/src/test/ui/lub-match.nll.stderr
@@ -0,0 +1,32 @@
+warning: not reporting region error due to nll
+ --> $DIR/lub-match.rs:40:13
+ |
+LL | s //~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/lub-match.rs:49:13
+ |
+LL | s //~ ERROR E0312
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/lub-match.rs:40:13
+ |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | -- lifetime `'a` defined here
+...
+LL | s //~ ERROR E0312
+ | ^ returning this value requires that `'a` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/lub-match.rs:49:13
+ |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | -- lifetime `'a` defined here
+...
+LL | s //~ ERROR E0312
+ | ^ returning this value requires that `'a` must outlive `'static`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/lub-match.rs b/src/test/ui/lub-match.rs
similarity index 100%
rename from src/test/compile-fail/lub-match.rs
rename to src/test/ui/lub-match.rs
diff --git a/src/test/ui/lub-match.stderr b/src/test/ui/lub-match.stderr
new file mode 100644
index 0000000..3543676
--- /dev/null
+++ b/src/test/ui/lub-match.stderr
@@ -0,0 +1,29 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/lub-match.rs:40:13
+ |
+LL | s //~ ERROR E0312
+ | ^
+ |
+ = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 35:17
+ --> $DIR/lub-match.rs:35:17
+ |
+LL | pub fn opt_str2<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | ^^
+
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/lub-match.rs:49:13
+ |
+LL | s //~ ERROR E0312
+ | ^
+ |
+ = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 45:17
+ --> $DIR/lub-match.rs:45:17
+ |
+LL | pub fn opt_str3<'a>(maybestr: &'a Option<String>) -> &'static str {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/ui/macro-path-prelude-fail-1.rs b/src/test/ui/macro-path-prelude-fail-1.rs
deleted file mode 100644
index b953805..0000000
--- a/src/test/ui/macro-path-prelude-fail-1.rs
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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.
-
-#![feature(use_extern_macros, extern_prelude)]
-
-mod m {
- fn check() {
- Vec::clone!(); //~ ERROR failed to resolve. Not a module `Vec`
- u8::clone!(); //~ ERROR failed to resolve. Not a module `u8`
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/macro-path-prelude-fail-2.rs b/src/test/ui/macro-path-prelude-fail-2.rs
deleted file mode 100644
index ec77e27..0000000
--- a/src/test/ui/macro-path-prelude-fail-2.rs
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-#![feature(use_extern_macros)]
-
-mod m {
- fn check() {
- Result::Ok!(); //~ ERROR fail to resolve non-ident macro path
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/macro-path-prelude-fail-2.stderr b/src/test/ui/macro-path-prelude-fail-2.stderr
deleted file mode 100644
index d23aed8..0000000
--- a/src/test/ui/macro-path-prelude-fail-2.stderr
+++ /dev/null
@@ -1,8 +0,0 @@
-error: fail to resolve non-ident macro path
- --> $DIR/macro-path-prelude-fail-2.rs:15:9
- |
-LL | Result::Ok!(); //~ ERROR fail to resolve non-ident macro path
- | ^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/macro-path-prelude-fail-3.rs b/src/test/ui/macro-path-prelude-fail-3.rs
deleted file mode 100644
index bdbc7bd..0000000
--- a/src/test/ui/macro-path-prelude-fail-3.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// 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.
-
-#![feature(use_extern_macros)]
-
-#[derive(inline)] //~ ERROR expected a macro, found built-in attribute
-struct S;
-
-fn main() {
- inline!(); //~ ERROR expected a macro, found built-in attribute
-}
diff --git a/src/test/ui/macro-path-prelude-fail-3.stderr b/src/test/ui/macro-path-prelude-fail-3.stderr
deleted file mode 100644
index 396bba2..0000000
--- a/src/test/ui/macro-path-prelude-fail-3.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: expected a macro, found built-in attribute
- --> $DIR/macro-path-prelude-fail-3.rs:13:10
- |
-LL | #[derive(inline)] //~ ERROR expected a macro, found built-in attribute
- | ^^^^^^
-
-error: expected a macro, found built-in attribute
- --> $DIR/macro-path-prelude-fail-3.rs:17:5
- |
-LL | inline!(); //~ ERROR expected a macro, found built-in attribute
- | ^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/macro-path-prelude-pass.rs b/src/test/ui/macro-path-prelude-pass.rs
deleted file mode 100644
index bc58754..0000000
--- a/src/test/ui/macro-path-prelude-pass.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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.
-
-// compile-pass
-
-#![feature(use_extern_macros, extern_prelude)]
-
-mod m {
- fn check() {
- std::panic!(); // OK
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/macro-path-prelude-shadowing.rs b/src/test/ui/macro-path-prelude-shadowing.rs
deleted file mode 100644
index 1aff777..0000000
--- a/src/test/ui/macro-path-prelude-shadowing.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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.
-
-// aux-build:macro-in-other-crate.rs
-
-#![feature(decl_macro, extern_prelude)]
-
-macro_rules! add_macro_expanded_things_to_macro_prelude {() => {
- #[macro_use]
- extern crate macro_in_other_crate;
-}}
-
-add_macro_expanded_things_to_macro_prelude!();
-
-mod m1 {
- fn check() {
- inline!(); //~ ERROR `inline` is ambiguous
- }
-}
-
-mod m2 {
- pub mod std {
- pub macro panic() {}
- }
-}
-
-mod m3 {
- use m2::*; // glob-import user-defined `std`
- fn check() {
- std::panic!(); //~ ERROR `std` is ambiguous
- }
-}
-
-fn main() {}
diff --git a/src/test/ui/macro-path-prelude-shadowing.stderr b/src/test/ui/macro-path-prelude-shadowing.stderr
deleted file mode 100644
index 0e1b9a9..0000000
--- a/src/test/ui/macro-path-prelude-shadowing.stderr
+++ /dev/null
@@ -1,42 +0,0 @@
-error[E0659]: `inline` is ambiguous
- --> $DIR/macro-path-prelude-shadowing.rs:24:9
- |
-LL | inline!(); //~ ERROR `inline` is ambiguous
- | ^^^^^^
- |
-note: `inline` could refer to the name imported here
- --> $DIR/macro-path-prelude-shadowing.rs:16:5
- |
-LL | #[macro_use]
- | ^^^^^^^^^^^^
-...
-LL | add_macro_expanded_things_to_macro_prelude!();
- | ---------------------------------------------- in this macro invocation
-note: `inline` could also refer to the name defined here
- --> $DIR/macro-path-prelude-shadowing.rs:24:9
- |
-LL | inline!(); //~ ERROR `inline` is ambiguous
- | ^^^^^^
- = note: macro-expanded macro imports do not shadow
-
-error[E0659]: `std` is ambiguous
- --> $DIR/macro-path-prelude-shadowing.rs:37:9
- |
-LL | std::panic!(); //~ ERROR `std` is ambiguous
- | ^^^^^^^^^^
- |
-note: `std` could refer to the name imported here
- --> $DIR/macro-path-prelude-shadowing.rs:35:9
- |
-LL | use m2::*; // glob-import user-defined `std`
- | ^^^^^
-note: `std` could also refer to the name defined here
- --> $DIR/macro-path-prelude-shadowing.rs:37:9
- |
-LL | std::panic!(); //~ ERROR `std` is ambiguous
- | ^^^
- = note: consider adding an explicit import of `std` to disambiguate
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/macro-reexport-removed.stderr b/src/test/ui/macro-reexport-removed.stderr
deleted file mode 100644
index ba0ab23..0000000
--- a/src/test/ui/macro-reexport-removed.stderr
+++ /dev/null
@@ -1,24 +0,0 @@
-error[E0557]: feature has been removed
- --> $DIR/macro-reexport-removed.rs:13:12
- |
-LL | #![feature(macro_reexport)] //~ ERROR feature has been removed
- | ^^^^^^^^^^^^^^
- |
-note: subsumed by `#![feature(use_extern_macros)]` and `pub use`
- --> $DIR/macro-reexport-removed.rs:13:12
- |
-LL | #![feature(macro_reexport)] //~ ERROR feature has been removed
- | ^^^^^^^^^^^^^^
-
-error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
- --> $DIR/macro-reexport-removed.rs:15:1
- |
-LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = help: add #![feature(custom_attribute)] to the crate attributes to enable
-
-error: aborting due to 2 previous errors
-
-Some errors occurred: E0557, E0658.
-For more information about an error, try `rustc --explain E0557`.
diff --git a/src/test/ui/auxiliary/macro-in-other-crate.rs b/src/test/ui/macros/auxiliary/macro-in-other-crate.rs
similarity index 100%
rename from src/test/ui/auxiliary/macro-in-other-crate.rs
rename to src/test/ui/macros/auxiliary/macro-in-other-crate.rs
diff --git a/src/test/compile-fail/auxiliary/macro_crate_nonterminal.rs b/src/test/ui/macros/auxiliary/macro_crate_nonterminal.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/macro_crate_nonterminal.rs
rename to src/test/ui/macros/auxiliary/macro_crate_nonterminal.rs
diff --git a/src/test/ui/auxiliary/two_macros.rs b/src/test/ui/macros/auxiliary/two_macros.rs
similarity index 100%
copy from src/test/ui/auxiliary/two_macros.rs
copy to src/test/ui/macros/auxiliary/two_macros.rs
diff --git a/src/test/compile-fail/auxiliary/unstable-macros.rs b/src/test/ui/macros/auxiliary/unstable-macros.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/unstable-macros.rs
rename to src/test/ui/macros/auxiliary/unstable-macros.rs
diff --git a/src/test/ui/macros/issue-30143.rs b/src/test/ui/macros/issue-30143.rs
new file mode 100644
index 0000000..b7fb5b3
--- /dev/null
+++ b/src/test/ui/macros/issue-30143.rs
@@ -0,0 +1,21 @@
+// 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.
+
+use std::fmt::Write;
+
+fn main() {
+ println!(0);
+ //~^ ERROR format argument must be a string literal
+ eprintln!('a');
+ //~^ ERROR format argument must be a string literal
+ let mut s = String::new();
+ writeln!(s, true).unwrap();
+ //~^ ERROR format argument must be a string literal
+}
diff --git a/src/test/ui/macros/issue-30143.stderr b/src/test/ui/macros/issue-30143.stderr
new file mode 100644
index 0000000..56834f6
--- /dev/null
+++ b/src/test/ui/macros/issue-30143.stderr
@@ -0,0 +1,32 @@
+error: format argument must be a string literal
+ --> $DIR/issue-30143.rs:14:14
+ |
+LL | println!(0);
+ | ^
+help: you might be missing a string literal to format with
+ |
+LL | println!("{}", 0);
+ | ^^^^^
+
+error: format argument must be a string literal
+ --> $DIR/issue-30143.rs:16:15
+ |
+LL | eprintln!('a');
+ | ^^^
+help: you might be missing a string literal to format with
+ |
+LL | eprintln!("{}", 'a');
+ | ^^^^^
+
+error: format argument must be a string literal
+ --> $DIR/issue-30143.rs:19:17
+ |
+LL | writeln!(s, true).unwrap();
+ | ^^^^
+help: you might be missing a string literal to format with
+ |
+LL | writeln!(s, "{}", true).unwrap();
+ | ^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs
index fd7925e..63a4ef1 100644
--- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep-feature-flag.rs
@@ -12,7 +12,7 @@
// with the feature flag.
// gate-test-macro_at_most_once_rep
-// compile-flags: --edition=2015
+// edition:2015
#![feature(macro_at_most_once_rep)]
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs
index 90bc197..64848d0 100644
--- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-rep.rs
@@ -10,7 +10,7 @@
// Test behavior of `?` macro _kleene op_ under the 2015 edition. Namely, it doesn't exist.
-// compile-flags: --edition=2015
+// edition:2015
macro_rules! bar {
($(a)?) => {} //~ERROR expected `*` or `+`
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs
index 2e06b4b..a785799 100644
--- a/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs
+++ b/src/test/ui/macros/macro-at-most-once-rep-2015-ques-sep.rs
@@ -11,7 +11,7 @@
// Test behavior of `?` macro _separator_ under the 2015 edition. Namely, `?` can be used as a
// separator, but you get a migration warning for the edition.
-// compile-flags: --edition=2015
+// edition:2015
// compile-pass
#![warn(rust_2018_compatibility)]
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs
index f3107d4..ffabf9b 100644
--- a/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs
+++ b/src/test/ui/macros/macro-at-most-once-rep-2018-feature-gate.rs
@@ -11,7 +11,7 @@
// Feature gate test for macro_at_most_once_rep under 2018 edition.
// gate-test-macro_at_most_once_rep
-// compile-flags: --edition=2018
+// edition:2018
macro_rules! foo {
($(a)?) => {}
diff --git a/src/test/ui/macros/macro-at-most-once-rep-2018.rs b/src/test/ui/macros/macro-at-most-once-rep-2018.rs
index 958a7e0..5dabe8d 100644
--- a/src/test/ui/macros/macro-at-most-once-rep-2018.rs
+++ b/src/test/ui/macros/macro-at-most-once-rep-2018.rs
@@ -10,7 +10,7 @@
// Tests that `?` is a Kleene op and not a macro separator in the 2018 edition.
-// compile-flags: --edition=2018
+// edition:2018
#![feature(macro_at_most_once_rep)]
diff --git a/src/test/ui/macros/macro-attribute.rs b/src/test/ui/macros/macro-attribute.rs
new file mode 100644
index 0000000..111375b
--- /dev/null
+++ b/src/test/ui/macros/macro-attribute.rs
@@ -0,0 +1,14 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(unrestricted_attribute_tokens)]
+
+#[doc = $not_there] //~ ERROR expected `]`, found `not_there`
+fn main() { }
diff --git a/src/test/ui/macros/macro-attribute.stderr b/src/test/ui/macros/macro-attribute.stderr
new file mode 100644
index 0000000..c403872
--- /dev/null
+++ b/src/test/ui/macros/macro-attribute.stderr
@@ -0,0 +1,8 @@
+error: expected `]`, found `not_there`
+ --> $DIR/macro-attribute.rs:13:10
+ |
+LL | #[doc = $not_there] //~ ERROR expected `]`, found `not_there`
+ | ^^^^^^^^^ expected `]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/macro-comma-behavior.core.stderr b/src/test/ui/macros/macro-comma-behavior.core.stderr
new file mode 100644
index 0000000..5ff31f0
--- /dev/null
+++ b/src/test/ui/macros/macro-comma-behavior.core.stderr
@@ -0,0 +1,44 @@
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:27:23
+ |
+LL | assert_eq!(1, 1, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:30:23
+ |
+LL | assert_ne!(1, 2, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:36:29
+ |
+LL | debug_assert_eq!(1, 1, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:39:29
+ |
+LL | debug_assert_ne!(1, 2, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:60:19
+ |
+LL | format_args!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:78:21
+ |
+LL | unimplemented!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:87:24
+ |
+LL | write!(f, "{}",)?;
+ | ^^
+
+error: aborting due to 7 previous errors
+
diff --git a/src/test/compile-fail/macro-comma-behavior.rs b/src/test/ui/macros/macro-comma-behavior.rs
similarity index 100%
rename from src/test/compile-fail/macro-comma-behavior.rs
rename to src/test/ui/macros/macro-comma-behavior.rs
diff --git a/src/test/ui/macros/macro-comma-behavior.std.stderr b/src/test/ui/macros/macro-comma-behavior.std.stderr
new file mode 100644
index 0000000..a87271e
--- /dev/null
+++ b/src/test/ui/macros/macro-comma-behavior.std.stderr
@@ -0,0 +1,62 @@
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:27:23
+ |
+LL | assert_eq!(1, 1, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:30:23
+ |
+LL | assert_ne!(1, 2, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:36:29
+ |
+LL | debug_assert_eq!(1, 1, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:39:29
+ |
+LL | debug_assert_ne!(1, 2, "{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:44:18
+ |
+LL | eprint!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:56:18
+ |
+LL | format!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:60:19
+ |
+LL | format_args!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:67:17
+ |
+LL | print!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:78:21
+ |
+LL | unimplemented!("{}",);
+ | ^^
+
+error: 1 positional argument in format string, but no arguments were given
+ --> $DIR/macro-comma-behavior.rs:87:24
+ |
+LL | write!(f, "{}",)?;
+ | ^^
+
+error: aborting due to 10 previous errors
+
diff --git a/src/test/compile-fail/macro-comma-support.rs b/src/test/ui/macros/macro-comma-support.rs
similarity index 100%
rename from src/test/compile-fail/macro-comma-support.rs
rename to src/test/ui/macros/macro-comma-support.rs
diff --git a/src/test/ui/macros/macro-comma-support.stderr b/src/test/ui/macros/macro-comma-support.stderr
new file mode 100644
index 0000000..2ebba22
--- /dev/null
+++ b/src/test/ui/macros/macro-comma-support.stderr
@@ -0,0 +1,14 @@
+error: lel
+ --> $DIR/macro-comma-support.rs:16:5
+ |
+LL | compile_error!("lel"); //~ ERROR lel
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: lel
+ --> $DIR/macro-comma-support.rs:17:5
+ |
+LL | compile_error!("lel",); //~ ERROR lel
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/macro-context.rs b/src/test/ui/macros/macro-context.rs
similarity index 100%
rename from src/test/ui/macro-context.rs
rename to src/test/ui/macros/macro-context.rs
diff --git a/src/test/ui/macro-context.stderr b/src/test/ui/macros/macro-context.stderr
similarity index 100%
rename from src/test/ui/macro-context.stderr
rename to src/test/ui/macros/macro-context.stderr
diff --git a/src/test/compile-fail/macro-crate-nonterminal-non-root.rs b/src/test/ui/macros/macro-crate-nonterminal-non-root.rs
similarity index 100%
rename from src/test/compile-fail/macro-crate-nonterminal-non-root.rs
rename to src/test/ui/macros/macro-crate-nonterminal-non-root.rs
diff --git a/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr
new file mode 100644
index 0000000..029128a
--- /dev/null
+++ b/src/test/ui/macros/macro-crate-nonterminal-non-root.stderr
@@ -0,0 +1,9 @@
+error[E0468]: an `extern crate` loading macros must be at the crate root
+ --> $DIR/macro-crate-nonterminal-non-root.rs:15:5
+ |
+LL | extern crate macro_crate_nonterminal; //~ ERROR must be at the crate root
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0468`.
diff --git a/src/test/compile-fail/macro-error.rs b/src/test/ui/macros/macro-error.rs
similarity index 100%
rename from src/test/compile-fail/macro-error.rs
rename to src/test/ui/macros/macro-error.rs
diff --git a/src/test/ui/macros/macro-error.stderr b/src/test/ui/macros/macro-error.stderr
new file mode 100644
index 0000000..42808eb
--- /dev/null
+++ b/src/test/ui/macros/macro-error.stderr
@@ -0,0 +1,14 @@
+error: macro rhs must be delimited
+ --> $DIR/macro-error.rs:12:18
+ |
+LL | ($a:expr) => a; //~ ERROR macro rhs must be delimited
+ | ^
+
+error: non-type macro in type position: cfg
+ --> $DIR/macro-error.rs:18:12
+ |
+LL | let _: cfg!(foo) = (); //~ ERROR non-type macro in type position
+ | ^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/macro-expanded-include/file.txt b/src/test/ui/macros/macro-expanded-include/file.txt
similarity index 100%
rename from src/test/compile-fail/macro-expanded-include/file.txt
rename to src/test/ui/macros/macro-expanded-include/file.txt
diff --git a/src/test/compile-fail/macro-expanded-include/foo/mod.rs b/src/test/ui/macros/macro-expanded-include/foo/mod.rs
similarity index 100%
rename from src/test/compile-fail/macro-expanded-include/foo/mod.rs
rename to src/test/ui/macros/macro-expanded-include/foo/mod.rs
diff --git a/src/test/compile-fail/macro-expanded-include/test.rs b/src/test/ui/macros/macro-expanded-include/test.rs
similarity index 100%
rename from src/test/compile-fail/macro-expanded-include/test.rs
rename to src/test/ui/macros/macro-expanded-include/test.rs
diff --git a/src/test/ui/macros/macro-expanded-include/test.stderr b/src/test/ui/macros/macro-expanded-include/test.stderr
new file mode 100644
index 0000000..3ef0275
--- /dev/null
+++ b/src/test/ui/macros/macro-expanded-include/test.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/test.rs:23:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-expansion-tests.rs b/src/test/ui/macros/macro-expansion-tests.rs
similarity index 100%
rename from src/test/compile-fail/macro-expansion-tests.rs
rename to src/test/ui/macros/macro-expansion-tests.rs
diff --git a/src/test/ui/macros/macro-expansion-tests.stderr b/src/test/ui/macros/macro-expansion-tests.stderr
new file mode 100644
index 0000000..a3d4f3c
--- /dev/null
+++ b/src/test/ui/macros/macro-expansion-tests.stderr
@@ -0,0 +1,18 @@
+error: cannot find macro `m!` in this scope
+ --> $DIR/macro-expansion-tests.rs:17:21
+ |
+LL | fn g() -> i32 { m!() }
+ | ^
+ |
+ = help: have you added the `#[macro_use]` on the module/import?
+
+error: cannot find macro `m!` in this scope
+ --> $DIR/macro-expansion-tests.rs:25:21
+ |
+LL | fn g() -> i32 { m!() }
+ | ^
+ |
+ = help: have you added the `#[macro_use]` on the module/import?
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/macro-follow.rs b/src/test/ui/macros/macro-follow.rs
similarity index 100%
rename from src/test/compile-fail/macro-follow.rs
rename to src/test/ui/macros/macro-follow.rs
diff --git a/src/test/ui/macros/macro-follow.stderr b/src/test/ui/macros/macro-follow.stderr
new file mode 100644
index 0000000..ccd658a
--- /dev/null
+++ b/src/test/ui/macros/macro-follow.stderr
@@ -0,0 +1,512 @@
+error: `$p:pat` is followed by `(`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:17:14
+ |
+LL | ($p:pat ()) => {}; //~ERROR `$p:pat` is followed by `(`
+ | ^
+
+error: `$p:pat` is followed by `[`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:18:14
+ |
+LL | ($p:pat []) => {}; //~ERROR `$p:pat` is followed by `[`
+ | ^
+
+error: `$p:pat` is followed by `{`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:19:14
+ |
+LL | ($p:pat {}) => {}; //~ERROR `$p:pat` is followed by `{`
+ | ^
+
+error: `$p:pat` is followed by `:`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:20:13
+ |
+LL | ($p:pat :) => {}; //~ERROR `$p:pat` is followed by `:`
+ | ^
+
+error: `$p:pat` is followed by `>`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:21:13
+ |
+LL | ($p:pat >) => {}; //~ERROR `$p:pat` is followed by `>`
+ | ^
+
+error: `$p:pat` is followed by `+`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:22:13
+ |
+LL | ($p:pat +) => {}; //~ERROR `$p:pat` is followed by `+`
+ | ^
+
+error: `$p:pat` is followed by `ident`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:23:13
+ |
+LL | ($p:pat ident) => {}; //~ERROR `$p:pat` is followed by `ident`
+ | ^^^^^
+
+error: `$p:pat` is followed by `$p:pat`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:24:13
+ |
+LL | ($p:pat $p:pat) => {}; //~ERROR `$p:pat` is followed by `$p:pat`
+ | ^^^^^^
+
+error: `$p:pat` is followed by `$e:expr`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:25:13
+ |
+LL | ($p:pat $e:expr) => {}; //~ERROR `$p:pat` is followed by `$e:expr`
+ | ^^^^^^^
+
+error: `$p:pat` is followed by `$t:ty`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:26:13
+ |
+LL | ($p:pat $t:ty) => {}; //~ERROR `$p:pat` is followed by `$t:ty`
+ | ^^^^^
+
+error: `$p:pat` is followed by `$s:stmt`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:27:13
+ |
+LL | ($p:pat $s:stmt) => {}; //~ERROR `$p:pat` is followed by `$s:stmt`
+ | ^^^^^^^
+
+error: `$p:pat` is followed by `$p:path`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:28:13
+ |
+LL | ($p:pat $p:path) => {}; //~ERROR `$p:pat` is followed by `$p:path`
+ | ^^^^^^^
+
+error: `$p:pat` is followed by `$b:block`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:29:13
+ |
+LL | ($p:pat $b:block) => {}; //~ERROR `$p:pat` is followed by `$b:block`
+ | ^^^^^^^^
+
+error: `$p:pat` is followed by `$i:ident`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:30:13
+ |
+LL | ($p:pat $i:ident) => {}; //~ERROR `$p:pat` is followed by `$i:ident`
+ | ^^^^^^^^
+
+error: `$p:pat` is followed by `$t:tt`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:31:13
+ |
+LL | ($p:pat $t:tt) => {}; //~ERROR `$p:pat` is followed by `$t:tt`
+ | ^^^^^
+
+error: `$p:pat` is followed by `$i:item`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:32:13
+ |
+LL | ($p:pat $i:item) => {}; //~ERROR `$p:pat` is followed by `$i:item`
+ | ^^^^^^^
+
+error: `$p:pat` is followed by `$m:meta`, which is not allowed for `pat` fragments
+ --> $DIR/macro-follow.rs:33:13
+ |
+LL | ($p:pat $m:meta) => {}; //~ERROR `$p:pat` is followed by `$m:meta`
+ | ^^^^^^^
+
+error: `$e:expr` is followed by `(`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:37:15
+ |
+LL | ($e:expr ()) => {}; //~ERROR `$e:expr` is followed by `(`
+ | ^
+
+error: `$e:expr` is followed by `[`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:38:15
+ |
+LL | ($e:expr []) => {}; //~ERROR `$e:expr` is followed by `[`
+ | ^
+
+error: `$e:expr` is followed by `{`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:39:15
+ |
+LL | ($e:expr {}) => {}; //~ERROR `$e:expr` is followed by `{`
+ | ^
+
+error: `$e:expr` is followed by `=`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:40:14
+ |
+LL | ($e:expr =) => {}; //~ERROR `$e:expr` is followed by `=`
+ | ^
+
+error: `$e:expr` is followed by `|`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:41:14
+ |
+LL | ($e:expr |) => {}; //~ERROR `$e:expr` is followed by `|`
+ | ^
+
+error: `$e:expr` is followed by `:`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:42:14
+ |
+LL | ($e:expr :) => {}; //~ERROR `$e:expr` is followed by `:`
+ | ^
+
+error: `$e:expr` is followed by `>`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:43:14
+ |
+LL | ($e:expr >) => {}; //~ERROR `$e:expr` is followed by `>`
+ | ^
+
+error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:44:14
+ |
+LL | ($e:expr +) => {}; //~ERROR `$e:expr` is followed by `+`
+ | ^
+
+error: `$e:expr` is followed by `ident`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:45:14
+ |
+LL | ($e:expr ident) => {}; //~ERROR `$e:expr` is followed by `ident`
+ | ^^^^^
+
+error: `$e:expr` is followed by `if`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:46:14
+ |
+LL | ($e:expr if) => {}; //~ERROR `$e:expr` is followed by `if`
+ | ^^
+
+error: `$e:expr` is followed by `in`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:47:14
+ |
+LL | ($e:expr in) => {}; //~ERROR `$e:expr` is followed by `in`
+ | ^^
+
+error: `$e:expr` is followed by `$p:pat`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:48:14
+ |
+LL | ($e:expr $p:pat) => {}; //~ERROR `$e:expr` is followed by `$p:pat`
+ | ^^^^^^
+
+error: `$e:expr` is followed by `$e:expr`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:49:14
+ |
+LL | ($e:expr $e:expr) => {}; //~ERROR `$e:expr` is followed by `$e:expr`
+ | ^^^^^^^
+
+error: `$e:expr` is followed by `$t:ty`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:50:14
+ |
+LL | ($e:expr $t:ty) => {}; //~ERROR `$e:expr` is followed by `$t:ty`
+ | ^^^^^
+
+error: `$e:expr` is followed by `$s:stmt`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:51:14
+ |
+LL | ($e:expr $s:stmt) => {}; //~ERROR `$e:expr` is followed by `$s:stmt`
+ | ^^^^^^^
+
+error: `$e:expr` is followed by `$p:path`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:52:14
+ |
+LL | ($e:expr $p:path) => {}; //~ERROR `$e:expr` is followed by `$p:path`
+ | ^^^^^^^
+
+error: `$e:expr` is followed by `$b:block`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:53:14
+ |
+LL | ($e:expr $b:block) => {}; //~ERROR `$e:expr` is followed by `$b:block`
+ | ^^^^^^^^
+
+error: `$e:expr` is followed by `$i:ident`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:54:14
+ |
+LL | ($e:expr $i:ident) => {}; //~ERROR `$e:expr` is followed by `$i:ident`
+ | ^^^^^^^^
+
+error: `$e:expr` is followed by `$t:tt`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:55:14
+ |
+LL | ($e:expr $t:tt) => {}; //~ERROR `$e:expr` is followed by `$t:tt`
+ | ^^^^^
+
+error: `$e:expr` is followed by `$i:item`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:56:14
+ |
+LL | ($e:expr $i:item) => {}; //~ERROR `$e:expr` is followed by `$i:item`
+ | ^^^^^^^
+
+error: `$e:expr` is followed by `$m:meta`, which is not allowed for `expr` fragments
+ --> $DIR/macro-follow.rs:57:14
+ |
+LL | ($e:expr $m:meta) => {}; //~ERROR `$e:expr` is followed by `$m:meta`
+ | ^^^^^^^
+
+error: `$t:ty` is followed by `(`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:62:13
+ |
+LL | ($t:ty ()) => {}; //~ERROR `$t:ty` is followed by `(`
+ | ^
+
+error: `$t:ty` is followed by `+`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:64:12
+ |
+LL | ($t:ty +) => {}; //~ERROR `$t:ty` is followed by `+`
+ | ^
+
+error: `$t:ty` is followed by `ident`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:65:12
+ |
+LL | ($t:ty ident) => {}; //~ERROR `$t:ty` is followed by `ident`
+ | ^^^^^
+
+error: `$t:ty` is followed by `if`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:66:12
+ |
+LL | ($t:ty if) => {}; //~ERROR `$t:ty` is followed by `if`
+ | ^^
+
+error: `$t:ty` is followed by `$p:pat`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:67:12
+ |
+LL | ($t:ty $p:pat) => {}; //~ERROR `$t:ty` is followed by `$p:pat`
+ | ^^^^^^
+
+error: `$t:ty` is followed by `$e:expr`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:68:12
+ |
+LL | ($t:ty $e:expr) => {}; //~ERROR `$t:ty` is followed by `$e:expr`
+ | ^^^^^^^
+
+error: `$t:ty` is followed by `$t:ty`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:69:12
+ |
+LL | ($t:ty $t:ty) => {}; //~ERROR `$t:ty` is followed by `$t:ty`
+ | ^^^^^
+
+error: `$t:ty` is followed by `$s:stmt`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:70:12
+ |
+LL | ($t:ty $s:stmt) => {}; //~ERROR `$t:ty` is followed by `$s:stmt`
+ | ^^^^^^^
+
+error: `$t:ty` is followed by `$p:path`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:71:12
+ |
+LL | ($t:ty $p:path) => {}; //~ERROR `$t:ty` is followed by `$p:path`
+ | ^^^^^^^
+
+error: `$t:ty` is followed by `$i:ident`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:73:12
+ |
+LL | ($t:ty $i:ident) => {}; //~ERROR `$t:ty` is followed by `$i:ident`
+ | ^^^^^^^^
+
+error: `$t:ty` is followed by `$t:tt`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:74:12
+ |
+LL | ($t:ty $t:tt) => {}; //~ERROR `$t:ty` is followed by `$t:tt`
+ | ^^^^^
+
+error: `$t:ty` is followed by `$i:item`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:75:12
+ |
+LL | ($t:ty $i:item) => {}; //~ERROR `$t:ty` is followed by `$i:item`
+ | ^^^^^^^
+
+error: `$t:ty` is followed by `$m:meta`, which is not allowed for `ty` fragments
+ --> $DIR/macro-follow.rs:76:12
+ |
+LL | ($t:ty $m:meta) => {}; //~ERROR `$t:ty` is followed by `$m:meta`
+ | ^^^^^^^
+
+error: `$s:stmt` is followed by `(`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:80:15
+ |
+LL | ($s:stmt ()) => {}; //~ERROR `$s:stmt` is followed by `(`
+ | ^
+
+error: `$s:stmt` is followed by `[`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:81:15
+ |
+LL | ($s:stmt []) => {}; //~ERROR `$s:stmt` is followed by `[`
+ | ^
+
+error: `$s:stmt` is followed by `{`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:82:15
+ |
+LL | ($s:stmt {}) => {}; //~ERROR `$s:stmt` is followed by `{`
+ | ^
+
+error: `$s:stmt` is followed by `=`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:83:14
+ |
+LL | ($s:stmt =) => {}; //~ERROR `$s:stmt` is followed by `=`
+ | ^
+
+error: `$s:stmt` is followed by `|`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:84:14
+ |
+LL | ($s:stmt |) => {}; //~ERROR `$s:stmt` is followed by `|`
+ | ^
+
+error: `$s:stmt` is followed by `:`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:85:14
+ |
+LL | ($s:stmt :) => {}; //~ERROR `$s:stmt` is followed by `:`
+ | ^
+
+error: `$s:stmt` is followed by `>`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:86:14
+ |
+LL | ($s:stmt >) => {}; //~ERROR `$s:stmt` is followed by `>`
+ | ^
+
+error: `$s:stmt` is followed by `+`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:87:14
+ |
+LL | ($s:stmt +) => {}; //~ERROR `$s:stmt` is followed by `+`
+ | ^
+
+error: `$s:stmt` is followed by `ident`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:88:14
+ |
+LL | ($s:stmt ident) => {}; //~ERROR `$s:stmt` is followed by `ident`
+ | ^^^^^
+
+error: `$s:stmt` is followed by `if`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:89:14
+ |
+LL | ($s:stmt if) => {}; //~ERROR `$s:stmt` is followed by `if`
+ | ^^
+
+error: `$s:stmt` is followed by `in`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:90:14
+ |
+LL | ($s:stmt in) => {}; //~ERROR `$s:stmt` is followed by `in`
+ | ^^
+
+error: `$s:stmt` is followed by `$p:pat`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:91:14
+ |
+LL | ($s:stmt $p:pat) => {}; //~ERROR `$s:stmt` is followed by `$p:pat`
+ | ^^^^^^
+
+error: `$s:stmt` is followed by `$e:expr`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:92:14
+ |
+LL | ($s:stmt $e:expr) => {}; //~ERROR `$s:stmt` is followed by `$e:expr`
+ | ^^^^^^^
+
+error: `$s:stmt` is followed by `$t:ty`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:93:14
+ |
+LL | ($s:stmt $t:ty) => {}; //~ERROR `$s:stmt` is followed by `$t:ty`
+ | ^^^^^
+
+error: `$s:stmt` is followed by `$s:stmt`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:94:14
+ |
+LL | ($s:stmt $s:stmt) => {}; //~ERROR `$s:stmt` is followed by `$s:stmt`
+ | ^^^^^^^
+
+error: `$s:stmt` is followed by `$p:path`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:95:14
+ |
+LL | ($s:stmt $p:path) => {}; //~ERROR `$s:stmt` is followed by `$p:path`
+ | ^^^^^^^
+
+error: `$s:stmt` is followed by `$b:block`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:96:14
+ |
+LL | ($s:stmt $b:block) => {}; //~ERROR `$s:stmt` is followed by `$b:block`
+ | ^^^^^^^^
+
+error: `$s:stmt` is followed by `$i:ident`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:97:14
+ |
+LL | ($s:stmt $i:ident) => {}; //~ERROR `$s:stmt` is followed by `$i:ident`
+ | ^^^^^^^^
+
+error: `$s:stmt` is followed by `$t:tt`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:98:14
+ |
+LL | ($s:stmt $t:tt) => {}; //~ERROR `$s:stmt` is followed by `$t:tt`
+ | ^^^^^
+
+error: `$s:stmt` is followed by `$i:item`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:99:14
+ |
+LL | ($s:stmt $i:item) => {}; //~ERROR `$s:stmt` is followed by `$i:item`
+ | ^^^^^^^
+
+error: `$s:stmt` is followed by `$m:meta`, which is not allowed for `stmt` fragments
+ --> $DIR/macro-follow.rs:100:14
+ |
+LL | ($s:stmt $m:meta) => {}; //~ERROR `$s:stmt` is followed by `$m:meta`
+ | ^^^^^^^
+
+error: `$p:path` is followed by `(`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:104:15
+ |
+LL | ($p:path ()) => {}; //~ERROR `$p:path` is followed by `(`
+ | ^
+
+error: `$p:path` is followed by `+`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:106:14
+ |
+LL | ($p:path +) => {}; //~ERROR `$p:path` is followed by `+`
+ | ^
+
+error: `$p:path` is followed by `ident`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:107:14
+ |
+LL | ($p:path ident) => {}; //~ERROR `$p:path` is followed by `ident`
+ | ^^^^^
+
+error: `$p:path` is followed by `if`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:108:14
+ |
+LL | ($p:path if) => {}; //~ERROR `$p:path` is followed by `if`
+ | ^^
+
+error: `$p:path` is followed by `$p:pat`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:109:14
+ |
+LL | ($p:path $p:pat) => {}; //~ERROR `$p:path` is followed by `$p:pat`
+ | ^^^^^^
+
+error: `$p:path` is followed by `$e:expr`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:110:14
+ |
+LL | ($p:path $e:expr) => {}; //~ERROR `$p:path` is followed by `$e:expr`
+ | ^^^^^^^
+
+error: `$p:path` is followed by `$t:ty`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:111:14
+ |
+LL | ($p:path $t:ty) => {}; //~ERROR `$p:path` is followed by `$t:ty`
+ | ^^^^^
+
+error: `$p:path` is followed by `$s:stmt`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:112:14
+ |
+LL | ($p:path $s:stmt) => {}; //~ERROR `$p:path` is followed by `$s:stmt`
+ | ^^^^^^^
+
+error: `$p:path` is followed by `$p:path`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:113:14
+ |
+LL | ($p:path $p:path) => {}; //~ERROR `$p:path` is followed by `$p:path`
+ | ^^^^^^^
+
+error: `$p:path` is followed by `$i:ident`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:115:14
+ |
+LL | ($p:path $i:ident) => {}; //~ERROR `$p:path` is followed by `$i:ident`
+ | ^^^^^^^^
+
+error: `$p:path` is followed by `$t:tt`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:116:14
+ |
+LL | ($p:path $t:tt) => {}; //~ERROR `$p:path` is followed by `$t:tt`
+ | ^^^^^
+
+error: `$p:path` is followed by `$i:item`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:117:14
+ |
+LL | ($p:path $i:item) => {}; //~ERROR `$p:path` is followed by `$i:item`
+ | ^^^^^^^
+
+error: `$p:path` is followed by `$m:meta`, which is not allowed for `path` fragments
+ --> $DIR/macro-follow.rs:118:14
+ |
+LL | ($p:path $m:meta) => {}; //~ERROR `$p:path` is followed by `$m:meta`
+ | ^^^^^^^
+
+error: aborting due to 85 previous errors
+
diff --git a/src/test/compile-fail/macro-followed-by-seq-bad.rs b/src/test/ui/macros/macro-followed-by-seq-bad.rs
similarity index 100%
rename from src/test/compile-fail/macro-followed-by-seq-bad.rs
rename to src/test/ui/macros/macro-followed-by-seq-bad.rs
diff --git a/src/test/ui/macros/macro-followed-by-seq-bad.stderr b/src/test/ui/macros/macro-followed-by-seq-bad.stderr
new file mode 100644
index 0000000..bb07033
--- /dev/null
+++ b/src/test/ui/macros/macro-followed-by-seq-bad.stderr
@@ -0,0 +1,14 @@
+error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
+ --> $DIR/macro-followed-by-seq-bad.rs:17:15
+ |
+LL | ( $a:expr $($b:tt)* ) => { }; //~ ERROR not allowed for `expr` fragments
+ | ^^^^^
+
+error: `$a:ty` is followed by `$b:tt`, which is not allowed for `ty` fragments
+ --> $DIR/macro-followed-by-seq-bad.rs:18:13
+ |
+LL | ( $a:ty $($b:tt)* ) => { }; //~ ERROR not allowed for `ty` fragments
+ | ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/macro-inner-attributes.rs b/src/test/ui/macros/macro-inner-attributes.rs
similarity index 100%
rename from src/test/compile-fail/macro-inner-attributes.rs
rename to src/test/ui/macros/macro-inner-attributes.rs
diff --git a/src/test/ui/macros/macro-inner-attributes.stderr b/src/test/ui/macros/macro-inner-attributes.stderr
new file mode 100644
index 0000000..11922bc
--- /dev/null
+++ b/src/test/ui/macros/macro-inner-attributes.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `a`
+ --> $DIR/macro-inner-attributes.rs:27:5
+ |
+LL | a::bar();
+ | ^ Use of undeclared type or module `a`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/macro-input-future-proofing.rs b/src/test/ui/macros/macro-input-future-proofing.rs
similarity index 100%
rename from src/test/compile-fail/macro-input-future-proofing.rs
rename to src/test/ui/macros/macro-input-future-proofing.rs
diff --git a/src/test/ui/macros/macro-input-future-proofing.stderr b/src/test/ui/macros/macro-input-future-proofing.stderr
new file mode 100644
index 0000000..aed7a8a
--- /dev/null
+++ b/src/test/ui/macros/macro-input-future-proofing.stderr
@@ -0,0 +1,56 @@
+error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments
+ --> $DIR/macro-input-future-proofing.rs:14:13
+ |
+LL | ($ty:ty <) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
+ | ^
+
+error: `$ty:ty` is followed by `<`, which is not allowed for `ty` fragments
+ --> $DIR/macro-input-future-proofing.rs:15:13
+ |
+LL | ($ty:ty < foo ,) => (); //~ ERROR `$ty:ty` is followed by `<`, which is not allowed for `ty`
+ | ^
+
+error: `$pa:pat` is followed by `>`, which is not allowed for `pat` fragments
+ --> $DIR/macro-input-future-proofing.rs:21:14
+ |
+LL | ($pa:pat >) => (); //~ ERROR `$pa:pat` is followed by `>`, which is not allowed for `pat`
+ | ^
+
+error: `$pa:pat` is followed by `$pb:pat`, which is not allowed for `pat` fragments
+ --> $DIR/macro-input-future-proofing.rs:23:14
+ |
+LL | ($pa:pat $pb:pat $ty:ty ,) => ();
+ | ^^^^^^^
+
+error: `$pb:pat` is followed by `$ty:ty`, which is not allowed for `pat` fragments
+ --> $DIR/macro-input-future-proofing.rs:23:22
+ |
+LL | ($pa:pat $pb:pat $ty:ty ,) => ();
+ | ^^^^^^
+
+error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments
+ --> $DIR/macro-input-future-proofing.rs:26:17
+ |
+LL | ($($ty:ty)* -) => (); //~ ERROR `$ty:ty` is followed by `-`
+ | ^
+
+error: `$b:ty` is followed by `-`, which is not allowed for `ty` fragments
+ --> $DIR/macro-input-future-proofing.rs:27:23
+ |
+LL | ($($a:ty, $b:ty)* -) => (); //~ ERROR `$b:ty` is followed by `-`
+ | ^
+
+error: `$ty:ty` is followed by `-`, which is not allowed for `ty` fragments
+ --> $DIR/macro-input-future-proofing.rs:28:7
+ |
+LL | ($($ty:ty)-+) => (); //~ ERROR `$ty:ty` is followed by `-`, which is not allowed for `ty`
+ | ^^^^^^^^
+
+error: `$a:expr` is followed by `$b:tt`, which is not allowed for `expr` fragments
+ --> $DIR/macro-input-future-proofing.rs:29:21
+ |
+LL | ( $($a:expr)* $($b:tt)* ) => { };
+ | ^^^^^
+
+error: aborting due to 9 previous errors
+
diff --git a/src/test/ui/macro-invalid-fragment-spec.rs b/src/test/ui/macros/macro-invalid-fragment-spec.rs
similarity index 100%
rename from src/test/ui/macro-invalid-fragment-spec.rs
rename to src/test/ui/macros/macro-invalid-fragment-spec.rs
diff --git a/src/test/ui/macro-invalid-fragment-spec.stderr b/src/test/ui/macros/macro-invalid-fragment-spec.stderr
similarity index 100%
rename from src/test/ui/macro-invalid-fragment-spec.stderr
rename to src/test/ui/macros/macro-invalid-fragment-spec.stderr
diff --git a/src/test/compile-fail/macro-local-data-key-priv.rs b/src/test/ui/macros/macro-local-data-key-priv.rs
similarity index 100%
rename from src/test/compile-fail/macro-local-data-key-priv.rs
rename to src/test/ui/macros/macro-local-data-key-priv.rs
diff --git a/src/test/ui/macros/macro-local-data-key-priv.stderr b/src/test/ui/macros/macro-local-data-key-priv.stderr
new file mode 100644
index 0000000..57f4f79
--- /dev/null
+++ b/src/test/ui/macros/macro-local-data-key-priv.stderr
@@ -0,0 +1,9 @@
+error[E0603]: constant `baz` is private
+ --> $DIR/macro-local-data-key-priv.rs:18:5
+ |
+LL | bar::baz.with(|_| ());
+ | ^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/macro-match-nonterminal.rs b/src/test/ui/macros/macro-match-nonterminal.rs
similarity index 100%
rename from src/test/compile-fail/macro-match-nonterminal.rs
rename to src/test/ui/macros/macro-match-nonterminal.rs
diff --git a/src/test/ui/macros/macro-match-nonterminal.stderr b/src/test/ui/macros/macro-match-nonterminal.stderr
new file mode 100644
index 0000000..26648c4
--- /dev/null
+++ b/src/test/ui/macros/macro-match-nonterminal.stderr
@@ -0,0 +1,8 @@
+error: missing fragment specifier
+ --> $DIR/macro-match-nonterminal.rs:11:24
+ |
+LL | macro_rules! test { ($a, $b) => (()); } //~ ERROR missing fragment
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-missing-delimiters.rs b/src/test/ui/macros/macro-missing-delimiters.rs
similarity index 100%
rename from src/test/compile-fail/macro-missing-delimiters.rs
rename to src/test/ui/macros/macro-missing-delimiters.rs
diff --git a/src/test/ui/macros/macro-missing-delimiters.stderr b/src/test/ui/macros/macro-missing-delimiters.stderr
new file mode 100644
index 0000000..eb43e39
--- /dev/null
+++ b/src/test/ui/macros/macro-missing-delimiters.stderr
@@ -0,0 +1,8 @@
+error: invalid macro matcher; matchers must be contained in balanced delimiters
+ --> $DIR/macro-missing-delimiters.rs:12:5
+ |
+LL | baz => () //~ ERROR invalid macro matcher;
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-missing-fragment.rs b/src/test/ui/macros/macro-missing-fragment.rs
similarity index 100%
rename from src/test/compile-fail/macro-missing-fragment.rs
rename to src/test/ui/macros/macro-missing-fragment.rs
diff --git a/src/test/ui/macros/macro-missing-fragment.stderr b/src/test/ui/macros/macro-missing-fragment.stderr
new file mode 100644
index 0000000..48e07ed
--- /dev/null
+++ b/src/test/ui/macros/macro-missing-fragment.stderr
@@ -0,0 +1,8 @@
+error: missing fragment specifier
+ --> $DIR/macro-missing-fragment.rs:12:20
+ |
+LL | ( $( any_token $field_rust_type )* ) => {}; //~ ERROR missing fragment
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-non-lifetime.rs b/src/test/ui/macros/macro-non-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/macro-non-lifetime.rs
rename to src/test/ui/macros/macro-non-lifetime.rs
diff --git a/src/test/ui/macros/macro-non-lifetime.stderr b/src/test/ui/macros/macro-non-lifetime.stderr
new file mode 100644
index 0000000..93b7f48
--- /dev/null
+++ b/src/test/ui/macros/macro-non-lifetime.stderr
@@ -0,0 +1,8 @@
+error: no rules expected the token `a`
+ --> $DIR/macro-non-lifetime.rs:18:8
+ |
+LL | m!(a);
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-outer-attributes.rs b/src/test/ui/macros/macro-outer-attributes.rs
similarity index 100%
rename from src/test/compile-fail/macro-outer-attributes.rs
rename to src/test/ui/macros/macro-outer-attributes.rs
diff --git a/src/test/ui/macros/macro-outer-attributes.stderr b/src/test/ui/macros/macro-outer-attributes.stderr
new file mode 100644
index 0000000..4cc8cd5
--- /dev/null
+++ b/src/test/ui/macros/macro-outer-attributes.stderr
@@ -0,0 +1,13 @@
+error[E0425]: cannot find function `bar` in module `a`
+ --> $DIR/macro-outer-attributes.rs:28:8
+ |
+LL | a::bar(); //~ ERROR cannot find function `bar` in module `a`
+ | ^^^ not found in `a`
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use b::bar;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/macro-parameter-span.rs b/src/test/ui/macros/macro-parameter-span.rs
similarity index 100%
rename from src/test/compile-fail/macro-parameter-span.rs
rename to src/test/ui/macros/macro-parameter-span.rs
diff --git a/src/test/ui/macros/macro-parameter-span.stderr b/src/test/ui/macros/macro-parameter-span.stderr
new file mode 100644
index 0000000..749221e
--- /dev/null
+++ b/src/test/ui/macros/macro-parameter-span.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/macro-parameter-span.rs:21:9
+ |
+LL | x //~ ERROR cannot find value `x` in this scope
+ | ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/ui/macros/macro-path-prelude-fail-1.rs b/src/test/ui/macros/macro-path-prelude-fail-1.rs
new file mode 100644
index 0000000..e1181eb
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-fail-1.rs
@@ -0,0 +1,20 @@
+// 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.
+
+#![feature(extern_prelude)]
+
+mod m {
+ fn check() {
+ Vec::clone!(); //~ ERROR failed to resolve. Not a module `Vec`
+ u8::clone!(); //~ ERROR failed to resolve. Not a module `u8`
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/macro-path-prelude-fail-1.stderr b/src/test/ui/macros/macro-path-prelude-fail-1.stderr
similarity index 100%
rename from src/test/ui/macro-path-prelude-fail-1.stderr
rename to src/test/ui/macros/macro-path-prelude-fail-1.stderr
diff --git a/src/test/ui/macros/macro-path-prelude-fail-2.rs b/src/test/ui/macros/macro-path-prelude-fail-2.rs
new file mode 100644
index 0000000..82258da
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-fail-2.rs
@@ -0,0 +1,17 @@
+// 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.
+
+mod m {
+ fn check() {
+ Result::Ok!(); //~ ERROR fail to resolve non-ident macro path
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-path-prelude-fail-2.stderr b/src/test/ui/macros/macro-path-prelude-fail-2.stderr
new file mode 100644
index 0000000..876ee25
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-fail-2.stderr
@@ -0,0 +1,8 @@
+error: fail to resolve non-ident macro path
+ --> $DIR/macro-path-prelude-fail-2.rs:13:9
+ |
+LL | Result::Ok!(); //~ ERROR fail to resolve non-ident macro path
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.rs b/src/test/ui/macros/macro-path-prelude-fail-3.rs
new file mode 100644
index 0000000..c706b8f
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-fail-3.rs
@@ -0,0 +1,16 @@
+// 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.
+
+#[derive(inline)] //~ ERROR cannot find derive macro `inline` in this scope
+struct S;
+
+fn main() {
+ inline!(); //~ ERROR cannot find macro `inline!` in this scope
+}
diff --git a/src/test/ui/macros/macro-path-prelude-fail-3.stderr b/src/test/ui/macros/macro-path-prelude-fail-3.stderr
new file mode 100644
index 0000000..a8edf54
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-fail-3.stderr
@@ -0,0 +1,14 @@
+error: cannot find derive macro `inline` in this scope
+ --> $DIR/macro-path-prelude-fail-3.rs:11:10
+ |
+LL | #[derive(inline)] //~ ERROR cannot find derive macro `inline` in this scope
+ | ^^^^^^
+
+error: cannot find macro `inline!` in this scope
+ --> $DIR/macro-path-prelude-fail-3.rs:15:5
+ |
+LL | inline!(); //~ ERROR cannot find macro `inline!` in this scope
+ | ^^^^^^ help: you could try the macro: `line`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/macros/macro-path-prelude-pass.rs b/src/test/ui/macros/macro-path-prelude-pass.rs
new file mode 100644
index 0000000..1f281d4
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-pass.rs
@@ -0,0 +1,21 @@
+// 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.
+
+// compile-pass
+
+#![feature(extern_prelude)]
+
+mod m {
+ fn check() {
+ std::panic!(); // OK
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-path-prelude-shadowing.rs b/src/test/ui/macros/macro-path-prelude-shadowing.rs
new file mode 100644
index 0000000..6831cd8
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-shadowing.rs
@@ -0,0 +1,43 @@
+// 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.
+
+// aux-build:macro-in-other-crate.rs
+
+#![feature(decl_macro, extern_prelude)]
+
+macro_rules! add_macro_expanded_things_to_macro_prelude {() => {
+ #[macro_use]
+ extern crate macro_in_other_crate;
+}}
+
+add_macro_expanded_things_to_macro_prelude!();
+
+mod m1 {
+ fn check() {
+ inline!(); // OK. Theoretically ambiguous, but we do not consider built-in attributes
+ // as candidates for non-attribute macro invocations to avoid regressions
+ // on stable channel
+ }
+}
+
+mod m2 {
+ pub mod std {
+ pub macro panic() {}
+ }
+}
+
+mod m3 {
+ use m2::*; // glob-import user-defined `std`
+ fn check() {
+ std::panic!(); //~ ERROR `std` is ambiguous
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/macros/macro-path-prelude-shadowing.stderr b/src/test/ui/macros/macro-path-prelude-shadowing.stderr
new file mode 100644
index 0000000..c0892f9
--- /dev/null
+++ b/src/test/ui/macros/macro-path-prelude-shadowing.stderr
@@ -0,0 +1,21 @@
+error[E0659]: `std` is ambiguous
+ --> $DIR/macro-path-prelude-shadowing.rs:39:9
+ |
+LL | std::panic!(); //~ ERROR `std` is ambiguous
+ | ^^^^^^^^^^
+ |
+note: `std` could refer to the name imported here
+ --> $DIR/macro-path-prelude-shadowing.rs:37:9
+ |
+LL | use m2::*; // glob-import user-defined `std`
+ | ^^^^^
+note: `std` could also refer to the name defined here
+ --> $DIR/macro-path-prelude-shadowing.rs:39:9
+ |
+LL | std::panic!(); //~ ERROR `std` is ambiguous
+ | ^^^
+ = note: consider adding an explicit import of `std` to disambiguate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0659`.
diff --git a/src/test/ui/macro-reexport-removed.rs b/src/test/ui/macros/macro-reexport-removed.rs
similarity index 100%
rename from src/test/ui/macro-reexport-removed.rs
rename to src/test/ui/macros/macro-reexport-removed.rs
diff --git a/src/test/ui/macros/macro-reexport-removed.stderr b/src/test/ui/macros/macro-reexport-removed.stderr
new file mode 100644
index 0000000..c93c714
--- /dev/null
+++ b/src/test/ui/macros/macro-reexport-removed.stderr
@@ -0,0 +1,24 @@
+error[E0557]: feature has been removed
+ --> $DIR/macro-reexport-removed.rs:13:12
+ |
+LL | #![feature(macro_reexport)] //~ ERROR feature has been removed
+ | ^^^^^^^^^^^^^^
+ |
+note: subsumed by `pub use`
+ --> $DIR/macro-reexport-removed.rs:13:12
+ |
+LL | #![feature(macro_reexport)] //~ ERROR feature has been removed
+ | ^^^^^^^^^^^^^^
+
+error[E0658]: The attribute `macro_reexport` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
+ --> $DIR/macro-reexport-removed.rs:15:1
+ |
+LL | #[macro_reexport(macro_one)] //~ ERROR attribute `macro_reexport` is currently unknown
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(custom_attribute)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0557, E0658.
+For more information about an error, try `rustc --explain E0557`.
diff --git a/src/test/ui/macro-shadowing.rs b/src/test/ui/macros/macro-shadowing.rs
similarity index 100%
rename from src/test/ui/macro-shadowing.rs
rename to src/test/ui/macros/macro-shadowing.rs
diff --git a/src/test/ui/macro-shadowing.stderr b/src/test/ui/macros/macro-shadowing.stderr
similarity index 100%
rename from src/test/ui/macro-shadowing.stderr
rename to src/test/ui/macros/macro-shadowing.stderr
diff --git a/src/test/compile-fail/macro-stability.rs b/src/test/ui/macros/macro-stability.rs
similarity index 100%
rename from src/test/compile-fail/macro-stability.rs
rename to src/test/ui/macros/macro-stability.rs
diff --git a/src/test/ui/macros/macro-stability.stderr b/src/test/ui/macros/macro-stability.stderr
new file mode 100644
index 0000000..947133f
--- /dev/null
+++ b/src/test/ui/macros/macro-stability.stderr
@@ -0,0 +1,11 @@
+error[E0658]: macro unstable_macro! is unstable
+ --> $DIR/macro-stability.rs:21:5
+ |
+LL | unstable_macro!(); //~ ERROR: macro unstable_macro! is unstable
+ | ^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_macros)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/macro-stmt-matchers.rs b/src/test/ui/macros/macro-stmt-matchers.rs
similarity index 100%
rename from src/test/compile-fail/macro-stmt-matchers.rs
rename to src/test/ui/macros/macro-stmt-matchers.rs
diff --git a/src/test/ui/macros/macro-stmt-matchers.stderr b/src/test/ui/macros/macro-stmt-matchers.stderr
new file mode 100644
index 0000000..ef6210b
--- /dev/null
+++ b/src/test/ui/macros/macro-stmt-matchers.stderr
@@ -0,0 +1,11 @@
+error: compilation successful
+ --> $DIR/macro-stmt-matchers.rs:14:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | macro_rules! m { ($s:stmt;) => { $s } }
+LL | | m!(vec![].push(0););
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-tt-matchers.rs b/src/test/ui/macros/macro-tt-matchers.rs
similarity index 100%
rename from src/test/compile-fail/macro-tt-matchers.rs
rename to src/test/ui/macros/macro-tt-matchers.rs
diff --git a/src/test/ui/macros/macro-tt-matchers.stderr b/src/test/ui/macros/macro-tt-matchers.stderr
new file mode 100644
index 0000000..b7551c1
--- /dev/null
+++ b/src/test/ui/macros/macro-tt-matchers.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/macro-tt-matchers.rs:21:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-use-bad-args-1.rs b/src/test/ui/macros/macro-use-bad-args-1.rs
similarity index 100%
rename from src/test/compile-fail/macro-use-bad-args-1.rs
rename to src/test/ui/macros/macro-use-bad-args-1.rs
diff --git a/src/test/ui/macros/macro-use-bad-args-1.stderr b/src/test/ui/macros/macro-use-bad-args-1.stderr
new file mode 100644
index 0000000..19a8c7c
--- /dev/null
+++ b/src/test/ui/macros/macro-use-bad-args-1.stderr
@@ -0,0 +1,14 @@
+error[E0466]: bad macro import
+ --> $DIR/macro-use-bad-args-1.rs:14:13
+ |
+LL | #[macro_use(foo(bar))] //~ ERROR bad macro import
+ | ^^^^^^^^
+
+error[E0601]: `main` function not found in crate `macro_use_bad_args_1`
+ |
+ = note: consider adding a `main` function to `$DIR/macro-use-bad-args-1.rs`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0466, E0601.
+For more information about an error, try `rustc --explain E0466`.
diff --git a/src/test/compile-fail/macro-use-bad-args-2.rs b/src/test/ui/macros/macro-use-bad-args-2.rs
similarity index 100%
rename from src/test/compile-fail/macro-use-bad-args-2.rs
rename to src/test/ui/macros/macro-use-bad-args-2.rs
diff --git a/src/test/ui/macros/macro-use-bad-args-2.stderr b/src/test/ui/macros/macro-use-bad-args-2.stderr
new file mode 100644
index 0000000..0ac1820
--- /dev/null
+++ b/src/test/ui/macros/macro-use-bad-args-2.stderr
@@ -0,0 +1,14 @@
+error[E0466]: bad macro import
+ --> $DIR/macro-use-bad-args-2.rs:14:13
+ |
+LL | #[macro_use(foo="bar")] //~ ERROR bad macro import
+ | ^^^^^^^^^
+
+error[E0601]: `main` function not found in crate `macro_use_bad_args_2`
+ |
+ = note: consider adding a `main` function to `$DIR/macro-use-bad-args-2.rs`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0466, E0601.
+For more information about an error, try `rustc --explain E0466`.
diff --git a/src/test/compile-fail/macro-use-scope.rs b/src/test/ui/macros/macro-use-scope.rs
similarity index 100%
rename from src/test/compile-fail/macro-use-scope.rs
rename to src/test/ui/macros/macro-use-scope.rs
diff --git a/src/test/ui/macros/macro-use-scope.stderr b/src/test/ui/macros/macro-use-scope.stderr
new file mode 100644
index 0000000..2e81750
--- /dev/null
+++ b/src/test/ui/macros/macro-use-scope.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/macro-use-scope.rs:32:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/macro-use-undef.rs b/src/test/ui/macros/macro-use-undef.rs
similarity index 100%
rename from src/test/compile-fail/macro-use-undef.rs
rename to src/test/ui/macros/macro-use-undef.rs
diff --git a/src/test/ui/macros/macro-use-undef.stderr b/src/test/ui/macros/macro-use-undef.stderr
new file mode 100644
index 0000000..6fc57a3
--- /dev/null
+++ b/src/test/ui/macros/macro-use-undef.stderr
@@ -0,0 +1,9 @@
+error[E0469]: imported macro not found
+ --> $DIR/macro-use-undef.rs:13:24
+ |
+LL | #[macro_use(macro_two, no_way)] //~ ERROR imported macro not found
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0469`.
diff --git a/src/test/compile-fail/macro-use-wrong-name.rs b/src/test/ui/macros/macro-use-wrong-name.rs
similarity index 100%
rename from src/test/compile-fail/macro-use-wrong-name.rs
rename to src/test/ui/macros/macro-use-wrong-name.rs
diff --git a/src/test/ui/macros/macro-use-wrong-name.stderr b/src/test/ui/macros/macro-use-wrong-name.stderr
new file mode 100644
index 0000000..26271a2
--- /dev/null
+++ b/src/test/ui/macros/macro-use-wrong-name.stderr
@@ -0,0 +1,8 @@
+error: cannot find macro `macro_two!` in this scope
+ --> $DIR/macro-use-wrong-name.rs:17:5
+ |
+LL | macro_two!();
+ | ^^^^^^^^^ help: you could try the macro: `macro_one`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/macros/macro_undefined.rs b/src/test/ui/macros/macro_undefined.rs
index c0acbc9..4a81273 100644
--- a/src/test/ui/macros/macro_undefined.rs
+++ b/src/test/ui/macros/macro_undefined.rs
@@ -19,5 +19,5 @@
fn main() {
k!(); //~ ERROR cannot find
- kl!(); //~ ERROR cannot find
+ kl!();
}
diff --git a/src/test/ui/macros/macro_undefined.stderr b/src/test/ui/macros/macro_undefined.stderr
index 8d44df8..87b039f 100644
--- a/src/test/ui/macros/macro_undefined.stderr
+++ b/src/test/ui/macros/macro_undefined.stderr
@@ -1,16 +1,8 @@
-error: cannot find macro `kl!` in this scope
- --> $DIR/macro_undefined.rs:22:5
- |
-LL | kl!(); //~ ERROR cannot find
- | ^^
- |
- = help: have you added the `#[macro_use]` on the module/import?
-
error: cannot find macro `k!` in this scope
--> $DIR/macro_undefined.rs:21:5
|
LL | k!(); //~ ERROR cannot find
| ^ help: you could try the macro: `kl`
-error: aborting due to 2 previous errors
+error: aborting due to previous error
diff --git a/src/test/compile-fail/macros-in-extern.rs b/src/test/ui/macros/macros-in-extern.rs
similarity index 100%
rename from src/test/compile-fail/macros-in-extern.rs
rename to src/test/ui/macros/macros-in-extern.rs
diff --git a/src/test/ui/macros/macros-in-extern.stderr b/src/test/ui/macros/macros-in-extern.stderr
new file mode 100644
index 0000000..60492d3
--- /dev/null
+++ b/src/test/ui/macros/macros-in-extern.stderr
@@ -0,0 +1,27 @@
+error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476)
+ --> $DIR/macros-in-extern.rs:36:5
+ |
+LL | returns_isize!(rust_get_test_int);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(macros_in_extern)] to the crate attributes to enable
+
+error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476)
+ --> $DIR/macros-in-extern.rs:38:5
+ |
+LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(macros_in_extern)] to the crate attributes to enable
+
+error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476)
+ --> $DIR/macros-in-extern.rs:40:5
+ |
+LL | emits_nothing!();
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(macros_in_extern)] to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/macros/macros-nonfatal-errors.rs b/src/test/ui/macros/macros-nonfatal-errors.rs
new file mode 100644
index 0000000..ce2dfb9
--- /dev/null
+++ b/src/test/ui/macros/macros-nonfatal-errors.rs
@@ -0,0 +1,43 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// normalize-stderr-test: "The system cannot find the file specified\." -> "No such file or directory"
+// ignore-tidy-linelength
+
+// test that errors in a (selection) of macros don't kill compilation
+// immediately, so that we get more errors listed at a time.
+
+#![feature(asm)]
+#![feature(trace_macros, concat_idents)]
+
+#[derive(Default)] //~ ERROR
+enum OrDeriveThis {}
+
+fn main() {
+ asm!(invalid); //~ ERROR
+
+ concat_idents!("not", "idents"); //~ ERROR
+
+ option_env!(invalid); //~ ERROR
+ env!(invalid); //~ ERROR
+ env!(foo, abr, baz); //~ ERROR
+ env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR
+
+ format!(invalid); //~ ERROR
+
+ include!(invalid); //~ ERROR
+
+ include_str!(invalid); //~ ERROR
+ include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR
+ include_bytes!(invalid); //~ ERROR
+ include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR
+
+ trace_macros!(invalid); //~ ERROR
+}
diff --git a/src/test/ui/macros/macros-nonfatal-errors.stderr b/src/test/ui/macros/macros-nonfatal-errors.stderr
new file mode 100644
index 0000000..81e250d
--- /dev/null
+++ b/src/test/ui/macros/macros-nonfatal-errors.stderr
@@ -0,0 +1,91 @@
+error[E0665]: `Default` cannot be derived for enums, only structs
+ --> $DIR/macros-nonfatal-errors.rs:20:10
+ |
+LL | #[derive(Default)] //~ ERROR
+ | ^^^^^^^
+
+error: inline assembly must be a string literal
+ --> $DIR/macros-nonfatal-errors.rs:24:10
+ |
+LL | asm!(invalid); //~ ERROR
+ | ^^^^^^^
+
+error: concat_idents! requires ident args.
+ --> $DIR/macros-nonfatal-errors.rs:26:5
+ |
+LL | concat_idents!("not", "idents"); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: argument must be a string literal
+ --> $DIR/macros-nonfatal-errors.rs:28:17
+ |
+LL | option_env!(invalid); //~ ERROR
+ | ^^^^^^^
+
+error: expected string literal
+ --> $DIR/macros-nonfatal-errors.rs:29:10
+ |
+LL | env!(invalid); //~ ERROR
+ | ^^^^^^^
+
+error: expected string literal
+ --> $DIR/macros-nonfatal-errors.rs:30:10
+ |
+LL | env!(foo, abr, baz); //~ ERROR
+ | ^^^
+
+error: environment variable `RUST_HOPEFULLY_THIS_DOESNT_EXIST` not defined
+ --> $DIR/macros-nonfatal-errors.rs:31:5
+ |
+LL | env!("RUST_HOPEFULLY_THIS_DOESNT_EXIST"); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: format argument must be a string literal
+ --> $DIR/macros-nonfatal-errors.rs:33:13
+ |
+LL | format!(invalid); //~ ERROR
+ | ^^^^^^^
+help: you might be missing a string literal to format with
+ |
+LL | format!("{}", invalid); //~ ERROR
+ | ^^^^^
+
+error: argument must be a string literal
+ --> $DIR/macros-nonfatal-errors.rs:35:14
+ |
+LL | include!(invalid); //~ ERROR
+ | ^^^^^^^
+
+error: argument must be a string literal
+ --> $DIR/macros-nonfatal-errors.rs:37:18
+ |
+LL | include_str!(invalid); //~ ERROR
+ | ^^^^^^^
+
+error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: No such file or directory (os error 2)
+ --> $DIR/macros-nonfatal-errors.rs:38:5
+ |
+LL | include_str!("i'd be quite surprised if a file with this name existed"); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: argument must be a string literal
+ --> $DIR/macros-nonfatal-errors.rs:39:20
+ |
+LL | include_bytes!(invalid); //~ ERROR
+ | ^^^^^^^
+
+error: couldn't read $DIR/i'd be quite surprised if a file with this name existed: No such file or directory (os error 2)
+ --> $DIR/macros-nonfatal-errors.rs:40:5
+ |
+LL | include_bytes!("i'd be quite surprised if a file with this name existed"); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/macros-nonfatal-errors.rs:42:5
+ |
+LL | trace_macros!(invalid); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 14 previous errors
+
+For more information about this error, try `rustc --explain E0665`.
diff --git a/src/test/ui/macros/missing-comma.rs b/src/test/ui/macros/missing-comma.rs
index ac82171..07e69b9 100644
--- a/src/test/ui/macros/missing-comma.rs
+++ b/src/test/ui/macros/missing-comma.rs
@@ -9,7 +9,11 @@
// except according to those terms.
macro_rules! foo {
- ($a:ident, $b:ident) => ()
+ ($a:ident) => ();
+ ($a:ident, $b:ident) => ();
+ ($a:ident, $b:ident, $c:ident) => ();
+ ($a:ident, $b:ident, $c:ident, $d:ident) => ();
+ ($a:ident, $b:ident, $c:ident, $d:ident, $e:ident) => ();
}
fn main() {
@@ -17,4 +21,10 @@
//~^ ERROR expected token: `,`
foo!(a b);
//~^ ERROR no rules expected the token `b`
+ foo!(a, b, c, d e);
+ //~^ ERROR no rules expected the token `e`
+ foo!(a, b, c d, e);
+ //~^ ERROR no rules expected the token `d`
+ foo!(a, b, c d e);
+ //~^ ERROR no rules expected the token `d`
}
diff --git a/src/test/ui/macros/missing-comma.stderr b/src/test/ui/macros/missing-comma.stderr
index 3467032..9d8de87 100644
--- a/src/test/ui/macros/missing-comma.stderr
+++ b/src/test/ui/macros/missing-comma.stderr
@@ -1,16 +1,38 @@
error: expected token: `,`
- --> $DIR/missing-comma.rs:16:19
+ --> $DIR/missing-comma.rs:20:19
|
LL | println!("{}" a);
| ^
error: no rules expected the token `b`
- --> $DIR/missing-comma.rs:18:12
+ --> $DIR/missing-comma.rs:22:12
|
LL | foo!(a b);
| -^
| |
| help: missing comma here
-error: aborting due to 2 previous errors
+error: no rules expected the token `e`
+ --> $DIR/missing-comma.rs:24:21
+ |
+LL | foo!(a, b, c, d e);
+ | -^
+ | |
+ | help: missing comma here
+
+error: no rules expected the token `d`
+ --> $DIR/missing-comma.rs:26:18
+ |
+LL | foo!(a, b, c d, e);
+ | -^
+ | |
+ | help: missing comma here
+
+error: no rules expected the token `d`
+ --> $DIR/missing-comma.rs:28:18
+ |
+LL | foo!(a, b, c d e);
+ | ^
+
+error: aborting due to 5 previous errors
diff --git a/src/test/compile-fail/main-wrong-type.rs b/src/test/ui/main-wrong-type.rs
similarity index 100%
rename from src/test/compile-fail/main-wrong-type.rs
rename to src/test/ui/main-wrong-type.rs
diff --git a/src/test/ui/main-wrong-type.stderr b/src/test/ui/main-wrong-type.stderr
new file mode 100644
index 0000000..15094bd
--- /dev/null
+++ b/src/test/ui/main-wrong-type.stderr
@@ -0,0 +1,12 @@
+error[E0580]: main function has wrong type
+ --> $DIR/main-wrong-type.rs:16:1
+ |
+LL | fn main(foo: S) {
+ | ^^^^^^^^^^^^^^^ incorrect number of function parameters
+ |
+ = note: expected type `fn()`
+ found type `fn(S)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0580`.
diff --git a/src/test/compile-fail/malformed-derive-entry.rs b/src/test/ui/malformed/malformed-derive-entry.rs
similarity index 100%
rename from src/test/compile-fail/malformed-derive-entry.rs
rename to src/test/ui/malformed/malformed-derive-entry.rs
diff --git a/src/test/ui/malformed/malformed-derive-entry.stderr b/src/test/ui/malformed/malformed-derive-entry.stderr
new file mode 100644
index 0000000..b1984f5
--- /dev/null
+++ b/src/test/ui/malformed/malformed-derive-entry.stderr
@@ -0,0 +1,26 @@
+error: expected one of `)`, `,`, or `::`, found `(`
+ --> $DIR/malformed-derive-entry.rs:11:14
+ |
+LL | #[derive(Copy(Bad))]
+ | ^ expected one of `)`, `,`, or `::` here
+
+error: expected one of `)`, `,`, or `::`, found `=`
+ --> $DIR/malformed-derive-entry.rs:15:14
+ |
+LL | #[derive(Copy="bad")]
+ | ^ expected one of `)`, `,`, or `::` here
+
+warning: empty trait list in `derive`
+ --> $DIR/malformed-derive-entry.rs:19:1
+ |
+LL | #[derive()]
+ | ^^^^^^^^^^^
+
+warning: empty trait list in `derive`
+ --> $DIR/malformed-derive-entry.rs:23:1
+ |
+LL | #[derive]
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/malformed-plugin-1.rs b/src/test/ui/malformed/malformed-plugin-1.rs
similarity index 100%
rename from src/test/compile-fail/malformed-plugin-1.rs
rename to src/test/ui/malformed/malformed-plugin-1.rs
diff --git a/src/test/ui/malformed/malformed-plugin-1.stderr b/src/test/ui/malformed/malformed-plugin-1.stderr
new file mode 100644
index 0000000..5ceabc3
--- /dev/null
+++ b/src/test/ui/malformed/malformed-plugin-1.stderr
@@ -0,0 +1,9 @@
+error[E0498]: malformed plugin attribute
+ --> $DIR/malformed-plugin-1.rs:12:1
+ |
+LL | #![plugin] //~ ERROR malformed plugin attribute
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0498`.
diff --git a/src/test/compile-fail/malformed-plugin-2.rs b/src/test/ui/malformed/malformed-plugin-2.rs
similarity index 100%
rename from src/test/compile-fail/malformed-plugin-2.rs
rename to src/test/ui/malformed/malformed-plugin-2.rs
diff --git a/src/test/ui/malformed/malformed-plugin-2.stderr b/src/test/ui/malformed/malformed-plugin-2.stderr
new file mode 100644
index 0000000..56c87f9
--- /dev/null
+++ b/src/test/ui/malformed/malformed-plugin-2.stderr
@@ -0,0 +1,9 @@
+error[E0498]: malformed plugin attribute
+ --> $DIR/malformed-plugin-2.rs:12:1
+ |
+LL | #![plugin="bleh"] //~ ERROR malformed plugin attribute
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0498`.
diff --git a/src/test/compile-fail/malformed-plugin-3.rs b/src/test/ui/malformed/malformed-plugin-3.rs
similarity index 100%
rename from src/test/compile-fail/malformed-plugin-3.rs
rename to src/test/ui/malformed/malformed-plugin-3.rs
diff --git a/src/test/ui/malformed/malformed-plugin-3.stderr b/src/test/ui/malformed/malformed-plugin-3.stderr
new file mode 100644
index 0000000..fff52c6
--- /dev/null
+++ b/src/test/ui/malformed/malformed-plugin-3.stderr
@@ -0,0 +1,9 @@
+error[E0498]: malformed plugin attribute
+ --> $DIR/malformed-plugin-3.rs:12:1
+ |
+LL | #![plugin(foo="bleh")] //~ ERROR malformed plugin attribute
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0498`.
diff --git a/src/test/compile-fail/malformed_macro_lhs.rs b/src/test/ui/malformed_macro_lhs.rs
similarity index 100%
rename from src/test/compile-fail/malformed_macro_lhs.rs
rename to src/test/ui/malformed_macro_lhs.rs
diff --git a/src/test/ui/malformed_macro_lhs.stderr b/src/test/ui/malformed_macro_lhs.stderr
new file mode 100644
index 0000000..6b42418
--- /dev/null
+++ b/src/test/ui/malformed_macro_lhs.stderr
@@ -0,0 +1,8 @@
+error: invalid macro matcher; matchers must be contained in balanced delimiters
+ --> $DIR/malformed_macro_lhs.rs:12:5
+ |
+LL | t => (1); //~ ERROR invalid macro matcher
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/manual-link-bad-form.rs b/src/test/ui/manual/manual-link-bad-form.rs
similarity index 100%
rename from src/test/compile-fail/manual-link-bad-form.rs
rename to src/test/ui/manual/manual-link-bad-form.rs
diff --git a/src/test/ui/manual/manual-link-bad-form.stderr b/src/test/ui/manual/manual-link-bad-form.stderr
new file mode 100644
index 0000000..ed3c4c4
--- /dev/null
+++ b/src/test/ui/manual/manual-link-bad-form.stderr
@@ -0,0 +1,4 @@
+error: empty library name given via `-l`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/manual-link-bad-kind.rs b/src/test/ui/manual/manual-link-bad-kind.rs
similarity index 100%
rename from src/test/compile-fail/manual-link-bad-kind.rs
rename to src/test/ui/manual/manual-link-bad-kind.rs
diff --git a/src/test/ui/manual/manual-link-bad-kind.stderr b/src/test/ui/manual/manual-link-bad-kind.stderr
new file mode 100644
index 0000000..03c33a9
--- /dev/null
+++ b/src/test/ui/manual/manual-link-bad-kind.stderr
@@ -0,0 +1,2 @@
+error: unknown library kind `bar`, expected one of dylib, framework, or static
+
diff --git a/src/test/compile-fail/manual-link-bad-search-path.rs b/src/test/ui/manual/manual-link-bad-search-path.rs
similarity index 100%
rename from src/test/compile-fail/manual-link-bad-search-path.rs
rename to src/test/ui/manual/manual-link-bad-search-path.rs
diff --git a/src/test/ui/manual/manual-link-bad-search-path.stderr b/src/test/ui/manual/manual-link-bad-search-path.stderr
new file mode 100644
index 0000000..2c0649e
--- /dev/null
+++ b/src/test/ui/manual/manual-link-bad-search-path.stderr
@@ -0,0 +1,2 @@
+error: empty search path given via `-L`
+
diff --git a/src/test/compile-fail/manual-link-framework.rs b/src/test/ui/manual/manual-link-framework.rs
similarity index 100%
rename from src/test/compile-fail/manual-link-framework.rs
rename to src/test/ui/manual/manual-link-framework.rs
diff --git a/src/test/ui/manual/manual-link-framework.stderr b/src/test/ui/manual/manual-link-framework.stderr
new file mode 100644
index 0000000..3e8da8b
--- /dev/null
+++ b/src/test/ui/manual/manual-link-framework.stderr
@@ -0,0 +1,4 @@
+error: native frameworks are only available on macOS targets
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/map-types.rs b/src/test/ui/map-types.rs
similarity index 100%
rename from src/test/compile-fail/map-types.rs
rename to src/test/ui/map-types.rs
diff --git a/src/test/ui/map-types.stderr b/src/test/ui/map-types.stderr
new file mode 100644
index 0000000..722113c
--- /dev/null
+++ b/src/test/ui/map-types.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `std::boxed::Box<dyn Map<isize, isize>>: Map<usize, isize>` is not satisfied
+ --> $DIR/map-types.rs:27:37
+ |
+LL | let y: Box<Map<usize, isize>> = Box::new(x);
+ | ^^^^^^^^^^^ the trait `Map<usize, isize>` is not implemented for `std::boxed::Box<dyn Map<isize, isize>>`
+ |
+ = note: required for the cast to the object type `dyn Map<usize, isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/match-argm-statics-2.rs b/src/test/ui/match/match-argm-statics-2.rs
similarity index 100%
rename from src/test/compile-fail/match-argm-statics-2.rs
rename to src/test/ui/match/match-argm-statics-2.rs
diff --git a/src/test/ui/match/match-argm-statics-2.stderr b/src/test/ui/match/match-argm-statics-2.stderr
new file mode 100644
index 0000000..485b2a3
--- /dev/null
+++ b/src/test/ui/match/match-argm-statics-2.stderr
@@ -0,0 +1,21 @@
+error[E0004]: non-exhaustive patterns: `(true, false)` not covered
+ --> $DIR/match-argm-statics-2.rs:27:11
+ |
+LL | match (true, false) {
+ | ^^^^^^^^^^^^^ pattern `(true, false)` not covered
+
+error[E0004]: non-exhaustive patterns: `Some(Some(West))` not covered
+ --> $DIR/match-argm-statics-2.rs:39:11
+ |
+LL | match Some(Some(North)) {
+ | ^^^^^^^^^^^^^^^^^ pattern `Some(Some(West))` not covered
+
+error[E0004]: non-exhaustive patterns: `Foo { bar: Some(North), baz: NewBool(true) }` not covered
+ --> $DIR/match-argm-statics-2.rs:58:11
+ |
+LL | match (Foo { bar: Some(North), baz: NewBool(true) }) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ pattern `Foo { bar: Some(North), baz: NewBool(true) }` not covered
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/match-arm-statics.rs b/src/test/ui/match/match-arm-statics.rs
similarity index 100%
rename from src/test/compile-fail/match-arm-statics.rs
rename to src/test/ui/match/match-arm-statics.rs
diff --git a/src/test/ui/match/match-arm-statics.stderr b/src/test/ui/match/match-arm-statics.stderr
new file mode 100644
index 0000000..8862be2
--- /dev/null
+++ b/src/test/ui/match/match-arm-statics.stderr
@@ -0,0 +1,26 @@
+error: unreachable pattern
+ --> $DIR/match-arm-statics.rs:35:9
+ |
+LL | (true, true) => ()
+ | ^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-arm-statics.rs:12:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-arm-statics.rs:50:9
+ |
+LL | Some(Some(East)) => (),
+ | ^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-arm-statics.rs:70:9
+ |
+LL | Foo { bar: Some(EAST), baz: NewBool(false) } => ()
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/match-byte-array-patterns-2.rs b/src/test/ui/match/match-byte-array-patterns-2.rs
similarity index 100%
rename from src/test/compile-fail/match-byte-array-patterns-2.rs
rename to src/test/ui/match/match-byte-array-patterns-2.rs
diff --git a/src/test/ui/match/match-byte-array-patterns-2.stderr b/src/test/ui/match/match-byte-array-patterns-2.stderr
new file mode 100644
index 0000000..bc52376
--- /dev/null
+++ b/src/test/ui/match/match-byte-array-patterns-2.stderr
@@ -0,0 +1,15 @@
+error[E0004]: non-exhaustive patterns: `&[_, _, _, _]` not covered
+ --> $DIR/match-byte-array-patterns-2.rs:14:11
+ |
+LL | match buf { //~ ERROR non-exhaustive
+ | ^^^ pattern `&[_, _, _, _]` not covered
+
+error[E0004]: non-exhaustive patterns: `&[]`, `&[_]`, `&[_, _]` and 3 more not covered
+ --> $DIR/match-byte-array-patterns-2.rs:20:11
+ |
+LL | match buf { //~ ERROR non-exhaustive
+ | ^^^ patterns `&[]`, `&[_]`, `&[_, _]` and 3 more not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/match-byte-array-patterns.rs b/src/test/ui/match/match-byte-array-patterns.rs
similarity index 100%
rename from src/test/compile-fail/match-byte-array-patterns.rs
rename to src/test/ui/match/match-byte-array-patterns.rs
diff --git a/src/test/ui/match/match-byte-array-patterns.stderr b/src/test/ui/match/match-byte-array-patterns.stderr
new file mode 100644
index 0000000..da3d577
--- /dev/null
+++ b/src/test/ui/match/match-byte-array-patterns.stderr
@@ -0,0 +1,56 @@
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:19:9
+ |
+LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-byte-array-patterns.rs:12:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:25:9
+ |
+LL | b"AAAA" => {}, //~ ERROR unreachable pattern
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:31:9
+ |
+LL | b"AAAA" => {}, //~ ERROR unreachable pattern
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:37:9
+ |
+LL | b"AAAA" => {}, //~ ERROR unreachable pattern
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:45:9
+ |
+LL | &[0x41, 0x41, 0x41, 0x41] => {} //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:51:9
+ |
+LL | b"AAAA" => {}, //~ ERROR unreachable pattern
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:57:9
+ |
+LL | b"AAAA" => {}, //~ ERROR unreachable pattern
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-byte-array-patterns.rs:63:9
+ |
+LL | b"AAAA" => {}, //~ ERROR unreachable pattern
+ | ^^^^^^^
+
+error: aborting due to 8 previous errors
+
diff --git a/src/test/compile-fail/match-ill-type2.rs b/src/test/ui/match/match-ill-type2.rs
similarity index 100%
rename from src/test/compile-fail/match-ill-type2.rs
rename to src/test/ui/match/match-ill-type2.rs
diff --git a/src/test/ui/match/match-ill-type2.stderr b/src/test/ui/match/match-ill-type2.stderr
new file mode 100644
index 0000000..b649a38
--- /dev/null
+++ b/src/test/ui/match/match-ill-type2.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/match-ill-type2.rs:14:9
+ |
+LL | 2u32 => 1, //~ ERROR mismatched types
+ | ^^^^ expected i32, found u32
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/match-join.rs b/src/test/ui/match/match-join.rs
similarity index 100%
rename from src/test/compile-fail/match-join.rs
rename to src/test/ui/match/match-join.rs
diff --git a/src/test/ui/match/match-join.stderr b/src/test/ui/match/match-join.stderr
new file mode 100644
index 0000000..a4a8a9d
--- /dev/null
+++ b/src/test/ui/match/match-join.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `x` in this scope
+ --> $DIR/match-join.rs:19:20
+ |
+LL | println!("{}", x); //~ ERROR cannot find value `x` in this scope
+ | ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/match-no-arms-unreachable-after.rs b/src/test/ui/match/match-no-arms-unreachable-after.rs
similarity index 100%
rename from src/test/compile-fail/match-no-arms-unreachable-after.rs
rename to src/test/ui/match/match-no-arms-unreachable-after.rs
diff --git a/src/test/ui/match/match-no-arms-unreachable-after.stderr b/src/test/ui/match/match-no-arms-unreachable-after.stderr
new file mode 100644
index 0000000..35fae05
--- /dev/null
+++ b/src/test/ui/match/match-no-arms-unreachable-after.stderr
@@ -0,0 +1,14 @@
+error: unreachable statement
+ --> $DIR/match-no-arms-unreachable-after.rs:18:5
+ |
+LL | let x = 2; //~ ERROR unreachable
+ | ^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-no-arms-unreachable-after.rs:12:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/match-non-exhaustive.rs b/src/test/ui/match/match-non-exhaustive.rs
similarity index 100%
rename from src/test/compile-fail/match-non-exhaustive.rs
rename to src/test/ui/match/match-non-exhaustive.rs
diff --git a/src/test/ui/match/match-non-exhaustive.stderr b/src/test/ui/match/match-non-exhaustive.stderr
new file mode 100644
index 0000000..04f09ca
--- /dev/null
+++ b/src/test/ui/match/match-non-exhaustive.stderr
@@ -0,0 +1,15 @@
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/match-non-exhaustive.rs:12:11
+ |
+LL | match 0 { 1 => () } //~ ERROR non-exhaustive patterns
+ | ^ pattern `_` not covered
+
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/match-non-exhaustive.rs:13:11
+ |
+LL | match 0 { 0 if false => () } //~ ERROR non-exhaustive patterns
+ | ^ pattern `_` not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/match-pattern-field-mismatch-2.rs b/src/test/ui/match/match-pattern-field-mismatch-2.rs
similarity index 100%
rename from src/test/compile-fail/match-pattern-field-mismatch-2.rs
rename to src/test/ui/match/match-pattern-field-mismatch-2.rs
diff --git a/src/test/ui/match/match-pattern-field-mismatch-2.stderr b/src/test/ui/match/match-pattern-field-mismatch-2.stderr
new file mode 100644
index 0000000..b43fa91
--- /dev/null
+++ b/src/test/ui/match/match-pattern-field-mismatch-2.stderr
@@ -0,0 +1,9 @@
+error[E0532]: expected tuple struct/variant, found unit variant `color::no_color`
+ --> $DIR/match-pattern-field-mismatch-2.rs:22:11
+ |
+LL | color::no_color(_) => { }
+ | ^^^^^^^^^^^^^^^ not a tuple struct/variant
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/match-pattern-field-mismatch.rs b/src/test/ui/match/match-pattern-field-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/match-pattern-field-mismatch.rs
rename to src/test/ui/match/match-pattern-field-mismatch.rs
diff --git a/src/test/ui/match/match-pattern-field-mismatch.stderr b/src/test/ui/match/match-pattern-field-mismatch.stderr
new file mode 100644
index 0000000..d975f9a
--- /dev/null
+++ b/src/test/ui/match/match-pattern-field-mismatch.stderr
@@ -0,0 +1,9 @@
+error[E0023]: this pattern has 2 fields, but the corresponding tuple variant has 3 fields
+ --> $DIR/match-pattern-field-mismatch.rs:20:11
+ |
+LL | color::rgb(_, _) => { }
+ | ^^^^^^^^^^^^^^^^ expected 3 fields, found 2
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0023`.
diff --git a/src/test/compile-fail/match-privately-empty.rs b/src/test/ui/match/match-privately-empty.rs
similarity index 100%
rename from src/test/compile-fail/match-privately-empty.rs
rename to src/test/ui/match/match-privately-empty.rs
diff --git a/src/test/ui/match/match-privately-empty.stderr b/src/test/ui/match/match-privately-empty.stderr
new file mode 100644
index 0000000..04b4ce0
--- /dev/null
+++ b/src/test/ui/match/match-privately-empty.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `Some(Private { misc: true, .. })` not covered
+ --> $DIR/match-privately-empty.rs:23:11
+ |
+LL | match private::DATA {
+ | ^^^^^^^^^^^^^ pattern `Some(Private { misc: true, .. })` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/match-range-fail-2.rs b/src/test/ui/match/match-range-fail-2.rs
similarity index 100%
rename from src/test/compile-fail/match-range-fail-2.rs
rename to src/test/ui/match/match-range-fail-2.rs
diff --git a/src/test/ui/match/match-range-fail-2.stderr b/src/test/ui/match/match-range-fail-2.stderr
new file mode 100644
index 0000000..616f74e
--- /dev/null
+++ b/src/test/ui/match/match-range-fail-2.stderr
@@ -0,0 +1,22 @@
+error[E0030]: lower range bound must be less than or equal to upper
+ --> $DIR/match-range-fail-2.rs:15:9
+ |
+LL | 6 ..= 1 => { }
+ | ^ lower bound larger than upper bound
+
+error[E0579]: lower range bound must be less than upper
+ --> $DIR/match-range-fail-2.rs:21:9
+ |
+LL | 0 .. 0 => { }
+ | ^
+
+error[E0030]: lower range bound must be less than or equal to upper
+ --> $DIR/match-range-fail-2.rs:27:9
+ |
+LL | 0xFFFF_FFFF_FFFF_FFFF ..= 1 => { }
+ | ^^^^^^^^^^^^^^^^^^^^^ lower bound larger than upper bound
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0030, E0579.
+For more information about an error, try `rustc --explain E0030`.
diff --git a/src/test/compile-fail/match-range-fail-dominate.rs b/src/test/ui/match/match-range-fail-dominate.rs
similarity index 100%
rename from src/test/compile-fail/match-range-fail-dominate.rs
rename to src/test/ui/match/match-range-fail-dominate.rs
diff --git a/src/test/ui/match/match-range-fail-dominate.stderr b/src/test/ui/match/match-range-fail-dominate.stderr
new file mode 100644
index 0000000..d75630e
--- /dev/null
+++ b/src/test/ui/match/match-range-fail-dominate.stderr
@@ -0,0 +1,66 @@
+error: unreachable pattern
+ --> $DIR/match-range-fail-dominate.rs:22:7
+ |
+LL | 5 ... 6 => { }
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-range-fail-dominate.rs:17:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-range-fail-dominate.rs:28:7
+ |
+LL | 4 ... 6 => { }
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-range-fail-dominate.rs:34:7
+ |
+LL | 4 ... 6 => { }
+ | ^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-range-fail-dominate.rs:40:7
+ |
+LL | 'a' ... 'z' => {}
+ | ^^^^^^^^^^^
+
+warning: floating-point types cannot be used in patterns
+ --> $DIR/match-range-fail-dominate.rs:45:7
+ |
+LL | 0.01f64 ... 6.5f64 => {}
+ | ^^^^^^^
+ |
+ = note: #[warn(illegal_floating_point_literal_pattern)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+warning: floating-point types cannot be used in patterns
+ --> $DIR/match-range-fail-dominate.rs:45:19
+ |
+LL | 0.01f64 ... 6.5f64 => {}
+ | ^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+warning: floating-point types cannot be used in patterns
+ --> $DIR/match-range-fail-dominate.rs:46:7
+ |
+LL | 0.02f64 => {}
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: unreachable pattern
+ --> $DIR/match-range-fail-dominate.rs:46:7
+ |
+LL | 0.02f64 => {}
+ | ^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/match-range-fail.rs b/src/test/ui/match/match-range-fail.rs
similarity index 100%
rename from src/test/compile-fail/match-range-fail.rs
rename to src/test/ui/match/match-range-fail.rs
diff --git a/src/test/ui/match/match-range-fail.stderr b/src/test/ui/match/match-range-fail.stderr
new file mode 100644
index 0000000..dbc2510
--- /dev/null
+++ b/src/test/ui/match/match-range-fail.stderr
@@ -0,0 +1,31 @@
+error[E0029]: only char and numeric types are allowed in range patterns
+ --> $DIR/match-range-fail.rs:13:9
+ |
+LL | "bar" ..= "foo" => { }
+ | ^^^^^^^^^^^^^^^ ranges require char or numeric types
+ |
+ = note: start type: &'static str
+ = note: end type: &'static str
+
+error[E0029]: only char and numeric types are allowed in range patterns
+ --> $DIR/match-range-fail.rs:20:16
+ |
+LL | 10 ..= "what" => ()
+ | ^^^^^^ ranges require char or numeric types
+ |
+ = note: start type: {integer}
+ = note: end type: &'static str
+
+error[E0308]: mismatched types
+ --> $DIR/match-range-fail.rs:27:9
+ |
+LL | 'c' ..= 100 => { }
+ | ^^^^^^^^^^^ expected integral variable, found char
+ |
+ = note: expected type `{integer}`
+ found type `char`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0029, E0308.
+For more information about an error, try `rustc --explain E0029`.
diff --git a/src/test/compile-fail/match-ref-ice.rs b/src/test/ui/match/match-ref-ice.rs
similarity index 100%
rename from src/test/compile-fail/match-ref-ice.rs
rename to src/test/ui/match/match-ref-ice.rs
diff --git a/src/test/ui/match/match-ref-ice.stderr b/src/test/ui/match/match-ref-ice.stderr
new file mode 100644
index 0000000..1dc87af
--- /dev/null
+++ b/src/test/ui/match/match-ref-ice.stderr
@@ -0,0 +1,14 @@
+error: unreachable pattern
+ --> $DIR/match-ref-ice.rs:23:9
+ |
+LL | [1, 2, 3] => (), //~ ERROR unreachable pattern
+ | ^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-ref-ice.rs:11:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/match/match-ref-mut-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-invariance.nll.stderr
new file mode 100644
index 0000000..26fcaa6
--- /dev/null
+++ b/src/test/ui/match/match-ref-mut-invariance.nll.stderr
@@ -0,0 +1,21 @@
+warning: not reporting region error due to nll
+ --> $DIR/match-ref-mut-invariance.rs:20:37
+ |
+LL | match self.0 { ref mut x => x } //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/match-ref-mut-invariance.rs:19:49
+ |
+LL | impl<'b> S<'b> {
+ | -- lifetime `'b` defined here
+LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+ | ____________--___________________________________^
+ | | |
+ | | lifetime `'a` defined here
+LL | | match self.0 { ref mut x => x } //~ ERROR mismatched types
+LL | | }
+ | |_____^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/match-ref-mut-invariance.rs b/src/test/ui/match/match-ref-mut-invariance.rs
similarity index 100%
rename from src/test/compile-fail/match-ref-mut-invariance.rs
rename to src/test/ui/match/match-ref-mut-invariance.rs
diff --git a/src/test/ui/match/match-ref-mut-invariance.stderr b/src/test/ui/match/match-ref-mut-invariance.stderr
new file mode 100644
index 0000000..24677fe
--- /dev/null
+++ b/src/test/ui/match/match-ref-mut-invariance.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+ --> $DIR/match-ref-mut-invariance.rs:20:37
+ |
+LL | match self.0 { ref mut x => x } //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `&'a mut &'a i32`
+ found type `&'a mut &'b i32`
+note: the lifetime 'a as defined on the method body at 19:12...
+ --> $DIR/match-ref-mut-invariance.rs:19:12
+ |
+LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 18:6
+ --> $DIR/match-ref-mut-invariance.rs:18:6
+ |
+LL | impl<'b> S<'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr
new file mode 100644
index 0000000..b1ec6ad
--- /dev/null
+++ b/src/test/ui/match/match-ref-mut-let-invariance.nll.stderr
@@ -0,0 +1,22 @@
+warning: not reporting region error due to nll
+ --> $DIR/match-ref-mut-let-invariance.rs:21:9
+ |
+LL | x //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/match-ref-mut-let-invariance.rs:19:49
+ |
+LL | impl<'b> S<'b> {
+ | -- lifetime `'b` defined here
+LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+ | ____________--___________________________________^
+ | | |
+ | | lifetime `'a` defined here
+LL | | let ref mut x = self.0;
+LL | | x //~ ERROR mismatched types
+LL | | }
+ | |_____^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/match-ref-mut-let-invariance.rs b/src/test/ui/match/match-ref-mut-let-invariance.rs
similarity index 100%
rename from src/test/compile-fail/match-ref-mut-let-invariance.rs
rename to src/test/ui/match/match-ref-mut-let-invariance.rs
diff --git a/src/test/ui/match/match-ref-mut-let-invariance.stderr b/src/test/ui/match/match-ref-mut-let-invariance.stderr
new file mode 100644
index 0000000..cc096d6
--- /dev/null
+++ b/src/test/ui/match/match-ref-mut-let-invariance.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+ --> $DIR/match-ref-mut-let-invariance.rs:21:9
+ |
+LL | x //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `&'a mut &'a i32`
+ found type `&'a mut &'b i32`
+note: the lifetime 'a as defined on the method body at 19:12...
+ --> $DIR/match-ref-mut-let-invariance.rs:19:12
+ |
+LL | fn bar<'a>(&'a mut self) -> &'a mut &'a i32 {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 18:6
+ --> $DIR/match-ref-mut-let-invariance.rs:18:6
+ |
+LL | impl<'b> S<'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/match-slice-patterns.rs b/src/test/ui/match/match-slice-patterns.rs
similarity index 100%
rename from src/test/compile-fail/match-slice-patterns.rs
rename to src/test/ui/match/match-slice-patterns.rs
diff --git a/src/test/ui/match/match-slice-patterns.stderr b/src/test/ui/match/match-slice-patterns.stderr
new file mode 100644
index 0000000..cefd7df
--- /dev/null
+++ b/src/test/ui/match/match-slice-patterns.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `&[_, Some(_), None, _]` not covered
+ --> $DIR/match-slice-patterns.rs:14:11
+ |
+LL | match list {
+ | ^^^^ pattern `&[_, Some(_), None, _]` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/match-static-const-lc.rs b/src/test/ui/match/match-static-const-lc.rs
similarity index 100%
rename from src/test/compile-fail/match-static-const-lc.rs
rename to src/test/ui/match/match-static-const-lc.rs
diff --git a/src/test/ui/match/match-static-const-lc.stderr b/src/test/ui/match/match-static-const-lc.stderr
new file mode 100644
index 0000000..08eb571
--- /dev/null
+++ b/src/test/ui/match/match-static-const-lc.stderr
@@ -0,0 +1,26 @@
+error: constant in pattern `a` should have an upper case name such as `A`
+ --> $DIR/match-static-const-lc.rs:21:13
+ |
+LL | (0, a) => 0,
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/match-static-const-lc.rs:14:9
+ |
+LL | #![deny(non_upper_case_globals)]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: constant in pattern `aha` should have an upper case name such as `AHA`
+ --> $DIR/match-static-const-lc.rs:36:13
+ |
+LL | (0, aha) => 0,
+ | ^^^
+
+error: constant in pattern `not_okay` should have an upper case name such as `NOT_OKAY`
+ --> $DIR/match-static-const-lc.rs:50:13
+ |
+LL | (0, not_okay) => 0,
+ | ^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/match-struct.rs b/src/test/ui/match/match-struct.rs
similarity index 100%
rename from src/test/compile-fail/match-struct.rs
rename to src/test/ui/match/match-struct.rs
diff --git a/src/test/ui/match/match-struct.stderr b/src/test/ui/match/match-struct.stderr
new file mode 100644
index 0000000..43f17b2
--- /dev/null
+++ b/src/test/ui/match/match-struct.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/match-struct.rs:17:9
+ |
+LL | E::C(_) => (),
+ | ^^^^^^^ expected struct `S`, found enum `E`
+ |
+ = note: expected type `S`
+ found type `E`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/match-tag-nullary.rs b/src/test/ui/match/match-tag-nullary.rs
similarity index 100%
rename from src/test/compile-fail/match-tag-nullary.rs
rename to src/test/ui/match/match-tag-nullary.rs
diff --git a/src/test/ui/match/match-tag-nullary.stderr b/src/test/ui/match/match-tag-nullary.stderr
new file mode 100644
index 0000000..869d8ac
--- /dev/null
+++ b/src/test/ui/match/match-tag-nullary.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/match-tag-nullary.rs:16:40
+ |
+LL | fn main() { let x: a = a::A; match x { b::B => { } } }
+ | ^^^^ expected enum `a`, found enum `b`
+ |
+ = note: expected type `a`
+ found type `b`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/match-tag-unary.rs b/src/test/ui/match/match-tag-unary.rs
similarity index 100%
rename from src/test/compile-fail/match-tag-unary.rs
rename to src/test/ui/match/match-tag-unary.rs
diff --git a/src/test/ui/match/match-tag-unary.stderr b/src/test/ui/match/match-tag-unary.stderr
new file mode 100644
index 0000000..bb4deee
--- /dev/null
+++ b/src/test/ui/match/match-tag-unary.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/match-tag-unary.rs:16:43
+ |
+LL | fn main() { let x: a = a::A(0); match x { b::B(y) => { } } }
+ | ^^^^^^^ expected enum `a`, found enum `b`
+ |
+ = note: expected type `a`
+ found type `b`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/match-unreachable-warning-with-diverging-discrim.rs b/src/test/ui/match/match-unreachable-warning-with-diverging-discrim.rs
similarity index 100%
rename from src/test/compile-fail/match-unreachable-warning-with-diverging-discrim.rs
rename to src/test/ui/match/match-unreachable-warning-with-diverging-discrim.rs
diff --git a/src/test/ui/match/match-unreachable-warning-with-diverging-discrim.stderr b/src/test/ui/match/match-unreachable-warning-with-diverging-discrim.stderr
new file mode 100644
index 0000000..10a86f9
--- /dev/null
+++ b/src/test/ui/match/match-unreachable-warning-with-diverging-discrim.stderr
@@ -0,0 +1,14 @@
+error: unreachable expression
+ --> $DIR/match-unreachable-warning-with-diverging-discrim.rs:15:5
+ |
+LL | match (return) { } //~ ERROR unreachable expression
+ | ^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-unreachable-warning-with-diverging-discrim.rs:12:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/match-unresolved-one-arm.rs b/src/test/ui/match/match-unresolved-one-arm.rs
similarity index 100%
rename from src/test/compile-fail/match-unresolved-one-arm.rs
rename to src/test/ui/match/match-unresolved-one-arm.rs
diff --git a/src/test/ui/match/match-unresolved-one-arm.stderr b/src/test/ui/match/match-unresolved-one-arm.stderr
new file mode 100644
index 0000000..fa689a8
--- /dev/null
+++ b/src/test/ui/match/match-unresolved-one-arm.stderr
@@ -0,0 +1,12 @@
+error[E0282]: type annotations needed
+ --> $DIR/match-unresolved-one-arm.rs:14:9
+ |
+LL | let x = match () { //~ ERROR type annotations needed
+ | ^
+ | |
+ | cannot infer type
+ | consider giving `x` a type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/compile-fail/match-vec-fixed.rs b/src/test/ui/match/match-vec-fixed.rs
similarity index 100%
rename from src/test/compile-fail/match-vec-fixed.rs
rename to src/test/ui/match/match-vec-fixed.rs
diff --git a/src/test/ui/match/match-vec-fixed.stderr b/src/test/ui/match/match-vec-fixed.stderr
new file mode 100644
index 0000000..1b85034
--- /dev/null
+++ b/src/test/ui/match/match-vec-fixed.stderr
@@ -0,0 +1,20 @@
+error: unreachable pattern
+ --> $DIR/match-vec-fixed.rs:17:9
+ |
+LL | [_, _, _] => {} //~ ERROR unreachable pattern
+ | ^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-vec-fixed.rs:11:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-vec-fixed.rs:21:9
+ |
+LL | [_, 1, _] => {} //~ ERROR unreachable pattern
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/match-vec-mismatch-2.rs b/src/test/ui/match/match-vec-mismatch-2.rs
similarity index 100%
rename from src/test/compile-fail/match-vec-mismatch-2.rs
rename to src/test/ui/match/match-vec-mismatch-2.rs
diff --git a/src/test/ui/match/match-vec-mismatch-2.stderr b/src/test/ui/match/match-vec-mismatch-2.stderr
new file mode 100644
index 0000000..66f58bd
--- /dev/null
+++ b/src/test/ui/match/match-vec-mismatch-2.stderr
@@ -0,0 +1,9 @@
+error[E0529]: expected an array or slice, found `()`
+ --> $DIR/match-vec-mismatch-2.rs:13:9
+ |
+LL | [()] => { }
+ | ^^^^ pattern cannot match with input type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0529`.
diff --git a/src/test/compile-fail/match-vec-mismatch.rs b/src/test/ui/match/match-vec-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/match-vec-mismatch.rs
rename to src/test/ui/match/match-vec-mismatch.rs
diff --git a/src/test/ui/match/match-vec-mismatch.stderr b/src/test/ui/match/match-vec-mismatch.stderr
new file mode 100644
index 0000000..c30ddf9
--- /dev/null
+++ b/src/test/ui/match/match-vec-mismatch.stderr
@@ -0,0 +1,36 @@
+error[E0425]: cannot find value `does_not_exist` in this scope
+ --> $DIR/match-vec-mismatch.rs:38:11
+ |
+LL | match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope
+ | ^^^^^^^^^^^^^^ not found in this scope
+
+error[E0529]: expected an array or slice, found `std::string::String`
+ --> $DIR/match-vec-mismatch.rs:15:9
+ |
+LL | ['f', 'o', ..] => {}
+ | ^^^^^^^^^^^^^^ pattern cannot match with input type `std::string::String`
+
+error[E0527]: pattern requires 1 elements but array has 3
+ --> $DIR/match-vec-mismatch.rs:30:9
+ |
+LL | [0] => {}, //~ ERROR pattern requires
+ | ^^^ expected 3 elements
+
+error[E0528]: pattern requires at least 4 elements but array has 3
+ --> $DIR/match-vec-mismatch.rs:35:9
+ |
+LL | [0, 1, 2, 3, x..] => {} //~ ERROR pattern requires
+ | ^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements
+
+error[E0282]: type annotations needed
+ --> $DIR/match-vec-mismatch.rs:46:9
+ |
+LL | [] => {} //~ ERROR type annotations needed
+ | ^^ cannot infer type
+ |
+ = note: type must be known at this point
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0282, E0425, E0527, E0528, E0529.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/src/test/compile-fail/match-vec-unreachable.rs b/src/test/ui/match/match-vec-unreachable.rs
similarity index 100%
rename from src/test/compile-fail/match-vec-unreachable.rs
rename to src/test/ui/match/match-vec-unreachable.rs
diff --git a/src/test/ui/match/match-vec-unreachable.stderr b/src/test/ui/match/match-vec-unreachable.stderr
new file mode 100644
index 0000000..e8869e8
--- /dev/null
+++ b/src/test/ui/match/match-vec-unreachable.stderr
@@ -0,0 +1,26 @@
+error: unreachable pattern
+ --> $DIR/match-vec-unreachable.rs:19:9
+ |
+LL | [(1, 2), (2, 3), b] => (), //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/match-vec-unreachable.rs:12:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-vec-unreachable.rs:29:9
+ |
+LL | [_, _, _, _, _] => { } //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/match-vec-unreachable.rs:37:9
+ |
+LL | ['a', 'b', 'c'] => {} //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/maybe-bounds-where-cpass.rs b/src/test/ui/maybe-bounds-where-cpass.rs
similarity index 100%
rename from src/test/compile-fail/maybe-bounds-where-cpass.rs
rename to src/test/ui/maybe-bounds-where-cpass.rs
diff --git a/src/test/ui/maybe-bounds-where-cpass.stderr b/src/test/ui/maybe-bounds-where-cpass.stderr
new file mode 100644
index 0000000..d60e4cd
--- /dev/null
+++ b/src/test/ui/maybe-bounds-where-cpass.stderr
@@ -0,0 +1,11 @@
+error: compilation successful
+ --> $DIR/maybe-bounds-where-cpass.rs:16:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let u = vec![1, 2, 3];
+LL | | let _s: S<[u8]> = S(&u[..]);
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/maybe-bounds-where.rs b/src/test/ui/maybe-bounds-where.rs
similarity index 100%
rename from src/test/compile-fail/maybe-bounds-where.rs
rename to src/test/ui/maybe-bounds-where.rs
diff --git a/src/test/ui/maybe-bounds-where.stderr b/src/test/ui/maybe-bounds-where.stderr
new file mode 100644
index 0000000..02aafec
--- /dev/null
+++ b/src/test/ui/maybe-bounds-where.stderr
@@ -0,0 +1,45 @@
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+ --> $DIR/maybe-bounds-where.rs:11:23
+ |
+LL | struct S1<T>(T) where (T): ?Sized;
+ | ^^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+ --> $DIR/maybe-bounds-where.rs:14:23
+ |
+LL | struct S2<T>(T) where u8: ?Sized;
+ | ^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+ --> $DIR/maybe-bounds-where.rs:17:23
+ |
+LL | struct S3<T>(T) where &'static T: ?Sized;
+ | ^^^^^^^^^^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+ --> $DIR/maybe-bounds-where.rs:22:31
+ |
+LL | struct S4<T>(T) where for<'a> T: ?Trait<'a>;
+ | ^
+
+error: `?Trait` bounds are only permitted at the point where a type parameter is declared
+ --> $DIR/maybe-bounds-where.rs:30:18
+ |
+LL | fn f() where T: ?Sized {}
+ | ^
+
+error[E0203]: type parameter has more than one relaxed default bound, only one is supported
+ --> $DIR/maybe-bounds-where.rs:25:11
+ |
+LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
+ | ^
+
+warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default. Only `?Sized` is supported
+ --> $DIR/maybe-bounds-where.rs:25:11
+ |
+LL | struct S5<T>(*const T) where T: ?Trait<'static> + ?Sized;
+ | ^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0203`.
diff --git a/src/test/ui/meta-expected-error-correct-rev.a.stderr b/src/test/ui/meta-expected-error-correct-rev.a.stderr
new file mode 100644
index 0000000..20b9306
--- /dev/null
+++ b/src/test/ui/meta-expected-error-correct-rev.a.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/meta-expected-error-correct-rev.rs:17:18
+ |
+LL | let x: u32 = 22_usize; //[a]~ ERROR mismatched types
+ | ^^^^^^^^ expected u32, found usize
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/meta-expected-error-correct-rev.rs b/src/test/ui/meta-expected-error-correct-rev.rs
similarity index 100%
rename from src/test/compile-fail/meta-expected-error-correct-rev.rs
rename to src/test/ui/meta-expected-error-correct-rev.rs
diff --git a/src/test/compile-fail/auxiliary/ambig_impl_2_lib.rs b/src/test/ui/methods/auxiliary/ambig_impl_2_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/ambig_impl_2_lib.rs
rename to src/test/ui/methods/auxiliary/ambig_impl_2_lib.rs
diff --git a/src/test/ui/auxiliary/macro-in-other-crate.rs b/src/test/ui/methods/auxiliary/macro-in-other-crate.rs
similarity index 100%
copy from src/test/ui/auxiliary/macro-in-other-crate.rs
copy to src/test/ui/methods/auxiliary/macro-in-other-crate.rs
diff --git a/src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.rs
similarity index 100%
rename from src/test/compile-fail/method-ambig-one-trait-unknown-int-type.rs
rename to src/test/ui/methods/method-ambig-one-trait-unknown-int-type.rs
diff --git a/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
new file mode 100644
index 0000000..7f034b9
--- /dev/null
+++ b/src/test/ui/methods/method-ambig-one-trait-unknown-int-type.stderr
@@ -0,0 +1,18 @@
+error[E0282]: type annotations needed
+ --> $DIR/method-ambig-one-trait-unknown-int-type.rs:34:17
+ |
+LL | let mut x = Vec::new();
+ | ----- ^^^^^^^^ cannot infer type for `T`
+ | |
+ | consider giving `x` a type
+
+error[E0308]: mismatched types
+ --> $DIR/method-ambig-one-trait-unknown-int-type.rs:43:20
+ |
+LL | let y: usize = x.foo(); //~ ERROR mismatched types
+ | ^^^^^^^ expected usize, found isize
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0282, E0308.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/src/test/compile-fail/method-ambig-two-traits-cross-crate.rs b/src/test/ui/methods/method-ambig-two-traits-cross-crate.rs
similarity index 100%
rename from src/test/compile-fail/method-ambig-two-traits-cross-crate.rs
rename to src/test/ui/methods/method-ambig-two-traits-cross-crate.rs
diff --git a/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr
new file mode 100644
index 0000000..7a75f20
--- /dev/null
+++ b/src/test/ui/methods/method-ambig-two-traits-cross-crate.stderr
@@ -0,0 +1,16 @@
+error[E0034]: multiple applicable items in scope
+ --> $DIR/method-ambig-two-traits-cross-crate.rs:21:21
+ |
+LL | fn main() { 1_usize.me(); } //~ ERROR E0034
+ | ^^ multiple `me` found
+ |
+note: candidate #1 is defined in an impl of the trait `me2` for the type `usize`
+ --> $DIR/method-ambig-two-traits-cross-crate.rs:20:22
+ |
+LL | impl me2 for usize { fn me(&self) -> usize { *self } }
+ | ^^^^^^^^^^^^^^^^^^^^^
+ = note: candidate #2 is defined in an impl of the trait `ambig_impl_2_lib::me` for the type `usize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0034`.
diff --git a/src/test/compile-fail/method-ambig-two-traits-from-bounds.rs b/src/test/ui/methods/method-ambig-two-traits-from-bounds.rs
similarity index 100%
rename from src/test/compile-fail/method-ambig-two-traits-from-bounds.rs
rename to src/test/ui/methods/method-ambig-two-traits-from-bounds.rs
diff --git a/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr
new file mode 100644
index 0000000..06003d9
--- /dev/null
+++ b/src/test/ui/methods/method-ambig-two-traits-from-bounds.stderr
@@ -0,0 +1,22 @@
+error[E0034]: multiple applicable items in scope
+ --> $DIR/method-ambig-two-traits-from-bounds.rs:15:7
+ |
+LL | t.foo(); //~ ERROR E0034
+ | ^^^ multiple `foo` found
+ |
+note: candidate #1 is defined in the trait `A`
+ --> $DIR/method-ambig-two-traits-from-bounds.rs:11:11
+ |
+LL | trait A { fn foo(&self); }
+ | ^^^^^^^^^^^^^^
+ = help: to disambiguate the method call, write `A::foo(t)` instead
+note: candidate #2 is defined in the trait `B`
+ --> $DIR/method-ambig-two-traits-from-bounds.rs:12:11
+ |
+LL | trait B { fn foo(&self); }
+ | ^^^^^^^^^^^^^^
+ = help: to disambiguate the method call, write `B::foo(t)` instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0034`.
diff --git a/src/test/compile-fail/method-ambig-two-traits-with-default-method.rs b/src/test/ui/methods/method-ambig-two-traits-with-default-method.rs
similarity index 100%
rename from src/test/compile-fail/method-ambig-two-traits-with-default-method.rs
rename to src/test/ui/methods/method-ambig-two-traits-with-default-method.rs
diff --git a/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr
new file mode 100644
index 0000000..d67e17d
--- /dev/null
+++ b/src/test/ui/methods/method-ambig-two-traits-with-default-method.stderr
@@ -0,0 +1,20 @@
+error[E0034]: multiple applicable items in scope
+ --> $DIR/method-ambig-two-traits-with-default-method.rs:22:13
+ |
+LL | 1_usize.method(); //~ ERROR E0034
+ | ^^^^^^ multiple `method` found
+ |
+note: candidate #1 is defined in an impl of the trait `Foo` for the type `usize`
+ --> $DIR/method-ambig-two-traits-with-default-method.rs:15:13
+ |
+LL | trait Foo { fn method(&self) {} }
+ | ^^^^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl of the trait `Bar` for the type `usize`
+ --> $DIR/method-ambig-two-traits-with-default-method.rs:16:13
+ |
+LL | trait Bar { fn method(&self) {} }
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0034`.
diff --git a/src/test/ui/method-call-err-msg.rs b/src/test/ui/methods/method-call-err-msg.rs
similarity index 100%
rename from src/test/ui/method-call-err-msg.rs
rename to src/test/ui/methods/method-call-err-msg.rs
diff --git a/src/test/ui/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr
similarity index 100%
rename from src/test/ui/method-call-err-msg.stderr
rename to src/test/ui/methods/method-call-err-msg.stderr
diff --git a/src/test/compile-fail/method-call-lifetime-args.rs b/src/test/ui/methods/method-call-lifetime-args-fail.rs
similarity index 100%
rename from src/test/compile-fail/method-call-lifetime-args.rs
rename to src/test/ui/methods/method-call-lifetime-args-fail.rs
diff --git a/src/test/ui/methods/method-call-lifetime-args-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-fail.stderr
new file mode 100644
index 0000000..3814f4b
--- /dev/null
+++ b/src/test/ui/methods/method-call-lifetime-args-fail.stderr
@@ -0,0 +1,196 @@
+error[E0090]: too few lifetime parameters provided: expected 2 lifetime parameters, found 1 lifetime parameter
+ --> $DIR/method-call-lifetime-args-fail.rs:26:7
+ |
+LL | S.early::<'static>();
+ | ^^^^^ expected 2 lifetime parameters
+
+error[E0088]: too many lifetime parameters provided: expected at most 2 lifetime parameters, found 3 lifetime parameters
+ --> $DIR/method-call-lifetime-args-fail.rs:28:33
+ |
+LL | S.early::<'static, 'static, 'static>();
+ | ^^^^^^^ expected 2 lifetime parameters
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:37:15
+ |
+LL | S::late::<'static>(S, &0, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:14:13
+ |
+LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+ | ^^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:39:15
+ |
+LL | S::late::<'static, 'static>(S, &0, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:14:13
+ |
+LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+ | ^^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:41:15
+ |
+LL | S::late::<'static, 'static, 'static>(S, &0, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:14:13
+ |
+LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+ | ^^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:44:21
+ |
+LL | S::late_early::<'static, 'static>(S, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:17:19
+ |
+LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+ | ^^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:46:21
+ |
+LL | S::late_early::<'static, 'static, 'static>(S, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:17:19
+ |
+LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+ | ^^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:50:24
+ |
+LL | S::late_implicit::<'static>(S, &0, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:15:31
+ |
+LL | fn late_implicit(self, _: &u8, _: &u8) {}
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:52:24
+ |
+LL | S::late_implicit::<'static, 'static>(S, &0, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:15:31
+ |
+LL | fn late_implicit(self, _: &u8, _: &u8) {}
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:54:24
+ |
+LL | S::late_implicit::<'static, 'static, 'static>(S, &0, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:15:31
+ |
+LL | fn late_implicit(self, _: &u8, _: &u8) {}
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:57:30
+ |
+LL | S::late_implicit_early::<'static, 'static>(S, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:18:41
+ |
+LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:59:30
+ |
+LL | S::late_implicit_early::<'static, 'static, 'static>(S, &0);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:18:41
+ |
+LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:62:35
+ |
+LL | S::late_implicit_self_early::<'static, 'static>(&S);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:19:37
+ |
+LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} }
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:64:35
+ |
+LL | S::late_implicit_self_early::<'static, 'static, 'static>(&S);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:19:37
+ |
+LL | fn late_implicit_self_early<'b>(&self) -> &'b u8 { loop {} }
+ | ^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:67:28
+ |
+LL | S::late_unused_early::<'static, 'static>(S);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:20:26
+ |
+LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} }
+ | ^^
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-fail.rs:69:28
+ |
+LL | S::late_unused_early::<'static, 'static, 'static>(S);
+ | ^^^^^^^
+ |
+note: the late bound lifetime parameter is introduced here
+ --> $DIR/method-call-lifetime-args-fail.rs:20:26
+ |
+LL | fn late_unused_early<'a, 'b>(self) -> &'b u8 { loop {} }
+ | ^^
+
+error[E0090]: too few lifetime parameters provided: expected 2 lifetime parameters, found 1 lifetime parameter
+ --> $DIR/method-call-lifetime-args-fail.rs:73:5
+ |
+LL | S::early::<'static>(S);
+ | ^^^^^^^^^^^^^^^^^^^ expected 2 lifetime parameters
+
+error[E0088]: too many lifetime parameters provided: expected at most 2 lifetime parameters, found 3 lifetime parameters
+ --> $DIR/method-call-lifetime-args-fail.rs:75:34
+ |
+LL | S::early::<'static, 'static, 'static>(S);
+ | ^^^^^^^ expected 2 lifetime parameters
+
+error: aborting due to 18 previous errors
+
+Some errors occurred: E0088, E0090.
+For more information about an error, try `rustc --explain E0088`.
diff --git a/src/test/compile-fail/method-call-lifetime-args-lint.rs b/src/test/ui/methods/method-call-lifetime-args-lint-fail.rs
similarity index 100%
rename from src/test/compile-fail/method-call-lifetime-args-lint.rs
rename to src/test/ui/methods/method-call-lifetime-args-lint-fail.rs
diff --git a/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr b/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr
new file mode 100644
index 0000000..34747ed
--- /dev/null
+++ b/src/test/ui/methods/method-call-lifetime-args-lint-fail.stderr
@@ -0,0 +1,187 @@
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:33:14
+ |
+LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S.late::<'static>(&0, &0);
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:11:9
+ |
+LL | #![deny(late_bound_lifetime_arguments)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:36:14
+ |
+LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S.late::<'static, 'static>(&0, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:39:14
+ |
+LL | fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S.late::<'static, 'static, 'static>(&0, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:43:20
+ |
+LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S.late_early::<'static>(&0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:46:20
+ |
+LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S.late_early::<'static, 'static>(&0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:49:20
+ |
+LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S.late_early::<'static, 'static, 'static>(&0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:54:23
+ |
+LL | fn late_implicit(self, _: &u8, _: &u8) {}
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S.late_implicit::<'static>(&0, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:57:23
+ |
+LL | fn late_implicit(self, _: &u8, _: &u8) {}
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S.late_implicit::<'static, 'static>(&0, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:60:23
+ |
+LL | fn late_implicit(self, _: &u8, _: &u8) {}
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S.late_implicit::<'static, 'static, 'static>(&0, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:64:29
+ |
+LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S.late_implicit_early::<'static>(&0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:67:29
+ |
+LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S.late_implicit_early::<'static, 'static>(&0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:70:29
+ |
+LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S.late_implicit_early::<'static, 'static, 'static>(&0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:79:21
+ |
+LL | fn late_early<'a, 'b>(self, _: &'a u8) -> &'b u8 { loop {} }
+ | -- the late bound lifetime parameter is introduced here
+...
+LL | S::late_early::<'static>(S, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:83:30
+ |
+LL | fn late_implicit_early<'b>(self, _: &u8) -> &'b u8 { loop {} }
+ | - the late bound lifetime parameter is introduced here
+...
+LL | S::late_implicit_early::<'static>(S, &0);
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
+ --> $DIR/method-call-lifetime-args-lint-fail.rs:92:9
+ |
+LL | fn f<'early, 'late, T: 'early>() {}
+ | ----- the late bound lifetime parameter is introduced here
+...
+LL | f::<'static, u8>;
+ | ^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #42868 <https://github.com/rust-lang/rust/issues/42868>
+
+error: aborting due to 15 previous errors
+
diff --git a/src/test/ui/method-call-lifetime-args-lint.rs b/src/test/ui/methods/method-call-lifetime-args-lint.rs
similarity index 100%
rename from src/test/ui/method-call-lifetime-args-lint.rs
rename to src/test/ui/methods/method-call-lifetime-args-lint.rs
diff --git a/src/test/ui/method-call-lifetime-args-lint.stderr b/src/test/ui/methods/method-call-lifetime-args-lint.stderr
similarity index 100%
rename from src/test/ui/method-call-lifetime-args-lint.stderr
rename to src/test/ui/methods/method-call-lifetime-args-lint.stderr
diff --git a/src/test/compile-fail/method-call-lifetime-args-subst-index.rs b/src/test/ui/methods/method-call-lifetime-args-subst-index.rs
similarity index 100%
rename from src/test/compile-fail/method-call-lifetime-args-subst-index.rs
rename to src/test/ui/methods/method-call-lifetime-args-subst-index.rs
diff --git a/src/test/ui/methods/method-call-lifetime-args-subst-index.stderr b/src/test/ui/methods/method-call-lifetime-args-subst-index.stderr
new file mode 100644
index 0000000..2848ff8
--- /dev/null
+++ b/src/test/ui/methods/method-call-lifetime-args-subst-index.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/method-call-lifetime-args-subst-index.rs:25:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/method-call-lifetime-args-unresolved.rs b/src/test/ui/methods/method-call-lifetime-args-unresolved.rs
similarity index 100%
rename from src/test/compile-fail/method-call-lifetime-args-unresolved.rs
rename to src/test/ui/methods/method-call-lifetime-args-unresolved.rs
diff --git a/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr
new file mode 100644
index 0000000..8eb860d
--- /dev/null
+++ b/src/test/ui/methods/method-call-lifetime-args-unresolved.stderr
@@ -0,0 +1,9 @@
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/method-call-lifetime-args-unresolved.rs:12:15
+ |
+LL | 0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/src/test/ui/method-call-lifetime-args.rs b/src/test/ui/methods/method-call-lifetime-args.rs
similarity index 100%
rename from src/test/ui/method-call-lifetime-args.rs
rename to src/test/ui/methods/method-call-lifetime-args.rs
diff --git a/src/test/ui/method-call-lifetime-args.stderr b/src/test/ui/methods/method-call-lifetime-args.stderr
similarity index 100%
rename from src/test/ui/method-call-lifetime-args.stderr
rename to src/test/ui/methods/method-call-lifetime-args.stderr
diff --git a/src/test/compile-fail/method-call-type-binding.rs b/src/test/ui/methods/method-call-type-binding.rs
similarity index 100%
rename from src/test/compile-fail/method-call-type-binding.rs
rename to src/test/ui/methods/method-call-type-binding.rs
diff --git a/src/test/ui/methods/method-call-type-binding.stderr b/src/test/ui/methods/method-call-type-binding.stderr
new file mode 100644
index 0000000..aafc848
--- /dev/null
+++ b/src/test/ui/methods/method-call-type-binding.stderr
@@ -0,0 +1,9 @@
+error[E0229]: associated type bindings are not allowed here
+ --> $DIR/method-call-type-binding.rs:12:15
+ |
+LL | 0.clone::<T = u8>(); //~ ERROR associated type bindings are not allowed here
+ | ^^^^^^ associated type not allowed here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0229`.
diff --git a/src/test/compile-fail/method-macro-backtrace.rs b/src/test/ui/methods/method-macro-backtrace.rs
similarity index 100%
rename from src/test/compile-fail/method-macro-backtrace.rs
rename to src/test/ui/methods/method-macro-backtrace.rs
diff --git a/src/test/ui/methods/method-macro-backtrace.stderr b/src/test/ui/methods/method-macro-backtrace.stderr
new file mode 100644
index 0000000..28f46db
--- /dev/null
+++ b/src/test/ui/methods/method-macro-backtrace.stderr
@@ -0,0 +1,11 @@
+error[E0201]: duplicate definitions with name `bar`:
+ --> $DIR/method-macro-backtrace.rs:32:5
+ |
+LL | fn bar(&self) { }
+ | ----------------- previous definition of `bar` here
+LL | fn bar(&self) { } //~ ERROR duplicate definitions
+ | ^^^^^^^^^^^^^^^^^ duplicate definition
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0201`.
diff --git a/src/test/ui/method-missing-call.rs b/src/test/ui/methods/method-missing-call.rs
similarity index 100%
rename from src/test/ui/method-missing-call.rs
rename to src/test/ui/methods/method-missing-call.rs
diff --git a/src/test/ui/method-missing-call.stderr b/src/test/ui/methods/method-missing-call.stderr
similarity index 100%
rename from src/test/ui/method-missing-call.stderr
rename to src/test/ui/methods/method-missing-call.stderr
diff --git a/src/test/ui/method-on-ambiguous-numeric-type.rs b/src/test/ui/methods/method-on-ambiguous-numeric-type.rs
similarity index 100%
rename from src/test/ui/method-on-ambiguous-numeric-type.rs
rename to src/test/ui/methods/method-on-ambiguous-numeric-type.rs
diff --git a/src/test/ui/method-on-ambiguous-numeric-type.stderr b/src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
similarity index 100%
rename from src/test/ui/method-on-ambiguous-numeric-type.stderr
rename to src/test/ui/methods/method-on-ambiguous-numeric-type.stderr
diff --git a/src/test/compile-fail/method-path-in-pattern.rs b/src/test/ui/methods/method-path-in-pattern.rs
similarity index 100%
rename from src/test/compile-fail/method-path-in-pattern.rs
rename to src/test/ui/methods/method-path-in-pattern.rs
diff --git a/src/test/ui/methods/method-path-in-pattern.stderr b/src/test/ui/methods/method-path-in-pattern.stderr
new file mode 100644
index 0000000..1fae336
--- /dev/null
+++ b/src/test/ui/methods/method-path-in-pattern.stderr
@@ -0,0 +1,21 @@
+error[E0533]: expected unit struct/variant or constant, found method `<Foo>::bar`
+ --> $DIR/method-path-in-pattern.rs:25:9
+ |
+LL | Foo::bar => {}
+ | ^^^^^^^^
+
+error[E0533]: expected unit struct/variant or constant, found method `<Foo>::bar`
+ --> $DIR/method-path-in-pattern.rs:29:9
+ |
+LL | <Foo>::bar => {}
+ | ^^^^^^^^^^
+
+error[E0533]: expected unit struct/variant or constant, found method `<Foo>::trait_bar`
+ --> $DIR/method-path-in-pattern.rs:33:9
+ |
+LL | <Foo>::trait_bar => {}
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0533`.
diff --git a/src/test/compile-fail/method-resolvable-path-in-pattern.rs b/src/test/ui/methods/method-resolvable-path-in-pattern.rs
similarity index 100%
rename from src/test/compile-fail/method-resolvable-path-in-pattern.rs
rename to src/test/ui/methods/method-resolvable-path-in-pattern.rs
diff --git a/src/test/ui/methods/method-resolvable-path-in-pattern.stderr b/src/test/ui/methods/method-resolvable-path-in-pattern.stderr
new file mode 100644
index 0000000..c86367d
--- /dev/null
+++ b/src/test/ui/methods/method-resolvable-path-in-pattern.stderr
@@ -0,0 +1,9 @@
+error[E0532]: expected unit struct/variant or constant, found method `MyTrait::trait_bar`
+ --> $DIR/method-resolvable-path-in-pattern.rs:21:9
+ |
+LL | <Foo as MyTrait>::trait_bar => {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct/variant or constant
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/method-self-arg-1.rs b/src/test/ui/methods/method-self-arg-1.rs
similarity index 100%
rename from src/test/compile-fail/method-self-arg-1.rs
rename to src/test/ui/methods/method-self-arg-1.rs
diff --git a/src/test/ui/methods/method-self-arg-1.stderr b/src/test/ui/methods/method-self-arg-1.stderr
new file mode 100644
index 0000000..4a5ac2b
--- /dev/null
+++ b/src/test/ui/methods/method-self-arg-1.stderr
@@ -0,0 +1,24 @@
+error[E0308]: mismatched types
+ --> $DIR/method-self-arg-1.rs:21:14
+ |
+LL | Foo::bar(x); //~ ERROR mismatched types
+ | ^
+ | |
+ | expected &Foo, found struct `Foo`
+ | help: consider borrowing here: `&x`
+ |
+ = note: expected type `&Foo`
+ found type `Foo`
+
+error[E0308]: mismatched types
+ --> $DIR/method-self-arg-1.rs:25:14
+ |
+LL | Foo::bar(&42); //~ ERROR mismatched types
+ | ^^^ expected struct `Foo`, found integral variable
+ |
+ = note: expected type `&Foo`
+ found type `&{integer}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/methods/method-self-arg-2.nll.stderr b/src/test/ui/methods/method-self-arg-2.nll.stderr
new file mode 100644
index 0000000..f876aa2
--- /dev/null
+++ b/src/test/ui/methods/method-self-arg-2.nll.stderr
@@ -0,0 +1,24 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/method-self-arg-2.rs:25:14
+ |
+LL | let y = &mut x;
+ | ------ mutable borrow occurs here
+LL | Foo::bar(&x); //~ERROR cannot borrow `x`
+ | ^^ immutable borrow occurs here
+LL | y.use_mut();
+ | - borrow later used here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/method-self-arg-2.rs:30:14
+ |
+LL | let y = &mut x;
+ | ------ first mutable borrow occurs here
+LL | Foo::baz(&mut x); //~ERROR cannot borrow `x`
+ | ^^^^^^ second mutable borrow occurs here
+LL | y.use_mut();
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/ui/methods/method-self-arg-2.rs b/src/test/ui/methods/method-self-arg-2.rs
new file mode 100644
index 0000000..cba4e6d
--- /dev/null
+++ b/src/test/ui/methods/method-self-arg-2.rs
@@ -0,0 +1,35 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test method calls with self as an argument cannot subvert borrow checking.
+
+
+
+struct Foo;
+
+impl Foo {
+ fn bar(&self) {}
+ fn baz(&mut self) {}
+}
+
+fn main() {
+ let mut x = Foo;
+ let y = &mut x;
+ Foo::bar(&x); //~ERROR cannot borrow `x`
+ y.use_mut();
+
+ let mut x = Foo;
+ let y = &mut x;
+ Foo::baz(&mut x); //~ERROR cannot borrow `x`
+ y.use_mut();
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/methods/method-self-arg-2.stderr b/src/test/ui/methods/method-self-arg-2.stderr
new file mode 100644
index 0000000..0bfa603
--- /dev/null
+++ b/src/test/ui/methods/method-self-arg-2.stderr
@@ -0,0 +1,26 @@
+error[E0502]: cannot borrow `x` as immutable because it is also borrowed as mutable
+ --> $DIR/method-self-arg-2.rs:25:15
+ |
+LL | let y = &mut x;
+ | - mutable borrow occurs here
+LL | Foo::bar(&x); //~ERROR cannot borrow `x`
+ | ^ immutable borrow occurs here
+...
+LL | }
+ | - mutable borrow ends here
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/method-self-arg-2.rs:30:19
+ |
+LL | let y = &mut x;
+ | - first mutable borrow occurs here
+LL | Foo::baz(&mut x); //~ERROR cannot borrow `x`
+ | ^ second mutable borrow occurs here
+LL | y.use_mut();
+LL | }
+ | - first borrow ends here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/minus-string.rs b/src/test/ui/minus-string.rs
similarity index 100%
rename from src/test/compile-fail/minus-string.rs
rename to src/test/ui/minus-string.rs
diff --git a/src/test/ui/minus-string.stderr b/src/test/ui/minus-string.stderr
new file mode 100644
index 0000000..cbbb11a
--- /dev/null
+++ b/src/test/ui/minus-string.stderr
@@ -0,0 +1,11 @@
+error[E0600]: cannot apply unary operator `-` to type `std::string::String`
+ --> $DIR/minus-string.rs:13:13
+ |
+LL | fn main() { -"foo".to_string(); }
+ | ^^^^^^^^^^^^^^^^^^ cannot apply unary operator `-`
+ |
+ = note: an implementation of `std::ops::Neg` might be missing for `std::string::String`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0600`.
diff --git a/src/test/compile-fail/mir-dataflow/README.md b/src/test/ui/mir-dataflow/README.md
similarity index 100%
rename from src/test/compile-fail/mir-dataflow/README.md
rename to src/test/ui/mir-dataflow/README.md
diff --git a/src/test/compile-fail/mir-dataflow/def-inits-1.rs b/src/test/ui/mir-dataflow/def-inits-1.rs
similarity index 100%
rename from src/test/compile-fail/mir-dataflow/def-inits-1.rs
rename to src/test/ui/mir-dataflow/def-inits-1.rs
diff --git a/src/test/ui/mir-dataflow/def-inits-1.stderr b/src/test/ui/mir-dataflow/def-inits-1.stderr
new file mode 100644
index 0000000..84d3c66
--- /dev/null
+++ b/src/test/ui/mir-dataflow/def-inits-1.stderr
@@ -0,0 +1,28 @@
+error: rustc_peek: bit not set
+ --> $DIR/def-inits-1.rs:25:14
+ |
+LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/def-inits-1.rs:41:14
+ |
+LL | unsafe { rustc_peek(&z); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/def-inits-1.rs:44:14
+ |
+LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/def-inits-1.rs:52:14
+ |
+LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: stop_after_dataflow ended compilation
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/mir-dataflow/inits-1.rs b/src/test/ui/mir-dataflow/inits-1.rs
similarity index 100%
rename from src/test/compile-fail/mir-dataflow/inits-1.rs
rename to src/test/ui/mir-dataflow/inits-1.rs
diff --git a/src/test/ui/mir-dataflow/inits-1.stderr b/src/test/ui/mir-dataflow/inits-1.stderr
new file mode 100644
index 0000000..c39c9c8
--- /dev/null
+++ b/src/test/ui/mir-dataflow/inits-1.stderr
@@ -0,0 +1,22 @@
+error: rustc_peek: bit not set
+ --> $DIR/inits-1.rs:25:14
+ |
+LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/inits-1.rs:45:14
+ |
+LL | unsafe { rustc_peek(&y); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/inits-1.rs:53:14
+ |
+LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: stop_after_dataflow ended compilation
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/mir-dataflow/uninits-1.rs b/src/test/ui/mir-dataflow/uninits-1.rs
similarity index 100%
rename from src/test/compile-fail/mir-dataflow/uninits-1.rs
rename to src/test/ui/mir-dataflow/uninits-1.rs
diff --git a/src/test/ui/mir-dataflow/uninits-1.stderr b/src/test/ui/mir-dataflow/uninits-1.stderr
new file mode 100644
index 0000000..c760124
--- /dev/null
+++ b/src/test/ui/mir-dataflow/uninits-1.stderr
@@ -0,0 +1,34 @@
+error: rustc_peek: bit not set
+ --> $DIR/uninits-1.rs:29:14
+ |
+LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/uninits-1.rs:30:14
+ |
+LL | unsafe { rustc_peek(&y) }; //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/uninits-1.rs:31:14
+ |
+LL | unsafe { rustc_peek(&z) }; //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/uninits-1.rs:47:14
+ |
+LL | unsafe { rustc_peek(&x); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: rustc_peek: bit not set
+ --> $DIR/uninits-1.rs:55:14
+ |
+LL | unsafe { rustc_peek(&ret); } //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^^^
+
+error: stop_after_dataflow ended compilation
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/compile-fail/mir-dataflow/uninits-2.rs b/src/test/ui/mir-dataflow/uninits-2.rs
similarity index 100%
rename from src/test/compile-fail/mir-dataflow/uninits-2.rs
rename to src/test/ui/mir-dataflow/uninits-2.rs
diff --git a/src/test/ui/mir-dataflow/uninits-2.stderr b/src/test/ui/mir-dataflow/uninits-2.stderr
new file mode 100644
index 0000000..8ed7351
--- /dev/null
+++ b/src/test/ui/mir-dataflow/uninits-2.stderr
@@ -0,0 +1,10 @@
+error: rustc_peek: bit not set
+ --> $DIR/uninits-2.rs:25:14
+ |
+LL | unsafe { rustc_peek(&x) }; //~ ERROR rustc_peek: bit not set
+ | ^^^^^^^^^^^^^^
+
+error: stop_after_dataflow ended compilation
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/mir-unpretty.rs b/src/test/ui/mir-unpretty.rs
similarity index 100%
rename from src/test/compile-fail/mir-unpretty.rs
rename to src/test/ui/mir-unpretty.rs
diff --git a/src/test/ui/mir-unpretty.stderr b/src/test/ui/mir-unpretty.stderr
new file mode 100644
index 0000000..5a53b69
--- /dev/null
+++ b/src/test/ui/mir-unpretty.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/mir-unpretty.rs:14:17
+ |
+LL | let x: () = 0; //~ ERROR: mismatched types
+ | ^ expected (), found integral variable
+ |
+ = note: expected type `()`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/mismatched_types/cast-rfc0401.stderr b/src/test/ui/mismatched_types/cast-rfc0401.stderr
index d3b9ade..81fe493 100644
--- a/src/test/ui/mismatched_types/cast-rfc0401.stderr
+++ b/src/test/ui/mismatched_types/cast-rfc0401.stderr
@@ -223,7 +223,7 @@
| ^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `[u8]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0277]: the size for values of type `str` cannot be known at compilation time
@@ -233,7 +233,7 @@
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: required for the cast to the object type `dyn Foo`
error[E0606]: casting `&{float}` as `f32` is invalid
diff --git a/src/test/ui/auxiliary/two_macros.rs b/src/test/ui/missing/auxiliary/two_macros.rs
similarity index 100%
copy from src/test/ui/auxiliary/two_macros.rs
copy to src/test/ui/missing/auxiliary/two_macros.rs
diff --git a/src/test/ui/missing-alloc_error_handler.rs b/src/test/ui/missing/missing-alloc_error_handler.rs
similarity index 100%
rename from src/test/ui/missing-alloc_error_handler.rs
rename to src/test/ui/missing/missing-alloc_error_handler.rs
diff --git a/src/test/ui/missing-alloc_error_handler.stderr b/src/test/ui/missing/missing-alloc_error_handler.stderr
similarity index 100%
rename from src/test/ui/missing-alloc_error_handler.stderr
rename to src/test/ui/missing/missing-alloc_error_handler.stderr
diff --git a/src/test/ui/missing-allocator.rs b/src/test/ui/missing/missing-allocator.rs
similarity index 100%
rename from src/test/ui/missing-allocator.rs
rename to src/test/ui/missing/missing-allocator.rs
diff --git a/src/test/ui/missing-allocator.stderr b/src/test/ui/missing/missing-allocator.stderr
similarity index 100%
rename from src/test/ui/missing-allocator.stderr
rename to src/test/ui/missing/missing-allocator.stderr
diff --git a/src/test/ui/missing-block-hint.rs b/src/test/ui/missing/missing-block-hint.rs
similarity index 100%
rename from src/test/ui/missing-block-hint.rs
rename to src/test/ui/missing/missing-block-hint.rs
diff --git a/src/test/ui/missing-block-hint.stderr b/src/test/ui/missing/missing-block-hint.stderr
similarity index 100%
rename from src/test/ui/missing-block-hint.stderr
rename to src/test/ui/missing/missing-block-hint.stderr
diff --git a/src/test/ui/missing-comma-in-match.fixed b/src/test/ui/missing/missing-comma-in-match.fixed
similarity index 100%
rename from src/test/ui/missing-comma-in-match.fixed
rename to src/test/ui/missing/missing-comma-in-match.fixed
diff --git a/src/test/ui/missing-comma-in-match.rs b/src/test/ui/missing/missing-comma-in-match.rs
similarity index 100%
rename from src/test/ui/missing-comma-in-match.rs
rename to src/test/ui/missing/missing-comma-in-match.rs
diff --git a/src/test/ui/missing-comma-in-match.stderr b/src/test/ui/missing/missing-comma-in-match.stderr
similarity index 100%
rename from src/test/ui/missing-comma-in-match.stderr
rename to src/test/ui/missing/missing-comma-in-match.stderr
diff --git a/src/test/compile-fail/missing-derivable-attr.rs b/src/test/ui/missing/missing-derivable-attr.rs
similarity index 100%
rename from src/test/compile-fail/missing-derivable-attr.rs
rename to src/test/ui/missing/missing-derivable-attr.rs
diff --git a/src/test/ui/missing/missing-derivable-attr.stderr b/src/test/ui/missing/missing-derivable-attr.stderr
new file mode 100644
index 0000000..cccba2f
--- /dev/null
+++ b/src/test/ui/missing/missing-derivable-attr.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `eq`
+ --> $DIR/missing-derivable-attr.rs:23:1
+ |
+LL | fn eq(&self, other: &Self) -> bool;
+ | ----------------------------------- `eq` from trait
+...
+LL | impl MyEq for A {} //~ ERROR not all trait items implemented, missing: `eq`
+ | ^^^^^^^^^^^^^^^ missing `eq` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/src/test/ui/missing-fields-in-struct-pattern.rs b/src/test/ui/missing/missing-fields-in-struct-pattern.rs
similarity index 100%
rename from src/test/ui/missing-fields-in-struct-pattern.rs
rename to src/test/ui/missing/missing-fields-in-struct-pattern.rs
diff --git a/src/test/ui/missing-fields-in-struct-pattern.stderr b/src/test/ui/missing/missing-fields-in-struct-pattern.stderr
similarity index 100%
rename from src/test/ui/missing-fields-in-struct-pattern.stderr
rename to src/test/ui/missing/missing-fields-in-struct-pattern.stderr
diff --git a/src/test/ui/missing-items/auxiliary/m1.rs b/src/test/ui/missing/missing-items/auxiliary/m1.rs
similarity index 100%
rename from src/test/ui/missing-items/auxiliary/m1.rs
rename to src/test/ui/missing/missing-items/auxiliary/m1.rs
diff --git a/src/test/ui/missing-items/issue-40221.rs b/src/test/ui/missing/missing-items/issue-40221.rs
similarity index 100%
rename from src/test/ui/missing-items/issue-40221.rs
rename to src/test/ui/missing/missing-items/issue-40221.rs
diff --git a/src/test/ui/missing-items/issue-40221.stderr b/src/test/ui/missing/missing-items/issue-40221.stderr
similarity index 100%
rename from src/test/ui/missing-items/issue-40221.stderr
rename to src/test/ui/missing/missing-items/issue-40221.stderr
diff --git a/src/test/ui/missing-items/m2.rs b/src/test/ui/missing/missing-items/m2.rs
similarity index 100%
rename from src/test/ui/missing-items/m2.rs
rename to src/test/ui/missing/missing-items/m2.rs
diff --git a/src/test/ui/missing-items/m2.stderr b/src/test/ui/missing/missing-items/m2.stderr
similarity index 100%
rename from src/test/ui/missing-items/m2.stderr
rename to src/test/ui/missing/missing-items/m2.stderr
diff --git a/src/test/ui/missing-items/missing-type-parameter.rs b/src/test/ui/missing/missing-items/missing-type-parameter.rs
similarity index 100%
rename from src/test/ui/missing-items/missing-type-parameter.rs
rename to src/test/ui/missing/missing-items/missing-type-parameter.rs
diff --git a/src/test/ui/missing-items/missing-type-parameter.stderr b/src/test/ui/missing/missing-items/missing-type-parameter.stderr
similarity index 100%
rename from src/test/ui/missing-items/missing-type-parameter.stderr
rename to src/test/ui/missing/missing-items/missing-type-parameter.stderr
diff --git a/src/test/compile-fail/missing-macro-use.rs b/src/test/ui/missing/missing-macro-use.rs
similarity index 100%
rename from src/test/compile-fail/missing-macro-use.rs
rename to src/test/ui/missing/missing-macro-use.rs
diff --git a/src/test/ui/missing/missing-macro-use.stderr b/src/test/ui/missing/missing-macro-use.stderr
new file mode 100644
index 0000000..6986b4d
--- /dev/null
+++ b/src/test/ui/missing/missing-macro-use.stderr
@@ -0,0 +1,8 @@
+error: cannot find macro `macro_two!` in this scope
+ --> $DIR/missing-macro-use.rs:16:5
+ |
+LL | macro_two!();
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/missing-main.rs b/src/test/ui/missing/missing-main.rs
similarity index 100%
rename from src/test/compile-fail/missing-main.rs
rename to src/test/ui/missing/missing-main.rs
diff --git a/src/test/ui/missing/missing-main.stderr b/src/test/ui/missing/missing-main.stderr
new file mode 100644
index 0000000..34b03ad
--- /dev/null
+++ b/src/test/ui/missing/missing-main.stderr
@@ -0,0 +1,7 @@
+error[E0601]: `main` function not found in crate `missing_main`
+ |
+ = note: consider adding a `main` function to `$DIR/missing-main.rs`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/missing-return.rs b/src/test/ui/missing/missing-return.rs
similarity index 100%
rename from src/test/compile-fail/missing-return.rs
rename to src/test/ui/missing/missing-return.rs
diff --git a/src/test/ui/missing/missing-return.stderr b/src/test/ui/missing/missing-return.stderr
new file mode 100644
index 0000000..d12a583
--- /dev/null
+++ b/src/test/ui/missing/missing-return.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/missing-return.rs:13:17
+ |
+LL | fn f() -> isize { }
+ | ^^^ expected isize, found ()
+ |
+ = note: expected type `isize`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/missing-semicolon-warning.rs b/src/test/ui/missing/missing-semicolon-warning.rs
similarity index 100%
rename from src/test/compile-fail/missing-semicolon-warning.rs
rename to src/test/ui/missing/missing-semicolon-warning.rs
diff --git a/src/test/ui/missing/missing-semicolon-warning.stderr b/src/test/ui/missing/missing-semicolon-warning.stderr
new file mode 100644
index 0000000..72319a2
--- /dev/null
+++ b/src/test/ui/missing/missing-semicolon-warning.stderr
@@ -0,0 +1,30 @@
+warning: expected `;`, found `let`
+ --> $DIR/missing-semicolon-warning.rs:16:12
+ |
+LL | $( let x = $e1 )*; //~ WARN expected `;`
+ | ^^^
+...
+LL | fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
+ | --------------- in this macro invocation
+ |
+ = note: This was erroneously allowed and will become a hard error in a future release
+
+warning: expected `;`, found `println`
+ --> $DIR/missing-semicolon-warning.rs:17:12
+ |
+LL | $( println!("{}", $e2) )*; //~ WARN expected `;`
+ | ^^^^^^^
+...
+LL | fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
+ | --------------- in this macro invocation
+ |
+ = note: This was erroneously allowed and will become a hard error in a future release
+
+error: compilation successful
+ --> $DIR/missing-semicolon-warning.rs:22:1
+ |
+LL | fn main() { m!(0, 0; 0, 0); } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/missing-stability.rs b/src/test/ui/missing/missing-stability.rs
similarity index 100%
rename from src/test/compile-fail/missing-stability.rs
rename to src/test/ui/missing/missing-stability.rs
diff --git a/src/test/ui/missing/missing-stability.stderr b/src/test/ui/missing/missing-stability.stderr
new file mode 100644
index 0000000..6e2802e
--- /dev/null
+++ b/src/test/ui/missing/missing-stability.stderr
@@ -0,0 +1,17 @@
+error: This node does not have a stability attribute
+ --> $DIR/missing-stability.rs:18:1
+ |
+LL | / pub fn unmarked() {
+LL | | //~^ ERROR This node does not have a stability attribute
+LL | | ()
+LL | | }
+ | |_^
+
+error: This node does not have a stability attribute
+ --> $DIR/missing-stability.rs:32:5
+ |
+LL | pub fn unmarked() {}
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/missing_debug_impls.rs b/src/test/ui/missing_debug_impls.rs
similarity index 100%
rename from src/test/compile-fail/missing_debug_impls.rs
rename to src/test/ui/missing_debug_impls.rs
diff --git a/src/test/ui/missing_debug_impls.stderr b/src/test/ui/missing_debug_impls.stderr
new file mode 100644
index 0000000..4b4c05f
--- /dev/null
+++ b/src/test/ui/missing_debug_impls.stderr
@@ -0,0 +1,20 @@
+error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
+ --> $DIR/missing_debug_impls.rs:17:1
+ |
+LL | pub enum A {} //~ ERROR type does not implement `fmt::Debug`
+ | ^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/missing_debug_impls.rs:12:9
+ |
+LL | #![deny(missing_debug_implementations)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type does not implement `fmt::Debug`; consider adding #[derive(Debug)] or a manual implementation
+ --> $DIR/missing_debug_impls.rs:30:1
+ |
+LL | pub struct Foo; //~ ERROR type does not implement `fmt::Debug`
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/mod_file_aux.rs b/src/test/ui/mod/mod_file_aux.rs
similarity index 100%
rename from src/test/compile-fail/mod_file_aux.rs
rename to src/test/ui/mod/mod_file_aux.rs
diff --git a/src/test/ui/mod/mod_file_correct_spans.rs b/src/test/ui/mod/mod_file_correct_spans.rs
new file mode 100644
index 0000000..1efd9ba
--- /dev/null
+++ b/src/test/ui/mod/mod_file_correct_spans.rs
@@ -0,0 +1,18 @@
+// Copyright 2012 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.
+
+// Testing that the source_map is maintained correctly when parsing mods from external files
+
+mod mod_file_aux;
+
+fn main() {
+ assert!(mod_file_aux::bar() == 10);
+ //~^ ERROR cannot find function `bar` in module `mod_file_aux`
+}
diff --git a/src/test/ui/mod/mod_file_correct_spans.stderr b/src/test/ui/mod/mod_file_correct_spans.stderr
new file mode 100644
index 0000000..6f5e4cc
--- /dev/null
+++ b/src/test/ui/mod/mod_file_correct_spans.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find function `bar` in module `mod_file_aux`
+ --> $DIR/mod_file_correct_spans.rs:16:27
+ |
+LL | assert!(mod_file_aux::bar() == 10);
+ | ^^^ not found in `mod_file_aux`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/mod_file_disambig.rs b/src/test/ui/mod/mod_file_disambig.rs
similarity index 100%
rename from src/test/compile-fail/mod_file_disambig.rs
rename to src/test/ui/mod/mod_file_disambig.rs
diff --git a/src/test/ui/mod/mod_file_disambig.stderr b/src/test/ui/mod/mod_file_disambig.stderr
new file mode 100644
index 0000000..16a013e
--- /dev/null
+++ b/src/test/ui/mod/mod_file_disambig.stderr
@@ -0,0 +1,11 @@
+error[E0584]: file for module `mod_file_disambig_aux` found at both mod_file_disambig_aux.rs and mod_file_disambig_aux/mod.rs
+ --> $DIR/mod_file_disambig.rs:13:5
+ |
+LL | mod mod_file_disambig_aux; //~ ERROR file for module `mod_file_disambig_aux` found at both
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: delete or rename one of them to remove the ambiguity
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0584`.
diff --git a/src/test/compile-fail/mod_file_disambig_aux.rs b/src/test/ui/mod/mod_file_disambig_aux.rs
similarity index 100%
rename from src/test/compile-fail/mod_file_disambig_aux.rs
rename to src/test/ui/mod/mod_file_disambig_aux.rs
diff --git a/src/test/compile-fail/mod_file_disambig_aux/mod.rs b/src/test/ui/mod/mod_file_disambig_aux/mod.rs
similarity index 100%
rename from src/test/compile-fail/mod_file_disambig_aux/mod.rs
rename to src/test/ui/mod/mod_file_disambig_aux/mod.rs
diff --git a/src/test/compile-fail/module-macro_use-arguments.rs b/src/test/ui/module-macro_use-arguments.rs
similarity index 100%
rename from src/test/compile-fail/module-macro_use-arguments.rs
rename to src/test/ui/module-macro_use-arguments.rs
diff --git a/src/test/ui/module-macro_use-arguments.stderr b/src/test/ui/module-macro_use-arguments.stderr
new file mode 100644
index 0000000..c6128877
--- /dev/null
+++ b/src/test/ui/module-macro_use-arguments.stderr
@@ -0,0 +1,8 @@
+error: arguments to macro_use are not allowed here
+ --> $DIR/module-macro_use-arguments.rs:11:1
+ |
+LL | #[macro_use(foo, bar)] //~ ERROR arguments to macro_use are not allowed here
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves-based-on-type-block-bad.nll.stderr
deleted file mode 100644
index 94f2074..0000000
--- a/src/test/ui/moves-based-on-type-block-bad.nll.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0507]: cannot move out of borrowed content
- --> $DIR/moves-based-on-type-block-bad.rs:34:19
- |
-LL | match hellothere.x { //~ ERROR cannot move out
- | ^^^^^^^^^^^^
- | |
- | cannot move out of borrowed content
- | help: consider using a reference instead: `&hellothere.x`
-...
-LL | box E::Bar(x) => println!("{}", x.to_string()),
- | - move occurs because x has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/move-guard-same-consts.rs b/src/test/ui/moves/move-guard-same-consts.rs
similarity index 100%
rename from src/test/compile-fail/move-guard-same-consts.rs
rename to src/test/ui/moves/move-guard-same-consts.rs
diff --git a/src/test/ui/moves/move-guard-same-consts.stderr b/src/test/ui/moves/move-guard-same-consts.stderr
new file mode 100644
index 0000000..71f90ee
--- /dev/null
+++ b/src/test/ui/moves/move-guard-same-consts.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-guard-same-consts.rs:30:24
+ |
+LL | (1, 2) if take(x) => (),
+ | - value moved here
+LL | (1, 2) if take(x) => (), //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/move-in-guard-1.rs b/src/test/ui/moves/move-in-guard-1.rs
similarity index 100%
rename from src/test/compile-fail/move-in-guard-1.rs
rename to src/test/ui/moves/move-in-guard-1.rs
diff --git a/src/test/ui/moves/move-in-guard-1.stderr b/src/test/ui/moves/move-in-guard-1.stderr
new file mode 100644
index 0000000..5dd46a6
--- /dev/null
+++ b/src/test/ui/moves/move-in-guard-1.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-in-guard-1.rs:20:24
+ |
+LL | (1, _) if take(x) => (),
+ | - value moved here
+LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/move-in-guard-2.rs b/src/test/ui/moves/move-in-guard-2.rs
similarity index 100%
rename from src/test/compile-fail/move-in-guard-2.rs
rename to src/test/ui/moves/move-in-guard-2.rs
diff --git a/src/test/ui/moves/move-in-guard-2.stderr b/src/test/ui/moves/move-in-guard-2.stderr
new file mode 100644
index 0000000..a12d9e9
--- /dev/null
+++ b/src/test/ui/moves/move-in-guard-2.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/move-in-guard-2.rs:20:24
+ |
+LL | (_, 2) if take(x) => (), //~ ERROR use of moved value: `x`
+ | ^ value moved here in previous iteration of loop
+ |
+ = note: move occurs because `x` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/move-into-dead-array-1.nll.stderr b/src/test/ui/moves/move-into-dead-array-1.nll.stderr
new file mode 100644
index 0000000..42f43d3
--- /dev/null
+++ b/src/test/ui/moves/move-into-dead-array-1.nll.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `a`
+ --> $DIR/move-into-dead-array-1.rs:24:5
+ |
+LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a`
+ | ^^^^ use of possibly uninitialized `a`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/compile-fail/move-into-dead-array-1.rs b/src/test/ui/moves/move-into-dead-array-1.rs
similarity index 100%
rename from src/test/compile-fail/move-into-dead-array-1.rs
rename to src/test/ui/moves/move-into-dead-array-1.rs
diff --git a/src/test/ui/moves/move-into-dead-array-1.stderr b/src/test/ui/moves/move-into-dead-array-1.stderr
new file mode 100644
index 0000000..ac18565
--- /dev/null
+++ b/src/test/ui/moves/move-into-dead-array-1.stderr
@@ -0,0 +1,9 @@
+error[E0381]: use of possibly uninitialized variable: `a`
+ --> $DIR/move-into-dead-array-1.rs:24:5
+ |
+LL | a[i] = d(); //~ ERROR use of possibly uninitialized variable: `a`
+ | ^^^^^^^^^^ use of possibly uninitialized `a`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0381`.
diff --git a/src/test/ui/moves/move-into-dead-array-2.nll.stderr b/src/test/ui/moves/move-into-dead-array-2.nll.stderr
new file mode 100644
index 0000000..cc6cc42
--- /dev/null
+++ b/src/test/ui/moves/move-into-dead-array-2.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `a`
+ --> $DIR/move-into-dead-array-2.rs:24:5
+ |
+LL | drop(a);
+ | - value moved here
+LL | a[i] = d(); //~ ERROR use of moved value: `a`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/move-into-dead-array-2.rs b/src/test/ui/moves/move-into-dead-array-2.rs
similarity index 100%
rename from src/test/compile-fail/move-into-dead-array-2.rs
rename to src/test/ui/moves/move-into-dead-array-2.rs
diff --git a/src/test/ui/moves/move-into-dead-array-2.stderr b/src/test/ui/moves/move-into-dead-array-2.stderr
new file mode 100644
index 0000000..0d999e6
--- /dev/null
+++ b/src/test/ui/moves/move-into-dead-array-2.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `a`
+ --> $DIR/move-into-dead-array-2.rs:24:5
+ |
+LL | drop(a);
+ | - value moved here
+LL | a[i] = d(); //~ ERROR use of moved value: `a`
+ | ^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `a` has type `[D; 4]`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/move-out-of-array-1.rs b/src/test/ui/moves/move-out-of-array-1.rs
similarity index 100%
rename from src/test/compile-fail/move-out-of-array-1.rs
rename to src/test/ui/moves/move-out-of-array-1.rs
diff --git a/src/test/ui/moves/move-out-of-array-1.stderr b/src/test/ui/moves/move-out-of-array-1.stderr
new file mode 100644
index 0000000..d015505
--- /dev/null
+++ b/src/test/ui/moves/move-out-of-array-1.stderr
@@ -0,0 +1,9 @@
+error[E0508]: cannot move out of type `[D; 4]`, a non-copy array
+ --> $DIR/move-out-of-array-1.rs:27:5
+ |
+LL | a[i] //~ ERROR cannot move out of type `[D; 4]`, a non-copy array
+ | ^^^^ cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/moves/move-out-of-slice-1.nll.stderr b/src/test/ui/moves/move-out-of-slice-1.nll.stderr
new file mode 100644
index 0000000..aa62b45
--- /dev/null
+++ b/src/test/ui/moves/move-out-of-slice-1.nll.stderr
@@ -0,0 +1,17 @@
+error[E0508]: cannot move out of type `[A]`, a non-copy slice
+ --> $DIR/move-out-of-slice-1.rs:17:11
+ |
+LL | match a {
+ | ^ cannot move out of here
+LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
+ | - data moved here
+ |
+note: move occurs because `a` has type `A`, which does not implement the `Copy` trait
+ --> $DIR/move-out-of-slice-1.rs:18:14
+ |
+LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/compile-fail/move-out-of-slice-1.rs b/src/test/ui/moves/move-out-of-slice-1.rs
similarity index 100%
rename from src/test/compile-fail/move-out-of-slice-1.rs
rename to src/test/ui/moves/move-out-of-slice-1.rs
diff --git a/src/test/ui/moves/move-out-of-slice-1.stderr b/src/test/ui/moves/move-out-of-slice-1.stderr
new file mode 100644
index 0000000..87e6814
--- /dev/null
+++ b/src/test/ui/moves/move-out-of-slice-1.stderr
@@ -0,0 +1,12 @@
+error[E0508]: cannot move out of type `[A]`, a non-copy slice
+ --> $DIR/move-out-of-slice-1.rs:18:13
+ |
+LL | box [a] => {}, //~ ERROR cannot move out of type `[A]`, a non-copy slice
+ | ^-^
+ | ||
+ | |hint: to prevent move, use `ref a` or `ref mut a`
+ | cannot move out of here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0508`.
diff --git a/src/test/ui/moves/move-out-of-tuple-field.nll.stderr b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr
new file mode 100644
index 0000000..e18db1b
--- /dev/null
+++ b/src/test/ui/moves/move-out-of-tuple-field.nll.stderr
@@ -0,0 +1,23 @@
+error[E0382]: use of moved value: `x.0`
+ --> $DIR/move-out-of-tuple-field.rs:18:13
+ |
+LL | let y = x.0;
+ | --- value moved here
+LL | let z = x.0; //~ ERROR use of moved value: `x.0`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.0` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.0`
+ --> $DIR/move-out-of-tuple-field.rs:22:13
+ |
+LL | let y = x.0;
+ | --- value moved here
+LL | let z = x.0; //~ ERROR use of moved value: `x.0`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `x.0` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/move-out-of-tuple-field.rs b/src/test/ui/moves/move-out-of-tuple-field.rs
similarity index 100%
rename from src/test/compile-fail/move-out-of-tuple-field.rs
rename to src/test/ui/moves/move-out-of-tuple-field.rs
diff --git a/src/test/ui/moves/move-out-of-tuple-field.stderr b/src/test/ui/moves/move-out-of-tuple-field.stderr
new file mode 100644
index 0000000..1e8acf5a
--- /dev/null
+++ b/src/test/ui/moves/move-out-of-tuple-field.stderr
@@ -0,0 +1,23 @@
+error[E0382]: use of moved value: `x.0`
+ --> $DIR/move-out-of-tuple-field.rs:18:9
+ |
+LL | let y = x.0;
+ | - value moved here
+LL | let z = x.0; //~ ERROR use of moved value: `x.0`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x.0` has type `std::boxed::Box<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x.0`
+ --> $DIR/move-out-of-tuple-field.rs:22:9
+ |
+LL | let y = x.0;
+ | - value moved here
+LL | let z = x.0; //~ ERROR use of moved value: `x.0`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x.0` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr
new file mode 100644
index 0000000..39c7f06
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-access-to-field.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-access-to-field.rs:21:12
+ |
+LL | consume(x.into_iter().next().unwrap());
+ | - value moved here
+LL | touch(&x[0]); //~ ERROR use of moved value: `x`
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-based-on-type-access-to-field.rs b/src/test/ui/moves/moves-based-on-type-access-to-field.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-access-to-field.rs
rename to src/test/ui/moves/moves-based-on-type-access-to-field.rs
diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
new file mode 100644
index 0000000..8154651
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-access-to-field.rs:21:12
+ |
+LL | consume(x.into_iter().next().unwrap());
+ | - value moved here
+LL | touch(&x[0]); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr
new file mode 100644
index 0000000..1f22ab1
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr
@@ -0,0 +1,21 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/moves-based-on-type-block-bad.rs:34:19
+ |
+LL | match hellothere.x { //~ ERROR cannot move out
+ | ^^^^^^^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&hellothere.x`
+...
+LL | box E::Bar(x) => println!("{}", x.to_string()),
+ | - data moved here
+ |
+note: move occurs because `x` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+ --> $DIR/moves-based-on-type-block-bad.rs:37:28
+ |
+LL | box E::Bar(x) => println!("{}", x.to_string()),
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/moves-based-on-type-block-bad.rs b/src/test/ui/moves/moves-based-on-type-block-bad.rs
similarity index 100%
rename from src/test/ui/moves-based-on-type-block-bad.rs
rename to src/test/ui/moves/moves-based-on-type-block-bad.rs
diff --git a/src/test/ui/moves-based-on-type-block-bad.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.stderr
similarity index 100%
rename from src/test/ui/moves-based-on-type-block-bad.stderr
rename to src/test/ui/moves/moves-based-on-type-block-bad.stderr
diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr
new file mode 100644
index 0000000..0081fa6
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.nll.stderr
@@ -0,0 +1,16 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-capture-clause-bad.rs:18:20
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved into closure here
+LL | println!("{}", x);
+ | - variable moved due to use in closure
+LL | });
+LL | println!("{}", x); //~ ERROR use of moved value
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-capture-clause-bad.rs
rename to src/test/ui/moves/moves-based-on-type-capture-clause-bad.rs
diff --git a/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr
new file mode 100644
index 0000000..54b2567
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-capture-clause-bad.stderr
@@ -0,0 +1,14 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-capture-clause-bad.rs:18:20
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved (into closure) here
+...
+LL | println!("{}", x); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr
new file mode 100644
index 0000000..50b51c6
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.nll.stderr
@@ -0,0 +1,14 @@
+error[E0382]: use of moved value: `node`
+ --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:23:13
+ |
+LL | Some(right) => consume(right),
+ | ----- value moved here
+...
+LL | consume(node) + r //~ ERROR use of partially moved value: `node`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because value has type `std::boxed::Box<List>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-cyclic-types-issue-4821.rs
rename to src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.rs
diff --git a/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr
new file mode 100644
index 0000000..421d257
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-cyclic-types-issue-4821.stderr
@@ -0,0 +1,14 @@
+error[E0382]: use of partially moved value: `node`
+ --> $DIR/moves-based-on-type-cyclic-types-issue-4821.rs:23:13
+ |
+LL | Some(right) => consume(right),
+ | ----- value moved here
+...
+LL | consume(node) + r //~ ERROR use of partially moved value: `node`
+ | ^^^^ value used here after move
+ |
+ = note: move occurs because the value has type `std::boxed::Box<List>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr
new file mode 100644
index 0000000..8242073
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.nll.stderr
@@ -0,0 +1,25 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:21:11
+ |
+LL | let _y = Foo { f:x };
+ | - value moved here
+LL | //~^ NOTE value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:30:11
+ |
+LL | let _y = Foo { f:(((x))) };
+ | ------- value moved here
+LL | //~^ NOTE value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-based-on-type-distribute-copy-over-paren.rs b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-distribute-copy-over-paren.rs
rename to src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.rs
diff --git a/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr
new file mode 100644
index 0000000..8c40b4d
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-distribute-copy-over-paren.stderr
@@ -0,0 +1,25 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:21:12
+ |
+LL | let _y = Foo { f:x };
+ | - value moved here
+LL | //~^ NOTE value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-distribute-copy-over-paren.rs:30:12
+ |
+LL | let _y = Foo { f:(((x))) };
+ | ------- value moved here
+LL | //~^ NOTE value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr
new file mode 100644
index 0000000..aa248da
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-exprs.nll.stderr
@@ -0,0 +1,118 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:22:11
+ |
+LL | let _y = Foo { f:x };
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:28:11
+ |
+LL | let _y = (x, 3);
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:45:11
+ |
+LL | x
+ | - value moved here
+...
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/moves-based-on-type-exprs.rs:46:11
+ |
+LL | y
+ | - value moved here
+...
+LL | touch(&y); //~ ERROR use of moved value: `y`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:56:11
+ |
+LL | true => x,
+ | - value moved here
+...
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `y`
+ --> $DIR/moves-based-on-type-exprs.rs:57:11
+ |
+LL | false => y
+ | - value moved here
+...
+LL | touch(&y); //~ ERROR use of moved value: `y`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:68:11
+ |
+LL | _ if guard(x) => 10,
+ | - value moved here
+...
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:75:11
+ |
+LL | let _y = [x];
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:81:11
+ |
+LL | let _y = vec![x];
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:87:11
+ |
+LL | let _y = x.into_iter().next().unwrap();
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:93:11
+ |
+LL | let _y = [x.into_iter().next().unwrap(); 1];
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-based-on-type-exprs.rs b/src/test/ui/moves/moves-based-on-type-exprs.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-exprs.rs
rename to src/test/ui/moves/moves-based-on-type-exprs.rs
diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr
new file mode 100644
index 0000000..003ae01
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr
@@ -0,0 +1,118 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:22:12
+ |
+LL | let _y = Foo { f:x };
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:28:12
+ |
+LL | let _y = (x, 3);
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:45:12
+ |
+LL | x
+ | - value moved here
+...
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `y`
+ --> $DIR/moves-based-on-type-exprs.rs:46:12
+ |
+LL | y
+ | - value moved here
+...
+LL | touch(&y); //~ ERROR use of moved value: `y`
+ | ^ value used here after move
+ |
+ = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:56:12
+ |
+LL | true => x,
+ | - value moved here
+...
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `y`
+ --> $DIR/moves-based-on-type-exprs.rs:57:12
+ |
+LL | false => y
+ | - value moved here
+...
+LL | touch(&y); //~ ERROR use of moved value: `y`
+ | ^ value used here after move
+ |
+ = note: move occurs because `y` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:68:12
+ |
+LL | _ if guard(x) => 10,
+ | - value moved here
+...
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:75:12
+ |
+LL | let _y = [x];
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:81:12
+ |
+LL | let _y = vec![x];
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:87:12
+ |
+LL | let _y = x.into_iter().next().unwrap();
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/moves-based-on-type-exprs.rs:93:12
+ |
+LL | let _y = [x.into_iter().next().unwrap(); 1];
+ | - value moved here
+LL | touch(&x); //~ ERROR use of moved value: `x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves-based-on-type-match-bindings.nll.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr
similarity index 100%
rename from src/test/ui/moves-based-on-type-match-bindings.nll.stderr
rename to src/test/ui/moves/moves-based-on-type-match-bindings.nll.stderr
diff --git a/src/test/ui/moves-based-on-type-match-bindings.rs b/src/test/ui/moves/moves-based-on-type-match-bindings.rs
similarity index 100%
rename from src/test/ui/moves-based-on-type-match-bindings.rs
rename to src/test/ui/moves/moves-based-on-type-match-bindings.rs
diff --git a/src/test/ui/moves-based-on-type-match-bindings.stderr b/src/test/ui/moves/moves-based-on-type-match-bindings.stderr
similarity index 100%
rename from src/test/ui/moves-based-on-type-match-bindings.stderr
rename to src/test/ui/moves/moves-based-on-type-match-bindings.stderr
diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr
new file mode 100644
index 0000000..13a6fc1
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr
@@ -0,0 +1,11 @@
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28
+ |
+LL | let i = box 3;
+ | - captured outer variable
+LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out
+ | ^ cannot move out of captured variable in an `Fn` closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
rename to src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
new file mode 100644
index 0000000..43de901
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.stderr
@@ -0,0 +1,11 @@
+error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+ --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28
+ |
+LL | let i = box 3;
+ | - captured outer variable
+LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out
+ | ^ cannot move out of captured outer variable in an `Fn` closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr
new file mode 100644
index 0000000..e23a6be
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.nll.stderr
@@ -0,0 +1,24 @@
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:30:27
+ |
+LL | (f.c)(f, true);
+ | ------^-------
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error[E0382]: borrow of moved value: `f`
+ --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:42:5
+ |
+LL | let mut r = R {c: Box::new(f)};
+ | - value moved here
+LL | f(&mut r, false) //~ ERROR use of moved value
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0382, E0499.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs
similarity index 100%
rename from src/test/compile-fail/moves-based-on-type-no-recursive-stack-closure.rs
rename to src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.rs
diff --git a/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
new file mode 100644
index 0000000..65cea57
--- /dev/null
+++ b/src/test/ui/moves/moves-based-on-type-no-recursive-stack-closure.stderr
@@ -0,0 +1,23 @@
+error[E0499]: cannot borrow `*f` as mutable more than once at a time
+ --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:30:27
+ |
+LL | (f.c)(f, true);
+ | ----- ^ - first borrow ends here
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+
+error[E0382]: use of moved value: `f`
+ --> $DIR/moves-based-on-type-no-recursive-stack-closure.rs:42:5
+ |
+LL | let mut r = R {c: Box::new(f)};
+ | - value moved here
+LL | f(&mut r, false) //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `f` has type `F`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0382, E0499.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/ui/moves-based-on-type-tuple.rs b/src/test/ui/moves/moves-based-on-type-tuple.rs
similarity index 100%
rename from src/test/ui/moves-based-on-type-tuple.rs
rename to src/test/ui/moves/moves-based-on-type-tuple.rs
diff --git a/src/test/ui/moves-based-on-type-tuple.stderr b/src/test/ui/moves/moves-based-on-type-tuple.stderr
similarity index 100%
rename from src/test/ui/moves-based-on-type-tuple.stderr
rename to src/test/ui/moves/moves-based-on-type-tuple.stderr
diff --git a/src/test/ui/moves/moves-sru-moved-field.nll.stderr b/src/test/ui/moves/moves-sru-moved-field.nll.stderr
new file mode 100644
index 0000000..d1a528c
--- /dev/null
+++ b/src/test/ui/moves/moves-sru-moved-field.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `f.moved`
+ --> $DIR/moves-sru-moved-field.rs:30:14
+ |
+LL | let _b = Foo {noncopyable: g, ..f};
+ | ------------------------- value moved here
+LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `f.moved` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/moves-sru-moved-field.rs b/src/test/ui/moves/moves-sru-moved-field.rs
similarity index 100%
rename from src/test/compile-fail/moves-sru-moved-field.rs
rename to src/test/ui/moves/moves-sru-moved-field.rs
diff --git a/src/test/ui/moves/moves-sru-moved-field.stderr b/src/test/ui/moves/moves-sru-moved-field.stderr
new file mode 100644
index 0000000..878dd7b
--- /dev/null
+++ b/src/test/ui/moves/moves-sru-moved-field.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `f.moved`
+ --> $DIR/moves-sru-moved-field.rs:30:37
+ |
+LL | let _b = Foo {noncopyable: g, ..f};
+ | - value moved here
+LL | let _c = Foo {noncopyable: h, ..f}; //~ ERROR use of moved value: `f.moved`
+ | ^ value used here after move
+ |
+ = note: move occurs because `f.moved` has type `std::boxed::Box<isize>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/multiple-main-2.rs b/src/test/ui/multiple-main-2.rs
similarity index 100%
rename from src/test/compile-fail/multiple-main-2.rs
rename to src/test/ui/multiple-main-2.rs
diff --git a/src/test/ui/multiple-main-2.stderr b/src/test/ui/multiple-main-2.stderr
new file mode 100644
index 0000000..e63bbc5
--- /dev/null
+++ b/src/test/ui/multiple-main-2.stderr
@@ -0,0 +1,14 @@
+error[E0137]: multiple functions with a #[main] attribute
+ --> $DIR/multiple-main-2.rs:18:1
+ |
+LL | / fn bar() {
+LL | | }
+ | |_- first #[main] function
+...
+LL | / fn foo() { //~ ERROR multiple functions with a #[main] attribute
+LL | | }
+ | |_^ additional #[main] function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0137`.
diff --git a/src/test/compile-fail/multiple-main-3.rs b/src/test/ui/multiple-main-3.rs
similarity index 100%
rename from src/test/compile-fail/multiple-main-3.rs
rename to src/test/ui/multiple-main-3.rs
diff --git a/src/test/ui/multiple-main-3.stderr b/src/test/ui/multiple-main-3.stderr
new file mode 100644
index 0000000..d489e34
--- /dev/null
+++ b/src/test/ui/multiple-main-3.stderr
@@ -0,0 +1,14 @@
+error[E0137]: multiple functions with a #[main] attribute
+ --> $DIR/multiple-main-3.rs:19:5
+ |
+LL | / fn main1() {
+LL | | }
+ | |_- first #[main] function
+...
+LL | / fn main2() { //~ ERROR multiple functions with a #[main] attribute
+LL | | }
+ | |_____^ additional #[main] function
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0137`.
diff --git a/src/test/compile-fail/multiple-plugin-registrars.rs b/src/test/ui/multiple-plugin-registrars.rs
similarity index 100%
rename from src/test/compile-fail/multiple-plugin-registrars.rs
rename to src/test/ui/multiple-plugin-registrars.rs
diff --git a/src/test/ui/multiple-plugin-registrars.stderr b/src/test/ui/multiple-plugin-registrars.stderr
new file mode 100644
index 0000000..f1370df
--- /dev/null
+++ b/src/test/ui/multiple-plugin-registrars.stderr
@@ -0,0 +1,15 @@
+error: multiple plugin registration functions found
+ |
+note: one is here
+ --> $DIR/multiple-plugin-registrars.rs:17:1
+ |
+LL | pub fn one() {}
+ | ^^^^^^^^^^^^^^^
+note: one is here
+ --> $DIR/multiple-plugin-registrars.rs:20:1
+ |
+LL | pub fn two() {}
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/mut/mut-cant-alias.nll.stderr b/src/test/ui/mut/mut-cant-alias.nll.stderr
new file mode 100644
index 0000000..e2758f8
--- /dev/null
+++ b/src/test/ui/mut/mut-cant-alias.nll.stderr
@@ -0,0 +1,13 @@
+error[E0499]: cannot borrow `b` as mutable more than once at a time
+ --> $DIR/mut-cant-alias.rs:19:20
+ |
+LL | let b1 = &mut *b;
+ | - first mutable borrow occurs here
+LL | let b2 = &mut *b; //~ ERROR cannot borrow
+ | ^ second mutable borrow occurs here
+LL | b1.use_mut();
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/mut/mut-cant-alias.rs b/src/test/ui/mut/mut-cant-alias.rs
new file mode 100644
index 0000000..af7d0e2
--- /dev/null
+++ b/src/test/ui/mut/mut-cant-alias.rs
@@ -0,0 +1,24 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+use std::cell::RefCell;
+
+
+
+fn main() {
+ let m = RefCell::new(0);
+ let mut b = m.borrow_mut();
+ let b1 = &mut *b;
+ let b2 = &mut *b; //~ ERROR cannot borrow
+ b1.use_mut();
+}
+
+trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
+impl<T> Fake for T { }
diff --git a/src/test/ui/mut/mut-cant-alias.stderr b/src/test/ui/mut/mut-cant-alias.stderr
new file mode 100644
index 0000000..b15ffe6
--- /dev/null
+++ b/src/test/ui/mut/mut-cant-alias.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `b` as mutable more than once at a time
+ --> $DIR/mut-cant-alias.rs:19:20
+ |
+LL | let b1 = &mut *b;
+ | - first mutable borrow occurs here
+LL | let b2 = &mut *b; //~ ERROR cannot borrow
+ | ^ second mutable borrow occurs here
+LL | b1.use_mut();
+LL | }
+ | - first borrow ends here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/mut-cross-borrowing.rs b/src/test/ui/mut/mut-cross-borrowing.rs
similarity index 100%
rename from src/test/compile-fail/mut-cross-borrowing.rs
rename to src/test/ui/mut/mut-cross-borrowing.rs
diff --git a/src/test/ui/mut/mut-cross-borrowing.stderr b/src/test/ui/mut/mut-cross-borrowing.stderr
new file mode 100644
index 0000000..be32f23
--- /dev/null
+++ b/src/test/ui/mut/mut-cross-borrowing.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/mut-cross-borrowing.rs:17:7
+ |
+LL | f(x) //~ ERROR mismatched types
+ | ^
+ | |
+ | expected &mut isize, found struct `std::boxed::Box`
+ | help: consider mutably borrowing here: `&mut x`
+ |
+ = note: expected type `&mut isize`
+ found type `std::boxed::Box<{integer}>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr
new file mode 100644
index 0000000..0df303e
--- /dev/null
+++ b/src/test/ui/mut/mut-pattern-internal-mutability.ast.nll.stderr
@@ -0,0 +1,26 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/mut-pattern-internal-mutability.rs:18:5
+ |
+LL | let &mut x = foo;
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0506]: cannot assign to `*foo` because it is borrowed
+ --> $DIR/mut-pattern-internal-mutability.rs:27:5
+ |
+LL | let &mut ref x = foo;
+ | ----- borrow of `*foo` occurs here
+LL | *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
+LL | //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0384, E0506.
+For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr
new file mode 100644
index 0000000..47a33e3
--- /dev/null
+++ b/src/test/ui/mut/mut-pattern-internal-mutability.ast.stderr
@@ -0,0 +1,20 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/mut-pattern-internal-mutability.rs:18:5
+ |
+LL | let &mut x = foo;
+ | - first assignment to `x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0506]: cannot assign to `*foo` because it is borrowed
+ --> $DIR/mut-pattern-internal-mutability.rs:27:5
+ |
+LL | let &mut ref x = foo;
+ | ----- borrow of `*foo` occurs here
+LL | *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0384, E0506.
+For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr b/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr
new file mode 100644
index 0000000..0df303e
--- /dev/null
+++ b/src/test/ui/mut/mut-pattern-internal-mutability.mir.stderr
@@ -0,0 +1,26 @@
+error[E0384]: cannot assign twice to immutable variable `x`
+ --> $DIR/mut-pattern-internal-mutability.rs:18:5
+ |
+LL | let &mut x = foo;
+ | -
+ | |
+ | first assignment to `x`
+ | consider changing this to `mut x`
+LL | x += 1; //[ast]~ ERROR cannot assign twice to immutable variable
+ | ^^^^^^ cannot assign twice to immutable variable
+
+error[E0506]: cannot assign to `*foo` because it is borrowed
+ --> $DIR/mut-pattern-internal-mutability.rs:27:5
+ |
+LL | let &mut ref x = foo;
+ | ----- borrow of `*foo` occurs here
+LL | *foo += 1; //[ast]~ ERROR cannot assign to `*foo` because it is borrowed
+ | ^^^^^^^^^ assignment to borrowed `*foo` occurs here
+LL | //[mir]~^ ERROR cannot assign to `*foo` because it is borrowed
+LL | drop(x);
+ | - borrow later used here
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0384, E0506.
+For more information about an error, try `rustc --explain E0384`.
diff --git a/src/test/compile-fail/mut-pattern-internal-mutability.rs b/src/test/ui/mut/mut-pattern-internal-mutability.rs
similarity index 100%
rename from src/test/compile-fail/mut-pattern-internal-mutability.rs
rename to src/test/ui/mut/mut-pattern-internal-mutability.rs
diff --git a/src/test/compile-fail/mut-pattern-mismatched.rs b/src/test/ui/mut/mut-pattern-mismatched.rs
similarity index 100%
rename from src/test/compile-fail/mut-pattern-mismatched.rs
rename to src/test/ui/mut/mut-pattern-mismatched.rs
diff --git a/src/test/ui/mut/mut-pattern-mismatched.stderr b/src/test/ui/mut/mut-pattern-mismatched.stderr
new file mode 100644
index 0000000..20bd804
--- /dev/null
+++ b/src/test/ui/mut/mut-pattern-mismatched.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/mut-pattern-mismatched.rs:16:10
+ |
+LL | let &_ //~ ERROR mismatched types
+ | ^^ types differ in mutability
+ |
+ = note: expected type `&mut {integer}`
+ found type `&_`
+
+error[E0308]: mismatched types
+ --> $DIR/mut-pattern-mismatched.rs:25:9
+ |
+LL | let &mut _ //~ ERROR mismatched types
+ | ^^^^^^ types differ in mutability
+ |
+ = note: expected type `&{integer}`
+ found type `&mut _`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/mut-ref.rs b/src/test/ui/mut/mut-ref.rs
similarity index 100%
rename from src/test/ui/mut-ref.rs
rename to src/test/ui/mut/mut-ref.rs
diff --git a/src/test/ui/mut-ref.stderr b/src/test/ui/mut/mut-ref.stderr
similarity index 100%
rename from src/test/ui/mut-ref.stderr
rename to src/test/ui/mut/mut-ref.stderr
diff --git a/src/test/ui/mut/mut-suggestion.nll.stderr b/src/test/ui/mut/mut-suggestion.nll.stderr
new file mode 100644
index 0000000..39a1e93
--- /dev/null
+++ b/src/test/ui/mut/mut-suggestion.nll.stderr
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `arg` as mutable, as it is not declared as mutable
+ --> $DIR/mut-suggestion.rs:21:5
+ |
+LL | fn func(arg: S) {
+ | --- help: consider changing this to be mutable: `mut arg`
+LL | //~^ consider changing this to `mut arg`
+LL | arg.mutate();
+ | ^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `local` as mutable, as it is not declared as mutable
+ --> $DIR/mut-suggestion.rs:29:5
+ |
+LL | let local = S;
+ | ----- help: consider changing this to be mutable: `mut local`
+LL | //~^ consider changing this to `mut local`
+LL | local.mutate();
+ | ^^^^^ cannot borrow as mutable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/mut-suggestion.rs b/src/test/ui/mut/mut-suggestion.rs
similarity index 100%
rename from src/test/compile-fail/mut-suggestion.rs
rename to src/test/ui/mut/mut-suggestion.rs
diff --git a/src/test/ui/mut/mut-suggestion.stderr b/src/test/ui/mut/mut-suggestion.stderr
new file mode 100644
index 0000000..4aa9649
--- /dev/null
+++ b/src/test/ui/mut/mut-suggestion.stderr
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow immutable argument `arg` as mutable
+ --> $DIR/mut-suggestion.rs:21:5
+ |
+LL | fn func(arg: S) {
+ | --- consider changing this to `mut arg`
+LL | //~^ consider changing this to `mut arg`
+LL | arg.mutate();
+ | ^^^ cannot borrow mutably
+
+error[E0596]: cannot borrow immutable local variable `local` as mutable
+ --> $DIR/mut-suggestion.rs:29:5
+ |
+LL | let local = S;
+ | ----- consider changing this to `mut local`
+LL | //~^ consider changing this to `mut local`
+LL | local.mutate();
+ | ^^^^^ cannot borrow mutably
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/mut/mutable-class-fields-2.nll.stderr b/src/test/ui/mut/mutable-class-fields-2.nll.stderr
new file mode 100644
index 0000000..3433f9f
--- /dev/null
+++ b/src/test/ui/mut/mutable-class-fields-2.nll.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to `self.how_hungry` which is behind a `&` reference
+ --> $DIR/mutable-class-fields-2.rs:19:5
+ |
+LL | pub fn eat(&self) {
+ | ----- help: consider changing this to be a mutable reference: `&mut self`
+LL | self.how_hungry -= 5; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/mutable-class-fields-2.rs b/src/test/ui/mut/mutable-class-fields-2.rs
similarity index 100%
rename from src/test/compile-fail/mutable-class-fields-2.rs
rename to src/test/ui/mut/mutable-class-fields-2.rs
diff --git a/src/test/ui/mut/mutable-class-fields-2.stderr b/src/test/ui/mut/mutable-class-fields-2.stderr
new file mode 100644
index 0000000..aa588d8
--- /dev/null
+++ b/src/test/ui/mut/mutable-class-fields-2.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to field `self.how_hungry` of immutable binding
+ --> $DIR/mutable-class-fields-2.rs:19:5
+ |
+LL | pub fn eat(&self) {
+ | ----- use `&mut self` here to make mutable
+LL | self.how_hungry -= 5; //~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/mut/mutable-class-fields.ast.nll.stderr b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr
new file mode 100644
index 0000000..033a3bd
--- /dev/null
+++ b/src/test/ui/mut/mutable-class-fields.ast.nll.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
+ --> $DIR/mutable-class-fields.rs:28:3
+ |
+LL | let nyan : cat = cat(52, 99);
+ | ---- help: consider changing this to be mutable: `mut nyan`
+LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/mut/mutable-class-fields.ast.stderr b/src/test/ui/mut/mutable-class-fields.ast.stderr
new file mode 100644
index 0000000..0a4d3a0
--- /dev/null
+++ b/src/test/ui/mut/mutable-class-fields.ast.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to field `nyan.how_hungry` of immutable binding
+ --> $DIR/mutable-class-fields.rs:28:3
+ |
+LL | let nyan : cat = cat(52, 99);
+ | ---- consider changing this to `mut nyan`
+LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^^^^^ cannot mutably borrow field of immutable binding
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/mut/mutable-class-fields.mir.stderr b/src/test/ui/mut/mutable-class-fields.mir.stderr
new file mode 100644
index 0000000..033a3bd
--- /dev/null
+++ b/src/test/ui/mut/mutable-class-fields.mir.stderr
@@ -0,0 +1,11 @@
+error[E0594]: cannot assign to `nyan.how_hungry`, as `nyan` is not declared as mutable
+ --> $DIR/mutable-class-fields.rs:28:3
+ |
+LL | let nyan : cat = cat(52, 99);
+ | ---- help: consider changing this to be mutable: `mut nyan`
+LL | nyan.how_hungry = 0; //[ast]~ ERROR cannot assign
+ | ^^^^^^^^^^^^^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/mutable-class-fields.rs b/src/test/ui/mut/mutable-class-fields.rs
similarity index 100%
rename from src/test/compile-fail/mutable-class-fields.rs
rename to src/test/ui/mut/mutable-class-fields.rs
diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/ui/mut/mutable-enum-indirect.rs
similarity index 100%
rename from src/test/compile-fail/mutable-enum-indirect.rs
rename to src/test/ui/mut/mutable-enum-indirect.rs
diff --git a/src/test/ui/mut/mutable-enum-indirect.stderr b/src/test/ui/mut/mutable-enum-indirect.stderr
new file mode 100644
index 0000000..1ad4b6a
--- /dev/null
+++ b/src/test/ui/mut/mutable-enum-indirect.stderr
@@ -0,0 +1,18 @@
+error[E0277]: `NoSync` cannot be shared between threads safely
+ --> $DIR/mutable-enum-indirect.rs:27:5
+ |
+LL | bar(&x);
+ | ^^^ `NoSync` cannot be shared between threads safely
+ |
+ = help: within `&Foo`, the trait `std::marker::Sync` is not implemented for `NoSync`
+ = note: required because it appears within the type `Foo`
+ = note: required because it appears within the type `&Foo`
+note: required by `bar`
+ --> $DIR/mutable-enum-indirect.rs:23:1
+ |
+LL | fn bar<T: Sync>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/mutexguard-sync.rs b/src/test/ui/mutexguard-sync.rs
similarity index 100%
rename from src/test/compile-fail/mutexguard-sync.rs
rename to src/test/ui/mutexguard-sync.rs
diff --git a/src/test/ui/mutexguard-sync.stderr b/src/test/ui/mutexguard-sync.stderr
new file mode 100644
index 0000000..709829e
--- /dev/null
+++ b/src/test/ui/mutexguard-sync.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `std::cell::Cell<i32>` cannot be shared between threads safely
+ --> $DIR/mutexguard-sync.rs:21:5
+ |
+LL | test_sync(guard);
+ | ^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell<i32>`
+ = note: required because of the requirements on the impl of `std::marker::Sync` for `std::sync::MutexGuard<'_, std::cell::Cell<i32>>`
+note: required by `test_sync`
+ --> $DIR/mutexguard-sync.rs:15:1
+ |
+LL | fn test_sync<T: Sync>(_t: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/auxiliary/namespace-mix.rs b/src/test/ui/namespace/auxiliary/namespace-mix.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/namespace-mix.rs
rename to src/test/ui/namespace/auxiliary/namespace-mix.rs
diff --git a/src/test/compile-fail/auxiliary/namespaced_enums.rs b/src/test/ui/namespace/auxiliary/namespaced_enums.rs
similarity index 100%
copy from src/test/compile-fail/auxiliary/namespaced_enums.rs
copy to src/test/ui/namespace/auxiliary/namespaced_enums.rs
diff --git a/src/test/compile-fail/namespace-mix.rs b/src/test/ui/namespace/namespace-mix.rs
similarity index 100%
rename from src/test/compile-fail/namespace-mix.rs
rename to src/test/ui/namespace/namespace-mix.rs
diff --git a/src/test/ui/namespace/namespace-mix.stderr b/src/test/ui/namespace/namespace-mix.stderr
new file mode 100644
index 0000000..6d72b60
--- /dev/null
+++ b/src/test/ui/namespace/namespace-mix.stderr
@@ -0,0 +1,594 @@
+error[E0423]: expected value, found type alias `m1::S`
+ --> $DIR/namespace-mix.rs:44:11
+ |
+LL | check(m1::S); //~ ERROR expected value, found type alias `m1::S`
+ | ^^^^-
+ | |
+ | did you mean `TS`?
+ |
+ = note: can't use a type alias as a constructor
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use m2::S;
+ |
+LL | use namespace_mix::xm2::S;
+ |
+
+error[E0423]: expected value, found type alias `xm1::S`
+ --> $DIR/namespace-mix.rs:50:11
+ |
+LL | check(xm1::S); //~ ERROR expected value, found type alias `xm1::S`
+ | ^^^^^-
+ | |
+ | did you mean `TS`?
+ |
+ = note: can't use a type alias as a constructor
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use m2::S;
+ |
+LL | use namespace_mix::xm2::S;
+ |
+
+error[E0423]: expected value, found struct variant `m7::V`
+ --> $DIR/namespace-mix.rs:110:11
+ |
+LL | check(m7::V); //~ ERROR expected value, found struct variant `m7::V`
+ | ^^^^-
+ | | |
+ | | did you mean `TV`?
+ | did you mean `m7::V { /* fields */ }`?
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use m8::V;
+ |
+LL | use namespace_mix::xm8::V;
+ |
+
+error[E0423]: expected value, found struct variant `xm7::V`
+ --> $DIR/namespace-mix.rs:116:11
+ |
+LL | check(xm7::V); //~ ERROR expected value, found struct variant `xm7::V`
+ | ^^^^^-
+ | | |
+ | | did you mean `TV`?
+ | did you mean `xm7::V { /* fields */ }`?
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use m8::V;
+ |
+LL | use namespace_mix::xm8::V;
+ |
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:43:5
+ |
+LL | check(m1::S{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::S: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:45:5
+ |
+LL | check(m2::S{}); //~ ERROR c::S
+ | ^^^^^ the trait `Impossible` is not implemented for `c::S`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:46:5
+ |
+LL | check(m2::S); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:49:5
+ |
+LL | check(xm1::S{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::S: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:51:5
+ |
+LL | check(xm2::S{}); //~ ERROR c::S
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::S`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:52:5
+ |
+LL | check(xm2::S); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:65:5
+ |
+LL | check(m3::TS{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `fn() -> c::TS {c::TS::{{constructor}}}: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:66:5
+ |
+LL | check(m3::TS); //~ ERROR c::TS
+ | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::TS {c::TS::{{constructor}}}`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::TS: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:67:5
+ |
+LL | check(m4::TS{}); //~ ERROR c::TS
+ | ^^^^^ the trait `Impossible` is not implemented for `c::TS`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:68:5
+ |
+LL | check(m4::TS); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:71:5
+ |
+LL | check(xm3::TS{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `fn() -> namespace_mix::c::TS {namespace_mix::c::TS::{{constructor}}}: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:72:5
+ |
+LL | check(xm3::TS); //~ ERROR c::TS
+ | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::TS {namespace_mix::c::TS::{{constructor}}}`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::TS: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:73:5
+ |
+LL | check(xm4::TS{}); //~ ERROR c::TS
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::TS`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:74:5
+ |
+LL | check(xm4::TS); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:87:5
+ |
+LL | check(m5::US{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::US: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:88:5
+ |
+LL | check(m5::US); //~ ERROR c::US
+ | ^^^^^ the trait `Impossible` is not implemented for `c::US`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::US: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:89:5
+ |
+LL | check(m6::US{}); //~ ERROR c::US
+ | ^^^^^ the trait `Impossible` is not implemented for `c::US`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:90:5
+ |
+LL | check(m6::US); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:93:5
+ |
+LL | check(xm5::US{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:94:5
+ |
+LL | check(xm5::US); //~ ERROR c::US
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::US: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:95:5
+ |
+LL | check(xm6::US{}); //~ ERROR c::US
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::US`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:96:5
+ |
+LL | check(xm6::US); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:109:5
+ |
+LL | check(m7::V{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:111:5
+ |
+LL | check(m8::V{}); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:112:5
+ |
+LL | check(m8::V); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:115:5
+ |
+LL | check(xm7::V{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:117:5
+ |
+LL | check(xm8::V{}); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:118:5
+ |
+LL | check(xm8::V); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:131:5
+ |
+LL | check(m9::TV{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `fn() -> c::E {c::E::TV}: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:132:5
+ |
+LL | check(m9::TV); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `fn() -> c::E {c::E::TV}`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:133:5
+ |
+LL | check(mA::TV{}); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:134:5
+ |
+LL | check(mA::TV); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:137:5
+ |
+LL | check(xm9::TV{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:138:5
+ |
+LL | check(xm9::TV); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `fn() -> namespace_mix::c::E {namespace_mix::c::E::TV}`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:139:5
+ |
+LL | check(xmA::TV{}); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:140:5
+ |
+LL | check(xmA::TV); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:153:5
+ |
+LL | check(mB::UV{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:154:5
+ |
+LL | check(mB::UV); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:155:5
+ |
+LL | check(mC::UV{}); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:156:5
+ |
+LL | check(mC::UV); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:159:5
+ |
+LL | check(xmB::UV{}); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:160:5
+ |
+LL | check(xmB::UV); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::E: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:161:5
+ |
+LL | check(xmC::UV{}); //~ ERROR c::E
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::E`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `namespace_mix::c::Item: Impossible` is not satisfied
+ --> $DIR/namespace-mix.rs:162:5
+ |
+LL | check(xmC::UV); //~ ERROR c::Item
+ | ^^^^^ the trait `Impossible` is not implemented for `namespace_mix::c::Item`
+ |
+note: required by `check`
+ --> $DIR/namespace-mix.rs:31:1
+ |
+LL | fn check<T: Impossible>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 48 previous errors
+
+Some errors occurred: E0277, E0423.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs
similarity index 100%
rename from src/test/compile-fail/namespaced-enum-glob-import-no-impls-xcrate.rs
rename to src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.rs
diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr
new file mode 100644
index 0000000..47ecb12
--- /dev/null
+++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls-xcrate.stderr
@@ -0,0 +1,27 @@
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:21:5
+ |
+LL | foo(); //~ ERROR cannot find function `foo` in this scope
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `foo` in module `m`
+ --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:22:8
+ |
+LL | m::foo(); //~ ERROR cannot find function `foo` in module `m`
+ | ^^^ not found in `m`
+
+error[E0425]: cannot find function `bar` in this scope
+ --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:23:5
+ |
+LL | bar(); //~ ERROR cannot find function `bar` in this scope
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `bar` in module `m`
+ --> $DIR/namespaced-enum-glob-import-no-impls-xcrate.rs:24:8
+ |
+LL | m::bar(); //~ ERROR cannot find function `bar` in module `m`
+ | ^^^ not found in `m`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs
similarity index 100%
rename from src/test/compile-fail/namespaced-enum-glob-import-no-impls.rs
rename to src/test/ui/namespace/namespaced-enum-glob-import-no-impls.rs
diff --git a/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr
new file mode 100644
index 0000000..916801d
--- /dev/null
+++ b/src/test/ui/namespace/namespaced-enum-glob-import-no-impls.stderr
@@ -0,0 +1,27 @@
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/namespaced-enum-glob-import-no-impls.rs:31:5
+ |
+LL | foo(); //~ ERROR cannot find function `foo` in this scope
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `foo` in module `m`
+ --> $DIR/namespaced-enum-glob-import-no-impls.rs:32:8
+ |
+LL | m::foo(); //~ ERROR cannot find function `foo` in module `m`
+ | ^^^ not found in `m`
+
+error[E0425]: cannot find function `bar` in this scope
+ --> $DIR/namespaced-enum-glob-import-no-impls.rs:33:5
+ |
+LL | bar(); //~ ERROR cannot find function `bar` in this scope
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find function `bar` in module `m`
+ --> $DIR/namespaced-enum-glob-import-no-impls.rs:34:8
+ |
+LL | m::bar(); //~ ERROR cannot find function `bar` in module `m`
+ | ^^^ not found in `m`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/nested-cfg-attrs.rs b/src/test/ui/nested-cfg-attrs.rs
similarity index 100%
rename from src/test/compile-fail/nested-cfg-attrs.rs
rename to src/test/ui/nested-cfg-attrs.rs
diff --git a/src/test/ui/nested-cfg-attrs.stderr b/src/test/ui/nested-cfg-attrs.stderr
new file mode 100644
index 0000000..5501dc8
--- /dev/null
+++ b/src/test/ui/nested-cfg-attrs.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find function `f` in this scope
+ --> $DIR/nested-cfg-attrs.rs:14:13
+ |
+LL | fn main() { f() } //~ ERROR cannot find function `f` in this scope
+ | ^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/nested-ty-params.rs b/src/test/ui/nested-ty-params.rs
similarity index 100%
rename from src/test/compile-fail/nested-ty-params.rs
rename to src/test/ui/nested-ty-params.rs
diff --git a/src/test/ui/nested-ty-params.stderr b/src/test/ui/nested-ty-params.stderr
new file mode 100644
index 0000000..93b934f
--- /dev/null
+++ b/src/test/ui/nested-ty-params.stderr
@@ -0,0 +1,28 @@
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/nested-ty-params.rs:13:16
+ |
+LL | fn hd<U>(v: Vec<U> ) -> U {
+ | - type variable from outer function
+LL | fn hd1(w: [U]) -> U { return w[0]; }
+ | --- ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `hd1<U>`
+
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/nested-ty-params.rs:13:23
+ |
+LL | fn hd<U>(v: Vec<U> ) -> U {
+ | - type variable from outer function
+LL | fn hd1(w: [U]) -> U { return w[0]; }
+ | --- ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `hd1<U>`
+
+error[E0601]: `main` function not found in crate `nested_ty_params`
+ |
+ = note: consider adding a `main` function to `$DIR/nested-ty-params.rs`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0401, E0601.
+For more information about an error, try `rustc --explain E0401`.
diff --git a/src/test/compile-fail/never-assign-dead-code.rs b/src/test/ui/never-assign-dead-code.rs
similarity index 100%
rename from src/test/compile-fail/never-assign-dead-code.rs
rename to src/test/ui/never-assign-dead-code.rs
diff --git a/src/test/ui/never-assign-dead-code.stderr b/src/test/ui/never-assign-dead-code.stderr
new file mode 100644
index 0000000..7c7126c
--- /dev/null
+++ b/src/test/ui/never-assign-dead-code.stderr
@@ -0,0 +1,44 @@
+warning: unreachable statement
+ --> $DIR/never-assign-dead-code.rs:20:5
+ |
+LL | drop(x); //~ WARN unreachable
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/never-assign-dead-code.rs:15:9
+ |
+LL | #![warn(unused)]
+ | ^^^^^^
+ = note: #[warn(unreachable_code)] implied by #[warn(unused)]
+
+warning: unreachable expression
+ --> $DIR/never-assign-dead-code.rs:20:5
+ |
+LL | drop(x); //~ WARN unreachable
+ | ^^^^^^^
+
+warning: unused variable: `x`
+ --> $DIR/never-assign-dead-code.rs:19:9
+ |
+LL | let x: ! = panic!("aah"); //~ WARN unused
+ | ^ help: consider using `_x` instead
+ |
+note: lint level defined here
+ --> $DIR/never-assign-dead-code.rs:15:9
+ |
+LL | #![warn(unused)]
+ | ^^^^^^
+ = note: #[warn(unused_variables)] implied by #[warn(unused)]
+
+error: compilation successful
+ --> $DIR/never-assign-dead-code.rs:18:1
+ |
+LL | / fn main() { //~ ERROR: compilation successful
+LL | | let x: ! = panic!("aah"); //~ WARN unused
+LL | | drop(x); //~ WARN unreachable
+LL | | //~^ WARN unreachable
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/never-assign-wrong-type.rs b/src/test/ui/never-assign-wrong-type.rs
similarity index 100%
rename from src/test/compile-fail/never-assign-wrong-type.rs
rename to src/test/ui/never-assign-wrong-type.rs
diff --git a/src/test/ui/never-assign-wrong-type.stderr b/src/test/ui/never-assign-wrong-type.stderr
new file mode 100644
index 0000000..41afe88
--- /dev/null
+++ b/src/test/ui/never-assign-wrong-type.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/never-assign-wrong-type.rs:17:16
+ |
+LL | let x: ! = "hello"; //~ ERROR mismatched types
+ | ^^^^^^^ expected !, found reference
+ |
+ = note: expected type `!`
+ found type `&'static str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/never_transmute_never.rs b/src/test/ui/never_transmute_never.rs
similarity index 100%
rename from src/test/compile-fail/never_transmute_never.rs
rename to src/test/ui/never_transmute_never.rs
diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr
index 814e11b..6a4c8f2 100644
--- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr
+++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr
@@ -5,7 +5,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `r`
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:16:22
@@ -14,7 +14,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `r`
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:17:26
@@ -23,7 +23,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `r`
+ | help: consider removing the `*`: `r`
error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
--> $DIR/cannot-move-block-spans.rs:21:15
@@ -32,7 +32,7 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&arr[0]`
+ | help: consider borrowing here: `&arr[0]`
error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
--> $DIR/cannot-move-block-spans.rs:22:22
@@ -41,7 +41,7 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&arr[0]`
+ | help: consider borrowing here: `&arr[0]`
error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array
--> $DIR/cannot-move-block-spans.rs:23:26
@@ -50,7 +50,7 @@
| ^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&arr[0]`
+ | help: consider borrowing here: `&arr[0]`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:27:38
@@ -59,7 +59,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `r`
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:28:45
@@ -68,7 +68,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `r`
+ | help: consider removing the `*`: `r`
error[E0507]: cannot move out of borrowed content
--> $DIR/cannot-move-block-spans.rs:29:49
@@ -77,7 +77,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `r`
+ | help: consider removing the `*`: `r`
error: aborting due to 9 previous errors
diff --git a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
index 116ff6e..00d79a9 100644
--- a/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
+++ b/src/test/ui/nll/closure-requirements/region-lbr-named-does-not-outlive-static.stderr
@@ -10,7 +10,7 @@
LL | fn foo<'a>(x: &'a u32) -> &'static u32 {
| -- lifetime `'a` defined here
LL | &*x
- | ^^^ requires that `'a` must outlive `'static`
+ | ^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error
diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr
index cf3f4df..bcdae17c 100644
--- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr
+++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.stderr
@@ -12,7 +12,7 @@
| |
| lifetime `'a` defined here
LL | &*x
- | ^^^ requires that `'a` must outlive `'b`
+ | ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
error: aborting due to previous error
diff --git a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
index d2e0888..8dc10de 100644
--- a/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
+++ b/src/test/ui/nll/closure-requirements/return-wrong-bound-region.stderr
@@ -19,7 +19,7 @@
--> $DIR/return-wrong-bound-region.rs:21:23
|
LL | expect_sig(|a, b| b); // ought to return `a`
- | - - ^ closure was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2`
+ | - - ^ closure was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
| | |
| | has type `&'1 i32`
| has type `&'2 i32`
diff --git a/src/test/compile-fail/nll/constant-thread-locals-issue-47053.rs b/src/test/ui/nll/constant-thread-locals-issue-47053.rs
similarity index 100%
rename from src/test/compile-fail/nll/constant-thread-locals-issue-47053.rs
rename to src/test/ui/nll/constant-thread-locals-issue-47053.rs
diff --git a/src/test/ui/nll/constant-thread-locals-issue-47053.stderr b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr
new file mode 100644
index 0000000..3aa95fc
--- /dev/null
+++ b/src/test/ui/nll/constant-thread-locals-issue-47053.stderr
@@ -0,0 +1,9 @@
+error[E0594]: cannot assign to immutable static item `FOO`
+ --> $DIR/constant-thread-locals-issue-47053.rs:20:5
+ |
+LL | FOO = 6; //~ ERROR cannot assign to immutable static item `FOO` [E0594]
+ | ^^^^^^^ cannot assign
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/nll/do-not-ignore-lifetime-bounds-in-copy.rs b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.rs
similarity index 100%
rename from src/test/compile-fail/nll/do-not-ignore-lifetime-bounds-in-copy.rs
rename to src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.rs
diff --git a/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr
new file mode 100644
index 0000000..edf32d3
--- /dev/null
+++ b/src/test/ui/nll/do-not-ignore-lifetime-bounds-in-copy.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `s` does not live long enough
+ --> $DIR/do-not-ignore-lifetime-bounds-in-copy.rs:20:17
+ |
+LL | let a = Foo(&s); //~ ERROR `s` does not live long enough [E0597]
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - `s` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/nll/get_default.nll.stderr b/src/test/ui/nll/get_default.nll.stderr
index b955a51..580dce3 100644
--- a/src/test/ui/nll/get_default.nll.stderr
+++ b/src/test/ui/nll/get_default.nll.stderr
@@ -63,9 +63,18 @@
LL | Some(v) => {
LL | map.set(String::new()); // Both AST and MIR error here
| ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
-...
-LL | return v;
- | - borrow later used here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 41:1...
+ --> $DIR/get_default.rs:41:1
+ |
+LL | / fn err(map: &mut Map) -> &String {
+LL | | loop {
+LL | | match map.get() {
+LL | | Some(v) => {
+... |
+LL | | }
+LL | | }
+ | |_^
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
--> $DIR/get_default.rs:51:17
diff --git a/src/test/ui/nll/get_default.stderr b/src/test/ui/nll/get_default.stderr
index 75194bf..2f8eab9 100644
--- a/src/test/ui/nll/get_default.stderr
+++ b/src/test/ui/nll/get_default.stderr
@@ -63,9 +63,18 @@
LL | Some(v) => {
LL | map.set(String::new()); // Both AST and MIR error here
| ^^^ mutable borrow occurs here
-...
-LL | return v;
- | - borrow later used here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 41:1...
+ --> $DIR/get_default.rs:41:1
+ |
+LL | / fn err(map: &mut Map) -> &String {
+LL | | loop {
+LL | | match map.get() {
+LL | | Some(v) => {
+... |
+LL | | }
+LL | | }
+ | |_^
error[E0502]: cannot borrow `*map` as mutable because it is also borrowed as immutable (Mir)
--> $DIR/get_default.rs:51:17
diff --git a/src/test/ui/nll/issue-27868.rs b/src/test/ui/nll/issue-27868.rs
new file mode 100644
index 0000000..022917a
--- /dev/null
+++ b/src/test/ui/nll/issue-27868.rs
@@ -0,0 +1,40 @@
+// 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 #27868
+
+#![feature(nll)]
+
+use std::ops::AddAssign;
+
+struct MyVec<T>(Vec<T>);
+
+impl <T> Drop for MyVec<T> {
+ fn drop(&mut self) {
+ println!("Being dropped.");
+ }
+}
+
+impl<T> AddAssign<T> for MyVec<T> {
+ fn add_assign(&mut self, _elem: T) {
+ println!("In add_assign.");
+ }
+}
+
+fn main() {
+ let mut vec = MyVec(vec![0]);
+ let mut vecvec = vec![vec];
+
+ vecvec[0] += {
+ vecvec = vec![];
+ //~^ ERROR cannot assign to `vecvec` because it is borrowed [E0506]
+ 0
+ };
+}
diff --git a/src/test/ui/nll/issue-27868.stderr b/src/test/ui/nll/issue-27868.stderr
new file mode 100644
index 0000000..a376829
--- /dev/null
+++ b/src/test/ui/nll/issue-27868.stderr
@@ -0,0 +1,18 @@
+error[E0506]: cannot assign to `vecvec` because it is borrowed
+ --> $DIR/issue-27868.rs:36:9
+ |
+LL | vecvec[0] += {
+ | ------
+ | |
+ | _____borrow of `vecvec` occurs here
+ | |
+LL | | vecvec = vec![];
+ | | ^^^^^^ assignment to borrowed `vecvec` occurs here
+LL | | //~^ ERROR cannot assign to `vecvec` because it is borrowed [E0506]
+LL | | 0
+LL | | };
+ | |_____- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/nll/issue-30104.rs b/src/test/ui/nll/issue-30104.rs
new file mode 100644
index 0000000..64c32a5
--- /dev/null
+++ b/src/test/ui/nll/issue-30104.rs
@@ -0,0 +1,52 @@
+// 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 #30104
+
+// compile-pass
+
+#![feature(nll)]
+
+use std::ops::{Deref, DerefMut};
+
+fn box_two_field(v: &mut Box<(i32, i32)>) {
+ let _a = &mut v.0;
+ let _b = &mut v.1;
+}
+
+fn box_destructure(v: &mut Box<(i32, i32)>) {
+ let (ref mut _head, ref mut _tail) = **v;
+}
+
+struct Wrap<T>(T);
+
+impl<T> Deref for Wrap<T> {
+ type Target = T;
+ fn deref(&self) -> &T {
+ &self.0
+ }
+}
+
+impl<T> DerefMut for Wrap<T> {
+ fn deref_mut(&mut self) -> &mut T {
+ &mut self.0
+ }
+}
+
+fn smart_two_field(v: &mut Wrap<(i32, i32)>) {
+ let _a = &mut v.0;
+ let _b = &mut v.1;
+}
+
+fn smart_destructure(v: &mut Wrap<(i32, i32)>) {
+ let (ref mut _head, ref mut _tail) = **v;
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/issue-48238.stderr b/src/test/ui/nll/issue-48238.stderr
index 84d0730..a48516e 100644
--- a/src/test/ui/nll/issue-48238.stderr
+++ b/src/test/ui/nll/issue-48238.stderr
@@ -2,7 +2,7 @@
--> $DIR/issue-48238.rs:21:13
|
LL | move || use_val(&orig); //~ ERROR
- | ------- ^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2`
+ | ------- ^^^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
| | |
| | return type of closure is &'2 u8
| lifetime `'1` represents this closure's body
diff --git a/src/test/ui/nll/issue-48697.rs b/src/test/ui/nll/issue-48697.rs
new file mode 100644
index 0000000..69ff82e
--- /dev/null
+++ b/src/test/ui/nll/issue-48697.rs
@@ -0,0 +1,24 @@
+// 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 #48697
+
+// compile-pass
+
+#![feature(nll)]
+
+fn foo(x: &i32) -> &i32 {
+ let z = 4;
+ let f = &|y| y;
+ let k = f(&z);
+ f(x)
+}
+
+fn main() {}
diff --git a/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs b/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs
new file mode 100644
index 0000000..dc40b0c
--- /dev/null
+++ b/src/test/ui/nll/issue-52663-span-decl-captured-variable.rs
@@ -0,0 +1,23 @@
+// 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.
+
+#![feature(nll)]
+
+fn expect_fn<F>(f: F) where F : Fn() {
+ f();
+}
+
+fn main() {
+ {
+ let x = (vec![22], vec![44]);
+ expect_fn(|| drop(x.0));
+ //~^ ERROR cannot move out of captured variable in an `Fn` closure [E0507]
+ }
+}
diff --git a/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr b/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr
new file mode 100644
index 0000000..51f1956
--- /dev/null
+++ b/src/test/ui/nll/issue-52663-span-decl-captured-variable.stderr
@@ -0,0 +1,11 @@
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/issue-52663-span-decl-captured-variable.rs:20:26
+ |
+LL | let x = (vec![22], vec![44]);
+ | - captured outer variable
+LL | expect_fn(|| drop(x.0));
+ | ^^^ cannot move out of captured variable in an `Fn` closure
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/nll/issue-52742.rs b/src/test/ui/nll/issue-52742.rs
new file mode 100644
index 0000000..c36e4cc
--- /dev/null
+++ b/src/test/ui/nll/issue-52742.rs
@@ -0,0 +1,31 @@
+// Copyright 2012 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.
+
+#![feature(nll)]
+#![feature(in_band_lifetimes)]
+#![feature(impl_header_lifetime_elision)]
+
+struct Foo<'a, 'b> {
+ x: &'a u32,
+ y: &'b u32,
+}
+
+struct Bar<'b> {
+ z: &'b u32
+}
+
+impl Foo<'_, '_> {
+ fn take_bar(&mut self, b: Bar<'_>) {
+ self.y = b.z
+ //~^ ERROR unsatisfied lifetime constraints
+ }
+}
+
+fn main() { }
diff --git a/src/test/ui/nll/issue-52742.stderr b/src/test/ui/nll/issue-52742.stderr
new file mode 100644
index 0000000..515ba55
--- /dev/null
+++ b/src/test/ui/nll/issue-52742.stderr
@@ -0,0 +1,12 @@
+error: unsatisfied lifetime constraints
+ --> $DIR/issue-52742.rs:26:9
+ |
+LL | fn take_bar(&mut self, b: Bar<'_>) {
+ | --------- -- let's call this `'1`
+ | |
+ | has type `&mut Foo<'_, '2>`
+LL | self.y = b.z
+ | ^^^^^^^^^^^^ requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/nll/loan_ends_mid_block_pair.rs b/src/test/ui/nll/loan_ends_mid_block_pair.rs
similarity index 100%
rename from src/test/compile-fail/nll/loan_ends_mid_block_pair.rs
rename to src/test/ui/nll/loan_ends_mid_block_pair.rs
diff --git a/src/test/ui/nll/loan_ends_mid_block_pair.stderr b/src/test/ui/nll/loan_ends_mid_block_pair.stderr
new file mode 100644
index 0000000..9afae71
--- /dev/null
+++ b/src/test/ui/nll/loan_ends_mid_block_pair.stderr
@@ -0,0 +1,93 @@
+error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
+ --> $DIR/loan_ends_mid_block_pair.rs:25:5
+ |
+LL | let c = &mut data.0;
+ | ------ borrow of `data.0` occurs here
+LL | capitalize(c);
+LL | data.0 = 'e';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
+ --> $DIR/loan_ends_mid_block_pair.rs:28:5
+ |
+LL | let c = &mut data.0;
+ | ------ borrow of `data.0` occurs here
+...
+LL | data.0 = 'f';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
+ --> $DIR/loan_ends_mid_block_pair.rs:31:5
+ |
+LL | let c = &mut data.0;
+ | ------ borrow of `data.0` occurs here
+...
+LL | data.0 = 'g';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
+ --> $DIR/loan_ends_mid_block_pair.rs:41:5
+ |
+LL | let c = &mut data.0;
+ | ------ borrow of `data.0` occurs here
+LL | capitalize(c);
+LL | data.0 = 'e';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
+ --> $DIR/loan_ends_mid_block_pair.rs:43:5
+ |
+LL | let c = &mut data.0;
+ | ------ borrow of `data.0` occurs here
+...
+LL | data.0 = 'f';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Ast)
+ --> $DIR/loan_ends_mid_block_pair.rs:45:5
+ |
+LL | let c = &mut data.0;
+ | ------ borrow of `data.0` occurs here
+...
+LL | data.0 = 'g';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Mir)
+ --> $DIR/loan_ends_mid_block_pair.rs:25:5
+ |
+LL | let c = &mut data.0;
+ | ----------- borrow of `data.0` occurs here
+LL | capitalize(c);
+LL | data.0 = 'e';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+...
+LL | capitalize(c);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Mir)
+ --> $DIR/loan_ends_mid_block_pair.rs:28:5
+ |
+LL | let c = &mut data.0;
+ | ----------- borrow of `data.0` occurs here
+...
+LL | data.0 = 'f';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+...
+LL | capitalize(c);
+ | - borrow later used here
+
+error[E0506]: cannot assign to `data.0` because it is borrowed (Mir)
+ --> $DIR/loan_ends_mid_block_pair.rs:31:5
+ |
+LL | let c = &mut data.0;
+ | ----------- borrow of `data.0` occurs here
+...
+LL | data.0 = 'g';
+ | ^^^^^^^^^^^^ assignment to borrowed `data.0` occurs here
+...
+LL | capitalize(c);
+ | - borrow later used here
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/nll/loan_ends_mid_block_vec.rs b/src/test/ui/nll/loan_ends_mid_block_vec.rs
similarity index 100%
rename from src/test/compile-fail/nll/loan_ends_mid_block_vec.rs
rename to src/test/ui/nll/loan_ends_mid_block_vec.rs
diff --git a/src/test/ui/nll/loan_ends_mid_block_vec.stderr b/src/test/ui/nll/loan_ends_mid_block_vec.stderr
new file mode 100644
index 0000000..4c739cf
--- /dev/null
+++ b/src/test/ui/nll/loan_ends_mid_block_vec.stderr
@@ -0,0 +1,111 @@
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
+ --> $DIR/loan_ends_mid_block_vec.rs:24:5
+ |
+LL | let slice = &mut data;
+ | ---- first mutable borrow occurs here
+LL | capitalize(slice);
+LL | data.push('d');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
+ --> $DIR/loan_ends_mid_block_vec.rs:27:5
+ |
+LL | let slice = &mut data;
+ | ---- first mutable borrow occurs here
+...
+LL | data.push('e');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
+ --> $DIR/loan_ends_mid_block_vec.rs:30:5
+ |
+LL | let slice = &mut data;
+ | ---- first mutable borrow occurs here
+...
+LL | data.push('f');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
+ --> $DIR/loan_ends_mid_block_vec.rs:40:5
+ |
+LL | let slice = &mut data;
+ | ---- first mutable borrow occurs here
+LL | capitalize(slice);
+LL | data.push('d');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
+ --> $DIR/loan_ends_mid_block_vec.rs:42:5
+ |
+LL | let slice = &mut data;
+ | ---- first mutable borrow occurs here
+...
+LL | data.push('e');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Ast)
+ --> $DIR/loan_ends_mid_block_vec.rs:44:5
+ |
+LL | let slice = &mut data;
+ | ---- first mutable borrow occurs here
+...
+LL | data.push('f');
+ | ^^^^ second mutable borrow occurs here
+LL | //~^ ERROR (Ast) [E0499]
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir)
+ --> $DIR/loan_ends_mid_block_vec.rs:24:5
+ |
+LL | let slice = &mut data;
+ | --------- first mutable borrow occurs here
+LL | capitalize(slice);
+LL | data.push('d');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | capitalize(slice);
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir)
+ --> $DIR/loan_ends_mid_block_vec.rs:27:5
+ |
+LL | let slice = &mut data;
+ | --------- first mutable borrow occurs here
+...
+LL | data.push('e');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | capitalize(slice);
+ | ----- borrow later used here
+
+error[E0499]: cannot borrow `data` as mutable more than once at a time (Mir)
+ --> $DIR/loan_ends_mid_block_vec.rs:30:5
+ |
+LL | let slice = &mut data;
+ | --------- first mutable borrow occurs here
+...
+LL | data.push('f');
+ | ^^^^ second mutable borrow occurs here
+...
+LL | capitalize(slice);
+ | ----- borrow later used here
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr
new file mode 100644
index 0000000..54b1fcb
--- /dev/null
+++ b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/match-guards-always-borrow.rs:23:13
+ |
+LL | (|| { let bar = foo; bar.take() })();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.stderr
new file mode 100644
index 0000000..d6186d7
--- /dev/null
+++ b/src/test/ui/nll/match-guards-always-borrow.ast.stderr
@@ -0,0 +1,12 @@
+error: compilation successful
+ --> $DIR/match-guards-always-borrow.rs:57:1
+ |
+LL | / fn main() { //[ast]~ ERROR compilation successful
+LL | | should_reject_destructive_mutate_in_guard();
+LL | | allow_mutate_in_arm_body();
+LL | | allow_move_into_arm_body();
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/nll/match-guards-always-borrow.mir.stderr b/src/test/ui/nll/match-guards-always-borrow.mir.stderr
new file mode 100644
index 0000000..54b1fcb
--- /dev/null
+++ b/src/test/ui/nll/match-guards-always-borrow.mir.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/match-guards-always-borrow.rs:23:13
+ |
+LL | (|| { let bar = foo; bar.take() })();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/nll/match-guards-always-borrow.rs b/src/test/ui/nll/match-guards-always-borrow.rs
similarity index 100%
rename from src/test/compile-fail/nll/match-guards-always-borrow.rs
rename to src/test/ui/nll/match-guards-always-borrow.rs
diff --git a/src/test/ui/nll/mir_check_cast_closure.rs b/src/test/ui/nll/mir_check_cast_closure.rs
index 2200c15..a111699 100644
--- a/src/test/ui/nll/mir_check_cast_closure.rs
+++ b/src/test/ui/nll/mir_check_cast_closure.rs
@@ -14,9 +14,9 @@
fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 {
let g: fn(_, _) -> _ = |_x, y| y;
- //~^ ERROR unsatisfied lifetime constraints
g
//~^ WARNING not reporting region error due to nll
+ //~^^ ERROR unsatisfied lifetime constraints
}
fn main() {}
diff --git a/src/test/ui/nll/mir_check_cast_closure.stderr b/src/test/ui/nll/mir_check_cast_closure.stderr
index cdc4079..6805dbf 100644
--- a/src/test/ui/nll/mir_check_cast_closure.stderr
+++ b/src/test/ui/nll/mir_check_cast_closure.stderr
@@ -1,18 +1,19 @@
warning: not reporting region error due to nll
- --> $DIR/mir_check_cast_closure.rs:18:5
+ --> $DIR/mir_check_cast_closure.rs:17:5
|
LL | g
| ^
error: unsatisfied lifetime constraints
- --> $DIR/mir_check_cast_closure.rs:16:28
+ --> $DIR/mir_check_cast_closure.rs:17:5
|
LL | fn bar<'a, 'b>() -> fn(&'a u32, &'b u32) -> &'a u32 {
| -- -- lifetime `'b` defined here
| |
| lifetime `'a` defined here
LL | let g: fn(_, _) -> _ = |_x, y| y;
- | ^^^^^^^^^ cast requires that `'b` must outlive `'a`
+LL | g
+ | ^ returning this value requires that `'b` must outlive `'a`
error: aborting due to previous error
diff --git a/src/test/ui/nll/mir_check_cast_reify.stderr b/src/test/ui/nll/mir_check_cast_reify.stderr
index d8f186a..c6e5fb3 100644
--- a/src/test/ui/nll/mir_check_cast_reify.stderr
+++ b/src/test/ui/nll/mir_check_cast_reify.stderr
@@ -4,14 +4,14 @@
LL | let f: fn(_) -> _ = foo;
| ^^^
-error: borrowed data escapes outside of function
+error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_reify.rs:48:5
|
LL | fn bar<'a>(x: &'a u32) -> &'static u32 {
- | - `x` is a reference that is only valid in the function body
+ | -- lifetime `'a` defined here
...
LL | f(x)
- | ^^^^ `x` escapes the function body here
+ | ^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error
diff --git a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr
index 98c03e3..e8315d3 100644
--- a/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr
+++ b/src/test/ui/nll/mir_check_cast_unsafe_fn.stderr
@@ -4,14 +4,14 @@
LL | let g: unsafe fn(_) -> _ = f;
| ^
-error: borrowed data escapes outside of function
+error: unsatisfied lifetime constraints
--> $DIR/mir_check_cast_unsafe_fn.rs:20:14
|
LL | fn bar<'a>(input: &'a u32, f: fn(&'a u32) -> &'a u32) -> &'static u32 {
- | ----- `input` is a reference that is only valid in the function body
+ | -- lifetime `'a` defined here
...
LL | unsafe { g(input) }
- | ^^^^^^^^ `input` escapes the function body here
+ | ^^^^^^^^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error
diff --git a/src/test/ui/nll/mir_check_cast_unsize.stderr b/src/test/ui/nll/mir_check_cast_unsize.stderr
index 02ecd05..4219c07 100644
--- a/src/test/ui/nll/mir_check_cast_unsize.stderr
+++ b/src/test/ui/nll/mir_check_cast_unsize.stderr
@@ -15,7 +15,7 @@
LL | | x
LL | | //~^ WARNING not reporting region error due to nll
LL | | }
- | |_^ return requires that `'a` must outlive `'static`
+ | |_^ returning this value requires that `'a` must outlive `'static`
error: aborting due to previous error
diff --git a/src/test/ui/nll/move-errors.stderr b/src/test/ui/nll/move-errors.stderr
index 53d60d3..5927683 100644
--- a/src/test/ui/nll/move-errors.stderr
+++ b/src/test/ui/nll/move-errors.stderr
@@ -5,7 +5,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `a`
+ | help: consider removing the `*`: `a`
error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
--> $DIR/move-errors.rs:25:13
@@ -14,7 +14,7 @@
| ^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&a[0]`
+ | help: consider borrowing here: `&a[0]`
error[E0507]: cannot move out of borrowed content
--> $DIR/move-errors.rs:32:13
@@ -23,7 +23,7 @@
| ^^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&**r`
+ | help: consider removing the `*`: `*r`
error[E0507]: cannot move out of borrowed content
--> $DIR/move-errors.rs:40:13
@@ -32,7 +32,7 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider using a reference instead: `&*r`
+ | help: consider removing the `*`: `r`
error[E0508]: cannot move out of type `[A; 1]`, a non-copy array
--> $DIR/move-errors.rs:45:13
@@ -41,7 +41,7 @@
| ^^^^^^^^^^^^^^^^^^^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&[A("".to_string())][0]`
+ | help: consider borrowing here: `&[A("".to_string())][0]`
error[E0507]: cannot move out of borrowed content
--> $DIR/move-errors.rs:51:16
@@ -50,8 +50,14 @@
| - ^^
| | |
| | cannot move out of borrowed content
- | | help: consider removing this dereference operator: `a`
- | move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
+ | | help: consider removing the `*`: `a`
+ | data moved here
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/move-errors.rs:51:11
+ |
+LL | let A(s) = *a;
+ | ^
error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
--> $DIR/move-errors.rs:57:19
@@ -60,7 +66,12 @@
| - ^ cannot move out of here
| |
| data moved here
- | help: to prevent move, use ref or ref mut: `ref s`
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/move-errors.rs:57:13
+ |
+LL | let C(D(s)) = c;
+ | ^
error[E0507]: cannot move out of borrowed content
--> $DIR/move-errors.rs:64:9
@@ -75,12 +86,20 @@
| ^^^^
| |
| cannot move out of here
- | help: consider using a reference instead: `&x[0]`
+ | help: consider borrowing here: `&x[0]`
LL | //~^ ERROR
LL | B::U(d) => (),
- | - move occurs because d has type `D`, which does not implement the `Copy` trait
+ | - data moved here
LL | B::V(s) => (),
- | - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
+ | - ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/move-errors.rs:89:14
+ |
+LL | B::U(d) => (),
+ | ^
+LL | B::V(s) => (),
+ | ^
error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
--> $DIR/move-errors.rs:96:11
@@ -89,10 +108,13 @@
| ^ cannot move out of here
...
LL | B::U(D(s)) => (),
- | -
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref s`
+ | - data moved here
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/move-errors.rs:99:16
+ |
+LL | B::U(D(s)) => (),
+ | ^
error[E0509]: cannot move out of type `D`, which implements the `Drop` trait
--> $DIR/move-errors.rs:105:11
@@ -101,10 +123,13 @@
| ^ cannot move out of here
...
LL | (D(s), &t) => (),
- | -
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref s`
+ | - data moved here
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/move-errors.rs:108:12
+ |
+LL | (D(s), &t) => (),
+ | ^
error[E0507]: cannot move out of borrowed content
--> $DIR/move-errors.rs:105:11
@@ -113,10 +138,13 @@
| ^ cannot move out of borrowed content
...
LL | (D(s), &t) => (),
- | -
- | |
- | data moved here
- | help: to prevent move, use ref or ref mut: `ref t`
+ | - data moved here
+ |
+note: move occurs because `t` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/move-errors.rs:108:17
+ |
+LL | (D(s), &t) => (),
+ | ^
error[E0509]: cannot move out of type `F`, which implements the `Drop` trait
--> $DIR/move-errors.rs:115:11
@@ -125,13 +153,15 @@
| ^ cannot move out of here
LL | //~^ ERROR
LL | F(s, mut t) => (),
- | - ----- ... and here
+ | - ----- ...and here
| |
| data moved here
-help: to prevent move, use ref or ref mut
|
-LL | F(ref s, ref mut t) => (),
- | ^^^^^ ^^^^^^^^^
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/move-errors.rs:117:11
+ |
+LL | F(s, mut t) => (),
+ | ^ ^^^^^
error[E0507]: cannot move out of borrowed content
--> $DIR/move-errors.rs:123:11
@@ -140,10 +170,16 @@
| ^^
| |
| cannot move out of borrowed content
- | help: consider removing this dereference operator: `x`
+ | help: consider removing the `*`: `x`
LL | //~^ ERROR
LL | Ok(s) | Err(s) => (),
- | - move occurs because s has type `std::string::String`, which does not implement the `Copy` trait
+ | - data moved here
+ |
+note: move occurs because `s` has type `std::string::String`, which does not implement the `Copy` trait
+ --> $DIR/move-errors.rs:125:12
+ |
+LL | Ok(s) | Err(s) => (),
+ | ^
error: aborting due to 14 previous errors
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr b/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr
new file mode 100644
index 0000000..caa3173
--- /dev/null
+++ b/src/test/ui/nll/reference-carried-through-struct-field.ast.nll.stderr
@@ -0,0 +1,14 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/reference-carried-through-struct-field.rs:21:5
+ |
+LL | let wrapper = Wrap { w: &mut x };
+ | ------ borrow of `x` occurs here
+LL | x += 1; //[ast]~ ERROR cannot assign to `x` because it is borrowed [E0506]
+ | ^^^^^^ use of borrowed `x`
+LL | //[mir]~^ ERROR cannot use `x` because it was mutably borrowed [E0503]
+LL | *wrapper.w += 1;
+ | --------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr b/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr
new file mode 100644
index 0000000..c1022d6
--- /dev/null
+++ b/src/test/ui/nll/reference-carried-through-struct-field.ast.stderr
@@ -0,0 +1,11 @@
+error[E0506]: cannot assign to `x` because it is borrowed
+ --> $DIR/reference-carried-through-struct-field.rs:21:5
+ |
+LL | let wrapper = Wrap { w: &mut x };
+ | - borrow of `x` occurs here
+LL | x += 1; //[ast]~ ERROR cannot assign to `x` because it is borrowed [E0506]
+ | ^^^^^^ assignment to borrowed `x` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr b/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr
new file mode 100644
index 0000000..caa3173
--- /dev/null
+++ b/src/test/ui/nll/reference-carried-through-struct-field.mir.stderr
@@ -0,0 +1,14 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/reference-carried-through-struct-field.rs:21:5
+ |
+LL | let wrapper = Wrap { w: &mut x };
+ | ------ borrow of `x` occurs here
+LL | x += 1; //[ast]~ ERROR cannot assign to `x` because it is borrowed [E0506]
+ | ^^^^^^ use of borrowed `x`
+LL | //[mir]~^ ERROR cannot use `x` because it was mutably borrowed [E0503]
+LL | *wrapper.w += 1;
+ | --------------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/compile-fail/nll/reference-carried-through-struct-field.rs b/src/test/ui/nll/reference-carried-through-struct-field.rs
similarity index 100%
rename from src/test/compile-fail/nll/reference-carried-through-struct-field.rs
rename to src/test/ui/nll/reference-carried-through-struct-field.rs
diff --git a/src/test/ui/nll/region-ends-after-if-condition.nll.stderr b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr
new file mode 100644
index 0000000..fa3a5e0
--- /dev/null
+++ b/src/test/ui/nll/region-ends-after-if-condition.nll.stderr
@@ -0,0 +1,39 @@
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast)
+ --> $DIR/region-ends-after-if-condition.rs:29:9
+ |
+LL | let value = &my_struct.field;
+ | --------------- immutable borrow occurs here
+LL | if value.is_empty() {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast)
+ --> $DIR/region-ends-after-if-condition.rs:39:9
+ |
+LL | let value = &my_struct.field;
+ | --------------- immutable borrow occurs here
+LL | if value.is_empty() {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir)
+ --> $DIR/region-ends-after-if-condition.rs:39:9
+ |
+LL | let value = &my_struct.field;
+ | ---------------- immutable borrow occurs here
+LL | if value.is_empty() {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL | drop(value);
+ | ----- borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/nll/region-ends-after-if-condition.rs b/src/test/ui/nll/region-ends-after-if-condition.rs
similarity index 100%
rename from src/test/compile-fail/nll/region-ends-after-if-condition.rs
rename to src/test/ui/nll/region-ends-after-if-condition.rs
diff --git a/src/test/ui/nll/region-ends-after-if-condition.stderr b/src/test/ui/nll/region-ends-after-if-condition.stderr
new file mode 100644
index 0000000..d966c62
--- /dev/null
+++ b/src/test/ui/nll/region-ends-after-if-condition.stderr
@@ -0,0 +1,39 @@
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast)
+ --> $DIR/region-ends-after-if-condition.rs:29:9
+ |
+LL | let value = &my_struct.field;
+ | --------------- immutable borrow occurs here
+LL | if value.is_empty() {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast)
+ --> $DIR/region-ends-after-if-condition.rs:39:9
+ |
+LL | let value = &my_struct.field;
+ | --------------- immutable borrow occurs here
+LL | if value.is_empty() {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL | }
+ | - immutable borrow ends here
+
+error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir)
+ --> $DIR/region-ends-after-if-condition.rs:39:9
+ |
+LL | let value = &my_struct.field;
+ | ---------------- immutable borrow occurs here
+LL | if value.is_empty() {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ mutable borrow occurs here
+...
+LL | drop(value);
+ | ----- borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/nll/return-ref-mut-issue-46557.stderr b/src/test/ui/nll/return-ref-mut-issue-46557.stderr
index f40e38c..f441085 100644
--- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr
+++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr
@@ -1,16 +1,13 @@
error[E0597]: borrowed value does not live long enough
--> $DIR/return-ref-mut-issue-46557.rs:17:21
|
-LL | fn gimme_static_mut() -> &'static mut u32 {
- | ___________________________________________-
-LL | | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
- | | ^^^^^^^ temporary value does not live long enough
-LL | | x
-LL | | }
- | | -
- | | |
- | |_temporary value only lives until here
- | borrow later used here
+LL | let ref mut x = 1234543; //~ ERROR borrowed value does not live long enough [E0597]
+ | ^^^^^^^ temporary value does not live long enough
+LL | x
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
error: aborting due to previous error
diff --git a/src/test/compile-fail/nll/return_from_loop.rs b/src/test/ui/nll/return_from_loop.rs
similarity index 100%
rename from src/test/compile-fail/nll/return_from_loop.rs
rename to src/test/ui/nll/return_from_loop.rs
diff --git a/src/test/ui/nll/return_from_loop.stderr b/src/test/ui/nll/return_from_loop.stderr
new file mode 100644
index 0000000..7130aa6
--- /dev/null
+++ b/src/test/ui/nll/return_from_loop.stderr
@@ -0,0 +1,39 @@
+error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Ast)
+ --> $DIR/return_from_loop.rs:32:9
+ |
+LL | let value = &mut my_struct.field;
+ | --------------- first mutable borrow occurs here
+LL | loop {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Ast)
+ --> $DIR/return_from_loop.rs:45:9
+ |
+LL | let value = &mut my_struct.field;
+ | --------------- first mutable borrow occurs here
+LL | loop {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | }
+ | - first borrow ends here
+
+error[E0499]: cannot borrow `my_struct.field` as mutable more than once at a time (Mir)
+ --> $DIR/return_from_loop.rs:32:9
+ |
+LL | let value = &mut my_struct.field;
+ | -------------------- first mutable borrow occurs here
+LL | loop {
+LL | my_struct.field.push_str("Hello, world!");
+ | ^^^^^^^^^^^^^^^ second mutable borrow occurs here
+...
+LL | value.len();
+ | ----- borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/nll/unused-mut-issue-50343.rs b/src/test/ui/nll/unused-mut-issue-50343.rs
similarity index 100%
rename from src/test/compile-fail/nll/unused-mut-issue-50343.rs
rename to src/test/ui/nll/unused-mut-issue-50343.rs
diff --git a/src/test/ui/nll/unused-mut-issue-50343.stderr b/src/test/ui/nll/unused-mut-issue-50343.stderr
new file mode 100644
index 0000000..bfc67e2
--- /dev/null
+++ b/src/test/ui/nll/unused-mut-issue-50343.stderr
@@ -0,0 +1,16 @@
+error: variable does not need to be mutable
+ --> $DIR/unused-mut-issue-50343.rs:15:33
+ |
+LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count();
+ | ----^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/unused-mut-issue-50343.rs:12:9
+ |
+LL | #![deny(unused_mut)]
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/nll/where_clauses_in_functions.rs b/src/test/ui/nll/where_clauses_in_functions.rs
similarity index 100%
rename from src/test/compile-fail/nll/where_clauses_in_functions.rs
rename to src/test/ui/nll/where_clauses_in_functions.rs
diff --git a/src/test/ui/nll/where_clauses_in_functions.stderr b/src/test/ui/nll/where_clauses_in_functions.stderr
new file mode 100644
index 0000000..3d5dd4b
--- /dev/null
+++ b/src/test/ui/nll/where_clauses_in_functions.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/where_clauses_in_functions.rs:23:5
+ |
+LL | foo(x, y)
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/where_clauses_in_functions.rs:23:5
+ |
+LL | fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | foo(x, y)
+ | ^^^^^^^^^ argument requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/nll/where_clauses_in_structs.rs b/src/test/ui/nll/where_clauses_in_structs.rs
similarity index 100%
rename from src/test/compile-fail/nll/where_clauses_in_structs.rs
rename to src/test/ui/nll/where_clauses_in_structs.rs
diff --git a/src/test/ui/nll/where_clauses_in_structs.stderr b/src/test/ui/nll/where_clauses_in_structs.stderr
new file mode 100644
index 0000000..c7ad987
--- /dev/null
+++ b/src/test/ui/nll/where_clauses_in_structs.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/where_clauses_in_structs.rs:23:5
+ |
+LL | Foo { x, y };
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/where_clauses_in_structs.rs:23:11
+ |
+LL | fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | Foo { x, y };
+ | ^ requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/no-capture-arc.nll.stderr b/src/test/ui/no-capture-arc.nll.stderr
new file mode 100644
index 0000000..a58d5ad
--- /dev/null
+++ b/src/test/ui/no-capture-arc.nll.stderr
@@ -0,0 +1,29 @@
+error[E0382]: borrow of moved value: `arc_v`
+ --> $DIR/no-capture-arc.rs:24:18
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved into closure here
+LL | assert_eq!((*arc_v)[3], 4);
+ | ----- variable moved due to use in closure
+...
+LL | assert_eq!((*arc_v)[2], 3);
+ | ^^^^^ value borrowed here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `arc_v`
+ --> $DIR/no-capture-arc.rs:26:23
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved into closure here
+LL | assert_eq!((*arc_v)[3], 4);
+ | ----- variable moved due to use in closure
+...
+LL | println!("{:?}", *arc_v);
+ | ^^^^^ value borrowed here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/no-capture-arc.rs b/src/test/ui/no-capture-arc.rs
similarity index 100%
rename from src/test/compile-fail/no-capture-arc.rs
rename to src/test/ui/no-capture-arc.rs
diff --git a/src/test/ui/no-capture-arc.stderr b/src/test/ui/no-capture-arc.stderr
new file mode 100644
index 0000000..d6801d7
--- /dev/null
+++ b/src/test/ui/no-capture-arc.stderr
@@ -0,0 +1,25 @@
+error[E0382]: use of moved value: `arc_v`
+ --> $DIR/no-capture-arc.rs:24:18
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved (into closure) here
+...
+LL | assert_eq!((*arc_v)[2], 3);
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `arc_v`
+ --> $DIR/no-capture-arc.rs:26:23
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved (into closure) here
+...
+LL | println!("{:?}", *arc_v);
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/no-implicit-prelude-nested.rs b/src/test/ui/no-implicit-prelude-nested.rs
similarity index 100%
rename from src/test/compile-fail/no-implicit-prelude-nested.rs
rename to src/test/ui/no-implicit-prelude-nested.rs
diff --git a/src/test/ui/no-implicit-prelude-nested.stderr b/src/test/ui/no-implicit-prelude-nested.stderr
new file mode 100644
index 0000000..dd0666a
--- /dev/null
+++ b/src/test/ui/no-implicit-prelude-nested.stderr
@@ -0,0 +1,196 @@
+error[E0405]: cannot find trait `Add` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:21:14
+ |
+LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
+ | ^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use std::ops::Add;
+ |
+
+error[E0405]: cannot find trait `Clone` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:22:14
+ |
+LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::clone::Clone;
+ |
+LL | use std::prelude::v1::Clone;
+ |
+
+error[E0405]: cannot find trait `Iterator` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:23:14
+ |
+LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::iter::Iterator;
+ |
+LL | use std::prelude::v1::Iterator;
+ |
+
+error[E0405]: cannot find trait `ToString` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:24:14
+ |
+LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::prelude::v1::ToString;
+ |
+LL | use std::string::ToString;
+ |
+
+error[E0405]: cannot find trait `Writer` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:25:14
+ |
+LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
+ | ^^^^^^ not found in this scope
+
+error[E0425]: cannot find function `drop` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:28:13
+ |
+LL | drop(2) //~ ERROR cannot find function `drop` in this scope
+ | ^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::mem::drop;
+ |
+LL | use std::prelude::v1::drop;
+ |
+
+error[E0405]: cannot find trait `Add` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:33:10
+ |
+LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
+ | ^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use std::ops::Add;
+ |
+
+error[E0405]: cannot find trait `Clone` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:34:10
+ |
+LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::clone::Clone;
+ |
+LL | use std::prelude::v1::Clone;
+ |
+
+error[E0405]: cannot find trait `Iterator` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:35:10
+ |
+LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::iter::Iterator;
+ |
+LL | use std::prelude::v1::Iterator;
+ |
+
+error[E0405]: cannot find trait `ToString` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:36:10
+ |
+LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::prelude::v1::ToString;
+ |
+LL | use std::string::ToString;
+ |
+
+error[E0405]: cannot find trait `Writer` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:37:10
+ |
+LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
+ | ^^^^^^ not found in this scope
+
+error[E0425]: cannot find function `drop` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:40:9
+ |
+LL | drop(2) //~ ERROR cannot find function `drop` in this scope
+ | ^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::mem::drop;
+ |
+LL | use std::prelude::v1::drop;
+ |
+
+error[E0405]: cannot find trait `Add` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:48:14
+ |
+LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
+ | ^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use std::ops::Add;
+ |
+
+error[E0405]: cannot find trait `Clone` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:49:14
+ |
+LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::clone::Clone;
+ |
+LL | use std::prelude::v1::Clone;
+ |
+
+error[E0405]: cannot find trait `Iterator` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:50:14
+ |
+LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::iter::Iterator;
+ |
+LL | use std::prelude::v1::Iterator;
+ |
+
+error[E0405]: cannot find trait `ToString` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:51:14
+ |
+LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::prelude::v1::ToString;
+ |
+LL | use std::string::ToString;
+ |
+
+error[E0405]: cannot find trait `Writer` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:52:14
+ |
+LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
+ | ^^^^^^ not found in this scope
+
+error[E0425]: cannot find function `drop` in this scope
+ --> $DIR/no-implicit-prelude-nested.rs:55:13
+ |
+LL | drop(2) //~ ERROR cannot find function `drop` in this scope
+ | ^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::mem::drop;
+ |
+LL | use std::prelude::v1::drop;
+ |
+
+error: aborting due to 18 previous errors
+
+Some errors occurred: E0405, E0425.
+For more information about an error, try `rustc --explain E0405`.
diff --git a/src/test/compile-fail/no-implicit-prelude.rs b/src/test/ui/no-implicit-prelude.rs
similarity index 100%
rename from src/test/compile-fail/no-implicit-prelude.rs
rename to src/test/ui/no-implicit-prelude.rs
diff --git a/src/test/ui/no-implicit-prelude.stderr b/src/test/ui/no-implicit-prelude.stderr
new file mode 100644
index 0000000..ae10985
--- /dev/null
+++ b/src/test/ui/no-implicit-prelude.stderr
@@ -0,0 +1,68 @@
+error[E0405]: cannot find trait `Add` in this scope
+ --> $DIR/no-implicit-prelude.rs:20:6
+ |
+LL | impl Add for Test {} //~ ERROR cannot find trait `Add` in this scope
+ | ^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use std::ops::Add;
+ |
+
+error[E0405]: cannot find trait `Clone` in this scope
+ --> $DIR/no-implicit-prelude.rs:21:6
+ |
+LL | impl Clone for Test {} //~ ERROR cannot find trait `Clone` in this scope
+ | ^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::clone::Clone;
+ |
+LL | use std::prelude::v1::Clone;
+ |
+
+error[E0405]: cannot find trait `Iterator` in this scope
+ --> $DIR/no-implicit-prelude.rs:22:6
+ |
+LL | impl Iterator for Test {} //~ ERROR cannot find trait `Iterator` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::iter::Iterator;
+ |
+LL | use std::prelude::v1::Iterator;
+ |
+
+error[E0405]: cannot find trait `ToString` in this scope
+ --> $DIR/no-implicit-prelude.rs:23:6
+ |
+LL | impl ToString for Test {} //~ ERROR cannot find trait `ToString` in this scope
+ | ^^^^^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::prelude::v1::ToString;
+ |
+LL | use std::string::ToString;
+ |
+
+error[E0405]: cannot find trait `Writer` in this scope
+ --> $DIR/no-implicit-prelude.rs:24:6
+ |
+LL | impl Writer for Test {} //~ ERROR cannot find trait `Writer` in this scope
+ | ^^^^^^ not found in this scope
+
+error[E0425]: cannot find function `drop` in this scope
+ --> $DIR/no-implicit-prelude.rs:27:5
+ |
+LL | drop(2) //~ ERROR cannot find function `drop` in this scope
+ | ^^^^ not found in this scope
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use std::mem::drop;
+ |
+LL | use std::prelude::v1::drop;
+ |
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0405, E0425.
+For more information about an error, try `rustc --explain E0405`.
diff --git a/src/test/ui/no-link.rs b/src/test/ui/no-link.rs
new file mode 100644
index 0000000..36efb67
--- /dev/null
+++ b/src/test/ui/no-link.rs
@@ -0,0 +1,18 @@
+// Copyright 2015 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.
+
+// aux-build:empty-struct.rs
+
+#[no_link]
+extern crate empty_struct;
+
+fn main() {
+ empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct`
+}
diff --git a/src/test/ui/no-link.stderr b/src/test/ui/no-link.stderr
new file mode 100644
index 0000000..3f159dd
--- /dev/null
+++ b/src/test/ui/no-link.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `XEmpty1` in module `empty_struct`
+ --> $DIR/no-link.rs:17:19
+ |
+LL | empty_struct::XEmpty1; //~ ERROR cannot find value `XEmpty1` in module `empty_struct`
+ | ^^^^^^^ not found in `empty_struct`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/no-patterns-in-args-2.rs b/src/test/ui/no-patterns-in-args-2.rs
similarity index 100%
rename from src/test/compile-fail/no-patterns-in-args-2.rs
rename to src/test/ui/no-patterns-in-args-2.rs
diff --git a/src/test/ui/no-patterns-in-args-2.stderr b/src/test/ui/no-patterns-in-args-2.stderr
new file mode 100644
index 0000000..1147616
--- /dev/null
+++ b/src/test/ui/no-patterns-in-args-2.stderr
@@ -0,0 +1,23 @@
+error[E0642]: patterns aren't allowed in methods without bodies
+ --> $DIR/no-patterns-in-args-2.rs:16:11
+ |
+LL | fn f2(&arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
+ | ^^^^
+
+error: patterns aren't allowed in methods without bodies
+ --> $DIR/no-patterns-in-args-2.rs:14:11
+ |
+LL | fn f1(mut arg: u8); //~ ERROR patterns aren't allowed in methods without bodies
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/no-patterns-in-args-2.rs:11:9
+ |
+LL | #![deny(patterns_in_fns_without_body)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #35203 <https://github.com/rust-lang/rust/issues/35203>
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0642`.
diff --git a/src/test/compile-fail/no-patterns-in-args-macro.rs b/src/test/ui/no-patterns-in-args-macro.rs
similarity index 100%
rename from src/test/compile-fail/no-patterns-in-args-macro.rs
rename to src/test/ui/no-patterns-in-args-macro.rs
diff --git a/src/test/ui/no-patterns-in-args-macro.stderr b/src/test/ui/no-patterns-in-args-macro.stderr
new file mode 100644
index 0000000..57af317
--- /dev/null
+++ b/src/test/ui/no-patterns-in-args-macro.stderr
@@ -0,0 +1,22 @@
+error[E0642]: patterns aren't allowed in methods without bodies
+ --> $DIR/no-patterns-in-args-macro.rs:30:8
+ |
+LL | m!((bad, pat));
+ | ^^^^^^^^^^
+
+error[E0561]: patterns aren't allowed in function pointer types
+ --> $DIR/no-patterns-in-args-macro.rs:30:8
+ |
+LL | m!((bad, pat));
+ | ^^^^^^^^^^
+
+error[E0130]: patterns aren't allowed in foreign function declarations
+ --> $DIR/no-patterns-in-args-macro.rs:30:8
+ |
+LL | m!((bad, pat));
+ | ^^^^^^^^^^ pattern not allowed in foreign function
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0130, E0561, E0642.
+For more information about an error, try `rustc --explain E0130`.
diff --git a/src/test/ui/no-reuse-move-arc.nll.stderr b/src/test/ui/no-reuse-move-arc.nll.stderr
new file mode 100644
index 0000000..902affc
--- /dev/null
+++ b/src/test/ui/no-reuse-move-arc.nll.stderr
@@ -0,0 +1,29 @@
+error[E0382]: borrow of moved value: `arc_v`
+ --> $DIR/no-reuse-move-arc.rs:22:18
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved into closure here
+LL | assert_eq!((*arc_v)[3], 4);
+ | ----- variable moved due to use in closure
+...
+LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v`
+ | ^^^^^ value borrowed here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error[E0382]: borrow of moved value: `arc_v`
+ --> $DIR/no-reuse-move-arc.rs:24:23
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved into closure here
+LL | assert_eq!((*arc_v)[3], 4);
+ | ----- variable moved due to use in closure
+...
+LL | println!("{:?}", *arc_v); //~ ERROR use of moved value: `arc_v`
+ | ^^^^^ value borrowed here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/no-reuse-move-arc.rs b/src/test/ui/no-reuse-move-arc.rs
similarity index 100%
rename from src/test/compile-fail/no-reuse-move-arc.rs
rename to src/test/ui/no-reuse-move-arc.rs
diff --git a/src/test/ui/no-reuse-move-arc.stderr b/src/test/ui/no-reuse-move-arc.stderr
new file mode 100644
index 0000000..91cba6e
--- /dev/null
+++ b/src/test/ui/no-reuse-move-arc.stderr
@@ -0,0 +1,25 @@
+error[E0382]: use of moved value: `arc_v`
+ --> $DIR/no-reuse-move-arc.rs:22:18
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved (into closure) here
+...
+LL | assert_eq!((*arc_v)[2], 3); //~ ERROR use of moved value: `arc_v`
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `arc_v`
+ --> $DIR/no-reuse-move-arc.rs:24:23
+ |
+LL | thread::spawn(move|| {
+ | ------ value moved (into closure) here
+...
+LL | println!("{:?}", *arc_v); //~ ERROR use of moved value: `arc_v`
+ | ^^^^^ value used here after move
+ |
+ = note: move occurs because `arc_v` has type `std::sync::Arc<std::vec::Vec<i32>>`, which does not implement the `Copy` trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/ui/no-send-res-ports.rs
similarity index 100%
rename from src/test/compile-fail/no-send-res-ports.rs
rename to src/test/ui/no-send-res-ports.rs
diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr
new file mode 100644
index 0000000..936b954
--- /dev/null
+++ b/src/test/ui/no-send-res-ports.stderr
@@ -0,0 +1,15 @@
+error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely
+ --> $DIR/no-send-res-ports.rs:35:5
+ |
+LL | thread::spawn(move|| {
+ | ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely
+ |
+ = help: within `[closure@$DIR/no-send-res-ports.rs:35:19: 39:6 x:main::foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>`
+ = note: required because it appears within the type `Port<()>`
+ = note: required because it appears within the type `main::foo`
+ = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:35:19: 39:6 x:main::foo]`
+ = note: required by `std::thread::spawn`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/no-std-inject.rs b/src/test/ui/no-std-inject.rs
similarity index 100%
rename from src/test/compile-fail/no-std-inject.rs
rename to src/test/ui/no-std-inject.rs
diff --git a/src/test/ui/no-std-inject.stderr b/src/test/ui/no-std-inject.stderr
new file mode 100644
index 0000000..c1ea823
--- /dev/null
+++ b/src/test/ui/no-std-inject.stderr
@@ -0,0 +1,15 @@
+error[E0259]: the name `core` is defined multiple times
+ --> $DIR/no-std-inject.rs:14:1
+ |
+LL | extern crate core; //~ ERROR: the name `core` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^ `core` reimported here
+ |
+ = note: `core` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | extern crate core as other_core; //~ ERROR: the name `core` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0259`.
diff --git a/src/test/compile-fail/no-type-for-node-ice.rs b/src/test/ui/no-type-for-node-ice.rs
similarity index 100%
rename from src/test/compile-fail/no-type-for-node-ice.rs
rename to src/test/ui/no-type-for-node-ice.rs
diff --git a/src/test/ui/no-type-for-node-ice.stderr b/src/test/ui/no-type-for-node-ice.stderr
new file mode 100644
index 0000000..c9de7d2
--- /dev/null
+++ b/src/test/ui/no-type-for-node-ice.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `homura` on type `&'static str`
+ --> $DIR/no-type-for-node-ice.rs:14:8
+ |
+LL | "".homura[""]; //~ no field `homura` on type `&'static str`
+ | ^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/compile-fail/no-warn-on-field-replace-issue-34101.rs b/src/test/ui/no-warn-on-field-replace-issue-34101.rs
similarity index 100%
rename from src/test/compile-fail/no-warn-on-field-replace-issue-34101.rs
rename to src/test/ui/no-warn-on-field-replace-issue-34101.rs
diff --git a/src/test/ui/no-warn-on-field-replace-issue-34101.stderr b/src/test/ui/no-warn-on-field-replace-issue-34101.stderr
new file mode 100644
index 0000000..91a9026
--- /dev/null
+++ b/src/test/ui/no-warn-on-field-replace-issue-34101.stderr
@@ -0,0 +1,11 @@
+error: compilation successful
+ --> $DIR/no-warn-on-field-replace-issue-34101.rs:53:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | inline();
+LL | | outline();
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/no_crate_type.rs b/src/test/ui/no_crate_type.rs
similarity index 100%
rename from src/test/compile-fail/no_crate_type.rs
rename to src/test/ui/no_crate_type.rs
diff --git a/src/test/ui/no_crate_type.stderr b/src/test/ui/no_crate_type.stderr
new file mode 100644
index 0000000..87f83f2
--- /dev/null
+++ b/src/test/ui/no_crate_type.stderr
@@ -0,0 +1,10 @@
+error: `crate_type` requires a value
+ --> $DIR/no_crate_type.rs:12:1
+ |
+LL | #![crate_type] //~ ERROR `crate_type` requires a value
+ | ^^^^^^^^^^^^^^
+ |
+ = note: for example: `#![crate_type="lib"]`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/no_owned_box_lang_item.rs b/src/test/ui/no_owned_box_lang_item.rs
similarity index 100%
rename from src/test/compile-fail/no_owned_box_lang_item.rs
rename to src/test/ui/no_owned_box_lang_item.rs
diff --git a/src/test/ui/no_owned_box_lang_item.stderr b/src/test/ui/no_owned_box_lang_item.stderr
new file mode 100644
index 0000000..c55c246
--- /dev/null
+++ b/src/test/ui/no_owned_box_lang_item.stderr
@@ -0,0 +1,4 @@
+error: requires `owned_box` lang_item
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/ui/no_send-enum.rs
similarity index 100%
rename from src/test/compile-fail/no_send-enum.rs
rename to src/test/ui/no_send-enum.rs
diff --git a/src/test/ui/no_send-enum.stderr b/src/test/ui/no_send-enum.stderr
new file mode 100644
index 0000000..4d53c5f
--- /dev/null
+++ b/src/test/ui/no_send-enum.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `NoSend` cannot be sent between threads safely
+ --> $DIR/no_send-enum.rs:26:5
+ |
+LL | bar(x);
+ | ^^^ `NoSend` cannot be sent between threads safely
+ |
+ = help: within `Foo`, the trait `std::marker::Send` is not implemented for `NoSend`
+ = note: required because it appears within the type `Foo`
+note: required by `bar`
+ --> $DIR/no_send-enum.rs:22:1
+ |
+LL | fn bar<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/no_send-rc.rs b/src/test/ui/no_send-rc.rs
similarity index 100%
rename from src/test/compile-fail/no_send-rc.rs
rename to src/test/ui/no_send-rc.rs
diff --git a/src/test/ui/no_send-rc.stderr b/src/test/ui/no_send-rc.stderr
new file mode 100644
index 0000000..a0dce6c
--- /dev/null
+++ b/src/test/ui/no_send-rc.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `std::rc::Rc<{integer}>` cannot be sent between threads safely
+ --> $DIR/no_send-rc.rs:17:5
+ |
+LL | bar(x);
+ | ^^^ `std::rc::Rc<{integer}>` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `std::rc::Rc<{integer}>`
+note: required by `bar`
+ --> $DIR/no_send-rc.rs:13:1
+ |
+LL | fn bar<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/no_send-struct.rs b/src/test/ui/no_send-struct.rs
similarity index 100%
rename from src/test/compile-fail/no_send-struct.rs
rename to src/test/ui/no_send-struct.rs
diff --git a/src/test/ui/no_send-struct.stderr b/src/test/ui/no_send-struct.stderr
new file mode 100644
index 0000000..dc7b5ec
--- /dev/null
+++ b/src/test/ui/no_send-struct.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `Foo` cannot be sent between threads safely
+ --> $DIR/no_send-struct.rs:25:5
+ |
+LL | bar(x);
+ | ^^^ `Foo` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `Foo`
+note: required by `bar`
+ --> $DIR/no_send-struct.rs:21:1
+ |
+LL | fn bar<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/ui/no_share-enum.rs
similarity index 100%
rename from src/test/compile-fail/no_share-enum.rs
rename to src/test/ui/no_share-enum.rs
diff --git a/src/test/ui/no_share-enum.stderr b/src/test/ui/no_share-enum.stderr
new file mode 100644
index 0000000..57b8891
--- /dev/null
+++ b/src/test/ui/no_share-enum.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `NoSync` cannot be shared between threads safely
+ --> $DIR/no_share-enum.rs:24:5
+ |
+LL | bar(x);
+ | ^^^ `NoSync` cannot be shared between threads safely
+ |
+ = help: within `Foo`, the trait `std::marker::Sync` is not implemented for `NoSync`
+ = note: required because it appears within the type `Foo`
+note: required by `bar`
+ --> $DIR/no_share-enum.rs:20:1
+ |
+LL | fn bar<T: Sync>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/no_share-struct.rs b/src/test/ui/no_share-struct.rs
similarity index 100%
rename from src/test/compile-fail/no_share-struct.rs
rename to src/test/ui/no_share-struct.rs
diff --git a/src/test/ui/no_share-struct.stderr b/src/test/ui/no_share-struct.stderr
new file mode 100644
index 0000000..66291db
--- /dev/null
+++ b/src/test/ui/no_share-struct.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `Foo` cannot be shared between threads safely
+ --> $DIR/no_share-struct.rs:22:5
+ |
+LL | bar(x);
+ | ^^^ `Foo` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `Foo`
+note: required by `bar`
+ --> $DIR/no_share-struct.rs:18:1
+ |
+LL | fn bar<T: Sync>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/noexporttypeexe.rs b/src/test/ui/noexporttypeexe.rs
similarity index 100%
rename from src/test/compile-fail/noexporttypeexe.rs
rename to src/test/ui/noexporttypeexe.rs
diff --git a/src/test/ui/noexporttypeexe.stderr b/src/test/ui/noexporttypeexe.stderr
new file mode 100644
index 0000000..1671b3e
--- /dev/null
+++ b/src/test/ui/noexporttypeexe.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/noexporttypeexe.rs:20:18
+ |
+LL | let x: isize = noexporttypelib::foo();
+ | ^^^^^^^^^^^^^^^^^^^^^^ expected isize, found enum `std::option::Option`
+ |
+ = note: expected type `isize`
+ found type `std::option::Option<isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/non-constant-in-const-path.rs b/src/test/ui/non-constant-in-const-path.rs
similarity index 100%
rename from src/test/compile-fail/non-constant-in-const-path.rs
rename to src/test/ui/non-constant-in-const-path.rs
diff --git a/src/test/ui/non-constant-in-const-path.stderr b/src/test/ui/non-constant-in-const-path.stderr
new file mode 100644
index 0000000..91ef9fd
--- /dev/null
+++ b/src/test/ui/non-constant-in-const-path.stderr
@@ -0,0 +1,9 @@
+error[E0080]: runtime values cannot be referenced in patterns
+ --> $DIR/non-constant-in-const-path.rs:14:15
+ |
+LL | 0 ..= x => {}
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/compile-fail/non-copyable-void.rs b/src/test/ui/non-copyable-void.rs
similarity index 100%
rename from src/test/compile-fail/non-copyable-void.rs
rename to src/test/ui/non-copyable-void.rs
diff --git a/src/test/ui/non-copyable-void.stderr b/src/test/ui/non-copyable-void.stderr
new file mode 100644
index 0000000..b5c83ec
--- /dev/null
+++ b/src/test/ui/non-copyable-void.stderr
@@ -0,0 +1,9 @@
+error[E0599]: no method named `clone` found for type `libc::c_void` in the current scope
+ --> $DIR/non-copyable-void.rs:21:23
+ |
+LL | let _z = (*y).clone();
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/non-exhaustive-match-nested.rs b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs
similarity index 100%
rename from src/test/compile-fail/non-exhaustive-match-nested.rs
rename to src/test/ui/non-exhaustive/non-exhaustive-match-nested.rs
diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr
new file mode 100644
index 0000000..6fb9788
--- /dev/null
+++ b/src/test/ui/non-exhaustive/non-exhaustive-match-nested.stderr
@@ -0,0 +1,15 @@
+error[E0004]: non-exhaustive patterns: `(Some(&[]), Err(_))` not covered
+ --> $DIR/non-exhaustive-match-nested.rs:17:11
+ |
+LL | match (l1, l2) { //~ ERROR non-exhaustive patterns: `(Some(&[]), Err(_))` not covered
+ | ^^^^^^^^ pattern `(Some(&[]), Err(_))` not covered
+
+error[E0004]: non-exhaustive patterns: `a(c)` not covered
+ --> $DIR/non-exhaustive-match-nested.rs:27:11
+ |
+LL | match x { //~ ERROR non-exhaustive patterns: `a(c)` not covered
+ | ^ pattern `a(c)` not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/non-exhaustive-match.rs b/src/test/ui/non-exhaustive/non-exhaustive-match.rs
similarity index 100%
rename from src/test/compile-fail/non-exhaustive-match.rs
rename to src/test/ui/non-exhaustive/non-exhaustive-match.rs
diff --git a/src/test/ui/non-exhaustive/non-exhaustive-match.stderr b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr
new file mode 100644
index 0000000..f48a0bc
--- /dev/null
+++ b/src/test/ui/non-exhaustive/non-exhaustive-match.stderr
@@ -0,0 +1,51 @@
+error[E0004]: non-exhaustive patterns: `a` not covered
+ --> $DIR/non-exhaustive-match.rs:18:11
+ |
+LL | match x { t::b => { } } //~ ERROR non-exhaustive patterns: `a` not covered
+ | ^ pattern `a` not covered
+
+error[E0004]: non-exhaustive patterns: `false` not covered
+ --> $DIR/non-exhaustive-match.rs:19:11
+ |
+LL | match true { //~ ERROR non-exhaustive patterns: `false` not covered
+ | ^^^^ pattern `false` not covered
+
+error[E0004]: non-exhaustive patterns: `Some(_)` not covered
+ --> $DIR/non-exhaustive-match.rs:22:11
+ |
+LL | match Some(10) { //~ ERROR non-exhaustive patterns: `Some(_)` not covered
+ | ^^^^^^^^ pattern `Some(_)` not covered
+
+error[E0004]: non-exhaustive patterns: `(_, _, _)` not covered
+ --> $DIR/non-exhaustive-match.rs:25:11
+ |
+LL | match (2, 3, 4) { //~ ERROR non-exhaustive patterns: `(_, _, _)` not covered
+ | ^^^^^^^^^ pattern `(_, _, _)` not covered
+
+error[E0004]: non-exhaustive patterns: `(a, a)` not covered
+ --> $DIR/non-exhaustive-match.rs:28:11
+ |
+LL | match (t::a, t::a) { //~ ERROR non-exhaustive patterns: `(a, a)` not covered
+ | ^^^^^^^^^^^^ pattern `(a, a)` not covered
+
+error[E0004]: non-exhaustive patterns: `b` not covered
+ --> $DIR/non-exhaustive-match.rs:32:11
+ |
+LL | match t::a { //~ ERROR non-exhaustive patterns: `b` not covered
+ | ^^^^ pattern `b` not covered
+
+error[E0004]: non-exhaustive patterns: `[]` not covered
+ --> $DIR/non-exhaustive-match.rs:43:11
+ |
+LL | match *vec { //~ ERROR non-exhaustive patterns: `[]` not covered
+ | ^^^^ pattern `[]` not covered
+
+error[E0004]: non-exhaustive patterns: `[_, _, _, _]` not covered
+ --> $DIR/non-exhaustive-match.rs:56:11
+ |
+LL | match *vec { //~ ERROR non-exhaustive patterns: `[_, _, _, _]` not covered
+ | ^^^^ pattern `[_, _, _, _]` not covered
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/non-exhaustive-pattern-witness.rs b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs
similarity index 100%
rename from src/test/ui/non-exhaustive-pattern-witness.rs
rename to src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.rs
diff --git a/src/test/ui/non-exhaustive-pattern-witness.stderr b/src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr
similarity index 100%
rename from src/test/ui/non-exhaustive-pattern-witness.stderr
rename to src/test/ui/non-exhaustive/non-exhaustive-pattern-witness.stderr
diff --git a/src/test/compile-fail/non-interger-atomic.rs b/src/test/ui/non-interger-atomic.rs
similarity index 100%
rename from src/test/compile-fail/non-interger-atomic.rs
rename to src/test/ui/non-interger-atomic.rs
diff --git a/src/test/ui/non-interger-atomic.stderr b/src/test/ui/non-interger-atomic.stderr
new file mode 100644
index 0000000..8cb114d
--- /dev/null
+++ b/src/test/ui/non-interger-atomic.stderr
@@ -0,0 +1,99 @@
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool`
+ --> $DIR/non-interger-atomic.rs:23:5
+ |
+LL | intrinsics::atomic_load(p);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool`
+ --> $DIR/non-interger-atomic.rs:28:5
+ |
+LL | intrinsics::atomic_store(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool`
+ --> $DIR/non-interger-atomic.rs:33:5
+ |
+LL | intrinsics::atomic_xchg(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
+ --> $DIR/non-interger-atomic.rs:38:5
+ |
+LL | intrinsics::atomic_cxchg(p, v, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo`
+ --> $DIR/non-interger-atomic.rs:43:5
+ |
+LL | intrinsics::atomic_load(p);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo`
+ --> $DIR/non-interger-atomic.rs:48:5
+ |
+LL | intrinsics::atomic_store(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
+ --> $DIR/non-interger-atomic.rs:53:5
+ |
+LL | intrinsics::atomic_xchg(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
+ --> $DIR/non-interger-atomic.rs:58:5
+ |
+LL | intrinsics::atomic_cxchg(p, v, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+ --> $DIR/non-interger-atomic.rs:63:5
+ |
+LL | intrinsics::atomic_load(p);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+ --> $DIR/non-interger-atomic.rs:68:5
+ |
+LL | intrinsics::atomic_store(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+ --> $DIR/non-interger-atomic.rs:73:5
+ |
+LL | intrinsics::atomic_xchg(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn std::ops::Fn()`
+ --> $DIR/non-interger-atomic.rs:78:5
+ |
+LL | intrinsics::atomic_cxchg(p, v, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
+ --> $DIR/non-interger-atomic.rs:83:5
+ |
+LL | intrinsics::atomic_load(p);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
+ --> $DIR/non-interger-atomic.rs:88:5
+ |
+LL | intrinsics::atomic_store(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
+ --> $DIR/non-interger-atomic.rs:93:5
+ |
+LL | intrinsics::atomic_xchg(p, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
+ --> $DIR/non-interger-atomic.rs:98:5
+ |
+LL | intrinsics::atomic_cxchg(p, v, v);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 16 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/noncopyable-class.rs b/src/test/ui/noncopyable-class.rs
similarity index 100%
rename from src/test/compile-fail/noncopyable-class.rs
rename to src/test/ui/noncopyable-class.rs
diff --git a/src/test/ui/noncopyable-class.stderr b/src/test/ui/noncopyable-class.stderr
new file mode 100644
index 0000000..49ad30e
--- /dev/null
+++ b/src/test/ui/noncopyable-class.stderr
@@ -0,0 +1,16 @@
+error[E0599]: no method named `clone` found for type `foo` in the current scope
+ --> $DIR/noncopyable-class.rs:44:16
+ |
+LL | struct foo {
+ | ---------- method `clone` not found for this
+...
+LL | let _y = x.clone(); //~ ERROR no method named `clone` found
+ | ^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/nonscalar-cast.rs b/src/test/ui/nonscalar-cast.rs
similarity index 100%
rename from src/test/compile-fail/nonscalar-cast.rs
rename to src/test/ui/nonscalar-cast.rs
diff --git a/src/test/ui/nonscalar-cast.stderr b/src/test/ui/nonscalar-cast.stderr
new file mode 100644
index 0000000..d66ccd0
--- /dev/null
+++ b/src/test/ui/nonscalar-cast.stderr
@@ -0,0 +1,11 @@
+error[E0605]: non-primitive cast: `foo` as `isize`
+ --> $DIR/nonscalar-cast.rs:17:20
+ |
+LL | println!("{}", foo{ x: 1 } as isize); //~ non-primitive cast: `foo` as `isize` [E0605]
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/not-clone-closure.rs b/src/test/ui/not-clone-closure.rs
similarity index 100%
rename from src/test/compile-fail/not-clone-closure.rs
rename to src/test/ui/not-clone-closure.rs
diff --git a/src/test/ui/not-clone-closure.stderr b/src/test/ui/not-clone-closure.stderr
new file mode 100644
index 0000000..eda9b1c
--- /dev/null
+++ b/src/test/ui/not-clone-closure.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `S: std::clone::Clone` is not satisfied in `[closure@$DIR/not-clone-closure.rs:17:17: 19:6 a:S]`
+ --> $DIR/not-clone-closure.rs:21:23
+ |
+LL | let hello = hello.clone(); //~ ERROR the trait bound `S: std::clone::Clone` is not satisfied
+ | ^^^^^ within `[closure@$DIR/not-clone-closure.rs:17:17: 19:6 a:S]`, the trait `std::clone::Clone` is not implemented for `S`
+ |
+ = note: required because it appears within the type `[closure@$DIR/not-clone-closure.rs:17:17: 19:6 a:S]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/not-copy-closure.nll.stderr b/src/test/ui/not-copy-closure.nll.stderr
new file mode 100644
index 0000000..b278df5
--- /dev/null
+++ b/src/test/ui/not-copy-closure.nll.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `hello`
+ --> $DIR/not-copy-closure.rs:20:13
+ |
+LL | let b = hello;
+ | ----- value moved here
+LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382]
+ | ^^^^^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/not-copy-closure.rs b/src/test/ui/not-copy-closure.rs
similarity index 100%
rename from src/test/compile-fail/not-copy-closure.rs
rename to src/test/ui/not-copy-closure.rs
diff --git a/src/test/ui/not-copy-closure.stderr b/src/test/ui/not-copy-closure.stderr
new file mode 100644
index 0000000..7193a3e
--- /dev/null
+++ b/src/test/ui/not-copy-closure.stderr
@@ -0,0 +1,17 @@
+error[E0382]: use of moved value: `hello`
+ --> $DIR/not-copy-closure.rs:20:9
+ |
+LL | let b = hello;
+ | - value moved here
+LL | let c = hello; //~ ERROR use of moved value: `hello` [E0382]
+ | ^ value used here after move
+ |
+note: closure cannot be invoked more than once because it moves the variable `a` out of its environment
+ --> $DIR/not-copy-closure.rs:16:9
+ |
+LL | a += 1;
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/not-panic-safe-2.rs b/src/test/ui/not-panic/not-panic-safe-2.rs
similarity index 100%
rename from src/test/compile-fail/not-panic-safe-2.rs
rename to src/test/ui/not-panic/not-panic-safe-2.rs
diff --git a/src/test/ui/not-panic/not-panic-safe-2.stderr b/src/test/ui/not-panic/not-panic-safe-2.stderr
new file mode 100644
index 0000000..1940862
--- /dev/null
+++ b/src/test/ui/not-panic/not-panic-safe-2.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-2.rs:20:5
+ |
+LL | assert::<Rc<RefCell<i32>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::rc::Rc<std::cell::RefCell<i32>>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-2.rs:17:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the type `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-2.rs:20:5
+ |
+LL | assert::<Rc<RefCell<i32>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<isize>`
+ = note: required because it appears within the type `std::cell::Cell<isize>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::rc::Rc<std::cell::RefCell<i32>>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-2.rs:17:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/not-panic-safe-3.rs b/src/test/ui/not-panic/not-panic-safe-3.rs
similarity index 100%
rename from src/test/compile-fail/not-panic-safe-3.rs
rename to src/test/ui/not-panic/not-panic-safe-3.rs
diff --git a/src/test/ui/not-panic/not-panic-safe-3.stderr b/src/test/ui/not-panic/not-panic-safe-3.stderr
new file mode 100644
index 0000000..a353c82
--- /dev/null
+++ b/src/test/ui/not-panic/not-panic-safe-3.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-3.rs:20:5
+ |
+LL | assert::<Arc<RefCell<i32>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::sync::Arc<std::cell::RefCell<i32>>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-3.rs:17:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the type `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-3.rs:20:5
+ |
+LL | assert::<Arc<RefCell<i32>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<isize>`
+ = note: required because it appears within the type `std::cell::Cell<isize>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `std::sync::Arc<std::cell::RefCell<i32>>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-3.rs:17:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/not-panic-safe-4.rs b/src/test/ui/not-panic/not-panic-safe-4.rs
similarity index 100%
rename from src/test/compile-fail/not-panic-safe-4.rs
rename to src/test/ui/not-panic/not-panic-safe-4.rs
diff --git a/src/test/ui/not-panic/not-panic-safe-4.stderr b/src/test/ui/not-panic/not-panic-safe-4.stderr
new file mode 100644
index 0000000..27d3def
--- /dev/null
+++ b/src/test/ui/not-panic/not-panic-safe-4.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-4.rs:19:5
+ |
+LL | assert::<&RefCell<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::RefCell<i32>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-4.rs:16:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the type `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-4.rs:19:5
+ |
+LL | assert::<&RefCell<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<isize>`
+ = note: required because it appears within the type `std::cell::Cell<isize>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::RefCell<i32>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-4.rs:16:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/not-panic-safe-5.rs b/src/test/ui/not-panic/not-panic-safe-5.rs
similarity index 100%
rename from src/test/compile-fail/not-panic-safe-5.rs
rename to src/test/ui/not-panic/not-panic-safe-5.rs
diff --git a/src/test/ui/not-panic/not-panic-safe-5.stderr b/src/test/ui/not-panic/not-panic-safe-5.stderr
new file mode 100644
index 0000000..ba3b3fa
--- /dev/null
+++ b/src/test/ui/not-panic/not-panic-safe-5.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the type `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-5.rs:19:5
+ |
+LL | assert::<*const UnsafeCell<i32>>(); //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `*const std::cell::UnsafeCell<i32>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-5.rs:16:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/not-panic-safe-6.rs b/src/test/ui/not-panic/not-panic-safe-6.rs
similarity index 100%
rename from src/test/compile-fail/not-panic-safe-6.rs
rename to src/test/ui/not-panic/not-panic-safe-6.rs
diff --git a/src/test/ui/not-panic/not-panic-safe-6.stderr b/src/test/ui/not-panic/not-panic-safe-6.stderr
new file mode 100644
index 0000000..da6c2a5
--- /dev/null
+++ b/src/test/ui/not-panic/not-panic-safe-6.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the type `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-6.rs:19:5
+ |
+LL | assert::<*mut RefCell<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<i32>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<i32>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `*mut std::cell::RefCell<i32>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-6.rs:16:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the type `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ --> $DIR/not-panic-safe-6.rs:19:5
+ |
+LL | assert::<*mut RefCell<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<isize>` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary
+ |
+ = help: within `std::cell::RefCell<i32>`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell<isize>`
+ = note: required because it appears within the type `std::cell::Cell<isize>`
+ = note: required because it appears within the type `std::cell::RefCell<i32>`
+ = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `*mut std::cell::RefCell<i32>`
+note: required by `assert`
+ --> $DIR/not-panic-safe-6.rs:16:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/not-panic-safe.rs b/src/test/ui/not-panic/not-panic-safe.rs
similarity index 100%
rename from src/test/compile-fail/not-panic-safe.rs
rename to src/test/ui/not-panic/not-panic-safe.rs
diff --git a/src/test/ui/not-panic/not-panic-safe.stderr b/src/test/ui/not-panic/not-panic-safe.stderr
new file mode 100644
index 0000000..f349b5d
--- /dev/null
+++ b/src/test/ui/not-panic/not-panic-safe.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the type `&mut i32` may not be safely transferred across an unwind boundary
+ --> $DIR/not-panic-safe.rs:19:5
+ |
+LL | assert::<&mut i32>();
+ | ^^^^^^^^^^^^^^^^^^ `&mut i32` may not be safely transferred across an unwind boundary
+ |
+ = help: the trait `std::panic::UnwindSafe` is not implemented for `&mut i32`
+note: required by `assert`
+ --> $DIR/not-panic-safe.rs:16:1
+ |
+LL | fn assert<T: UnwindSafe + ?Sized>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/not-sync.rs b/src/test/ui/not-sync.rs
similarity index 100%
rename from src/test/compile-fail/not-sync.rs
rename to src/test/ui/not-sync.rs
diff --git a/src/test/ui/not-sync.stderr b/src/test/ui/not-sync.stderr
new file mode 100644
index 0000000..026fd5d
--- /dev/null
+++ b/src/test/ui/not-sync.stderr
@@ -0,0 +1,81 @@
+error[E0277]: `std::cell::Cell<i32>` cannot be shared between threads safely
+ --> $DIR/not-sync.rs:18:5
+ |
+LL | test::<Cell<i32>>();
+ | ^^^^^^^^^^^^^^^^^ `std::cell::Cell<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::cell::Cell<i32>`
+note: required by `test`
+ --> $DIR/not-sync.rs:15:1
+ |
+LL | fn test<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::cell::RefCell<i32>` cannot be shared between threads safely
+ --> $DIR/not-sync.rs:20:5
+ |
+LL | test::<RefCell<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^^ `std::cell::RefCell<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell<i32>`
+note: required by `test`
+ --> $DIR/not-sync.rs:15:1
+ |
+LL | fn test<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::rc::Rc<i32>` cannot be shared between threads safely
+ --> $DIR/not-sync.rs:23:5
+ |
+LL | test::<Rc<i32>>();
+ | ^^^^^^^^^^^^^^^ `std::rc::Rc<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::rc::Rc<i32>`
+note: required by `test`
+ --> $DIR/not-sync.rs:15:1
+ |
+LL | fn test<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::rc::Weak<i32>` cannot be shared between threads safely
+ --> $DIR/not-sync.rs:25:5
+ |
+LL | test::<Weak<i32>>();
+ | ^^^^^^^^^^^^^^^^^ `std::rc::Weak<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::rc::Weak<i32>`
+note: required by `test`
+ --> $DIR/not-sync.rs:15:1
+ |
+LL | fn test<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
+ --> $DIR/not-sync.rs:28:5
+ |
+LL | test::<Receiver<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<i32>`
+note: required by `test`
+ --> $DIR/not-sync.rs:15:1
+ |
+LL | fn test<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely
+ --> $DIR/not-sync.rs:30:5
+ |
+LL | test::<Sender<i32>>();
+ | ^^^^^^^^^^^^^^^^^^^ `std::sync::mpsc::Sender<i32>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<i32>`
+note: required by `test`
+ --> $DIR/not-sync.rs:15:1
+ |
+LL | fn test<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/numeric-cast-2.rs b/src/test/ui/numeric/numeric-cast-2.rs
similarity index 100%
rename from src/test/ui/numeric-cast-2.rs
rename to src/test/ui/numeric/numeric-cast-2.rs
diff --git a/src/test/ui/numeric-cast-2.stderr b/src/test/ui/numeric/numeric-cast-2.stderr
similarity index 100%
rename from src/test/ui/numeric-cast-2.stderr
rename to src/test/ui/numeric/numeric-cast-2.stderr
diff --git a/src/test/ui/numeric-cast.rs b/src/test/ui/numeric/numeric-cast.rs
similarity index 100%
rename from src/test/ui/numeric-cast.rs
rename to src/test/ui/numeric/numeric-cast.rs
diff --git a/src/test/ui/numeric-cast.stderr b/src/test/ui/numeric/numeric-cast.stderr
similarity index 100%
rename from src/test/ui/numeric-cast.stderr
rename to src/test/ui/numeric/numeric-cast.stderr
diff --git a/src/test/ui/numeric-fields.rs b/src/test/ui/numeric/numeric-fields.rs
similarity index 100%
rename from src/test/ui/numeric-fields.rs
rename to src/test/ui/numeric/numeric-fields.rs
diff --git a/src/test/ui/numeric-fields.stderr b/src/test/ui/numeric/numeric-fields.stderr
similarity index 100%
rename from src/test/ui/numeric-fields.stderr
rename to src/test/ui/numeric/numeric-fields.stderr
diff --git a/src/test/compile-fail/object-does-not-impl-trait.rs b/src/test/ui/object-does-not-impl-trait.rs
similarity index 100%
rename from src/test/compile-fail/object-does-not-impl-trait.rs
rename to src/test/ui/object-does-not-impl-trait.rs
diff --git a/src/test/ui/object-does-not-impl-trait.stderr b/src/test/ui/object-does-not-impl-trait.stderr
new file mode 100644
index 0000000..a1ebdf3
--- /dev/null
+++ b/src/test/ui/object-does-not-impl-trait.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `std::boxed::Box<dyn Foo>: Foo` is not satisfied
+ --> $DIR/object-does-not-impl-trait.rs:16:31
+ |
+LL | fn take_object(f: Box<Foo>) { take_foo(f); }
+ | ^^^^^^^^ the trait `Foo` is not implemented for `std::boxed::Box<dyn Foo>`
+ |
+note: required by `take_foo`
+ --> $DIR/object-does-not-impl-trait.rs:15:1
+ |
+LL | fn take_foo<F:Foo>(f: F) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/object-lifetime-default-ambiguous.rs b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs
similarity index 100%
rename from src/test/compile-fail/object-lifetime-default-ambiguous.rs
rename to src/test/ui/object-lifetime/object-lifetime-default-ambiguous.rs
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr
new file mode 100644
index 0000000..cb603f2
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-ambiguous.stderr
@@ -0,0 +1,21 @@
+error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
+ --> $DIR/object-lifetime-default-ambiguous.rs:33:27
+ |
+LL | fn a<'a,'b>(t: Ref2<'a,'b,Test>) {
+ | ^^^^
+
+error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
+ --> $DIR/object-lifetime-default-ambiguous.rs:37:14
+ |
+LL | fn b(t: Ref2<Test>) {
+ | ^^^^
+
+error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
+ --> $DIR/object-lifetime-default-ambiguous.rs:53:15
+ |
+LL | fn f(t: &Ref2<Test>) {
+ | ^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0228`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr
new file mode 100644
index 0000000..0d21ddd
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.nll.stderr
@@ -0,0 +1,24 @@
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-elision.rs:81:5
+ |
+LL | ss
+ | ^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/object-lifetime-default-elision.rs:64:53
+ |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+ | __________--_--______________________________________^
+ | | | |
+ | | | lifetime `'b` defined here
+ | | lifetime `'a` defined here
+LL | | // Under old rules, the fully elaborated types of input/output were:
+LL | | //
+LL | | // for<'a,'b,'c>fn(&'a (SomeTrait+'c)) -> &'b (SomeTrait+'a)
+... |
+LL | | //~| ERROR cannot infer
+LL | | }
+ | |_^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/object-lifetime-default-elision.rs b/src/test/ui/object-lifetime/object-lifetime-default-elision.rs
similarity index 100%
rename from src/test/compile-fail/object-lifetime-default-elision.rs
rename to src/test/ui/object-lifetime/object-lifetime-default-elision.rs
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr
new file mode 100644
index 0000000..45e7d84
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-elision.stderr
@@ -0,0 +1,53 @@
+error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements
+ --> $DIR/object-lifetime-default-elision.rs:81:5
+ |
+LL | ss
+ | ^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 64:10...
+ --> $DIR/object-lifetime-default-elision.rs:64:10
+ |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+ | ^^
+note: ...so that the type `(dyn SomeTrait + 'a)` is not borrowed for too long
+ --> $DIR/object-lifetime-default-elision.rs:81:5
+ |
+LL | ss
+ | ^^
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 64:13...
+ --> $DIR/object-lifetime-default-elision.rs:64:13
+ |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected &'b (dyn SomeTrait + 'b)
+ found &dyn SomeTrait
+
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/object-lifetime-default-elision.rs:81:5
+ |
+LL | ss
+ | ^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 64:10...
+ --> $DIR/object-lifetime-default-elision.rs:64:10
+ |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+ | ^^
+note: ...so that the declared lifetime parameter bounds are satisfied
+ --> $DIR/object-lifetime-default-elision.rs:81:5
+ |
+LL | ss
+ | ^^
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 64:13...
+ --> $DIR/object-lifetime-default-elision.rs:64:13
+ |
+LL | fn load3<'a,'b>(ss: &'a SomeTrait) -> &'b SomeTrait {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected &'b (dyn SomeTrait + 'b)
+ found &dyn SomeTrait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
new file mode 100644
index 0000000..5cfced1
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.nll.stderr
@@ -0,0 +1,45 @@
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-from-box-error.rs:28:5
+ |
+LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621]
+ | ^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-from-box-error.rs:41:12
+ |
+LL | ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621]
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `ss`
+ --> $DIR/object-lifetime-default-from-box-error.rs:24:48
+ |
+LL | fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
+ | _____________---------------____________________^
+ | | |
+ | | help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
+LL | | // `Box<SomeTrait>` defaults to a `'static` bound, so this return
+LL | | // is illegal.
+LL | |
+LL | | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621]
+LL | | }
+ | |_^ lifetime `'static` required
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/object-lifetime-default-from-box-error.rs:28:5
+ |
+LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621]
+ | ^^^^ cannot move out of borrowed content
+
+error[E0621]: explicit lifetime required in the type of `ss`
+ --> $DIR/object-lifetime-default-from-box-error.rs:41:5
+ |
+LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) {
+ | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
+...
+LL | ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621]
+ | ^^^^ lifetime `'b` required
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0507, E0621.
+For more information about an error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/object-lifetime-default-from-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs
similarity index 100%
rename from src/test/compile-fail/object-lifetime-default-from-box-error.rs
rename to src/test/ui/object-lifetime/object-lifetime-default-from-box-error.rs
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr
new file mode 100644
index 0000000..9972930
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-box-error.stderr
@@ -0,0 +1,21 @@
+error[E0621]: explicit lifetime required in the type of `ss`
+ --> $DIR/object-lifetime-default-from-box-error.rs:28:5
+ |
+LL | fn load(ss: &mut SomeStruct) -> Box<SomeTrait> {
+ | --------------- help: add explicit lifetime `'static` to the type of `ss`: `&mut SomeStruct<'static>`
+...
+LL | ss.r //~ ERROR explicit lifetime required in the type of `ss` [E0621]
+ | ^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `ss`
+ --> $DIR/object-lifetime-default-from-box-error.rs:41:12
+ |
+LL | fn store1<'b>(ss: &mut SomeStruct, b: Box<SomeTrait+'b>) {
+ | --------------- help: add explicit lifetime `'b` to the type of `ss`: `&mut SomeStruct<'b>`
+...
+LL | ss.r = b; //~ ERROR 41:12: 41:13: explicit lifetime required in the type of `ss` [E0621]
+ | ^ lifetime `'b` required
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr
new file mode 100644
index 0000000..42bcdf2
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-from-rptr-box-error.rs:25:12
+ |
+LL | ss.t = t; //~ ERROR mismatched types
+ | ^
+
+error: borrowed data escapes outside of function
+ --> $DIR/object-lifetime-default-from-rptr-box-error.rs:25:5
+ |
+LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
+ | - `t` is a reference that is only valid in the function body
+LL | ss.t = t; //~ ERROR mismatched types
+ | ^^^^^^^^ `t` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs
similarity index 100%
rename from src/test/compile-fail/object-lifetime-default-from-rptr-box-error.rs
rename to src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.rs
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr
new file mode 100644
index 0000000..a59d809
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-box-error.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/object-lifetime-default-from-rptr-box-error.rs:25:12
+ |
+LL | ss.t = t; //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `&'a std::boxed::Box<(dyn Test + 'static)>`
+ found type `&'a std::boxed::Box<(dyn Test + 'a)>`
+note: the lifetime 'a as defined on the function body at 24:6...
+ --> $DIR/object-lifetime-default-from-rptr-box-error.rs:24:6
+ |
+LL | fn c<'a>(t: &'a Box<Test+'a>, mut ss: SomeStruct<'a>) {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr
new file mode 100644
index 0000000..73b419d
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:31:12
+ |
+LL | ss.t = t; //~ ERROR mismatched types
+ | ^
+
+error: borrowed data escapes outside of function
+ --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:31:5
+ |
+LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
+ | - `t` is a reference that is only valid in the function body
+LL | ss.t = t; //~ ERROR mismatched types
+ | ^^^^^^^^ `t` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/object-lifetime-default-from-rptr-struct-error.rs b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs
similarity index 100%
rename from src/test/compile-fail/object-lifetime-default-from-rptr-struct-error.rs
rename to src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.rs
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr
new file mode 100644
index 0000000..beda4df
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-from-rptr-struct-error.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:31:12
+ |
+LL | ss.t = t; //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `&'a MyBox<(dyn Test + 'static)>`
+ found type `&'a MyBox<(dyn Test + 'a)>`
+note: the lifetime 'a as defined on the function body at 30:6...
+ --> $DIR/object-lifetime-default-from-rptr-struct-error.rs:30:6
+ |
+LL | fn c<'a>(t: &'a MyBox<Test+'a>, mut ss: SomeStruct<'a>) {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr
new file mode 100644
index 0000000..14a3cbf
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.nll.stderr
@@ -0,0 +1,33 @@
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-mybox.rs:37:5
+ |
+LL | a //~ ERROR lifetime mismatch
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/object-lifetime-default-mybox.rs:41:11
+ |
+LL | load0(ss) //~ ERROR mismatched types
+ | ^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/object-lifetime-default-mybox.rs:37:5
+ |
+LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | a //~ ERROR lifetime mismatch
+ | ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: borrowed data escapes outside of function
+ --> $DIR/object-lifetime-default-mybox.rs:41:5
+ |
+LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> {
+ | -- `ss` is a reference that is only valid in the function body
+LL | load0(ss) //~ ERROR mismatched types
+ | ^^^^^^^^^ `ss` escapes the function body here
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/object-lifetime-default-mybox.rs b/src/test/ui/object-lifetime/object-lifetime-default-mybox.rs
similarity index 100%
rename from src/test/compile-fail/object-lifetime-default-mybox.rs
rename to src/test/ui/object-lifetime/object-lifetime-default-mybox.rs
diff --git a/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr
new file mode 100644
index 0000000..ec00369
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default-mybox.stderr
@@ -0,0 +1,31 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/object-lifetime-default-mybox.rs:37:5
+ |
+LL | fn load1<'a,'b>(a: &'a MyBox<SomeTrait>,
+ | -------------------- this parameter and the return type are declared with different lifetimes...
+LL | b: &'b MyBox<SomeTrait>)
+LL | -> &'b MyBox<SomeTrait>
+ | --------------------
+LL | {
+LL | a //~ ERROR lifetime mismatch
+ | ^ ...but data from `a` is returned here
+
+error[E0308]: mismatched types
+ --> $DIR/object-lifetime-default-mybox.rs:41:11
+ |
+LL | load0(ss) //~ ERROR mismatched types
+ | ^^ lifetime mismatch
+ |
+ = note: expected type `&MyBox<(dyn SomeTrait + 'static)>`
+ found type `&MyBox<(dyn SomeTrait + 'a)>`
+note: the lifetime 'a as defined on the function body at 40:10...
+ --> $DIR/object-lifetime-default-mybox.rs:40:10
+ |
+LL | fn load2<'a>(ss: &MyBox<SomeTrait+'a>) -> MyBox<SomeTrait+'a> {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0308, E0623.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/object-lifetime/object-lifetime-default.rs b/src/test/ui/object-lifetime/object-lifetime-default.rs
new file mode 100644
index 0000000..746a656
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default.rs
@@ -0,0 +1,36 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![feature(rustc_attrs)]
+
+#[rustc_object_lifetime_default]
+struct A<T>(T); //~ ERROR BaseDefault
+
+#[rustc_object_lifetime_default]
+struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault
+
+#[rustc_object_lifetime_default]
+struct C<'a,T:'a>(&'a T); //~ ERROR 'a
+
+#[rustc_object_lifetime_default]
+struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous
+
+#[rustc_object_lifetime_default]
+struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b
+
+#[rustc_object_lifetime_default]
+struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b
+
+#[rustc_object_lifetime_default]
+struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous
+
+fn main() { }
diff --git a/src/test/ui/object-lifetime/object-lifetime-default.stderr b/src/test/ui/object-lifetime/object-lifetime-default.stderr
new file mode 100644
index 0000000..7e334a0
--- /dev/null
+++ b/src/test/ui/object-lifetime/object-lifetime-default.stderr
@@ -0,0 +1,44 @@
+error: 'a,Ambiguous
+ --> $DIR/object-lifetime-default.rs:34:1
+ |
+LL | struct G<'a,'b,T:'a,U:'a+'b>(&'a T, &'b U); //~ ERROR 'a,Ambiguous
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: 'a,'b
+ --> $DIR/object-lifetime-default.rs:31:1
+ |
+LL | struct F<'a,'b,T:'a,U:'b>(&'a T, &'b U); //~ ERROR 'a,'b
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: 'b
+ --> $DIR/object-lifetime-default.rs:28:1
+ |
+LL | struct E<'a,'b:'a,T:'b>(&'a T, &'b T); //~ ERROR 'b
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Ambiguous
+ --> $DIR/object-lifetime-default.rs:25:1
+ |
+LL | struct D<'a,'b,T:'a+'b>(&'a T, &'b T); //~ ERROR Ambiguous
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: 'a
+ --> $DIR/object-lifetime-default.rs:22:1
+ |
+LL | struct C<'a,T:'a>(&'a T); //~ ERROR 'a
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: BaseDefault
+ --> $DIR/object-lifetime-default.rs:19:1
+ |
+LL | struct B<'a,T>(&'a (), T); //~ ERROR BaseDefault
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: BaseDefault
+ --> $DIR/object-lifetime-default.rs:16:1
+ |
+LL | struct A<T>(T); //~ ERROR BaseDefault
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
diff --git a/src/test/compile-fail/object-pointer-types.rs b/src/test/ui/object-pointer-types.rs
similarity index 100%
rename from src/test/compile-fail/object-pointer-types.rs
rename to src/test/ui/object-pointer-types.rs
diff --git a/src/test/ui/object-pointer-types.stderr b/src/test/ui/object-pointer-types.stderr
new file mode 100644
index 0000000..5d8679b
--- /dev/null
+++ b/src/test/ui/object-pointer-types.stderr
@@ -0,0 +1,29 @@
+error[E0599]: no method named `owned` found for type `&dyn Foo` in the current scope
+ --> $DIR/object-pointer-types.rs:22:7
+ |
+LL | x.owned(); //~ ERROR no method named `owned` found
+ | ^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `owned`, perhaps you need to implement it:
+ candidate #1: `Foo`
+
+error[E0599]: no method named `owned` found for type `&mut dyn Foo` in the current scope
+ --> $DIR/object-pointer-types.rs:28:7
+ |
+LL | x.owned(); //~ ERROR no method named `owned` found
+ | ^^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `owned`, perhaps you need to implement it:
+ candidate #1: `Foo`
+
+error[E0599]: no method named `managed` found for type `std::boxed::Box<(dyn Foo + 'static)>` in the current scope
+ --> $DIR/object-pointer-types.rs:34:7
+ |
+LL | x.managed(); //~ ERROR no method named `managed` found
+ | ^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/object-safety-associated-consts.rs b/src/test/ui/object-safety/object-safety-associated-consts.rs
similarity index 100%
rename from src/test/ui/object-safety-associated-consts.rs
rename to src/test/ui/object-safety/object-safety-associated-consts.rs
diff --git a/src/test/ui/object-safety-associated-consts.stderr b/src/test/ui/object-safety/object-safety-associated-consts.stderr
similarity index 100%
rename from src/test/ui/object-safety-associated-consts.stderr
rename to src/test/ui/object-safety/object-safety-associated-consts.stderr
diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr
new file mode 100644
index 0000000..cf0ee58
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-by-value-self-use.nll.stderr
@@ -0,0 +1,9 @@
+error[E0161]: cannot move a value of type dyn Bar: the size of dyn Bar cannot be statically determined
+ --> $DIR/object-safety-by-value-self-use.rs:25:5
+ |
+LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static)
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/object-safety-by-value-self-use.rs b/src/test/ui/object-safety/object-safety-by-value-self-use.rs
similarity index 100%
rename from src/test/compile-fail/object-safety-by-value-self-use.rs
rename to src/test/ui/object-safety/object-safety-by-value-self-use.rs
diff --git a/src/test/ui/object-safety/object-safety-by-value-self-use.stderr b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr
new file mode 100644
index 0000000..0152846
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-by-value-self-use.stderr
@@ -0,0 +1,9 @@
+error[E0161]: cannot move a value of type (dyn Bar + 'static): the size of (dyn Bar + 'static) cannot be statically determined
+ --> $DIR/object-safety-by-value-self-use.rs:25:5
+ |
+LL | t.bar() //~ ERROR cannot move a value of type (dyn Bar + 'static)
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0161`.
diff --git a/src/test/compile-fail/object-safety-by-value-self.rs b/src/test/ui/object-safety/object-safety-by-value-self.rs
similarity index 100%
rename from src/test/compile-fail/object-safety-by-value-self.rs
rename to src/test/ui/object-safety/object-safety-by-value-self.rs
diff --git a/src/test/ui/object-safety/object-safety-by-value-self.stderr b/src/test/ui/object-safety/object-safety-by-value-self.stderr
new file mode 100644
index 0000000..6125964
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-by-value-self.stderr
@@ -0,0 +1,9 @@
+error: compilation successful
+ --> $DIR/object-safety-by-value-self.rs:55:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/object-safety-generics.rs b/src/test/ui/object-safety/object-safety-generics.rs
similarity index 100%
rename from src/test/ui/object-safety-generics.rs
rename to src/test/ui/object-safety/object-safety-generics.rs
diff --git a/src/test/ui/object-safety-generics.stderr b/src/test/ui/object-safety/object-safety-generics.stderr
similarity index 100%
rename from src/test/ui/object-safety-generics.stderr
rename to src/test/ui/object-safety/object-safety-generics.stderr
diff --git a/src/test/compile-fail/object-safety-issue-22040.rs b/src/test/ui/object-safety/object-safety-issue-22040.rs
similarity index 100%
rename from src/test/compile-fail/object-safety-issue-22040.rs
rename to src/test/ui/object-safety/object-safety-issue-22040.rs
diff --git a/src/test/ui/object-safety/object-safety-issue-22040.stderr b/src/test/ui/object-safety/object-safety-issue-22040.stderr
new file mode 100644
index 0000000..b718e92
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-issue-22040.stderr
@@ -0,0 +1,11 @@
+error[E0038]: the trait `Expr` cannot be made into an object
+ --> $DIR/object-safety-issue-22040.rs:22:23
+ |
+LL | elements: Vec<Box<Expr+ 'x>>,
+ | ^^^^^^^^ the trait `Expr` cannot be made into an object
+ |
+ = note: the trait cannot use `Self` as a type parameter in the supertraits or where-clauses
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/ui/object-safety-mentions-Self.rs b/src/test/ui/object-safety/object-safety-mentions-Self.rs
similarity index 100%
rename from src/test/ui/object-safety-mentions-Self.rs
rename to src/test/ui/object-safety/object-safety-mentions-Self.rs
diff --git a/src/test/ui/object-safety-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-mentions-Self.stderr
similarity index 100%
rename from src/test/ui/object-safety-mentions-Self.stderr
rename to src/test/ui/object-safety/object-safety-mentions-Self.stderr
diff --git a/src/test/compile-fail/object-safety-no-static.rs b/src/test/ui/object-safety/object-safety-no-static.rs
similarity index 100%
rename from src/test/compile-fail/object-safety-no-static.rs
rename to src/test/ui/object-safety/object-safety-no-static.rs
diff --git a/src/test/ui/object-safety/object-safety-no-static.stderr b/src/test/ui/object-safety/object-safety-no-static.stderr
new file mode 100644
index 0000000..f17d290
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-no-static.stderr
@@ -0,0 +1,11 @@
+error[E0038]: the trait `Foo` cannot be made into an object
+ --> $DIR/object-safety-no-static.rs:18:1
+ |
+LL | fn foo_implicit<T:Foo+'static>(b: Box<T>) -> Box<Foo+'static> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object
+ |
+ = note: method `foo` has no receiver
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/object-safety-phantom-fn.rs b/src/test/ui/object-safety/object-safety-phantom-fn.rs
similarity index 100%
rename from src/test/compile-fail/object-safety-phantom-fn.rs
rename to src/test/ui/object-safety/object-safety-phantom-fn.rs
diff --git a/src/test/ui/object-safety/object-safety-phantom-fn.stderr b/src/test/ui/object-safety/object-safety-phantom-fn.stderr
new file mode 100644
index 0000000..645867f
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-phantom-fn.stderr
@@ -0,0 +1,9 @@
+error: compilation successful
+ --> $DIR/object-safety-phantom-fn.rs:31:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/object-safety-sized-2.rs b/src/test/ui/object-safety/object-safety-sized-2.rs
similarity index 100%
rename from src/test/compile-fail/object-safety-sized-2.rs
rename to src/test/ui/object-safety/object-safety-sized-2.rs
diff --git a/src/test/ui/object-safety/object-safety-sized-2.stderr b/src/test/ui/object-safety/object-safety-sized-2.stderr
new file mode 100644
index 0000000..1e179b6
--- /dev/null
+++ b/src/test/ui/object-safety/object-safety-sized-2.stderr
@@ -0,0 +1,11 @@
+error[E0038]: the trait `Bar` cannot be made into an object
+ --> $DIR/object-safety-sized-2.rs:20:1
+ |
+LL | fn make_bar<T:Bar>(t: &T) -> &Bar {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Bar` cannot be made into an object
+ |
+ = note: the trait cannot require that `Self : Sized`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/ui/object-safety-sized.rs b/src/test/ui/object-safety/object-safety-sized.rs
similarity index 100%
rename from src/test/ui/object-safety-sized.rs
rename to src/test/ui/object-safety/object-safety-sized.rs
diff --git a/src/test/ui/object-safety-sized.stderr b/src/test/ui/object-safety/object-safety-sized.stderr
similarity index 100%
rename from src/test/ui/object-safety-sized.stderr
rename to src/test/ui/object-safety/object-safety-sized.stderr
diff --git a/src/test/ui/object-safety-supertrait-mentions-Self.rs b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs
similarity index 100%
rename from src/test/ui/object-safety-supertrait-mentions-Self.rs
rename to src/test/ui/object-safety/object-safety-supertrait-mentions-Self.rs
diff --git a/src/test/ui/object-safety-supertrait-mentions-Self.stderr b/src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr
similarity index 100%
rename from src/test/ui/object-safety-supertrait-mentions-Self.stderr
rename to src/test/ui/object-safety/object-safety-supertrait-mentions-Self.stderr
diff --git a/src/test/compile-fail/occurs-check-2.rs b/src/test/ui/occurs-check-2.rs
similarity index 100%
rename from src/test/compile-fail/occurs-check-2.rs
rename to src/test/ui/occurs-check-2.rs
diff --git a/src/test/ui/occurs-check-2.stderr b/src/test/ui/occurs-check-2.stderr
new file mode 100644
index 0000000..547491c
--- /dev/null
+++ b/src/test/ui/occurs-check-2.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/occurs-check-2.rs:17:9
+ |
+LL | f = box g;
+ | ^^^^^
+ | |
+ | cyclic type of infinite size
+ | help: try using a conversion method: `box g.to_string()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/occurs-check-3.rs b/src/test/ui/occurs-check-3.rs
similarity index 100%
rename from src/test/compile-fail/occurs-check-3.rs
rename to src/test/ui/occurs-check-3.rs
diff --git a/src/test/ui/occurs-check-3.stderr b/src/test/ui/occurs-check-3.stderr
new file mode 100644
index 0000000..1483d41
--- /dev/null
+++ b/src/test/ui/occurs-check-3.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/occurs-check-3.rs:14:24
+ |
+LL | fn main() { let c; c = clam::a(c); match c { clam::a::<isize>(_) => { } } }
+ | ^^^^^^^^^^ cyclic type of infinite size
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/occurs-check.rs b/src/test/ui/occurs-check.rs
similarity index 100%
rename from src/test/compile-fail/occurs-check.rs
rename to src/test/ui/occurs-check.rs
diff --git a/src/test/ui/occurs-check.stderr b/src/test/ui/occurs-check.stderr
new file mode 100644
index 0000000..c6994d0
--- /dev/null
+++ b/src/test/ui/occurs-check.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/occurs-check.rs:15:9
+ |
+LL | f = box f;
+ | ^^^^^
+ | |
+ | cyclic type of infinite size
+ | help: try using a conversion method: `box f.to_string()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/old-suffixes-are-really-forbidden.rs b/src/test/ui/old-suffixes-are-really-forbidden.rs
similarity index 100%
rename from src/test/compile-fail/old-suffixes-are-really-forbidden.rs
rename to src/test/ui/old-suffixes-are-really-forbidden.rs
diff --git a/src/test/ui/old-suffixes-are-really-forbidden.stderr b/src/test/ui/old-suffixes-are-really-forbidden.stderr
new file mode 100644
index 0000000..d580a18
--- /dev/null
+++ b/src/test/ui/old-suffixes-are-really-forbidden.stderr
@@ -0,0 +1,18 @@
+error: invalid suffix `is` for numeric literal
+ --> $DIR/old-suffixes-are-really-forbidden.rs:12:13
+ |
+LL | let a = 1_is; //~ ERROR invalid suffix
+ | ^^^^
+ |
+ = help: the suffix must be one of the integral types (`u32`, `isize`, etc)
+
+error: invalid suffix `us` for numeric literal
+ --> $DIR/old-suffixes-are-really-forbidden.rs:13:13
+ |
+LL | let b = 2_us; //~ ERROR invalid suffix
+ | ^^^^
+ |
+ = help: the suffix must be one of the integral types (`u32`, `isize`, etc)
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/on-unimplemented/bad-annotation.rs b/src/test/ui/on-unimplemented/bad-annotation.rs
index 7ef155e..286c71b 100644
--- a/src/test/ui/on-unimplemented/bad-annotation.rs
+++ b/src/test/ui/on-unimplemented/bad-annotation.rs
@@ -28,7 +28,7 @@
{}
#[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
-//~^ ERROR there is no parameter C on trait BadAnnotation2
+//~^ ERROR there is no parameter `C` on trait `BadAnnotation2`
trait BadAnnotation2<A,B>
{}
diff --git a/src/test/ui/on-unimplemented/bad-annotation.stderr b/src/test/ui/on-unimplemented/bad-annotation.stderr
index 1c5d4d6..212eb12 100644
--- a/src/test/ui/on-unimplemented/bad-annotation.stderr
+++ b/src/test/ui/on-unimplemented/bad-annotation.stderr
@@ -4,9 +4,9 @@
LL | #[rustc_on_unimplemented] //~ ERROR `#[rustc_on_unimplemented]` requires a value
| ^^^^^^^^^^^^^^^^^^^^^^^^^ value required here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
-error[E0230]: there is no parameter C on trait BadAnnotation2
+error[E0230]: there is no parameter `C` on trait `BadAnnotation2`
--> $DIR/bad-annotation.rs:30:1
|
LL | #[rustc_on_unimplemented = "Unimplemented trait error on `{Self}` with params `<{A},{B},{C}>`"]
@@ -24,7 +24,7 @@
LL | #[rustc_on_unimplemented(lorem="")]
| ^^^^^^^^ expected value here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error[E0232]: this attribute must have a valid value
--> $DIR/bad-annotation.rs:44:26
@@ -32,7 +32,7 @@
LL | #[rustc_on_unimplemented(lorem(ipsum(dolor)))]
| ^^^^^^^^^^^^^^^^^^^ expected value here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error[E0232]: this attribute must have a valid value
--> $DIR/bad-annotation.rs:48:39
@@ -40,7 +40,7 @@
LL | #[rustc_on_unimplemented(message="x", message="y")]
| ^^^^^^^^^^^ expected value here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error[E0232]: this attribute must have a valid value
--> $DIR/bad-annotation.rs:52:39
@@ -48,7 +48,7 @@
LL | #[rustc_on_unimplemented(message="x", on(desugared, message="y"))]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error[E0232]: empty `on`-clause in `#[rustc_on_unimplemented]`
--> $DIR/bad-annotation.rs:56:26
@@ -62,7 +62,7 @@
LL | #[rustc_on_unimplemented(on="x", message="y")]
| ^^^^^^ expected value here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error[E0232]: this attribute must have a valid value
--> $DIR/bad-annotation.rs:67:40
@@ -70,7 +70,7 @@
LL | #[rustc_on_unimplemented(on(desugared, on(desugared, message="x")), message="y")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected value here
|
- = note: eg `#[rustc_on_unimplemented = "foo"]`
+ = note: eg `#[rustc_on_unimplemented(message="foo")]`
error: aborting due to 10 previous errors
diff --git a/src/test/compile-fail/once-cant-call-twice-on-heap.rs b/src/test/ui/once-cant-call-twice-on-heap.rs
similarity index 100%
rename from src/test/compile-fail/once-cant-call-twice-on-heap.rs
rename to src/test/ui/once-cant-call-twice-on-heap.rs
diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr
new file mode 100644
index 0000000..81a501f
--- /dev/null
+++ b/src/test/ui/once-cant-call-twice-on-heap.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `blk`
+ --> $DIR/once-cant-call-twice-on-heap.rs:19:5
+ |
+LL | blk();
+ | --- value moved here
+LL | blk(); //~ ERROR use of moved value
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `blk` has type `F`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/opt-in-copy.rs b/src/test/ui/opt-in-copy.rs
similarity index 100%
rename from src/test/compile-fail/opt-in-copy.rs
rename to src/test/ui/opt-in-copy.rs
diff --git a/src/test/ui/opt-in-copy.stderr b/src/test/ui/opt-in-copy.stderr
new file mode 100644
index 0000000..c644080
--- /dev/null
+++ b/src/test/ui/opt-in-copy.stderr
@@ -0,0 +1,21 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/opt-in-copy.rs:17:6
+ |
+LL | but_i_cant: CantCopyThis,
+ | ------------------------ this field does not implement `Copy`
+...
+LL | impl Copy for IWantToCopyThis {}
+ | ^^^^
+
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/opt-in-copy.rs:29:6
+ |
+LL | ButICant(CantCopyThisEither),
+ | ------------------ this field does not implement `Copy`
+...
+LL | impl Copy for IWantToCopyThisToo {}
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0204`.
diff --git a/src/test/compile-fail/or-patter-mismatch.rs b/src/test/ui/or-patter-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/or-patter-mismatch.rs
rename to src/test/ui/or-patter-mismatch.rs
diff --git a/src/test/ui/or-patter-mismatch.stderr b/src/test/ui/or-patter-mismatch.stderr
new file mode 100644
index 0000000..8bf4d2e
--- /dev/null
+++ b/src/test/ui/or-patter-mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/or-patter-mismatch.rs:15:68
+ |
+LL | fn main() { match blah::a(1, 1, 2) { blah::a(_, x, y) | blah::b(x, y) => { } } }
+ | ^ expected usize, found isize
+ |
+ = note: expected type `usize`
+ found type `isize`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/orphan-check-diagnostics.rs b/src/test/ui/orphan-check-diagnostics.rs
similarity index 100%
rename from src/test/compile-fail/orphan-check-diagnostics.rs
rename to src/test/ui/orphan-check-diagnostics.rs
diff --git a/src/test/ui/orphan-check-diagnostics.stderr b/src/test/ui/orphan-check-diagnostics.stderr
new file mode 100644
index 0000000..dc134dd
--- /dev/null
+++ b/src/test/ui/orphan-check-diagnostics.stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g. `MyStruct<T>`)
+ --> $DIR/orphan-check-diagnostics.rs:20:1
+ |
+LL | impl<T> RemoteTrait for T where T: LocalTrait {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/compile-fail/osx-frameworks.rs b/src/test/ui/osx-frameworks.rs
similarity index 100%
rename from src/test/compile-fail/osx-frameworks.rs
rename to src/test/ui/osx-frameworks.rs
diff --git a/src/test/ui/osx-frameworks.stderr b/src/test/ui/osx-frameworks.stderr
new file mode 100644
index 0000000..cdc2357
--- /dev/null
+++ b/src/test/ui/osx-frameworks.stderr
@@ -0,0 +1,9 @@
+error[E0455]: native frameworks are only available on macOS targets
+ --> $DIR/osx-frameworks.rs:13:1
+ |
+LL | #[link(name = "foo", kind = "framework")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0455`.
diff --git a/src/test/compile-fail/out-of-order-shadowing.rs b/src/test/ui/out-of-order-shadowing.rs
similarity index 100%
rename from src/test/compile-fail/out-of-order-shadowing.rs
rename to src/test/ui/out-of-order-shadowing.rs
diff --git a/src/test/ui/out-of-order-shadowing.stderr b/src/test/ui/out-of-order-shadowing.stderr
new file mode 100644
index 0000000..78e32e2
--- /dev/null
+++ b/src/test/ui/out-of-order-shadowing.stderr
@@ -0,0 +1,11 @@
+error: `bar` is already in scope
+ --> $DIR/out-of-order-shadowing.rs:15:1
+ |
+LL | define_macro!(bar);
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = note: macro-expanded `macro_rules!`s may not shadow existing macros (see RFC 1560)
+ = 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: aborting due to previous error
+
diff --git a/src/test/compile-fail/output-type-mismatch.rs b/src/test/ui/output-type-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/output-type-mismatch.rs
rename to src/test/ui/output-type-mismatch.rs
diff --git a/src/test/ui/output-type-mismatch.stderr b/src/test/ui/output-type-mismatch.stderr
new file mode 100644
index 0000000..e869dfa
--- /dev/null
+++ b/src/test/ui/output-type-mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/output-type-mismatch.rs:15:31
+ |
+LL | fn main() { let i: isize; i = f(); }
+ | ^^^ expected isize, found ()
+ |
+ = note: expected type `isize`
+ found type `()`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/overlap-marker-trait.rs b/src/test/ui/overlap-marker-trait.rs
similarity index 100%
rename from src/test/compile-fail/overlap-marker-trait.rs
rename to src/test/ui/overlap-marker-trait.rs
diff --git a/src/test/ui/overlap-marker-trait.stderr b/src/test/ui/overlap-marker-trait.stderr
new file mode 100644
index 0000000..d739dfc
--- /dev/null
+++ b/src/test/ui/overlap-marker-trait.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `NotDebugOrDisplay: Marker` is not satisfied
+ --> $DIR/overlap-marker-trait.rs:40:5
+ |
+LL | is_marker::<NotDebugOrDisplay>(); //~ ERROR
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Marker` is not implemented for `NotDebugOrDisplay`
+ |
+note: required by `is_marker`
+ --> $DIR/overlap-marker-trait.rs:28:1
+ |
+LL | fn is_marker<T: Marker>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/overloaded-calls-nontuple.rs b/src/test/ui/overloaded-calls-nontuple.rs
similarity index 100%
rename from src/test/compile-fail/overloaded-calls-nontuple.rs
rename to src/test/ui/overloaded-calls-nontuple.rs
diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded-calls-nontuple.stderr
new file mode 100644
index 0000000..78b8688
--- /dev/null
+++ b/src/test/ui/overloaded-calls-nontuple.stderr
@@ -0,0 +1,9 @@
+error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
+ --> $DIR/overloaded-calls-nontuple.rs:36:10
+ |
+LL | drop(s(3)) //~ ERROR cannot use call notation
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0059`.
diff --git a/src/test/compile-fail/packed-struct-generic-transmute.rs b/src/test/ui/packed-struct/packed-struct-generic-transmute.rs
similarity index 100%
rename from src/test/compile-fail/packed-struct-generic-transmute.rs
rename to src/test/ui/packed-struct/packed-struct-generic-transmute.rs
diff --git a/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr b/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr
new file mode 100644
index 0000000..397b1dd
--- /dev/null
+++ b/src/test/ui/packed-struct/packed-struct-generic-transmute.stderr
@@ -0,0 +1,12 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/packed-struct-generic-transmute.rs:34:38
+ |
+LL | let oof: Oof<[u8; 5], i32> = mem::transmute(foo);
+ | ^^^^^^^^^^^^^^
+ |
+ = note: source type: Foo<[u8; 5], i32> (72 bits)
+ = note: target type: Oof<[u8; 5], i32> (96 bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/ui/packed-struct/packed-struct-transmute.rs b/src/test/ui/packed-struct/packed-struct-transmute.rs
new file mode 100644
index 0000000..695ffbd
--- /dev/null
+++ b/src/test/ui/packed-struct/packed-struct-transmute.rs
@@ -0,0 +1,39 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// This assumes the packed and non-packed structs are different sizes.
+
+// the error points to the start of the file, not the line with the
+// transmute
+
+// normalize-stderr-test "\d+ bits" -> "N bits"
+// error-pattern: transmute called with types of different sizes
+
+use std::mem;
+
+#[repr(packed)]
+struct Foo {
+ bar: u8,
+ baz: usize
+}
+
+#[derive(Debug)]
+struct Oof {
+ rab: u8,
+ zab: usize
+}
+
+fn main() {
+ let foo = Foo { bar: 1, baz: 10 };
+ unsafe {
+ let oof: Oof = mem::transmute(foo);
+ println!("{:?}", oof);
+ }
+}
diff --git a/src/test/ui/packed-struct/packed-struct-transmute.stderr b/src/test/ui/packed-struct/packed-struct-transmute.stderr
new file mode 100644
index 0000000..5da7d8f
--- /dev/null
+++ b/src/test/ui/packed-struct/packed-struct-transmute.stderr
@@ -0,0 +1,12 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/packed-struct-transmute.rs:36:24
+ |
+LL | let oof: Oof = mem::transmute(foo);
+ | ^^^^^^^^^^^^^^
+ |
+ = note: source type: Foo (N bits)
+ = note: target type: Oof (N bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/ui/panic-implementation/auxiliary/some-panic-impl.rs b/src/test/ui/panic-implementation/auxiliary/some-panic-impl.rs
new file mode 100644
index 0000000..db16ac3
--- /dev/null
+++ b/src/test/ui/panic-implementation/auxiliary/some-panic-impl.rs
@@ -0,0 +1,22 @@
+// 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.
+
+// no-prefer-dynamic
+
+#![crate_type = "rlib"]
+#![feature(panic_implementation)]
+#![no_std]
+
+use core::panic::PanicInfo;
+
+#[panic_implementation]
+fn panic(info: &PanicInfo) -> ! {
+ loop {}
+}
diff --git a/src/test/compile-fail/panic-implementation-bad-signature-1.rs b/src/test/ui/panic-implementation/panic-implementation-bad-signature-1.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-bad-signature-1.rs
rename to src/test/ui/panic-implementation/panic-implementation-bad-signature-1.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-bad-signature-1.stderr b/src/test/ui/panic-implementation/panic-implementation-bad-signature-1.stderr
new file mode 100644
index 0000000..0e020fb
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-bad-signature-1.stderr
@@ -0,0 +1,14 @@
+error: return type should be `!`
+ --> $DIR/panic-implementation-bad-signature-1.rs:22:6
+ |
+LL | ) -> () //~ ERROR return type should be `!`
+ | ^^
+
+error: argument should be `&PanicInfo`
+ --> $DIR/panic-implementation-bad-signature-1.rs:21:11
+ |
+LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/panic-implementation-bad-signature-2.rs b/src/test/ui/panic-implementation/panic-implementation-bad-signature-2.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-bad-signature-2.rs
rename to src/test/ui/panic-implementation/panic-implementation-bad-signature-2.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-bad-signature-2.stderr b/src/test/ui/panic-implementation/panic-implementation-bad-signature-2.stderr
new file mode 100644
index 0000000..71ed1ef
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-bad-signature-2.stderr
@@ -0,0 +1,8 @@
+error: argument should be `&PanicInfo`
+ --> $DIR/panic-implementation-bad-signature-2.rs:21:11
+ |
+LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/panic-implementation-bad-signature-3.rs b/src/test/ui/panic-implementation/panic-implementation-bad-signature-3.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-bad-signature-3.rs
rename to src/test/ui/panic-implementation/panic-implementation-bad-signature-3.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-bad-signature-3.stderr b/src/test/ui/panic-implementation/panic-implementation-bad-signature-3.stderr
new file mode 100644
index 0000000..3fd29bc
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-bad-signature-3.stderr
@@ -0,0 +1,10 @@
+error: function should have one argument
+ --> $DIR/panic-implementation-bad-signature-3.rs:20:1
+ |
+LL | / fn panic() -> ! { //~ ERROR function should have one argument
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/panic-implementation-bad-signature-4.rs b/src/test/ui/panic-implementation/panic-implementation-bad-signature-4.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-bad-signature-4.rs
rename to src/test/ui/panic-implementation/panic-implementation-bad-signature-4.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-bad-signature-4.stderr b/src/test/ui/panic-implementation/panic-implementation-bad-signature-4.stderr
new file mode 100644
index 0000000..362be2f
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-bad-signature-4.stderr
@@ -0,0 +1,11 @@
+error: `#[panic_implementation]` function should have no type parameters
+ --> $DIR/panic-implementation-bad-signature-4.rs:20:1
+ |
+LL | / fn panic<T>(pi: &PanicInfo) -> ! {
+LL | | //~^ ERROR `#[panic_implementation]` function should have no type parameters
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/panic-implementation-duplicate.rs b/src/test/ui/panic-implementation/panic-implementation-duplicate.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-duplicate.rs
rename to src/test/ui/panic-implementation/panic-implementation-duplicate.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-duplicate.stderr b/src/test/ui/panic-implementation/panic-implementation-duplicate.stderr
new file mode 100644
index 0000000..d553c02
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-duplicate.stderr
@@ -0,0 +1,19 @@
+error[E0152]: duplicate lang item found: `panic_impl`.
+ --> $DIR/panic-implementation-duplicate.rs:26:1
+ |
+LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`.
+LL | | loop {}
+LL | | }
+ | |_^
+ |
+note: first defined here.
+ --> $DIR/panic-implementation-duplicate.rs:21:1
+ |
+LL | / fn panic(info: &PanicInfo) -> ! {
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0152`.
diff --git a/src/test/compile-fail/panic-implementation-requires-panic-info.rs b/src/test/ui/panic-implementation/panic-implementation-requires-panic-info.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-requires-panic-info.rs
rename to src/test/ui/panic-implementation/panic-implementation-requires-panic-info.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-requires-panic-info.stderr b/src/test/ui/panic-implementation/panic-implementation-requires-panic-info.stderr
new file mode 100644
index 0000000..2bae12e
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-requires-panic-info.stderr
@@ -0,0 +1,4 @@
+error: language item required, but not found: `panic_info`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/panic-implementation-std.rs b/src/test/ui/panic-implementation/panic-implementation-std.rs
similarity index 100%
rename from src/test/compile-fail/panic-implementation-std.rs
rename to src/test/ui/panic-implementation/panic-implementation-std.rs
diff --git a/src/test/ui/panic-implementation/panic-implementation-std.stderr b/src/test/ui/panic-implementation/panic-implementation-std.stderr
new file mode 100644
index 0000000..5016d50
--- /dev/null
+++ b/src/test/ui/panic-implementation/panic-implementation-std.stderr
@@ -0,0 +1,13 @@
+error[E0152]: duplicate lang item found: `panic_impl`.
+ --> $DIR/panic-implementation-std.rs:18:1
+ |
+LL | / fn panic(info: PanicInfo) -> ! {
+LL | | loop {}
+LL | | }
+ | |_^
+ |
+ = note: first defined in crate `std`.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0152`.
diff --git a/src/test/compile-fail/panic-runtime/abort-link-to-unwind-dylib.rs b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/abort-link-to-unwind-dylib.rs
rename to src/test/ui/panic-runtime/abort-link-to-unwind-dylib.rs
diff --git a/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.stderr b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.stderr
new file mode 100644
index 0000000..704b81a
--- /dev/null
+++ b/src/test/ui/panic-runtime/abort-link-to-unwind-dylib.stderr
@@ -0,0 +1,4 @@
+error: the linked panic runtime `panic_unwind` is not compiled with this crate's panic strategy `abort`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/depends.rs b/src/test/ui/panic-runtime/auxiliary/depends.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/depends.rs
rename to src/test/ui/panic-runtime/auxiliary/depends.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/needs-panic-runtime.rs b/src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/needs-panic-runtime.rs
rename to src/test/ui/panic-runtime/auxiliary/needs-panic-runtime.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-abort.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-abort.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-abort.rs
rename to src/test/ui/panic-runtime/auxiliary/panic-runtime-abort.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-lang-items.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-lang-items.rs
rename to src/test/ui/panic-runtime/auxiliary/panic-runtime-lang-items.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind.rs
rename to src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind2.rs b/src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/panic-runtime-unwind2.rs
rename to src/test/ui/panic-runtime/auxiliary/panic-runtime-unwind2.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/wants-panic-runtime-abort.rs b/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/wants-panic-runtime-abort.rs
rename to src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-abort.rs
diff --git a/src/test/compile-fail/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs b/src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs
rename to src/test/ui/panic-runtime/auxiliary/wants-panic-runtime-unwind.rs
diff --git a/src/test/compile-fail/panic-runtime/bad-panic-flag1.rs b/src/test/ui/panic-runtime/bad-panic-flag1.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/bad-panic-flag1.rs
rename to src/test/ui/panic-runtime/bad-panic-flag1.rs
diff --git a/src/test/ui/panic-runtime/bad-panic-flag1.stderr b/src/test/ui/panic-runtime/bad-panic-flag1.stderr
new file mode 100644
index 0000000..3a65419
--- /dev/null
+++ b/src/test/ui/panic-runtime/bad-panic-flag1.stderr
@@ -0,0 +1,2 @@
+error: incorrect value `foo` for codegen option `panic` - either `panic` or `abort` was expected
+
diff --git a/src/test/compile-fail/panic-runtime/bad-panic-flag2.rs b/src/test/ui/panic-runtime/bad-panic-flag2.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/bad-panic-flag2.rs
rename to src/test/ui/panic-runtime/bad-panic-flag2.rs
diff --git a/src/test/ui/panic-runtime/bad-panic-flag2.stderr b/src/test/ui/panic-runtime/bad-panic-flag2.stderr
new file mode 100644
index 0000000..8d919e5
--- /dev/null
+++ b/src/test/ui/panic-runtime/bad-panic-flag2.stderr
@@ -0,0 +1,2 @@
+error: codegen option `panic` requires either `panic` or `abort` (C panic=<value>)
+
diff --git a/src/test/compile-fail/panic-runtime/libtest-unwinds.rs b/src/test/ui/panic-runtime/libtest-unwinds.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/libtest-unwinds.rs
rename to src/test/ui/panic-runtime/libtest-unwinds.rs
diff --git a/src/test/ui/panic-runtime/libtest-unwinds.stderr b/src/test/ui/panic-runtime/libtest-unwinds.stderr
new file mode 100644
index 0000000..704b81a
--- /dev/null
+++ b/src/test/ui/panic-runtime/libtest-unwinds.stderr
@@ -0,0 +1,4 @@
+error: the linked panic runtime `panic_unwind` is not compiled with this crate's panic strategy `abort`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/panic-runtime/needs-gate.rs b/src/test/ui/panic-runtime/needs-gate.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/needs-gate.rs
rename to src/test/ui/panic-runtime/needs-gate.rs
diff --git a/src/test/ui/panic-runtime/needs-gate.stderr b/src/test/ui/panic-runtime/needs-gate.stderr
new file mode 100644
index 0000000..aa2b975
--- /dev/null
+++ b/src/test/ui/panic-runtime/needs-gate.stderr
@@ -0,0 +1,19 @@
+error[E0658]: the `#[panic_runtime]` attribute is an experimental feature (see issue #32837)
+ --> $DIR/needs-gate.rs:14:1
+ |
+LL | #![panic_runtime] //~ ERROR: is an experimental feature
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(panic_runtime)] to the crate attributes to enable
+
+error[E0658]: the `#[needs_panic_runtime]` attribute is an experimental feature (see issue #32837)
+ --> $DIR/needs-gate.rs:15:1
+ |
+LL | #![needs_panic_runtime] //~ ERROR: is an experimental feature
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(needs_panic_runtime)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/runtime-depend-on-needs-runtime.rs
rename to src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.rs
diff --git a/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr
new file mode 100644
index 0000000..0e68c9b
--- /dev/null
+++ b/src/test/ui/panic-runtime/runtime-depend-on-needs-runtime.stderr
@@ -0,0 +1,9 @@
+error: the crate `depends` cannot depend on a crate that needs a panic runtime, but it depends on `needs_panic_runtime`
+
+error[E0601]: `main` function not found in crate `runtime_depend_on_needs_runtime`
+ |
+ = note: consider adding a `main` function to `$DIR/runtime-depend-on-needs-runtime.rs`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/panic-runtime/transitive-link-a-bunch.rs b/src/test/ui/panic-runtime/transitive-link-a-bunch.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/transitive-link-a-bunch.rs
rename to src/test/ui/panic-runtime/transitive-link-a-bunch.rs
diff --git a/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr b/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr
new file mode 100644
index 0000000..4af754c
--- /dev/null
+++ b/src/test/ui/panic-runtime/transitive-link-a-bunch.stderr
@@ -0,0 +1,10 @@
+error: cannot link together two panic runtimes: panic_runtime_unwind and panic_runtime_abort
+
+error: the linked panic runtime `panic_runtime_abort` is not compiled with this crate's panic strategy `unwind`
+
+error: the crate `wants_panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind`
+
+error: the crate `panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind`
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/panic-runtime/want-unwind-got-abort.rs b/src/test/ui/panic-runtime/want-unwind-got-abort.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/want-unwind-got-abort.rs
rename to src/test/ui/panic-runtime/want-unwind-got-abort.rs
diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort.stderr b/src/test/ui/panic-runtime/want-unwind-got-abort.stderr
new file mode 100644
index 0000000..d4fd2cc
--- /dev/null
+++ b/src/test/ui/panic-runtime/want-unwind-got-abort.stderr
@@ -0,0 +1,6 @@
+error: the linked panic runtime `panic_runtime_abort` is not compiled with this crate's panic strategy `unwind`
+
+error: the crate `panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/panic-runtime/want-unwind-got-abort2.rs b/src/test/ui/panic-runtime/want-unwind-got-abort2.rs
similarity index 100%
rename from src/test/compile-fail/panic-runtime/want-unwind-got-abort2.rs
rename to src/test/ui/panic-runtime/want-unwind-got-abort2.rs
diff --git a/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr b/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr
new file mode 100644
index 0000000..364a27a
--- /dev/null
+++ b/src/test/ui/panic-runtime/want-unwind-got-abort2.stderr
@@ -0,0 +1,8 @@
+error: the linked panic runtime `panic_runtime_abort` is not compiled with this crate's panic strategy `unwind`
+
+error: the crate `wants_panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind`
+
+error: the crate `panic_runtime_abort` is compiled with the panic strategy `abort` which is incompatible with this crate's strategy of `unwind`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/panic_implementation-closures.rs b/src/test/ui/panic_implementation-closures.rs
similarity index 100%
rename from src/test/compile-fail/panic_implementation-closures.rs
rename to src/test/ui/panic_implementation-closures.rs
diff --git a/src/test/compile-fail/paren-span.rs b/src/test/ui/paren-span.rs
similarity index 100%
rename from src/test/compile-fail/paren-span.rs
rename to src/test/ui/paren-span.rs
diff --git a/src/test/ui/paren-span.stderr b/src/test/ui/paren-span.stderr
new file mode 100644
index 0000000..df6881a
--- /dev/null
+++ b/src/test/ui/paren-span.stderr
@@ -0,0 +1,9 @@
+error[E0616]: field `x` of struct `m::S` is private
+ --> $DIR/paren-span.rs:29:12
+ |
+LL | paren!(s.x); //~ ERROR field `x` of struct `m::S` is private
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/compile-fail/parse-error-correct.rs b/src/test/ui/parse-error-correct.rs
similarity index 100%
rename from src/test/compile-fail/parse-error-correct.rs
rename to src/test/ui/parse-error-correct.rs
diff --git a/src/test/ui/parse-error-correct.stderr b/src/test/ui/parse-error-correct.stderr
new file mode 100644
index 0000000..3eb0b19
--- /dev/null
+++ b/src/test/ui/parse-error-correct.stderr
@@ -0,0 +1,31 @@
+error: unexpected token: `;`
+ --> $DIR/parse-error-correct.rs:18:15
+ |
+LL | let x = y.; //~ ERROR unexpected token
+ | ^
+
+error: unexpected token: `(`
+ --> $DIR/parse-error-correct.rs:19:15
+ |
+LL | let x = y.(); //~ ERROR unexpected token
+ | ^
+
+error[E0618]: expected function, found `{integer}`
+ --> $DIR/parse-error-correct.rs:19:13
+ |
+LL | let y = 42;
+ | - `{integer}` defined here
+LL | let x = y.; //~ ERROR unexpected token
+LL | let x = y.(); //~ ERROR unexpected token
+ | ^^^^ not a function
+
+error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
+ --> $DIR/parse-error-correct.rs:21:15
+ |
+LL | let x = y.foo; //~ ERROR `{integer}` is a primitive type and therefore doesn't have fields [E061
+ | ^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0610, E0618.
+For more information about an error, try `rustc --explain E0610`.
diff --git a/src/test/compile-fail/parser-recovery-1.rs b/src/test/ui/parser-recovery-1.rs
similarity index 100%
rename from src/test/compile-fail/parser-recovery-1.rs
rename to src/test/ui/parser-recovery-1.rs
diff --git a/src/test/ui/parser-recovery-1.stderr b/src/test/ui/parser-recovery-1.stderr
new file mode 100644
index 0000000..bf40706
--- /dev/null
+++ b/src/test/ui/parser-recovery-1.stderr
@@ -0,0 +1,38 @@
+error: this file contains an un-closed delimiter
+ --> $DIR/parser-recovery-1.rs:24:55
+ |
+LL | } //~ ERROR this file contains an un-closed delimiter
+ | ^
+ |
+help: did you mean to close this delimiter?
+ --> $DIR/parser-recovery-1.rs:15:11
+ |
+LL | trait Foo {
+ | ^
+
+error: unexpected token: `;`
+ --> $DIR/parser-recovery-1.rs:22:15
+ |
+LL | let x = y.; //~ ERROR unexpected token
+ | ^
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/parser-recovery-1.rs:17:17
+ |
+LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `y` in this scope
+ --> $DIR/parser-recovery-1.rs:22:13
+ |
+LL | let x = y.; //~ ERROR unexpected token
+ | ^ not found in this scope
+
+error[E0601]: `main` function not found in crate `parser_recovery_1`
+ |
+ = note: consider adding a `main` function to `$DIR/parser-recovery-1.rs`
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0425, E0601.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/parser-recovery-2.rs b/src/test/ui/parser-recovery-2.rs
similarity index 100%
rename from src/test/compile-fail/parser-recovery-2.rs
rename to src/test/ui/parser-recovery-2.rs
diff --git a/src/test/ui/parser-recovery-2.stderr b/src/test/ui/parser-recovery-2.stderr
new file mode 100644
index 0000000..1025dad
--- /dev/null
+++ b/src/test/ui/parser-recovery-2.stderr
@@ -0,0 +1,30 @@
+error: incorrect close delimiter: `)`
+ --> $DIR/parser-recovery-2.rs:18:5
+ |
+LL | fn bar() {
+ | - unclosed delimiter
+LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope
+LL | ) //~ ERROR incorrect close delimiter: `)`
+ | ^ incorrect close delimiter
+
+error: unexpected token: `;`
+ --> $DIR/parser-recovery-2.rs:22:15
+ |
+LL | let x = y.; //~ ERROR unexpected token
+ | ^
+
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/parser-recovery-2.rs:17:17
+ |
+LL | let x = foo(); //~ ERROR cannot find function `foo` in this scope
+ | ^^^ not found in this scope
+
+error[E0425]: cannot find value `y` in this scope
+ --> $DIR/parser-recovery-2.rs:22:13
+ |
+LL | let x = y.; //~ ERROR unexpected token
+ | ^ not found in this scope
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/pat-shadow-in-nested-binding.rs b/src/test/ui/pattern/pat-shadow-in-nested-binding.rs
similarity index 100%
rename from src/test/compile-fail/pat-shadow-in-nested-binding.rs
rename to src/test/ui/pattern/pat-shadow-in-nested-binding.rs
diff --git a/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr
new file mode 100644
index 0000000..9dd6a31
--- /dev/null
+++ b/src/test/ui/pattern/pat-shadow-in-nested-binding.stderr
@@ -0,0 +1,12 @@
+error[E0530]: let bindings cannot shadow tuple structs
+ --> $DIR/pat-shadow-in-nested-binding.rs:14:10
+ |
+LL | struct foo(usize);
+ | ------------------ a tuple struct `foo` is defined here
+...
+LL | let (foo, _) = (2, 3); //~ ERROR let bindings cannot shadow tuple structs
+ | ^^^ cannot be named the same as a tuple struct
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0530`.
diff --git a/src/test/compile-fail/pat-tuple-bad-type.rs b/src/test/ui/pattern/pat-tuple-bad-type.rs
similarity index 100%
rename from src/test/compile-fail/pat-tuple-bad-type.rs
rename to src/test/ui/pattern/pat-tuple-bad-type.rs
diff --git a/src/test/ui/pattern/pat-tuple-bad-type.stderr b/src/test/ui/pattern/pat-tuple-bad-type.stderr
new file mode 100644
index 0000000..d4f8055
--- /dev/null
+++ b/src/test/ui/pattern/pat-tuple-bad-type.stderr
@@ -0,0 +1,24 @@
+error[E0282]: type annotations needed
+ --> $DIR/pat-tuple-bad-type.rs:15:9
+ |
+LL | let x;
+ | - consider giving `x` a type
+...
+LL | (..) => {} //~ ERROR type annotations needed
+ | ^^^^ cannot infer type
+ |
+ = note: type must be known at this point
+
+error[E0308]: mismatched types
+ --> $DIR/pat-tuple-bad-type.rs:20:9
+ |
+LL | (..) => {} //~ ERROR mismatched types
+ | ^^^^ expected u8, found ()
+ |
+ = note: expected type `u8`
+ found type `()`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0282, E0308.
+For more information about an error, try `rustc --explain E0282`.
diff --git a/src/test/compile-fail/pat-tuple-overfield.rs b/src/test/ui/pattern/pat-tuple-overfield.rs
similarity index 100%
rename from src/test/compile-fail/pat-tuple-overfield.rs
rename to src/test/ui/pattern/pat-tuple-overfield.rs
diff --git a/src/test/ui/pattern/pat-tuple-overfield.stderr b/src/test/ui/pattern/pat-tuple-overfield.stderr
new file mode 100644
index 0000000..2802b42
--- /dev/null
+++ b/src/test/ui/pattern/pat-tuple-overfield.stderr
@@ -0,0 +1,34 @@
+error[E0308]: mismatched types
+ --> $DIR/pat-tuple-overfield.rs:15:9
+ |
+LL | (1, 2, 3, 4) => {} //~ ERROR mismatched types
+ | ^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements
+ |
+ = note: expected type `({integer}, {integer}, {integer})`
+ found type `(_, _, _, _)`
+
+error[E0308]: mismatched types
+ --> $DIR/pat-tuple-overfield.rs:16:9
+ |
+LL | (1, 2, .., 3, 4) => {} //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^ expected a tuple with 3 elements, found one with 4 elements
+ |
+ = note: expected type `({integer}, {integer}, {integer})`
+ found type `(_, _, _, _)`
+
+error[E0023]: this pattern has 4 fields, but the corresponding tuple struct has 3 fields
+ --> $DIR/pat-tuple-overfield.rs:20:9
+ |
+LL | S(1, 2, 3, 4) => {}
+ | ^^^^^^^^^^^^^ expected 3 fields, found 4
+
+error[E0023]: this pattern has 4 fields, but the corresponding tuple struct has 3 fields
+ --> $DIR/pat-tuple-overfield.rs:22:9
+ |
+LL | S(1, 2, .., 3, 4) => {}
+ | ^^^^^^^^^^^^^^^^^ expected 3 fields, found 4
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0023, E0308.
+For more information about an error, try `rustc --explain E0023`.
diff --git a/src/test/compile-fail/patkind-litrange-no-expr.rs b/src/test/ui/pattern/patkind-litrange-no-expr.rs
similarity index 100%
rename from src/test/compile-fail/patkind-litrange-no-expr.rs
rename to src/test/ui/pattern/patkind-litrange-no-expr.rs
diff --git a/src/test/ui/pattern/patkind-litrange-no-expr.stderr b/src/test/ui/pattern/patkind-litrange-no-expr.stderr
new file mode 100644
index 0000000..f22870f
--- /dev/null
+++ b/src/test/ui/pattern/patkind-litrange-no-expr.stderr
@@ -0,0 +1,18 @@
+error: arbitrary expressions aren't allowed in patterns
+ --> $DIR/patkind-litrange-no-expr.rs:30:13
+ |
+LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns
+ | ^^^^^
+
+error[E0029]: only char and numeric types are allowed in range patterns
+ --> $DIR/patkind-litrange-no-expr.rs:30:13
+ |
+LL | Arith = 1 + 1, //~ ERROR arbitrary expressions aren't allowed in patterns
+ | ^^^^^ ranges require char or numeric types
+ |
+ = note: start type: {integer}
+ = note: end type: {integer}
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0029`.
diff --git a/src/test/compile-fail/pattern-binding-disambiguation.rs b/src/test/ui/pattern/pattern-binding-disambiguation.rs
similarity index 100%
rename from src/test/compile-fail/pattern-binding-disambiguation.rs
rename to src/test/ui/pattern/pattern-binding-disambiguation.rs
diff --git a/src/test/ui/pattern/pattern-binding-disambiguation.stderr b/src/test/ui/pattern/pattern-binding-disambiguation.stderr
new file mode 100644
index 0000000..7acdb07
--- /dev/null
+++ b/src/test/ui/pattern/pattern-binding-disambiguation.stderr
@@ -0,0 +1,75 @@
+error[E0530]: match bindings cannot shadow tuple structs
+ --> $DIR/pattern-binding-disambiguation.rs:34:9
+ |
+LL | struct TupleStruct();
+ | --------------------- a tuple struct `TupleStruct` is defined here
+...
+LL | TupleStruct => {} //~ ERROR match bindings cannot shadow tuple structs
+ | ^^^^^^^^^^^ cannot be named the same as a tuple struct
+
+error[E0530]: match bindings cannot shadow tuple variants
+ --> $DIR/pattern-binding-disambiguation.rs:43:9
+ |
+LL | use E::*;
+ | ---- a tuple variant `TupleVariant` is imported here
+...
+LL | TupleVariant => {} //~ ERROR match bindings cannot shadow tuple variants
+ | ^^^^^^^^^^^^ cannot be named the same as a tuple variant
+
+error[E0530]: match bindings cannot shadow struct variants
+ --> $DIR/pattern-binding-disambiguation.rs:46:9
+ |
+LL | use E::*;
+ | ---- a struct variant `BracedVariant` is imported here
+...
+LL | BracedVariant => {} //~ ERROR match bindings cannot shadow struct variants
+ | ^^^^^^^^^^^^^ cannot be named the same as a struct variant
+
+error[E0530]: match bindings cannot shadow statics
+ --> $DIR/pattern-binding-disambiguation.rs:52:9
+ |
+LL | static STATIC: () = ();
+ | ----------------------- a static `STATIC` is defined here
+...
+LL | STATIC => {} //~ ERROR match bindings cannot shadow statics
+ | ^^^^^^ cannot be named the same as a static
+
+error[E0530]: let bindings cannot shadow tuple structs
+ --> $DIR/pattern-binding-disambiguation.rs:59:9
+ |
+LL | struct TupleStruct();
+ | --------------------- a tuple struct `TupleStruct` is defined here
+...
+LL | let TupleStruct = doesnt_matter; //~ ERROR let bindings cannot shadow tuple structs
+ | ^^^^^^^^^^^ cannot be named the same as a tuple struct
+
+error[E0530]: let bindings cannot shadow tuple variants
+ --> $DIR/pattern-binding-disambiguation.rs:62:9
+ |
+LL | use E::*;
+ | ---- a tuple variant `TupleVariant` is imported here
+...
+LL | let TupleVariant = doesnt_matter; //~ ERROR let bindings cannot shadow tuple variants
+ | ^^^^^^^^^^^^ cannot be named the same as a tuple variant
+
+error[E0530]: let bindings cannot shadow struct variants
+ --> $DIR/pattern-binding-disambiguation.rs:63:9
+ |
+LL | use E::*;
+ | ---- a struct variant `BracedVariant` is imported here
+...
+LL | let BracedVariant = doesnt_matter; //~ ERROR let bindings cannot shadow struct variants
+ | ^^^^^^^^^^^^^ cannot be named the same as a struct variant
+
+error[E0530]: let bindings cannot shadow statics
+ --> $DIR/pattern-binding-disambiguation.rs:65:9
+ |
+LL | static STATIC: () = ();
+ | ----------------------- a static `STATIC` is defined here
+...
+LL | let STATIC = doesnt_matter; //~ ERROR let bindings cannot shadow statics
+ | ^^^^^^ cannot be named the same as a static
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0530`.
diff --git a/src/test/compile-fail/pattern-bindings-after-at.rs b/src/test/ui/pattern/pattern-bindings-after-at.rs
similarity index 100%
rename from src/test/compile-fail/pattern-bindings-after-at.rs
rename to src/test/ui/pattern/pattern-bindings-after-at.rs
diff --git a/src/test/ui/pattern/pattern-bindings-after-at.stderr b/src/test/ui/pattern/pattern-bindings-after-at.stderr
new file mode 100644
index 0000000..8c71500
--- /dev/null
+++ b/src/test/ui/pattern/pattern-bindings-after-at.stderr
@@ -0,0 +1,9 @@
+error[E0303]: pattern bindings are not allowed after an `@`
+ --> $DIR/pattern-bindings-after-at.rs:18:31
+ |
+LL | ref mut z @ &mut Some(ref a) => {
+ | ^^^^^ not allowed after `@`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0303`.
diff --git a/src/test/compile-fail/pattern-error-continue.rs b/src/test/ui/pattern/pattern-error-continue.rs
similarity index 100%
rename from src/test/compile-fail/pattern-error-continue.rs
rename to src/test/ui/pattern/pattern-error-continue.rs
diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr
new file mode 100644
index 0000000..b24366c
--- /dev/null
+++ b/src/test/ui/pattern/pattern-error-continue.stderr
@@ -0,0 +1,39 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `E`
+ --> $DIR/pattern-error-continue.rs:45:9
+ |
+LL | E::V => {} //~ ERROR failed to resolve. Use of undeclared type or module `E`
+ | ^ Use of undeclared type or module `E`
+
+error[E0532]: expected tuple struct/variant, found unit variant `A::D`
+ --> $DIR/pattern-error-continue.rs:28:9
+ |
+LL | A::D(_) => (), //~ ERROR expected tuple struct/variant, found unit variant `A::D`
+ | ^^^-
+ | |
+ | did you mean `B`?
+
+error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 2 fields
+ --> $DIR/pattern-error-continue.rs:27:9
+ |
+LL | A::B(_, _, _) => (), //~ ERROR this pattern has 3 fields, but
+ | ^^^^^^^^^^^^^ expected 2 fields, found 3
+
+error[E0308]: mismatched types
+ --> $DIR/pattern-error-continue.rs:32:9
+ |
+LL | S { .. } => (),
+ | ^^^^^^^^ expected char, found struct `S`
+ |
+ = note: expected type `char`
+ found type `S`
+
+error[E0308]: mismatched types
+ --> $DIR/pattern-error-continue.rs:40:7
+ |
+LL | f(true);
+ | ^^^^ expected char, found bool
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0023, E0308, E0433, E0532.
+For more information about an error, try `rustc --explain E0023`.
diff --git a/src/test/compile-fail/pattern-ident-path-generics.rs b/src/test/ui/pattern/pattern-ident-path-generics.rs
similarity index 100%
rename from src/test/compile-fail/pattern-ident-path-generics.rs
rename to src/test/ui/pattern/pattern-ident-path-generics.rs
diff --git a/src/test/ui/pattern/pattern-ident-path-generics.stderr b/src/test/ui/pattern/pattern-ident-path-generics.stderr
new file mode 100644
index 0000000..cd20595
--- /dev/null
+++ b/src/test/ui/pattern/pattern-ident-path-generics.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/pattern-ident-path-generics.rs:13:9
+ |
+LL | None::<isize> => {} //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^ expected &str, found isize
+ |
+ = note: expected type `std::option::Option<&str>`
+ found type `std::option::Option<isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/pattern-tyvar-2.rs b/src/test/ui/pattern/pattern-tyvar-2.rs
similarity index 100%
rename from src/test/compile-fail/pattern-tyvar-2.rs
rename to src/test/ui/pattern/pattern-tyvar-2.rs
diff --git a/src/test/ui/pattern/pattern-tyvar-2.stderr b/src/test/ui/pattern/pattern-tyvar-2.stderr
new file mode 100644
index 0000000..fd7ab84
--- /dev/null
+++ b/src/test/ui/pattern/pattern-tyvar-2.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `*` cannot be applied to type `std::vec::Vec<isize>`
+ --> $DIR/pattern-tyvar-2.rs:14:69
+ |
+LL | fn foo(t: bar) -> isize { match t { bar::t1(_, Some(x)) => { return x * 3; } _ => { panic!(); } } }
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Mul` might be missing for `std::vec::Vec<isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/pattern-tyvar.rs b/src/test/ui/pattern/pattern-tyvar.rs
similarity index 100%
rename from src/test/compile-fail/pattern-tyvar.rs
rename to src/test/ui/pattern/pattern-tyvar.rs
diff --git a/src/test/ui/pattern/pattern-tyvar.stderr b/src/test/ui/pattern/pattern-tyvar.stderr
new file mode 100644
index 0000000..55e09e0
--- /dev/null
+++ b/src/test/ui/pattern/pattern-tyvar.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/pattern-tyvar.rs:17:18
+ |
+LL | bar::t1(_, Some::<isize>(x)) => {
+ | ^^^^^^^^^^^^^^^^ expected struct `std::vec::Vec`, found isize
+ |
+ = note: expected type `std::option::Option<std::vec::Vec<isize>>`
+ found type `std::option::Option<isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/phantom-oibit.rs b/src/test/ui/phantom-oibit.rs
similarity index 100%
rename from src/test/compile-fail/phantom-oibit.rs
rename to src/test/ui/phantom-oibit.rs
diff --git a/src/test/ui/phantom-oibit.stderr b/src/test/ui/phantom-oibit.stderr
new file mode 100644
index 0000000..5156ba9
--- /dev/null
+++ b/src/test/ui/phantom-oibit.stderr
@@ -0,0 +1,38 @@
+error[E0277]: `T` cannot be shared between threads safely
+ --> $DIR/phantom-oibit.rs:31:5
+ |
+LL | is_zen(x)
+ | ^^^^^^ `T` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Sync` bound
+ = note: required because of the requirements on the impl of `Zen` for `&T`
+ = note: required because it appears within the type `std::marker::PhantomData<&T>`
+ = note: required because it appears within the type `Guard<'_, T>`
+note: required by `is_zen`
+ --> $DIR/phantom-oibit.rs:28:1
+ |
+LL | fn is_zen<T: Zen>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `T` cannot be shared between threads safely
+ --> $DIR/phantom-oibit.rs:36:5
+ |
+LL | is_zen(x)
+ | ^^^^^^ `T` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Sync` bound
+ = note: required because of the requirements on the impl of `Zen` for `&T`
+ = note: required because it appears within the type `std::marker::PhantomData<&T>`
+ = note: required because it appears within the type `Guard<'_, T>`
+ = note: required because it appears within the type `Nested<Guard<'_, T>>`
+note: required by `is_zen`
+ --> $DIR/phantom-oibit.rs:28:1
+ |
+LL | fn is_zen<T: Zen>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/platform-intrinsic-params.rs b/src/test/ui/platform-intrinsic-params.rs
similarity index 100%
rename from src/test/compile-fail/platform-intrinsic-params.rs
rename to src/test/ui/platform-intrinsic-params.rs
diff --git a/src/test/ui/platform-intrinsic-params.stderr b/src/test/ui/platform-intrinsic-params.stderr
new file mode 100644
index 0000000..e41de9f
--- /dev/null
+++ b/src/test/ui/platform-intrinsic-params.stderr
@@ -0,0 +1,9 @@
+error[E0444]: platform-specific intrinsic has invalid number of arguments: found 0, expected 1
+ --> $DIR/platform-intrinsic-params.rs:13:5
+ |
+LL | fn x86_mm_movemask_ps() -> i32; //~ERROR found 0, expected 1
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0444`.
diff --git a/src/test/compile-fail/pptypedef.rs b/src/test/ui/pptypedef.rs
similarity index 100%
rename from src/test/compile-fail/pptypedef.rs
rename to src/test/ui/pptypedef.rs
diff --git a/src/test/ui/pptypedef.stderr b/src/test/ui/pptypedef.stderr
new file mode 100644
index 0000000..bde48d8
--- /dev/null
+++ b/src/test/ui/pptypedef.stderr
@@ -0,0 +1,15 @@
+error[E0308]: mismatched types
+ --> $DIR/pptypedef.rs:14:37
+ |
+LL | let_in(3u32, |i| { assert!(i == 3i32); });
+ | ^^^^ expected u32, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/pptypedef.rs:18:37
+ |
+LL | let_in(3i32, |i| { assert!(i == 3u32); });
+ | ^^^^ expected i32, found u32
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/prim-with-args.rs b/src/test/ui/prim-with-args.rs
similarity index 100%
rename from src/test/compile-fail/prim-with-args.rs
rename to src/test/ui/prim-with-args.rs
diff --git a/src/test/ui/prim-with-args.stderr b/src/test/ui/prim-with-args.stderr
new file mode 100644
index 0000000..bfe7256
--- /dev/null
+++ b/src/test/ui/prim-with-args.stderr
@@ -0,0 +1,136 @@
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:13:14
+ |
+LL | let x: isize<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:14:11
+ |
+LL | let x: i8<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:15:12
+ |
+LL | let x: i16<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:16:12
+ |
+LL | let x: i32<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:17:12
+ |
+LL | let x: i64<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:18:14
+ |
+LL | let x: usize<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:19:11
+ |
+LL | let x: u8<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:20:12
+ |
+LL | let x: u16<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:21:12
+ |
+LL | let x: u32<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:22:12
+ |
+LL | let x: u64<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:23:13
+ |
+LL | let x: char<isize>; //~ ERROR type parameters are not allowed on this type
+ | ^^^^^ type parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:25:14
+ |
+LL | let x: isize<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:26:11
+ |
+LL | let x: i8<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:27:12
+ |
+LL | let x: i16<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:28:12
+ |
+LL | let x: i32<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:29:12
+ |
+LL | let x: i64<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:30:14
+ |
+LL | let x: usize<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:31:11
+ |
+LL | let x: u8<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:32:12
+ |
+LL | let x: u16<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:33:12
+ |
+LL | let x: u32<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:34:12
+ |
+LL | let x: u64<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error[E0110]: lifetime parameters are not allowed on this type
+ --> $DIR/prim-with-args.rs:35:13
+ |
+LL | let x: char<'static>; //~ ERROR lifetime parameters are not allowed on this type
+ | ^^^^^^^ lifetime parameter not allowed
+
+error: aborting due to 22 previous errors
+
+Some errors occurred: E0109, E0110.
+For more information about an error, try `rustc --explain E0109`.
diff --git a/src/test/compile-fail/priv-in-bad-locations.rs b/src/test/ui/priv-in-bad-locations.rs
similarity index 100%
rename from src/test/compile-fail/priv-in-bad-locations.rs
rename to src/test/ui/priv-in-bad-locations.rs
diff --git a/src/test/ui/priv-in-bad-locations.stderr b/src/test/ui/priv-in-bad-locations.stderr
new file mode 100644
index 0000000..e395a22
--- /dev/null
+++ b/src/test/ui/priv-in-bad-locations.stderr
@@ -0,0 +1,31 @@
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/priv-in-bad-locations.rs:11:1
+ |
+LL | pub extern { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual foreign items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/priv-in-bad-locations.rs:21:1
+ |
+LL | pub impl B {} //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual impl items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/priv-in-bad-locations.rs:23:1
+ |
+LL | pub impl A for B { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/priv-in-bad-locations.rs:24:5
+ |
+LL | pub fn foo(&self) {} //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/src/test/compile-fail/privacy/associated-item-privacy-inherent.rs b/src/test/ui/privacy/associated-item-privacy-inherent.rs
similarity index 100%
rename from src/test/compile-fail/privacy/associated-item-privacy-inherent.rs
rename to src/test/ui/privacy/associated-item-privacy-inherent.rs
diff --git a/src/test/ui/privacy/associated-item-privacy-inherent.stderr b/src/test/ui/privacy/associated-item-privacy-inherent.stderr
new file mode 100644
index 0000000..391e5bb
--- /dev/null
+++ b/src/test/ui/privacy/associated-item-privacy-inherent.stderr
@@ -0,0 +1,191 @@
+error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+ --> $DIR/associated-item-privacy-inherent.rs:23:21
+ |
+LL | let value = Pub::method;
+ | ^^^^^^^^^^^
+...
+LL | priv_nominal::mac!();
+ | --------------------- in this macro invocation
+
+error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+ --> $DIR/associated-item-privacy-inherent.rs:25:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_nominal::mac!();
+ | --------------------- in this macro invocation
+
+error: type `for<'r> fn(&'r priv_nominal::Pub) {priv_nominal::Pub::method}` is private
+ --> $DIR/associated-item-privacy-inherent.rs:27:13
+ |
+LL | Pub.method();
+ | ^^^^^^
+...
+LL | priv_nominal::mac!();
+ | --------------------- in this macro invocation
+
+error: associated constant `CONST` is private
+ --> $DIR/associated-item-privacy-inherent.rs:29:9
+ |
+LL | Pub::CONST;
+ | ^^^^^^^^^^
+...
+LL | priv_nominal::mac!();
+ | --------------------- in this macro invocation
+
+error: type `priv_signature::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:47:21
+ |
+LL | let value = Pub::method;
+ | ^^^^^^^^^^^
+...
+LL | priv_signature::mac!();
+ | ----------------------- in this macro invocation
+
+error: type `priv_signature::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:49:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_signature::mac!();
+ | ----------------------- in this macro invocation
+
+error: type `priv_signature::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:51:13
+ |
+LL | Pub.method(loop {});
+ | ^^^^^^
+...
+LL | priv_signature::mac!();
+ | ----------------------- in this macro invocation
+
+error: type `priv_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:67:21
+ |
+LL | let value = Pub::method::<Priv>;
+ | ^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_substs::mac!();
+ | -------------------- in this macro invocation
+
+error: type `priv_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:69:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_substs::mac!();
+ | -------------------- in this macro invocation
+
+error: type `priv_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:71:9
+ |
+LL | Pub.method::<Priv>();
+ | ^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_substs::mac!();
+ | -------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:90:21
+ |
+LL | let value = <Pub>::method;
+ | ^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:92:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:94:21
+ |
+LL | let value = Pub::method;
+ | ^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:96:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:98:21
+ |
+LL | let value = <Pub>::static_method;
+ | ^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:100:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:102:21
+ |
+LL | let value = Pub::static_method;
+ | ^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:104:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:106:19
+ |
+LL | Pub(Priv).method();
+ | ^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:109:10
+ |
+LL | <Pub>::CONST;
+ | ^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-inherent.rs:111:9
+ |
+LL | Pub::CONST;
+ | ^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: aborting due to 21 previous errors
+
diff --git a/src/test/compile-fail/privacy/associated-item-privacy-trait.rs b/src/test/ui/privacy/associated-item-privacy-trait.rs
similarity index 100%
rename from src/test/compile-fail/privacy/associated-item-privacy-trait.rs
rename to src/test/ui/privacy/associated-item-privacy-trait.rs
diff --git a/src/test/ui/privacy/associated-item-privacy-trait.stderr b/src/test/ui/privacy/associated-item-privacy-trait.stderr
new file mode 100644
index 0000000..5aac273
--- /dev/null
+++ b/src/test/ui/privacy/associated-item-privacy-trait.stderr
@@ -0,0 +1,317 @@
+error: type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as priv_trait::PrivTr>::method}` is private
+ --> $DIR/associated-item-privacy-trait.rs:27:21
+ |
+LL | let value = <Pub as PrivTr>::method;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: type `for<'r> fn(&'r priv_trait::Pub) {<priv_trait::Pub as priv_trait::PrivTr>::method}` is private
+ --> $DIR/associated-item-privacy-trait.rs:29:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: type `for<'r> fn(&'r Self) {<Self as priv_trait::PrivTr>::method}` is private
+ --> $DIR/associated-item-privacy-trait.rs:31:13
+ |
+LL | Pub.method();
+ | ^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: associated constant `PrivTr::CONST` is private
+ --> $DIR/associated-item-privacy-trait.rs:33:9
+ |
+LL | <Pub as PrivTr>::CONST;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-trait.rs:35:13
+ |
+LL | let _: <Pub as PrivTr>::AssocTy;
+ | ^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-trait.rs:35:16
+ |
+LL | let _: <Pub as PrivTr>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-trait.rs:38:34
+ |
+LL | pub type InSignatureTy = <Pub as PrivTr>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-trait.rs:40:34
+ |
+LL | pub trait InSignatureTr: PrivTr {}
+ | ^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-trait.rs:42:14
+ |
+LL | impl PrivTr for u8 {}
+ | ^^^^^^
+...
+LL | priv_trait::mac!();
+ | ------------------- in this macro invocation
+
+error: type `priv_signature::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:59:21
+ |
+LL | let value = <Pub as PubTr>::method;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_signature::mac!();
+ | ----------------------- in this macro invocation
+
+error: type `priv_signature::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:61:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_signature::mac!();
+ | ----------------------- in this macro invocation
+
+error: type `priv_signature::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:63:13
+ |
+LL | Pub.method(loop {});
+ | ^^^^^^
+...
+LL | priv_signature::mac!();
+ | ----------------------- in this macro invocation
+
+error: type `priv_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:80:21
+ |
+LL | let value = <Pub as PubTr>::method::<Priv>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_substs::mac!();
+ | -------------------- in this macro invocation
+
+error: type `priv_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:82:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_substs::mac!();
+ | -------------------- in this macro invocation
+
+error: type `priv_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:84:9
+ |
+LL | Pub.method::<Priv>();
+ | ^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_substs::mac!();
+ | -------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:104:21
+ |
+LL | let value = <Pub as PubTr>::method;
+ | ^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:106:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:108:21
+ |
+LL | let value = <Pub as PubTr<_>>::method;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:110:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:112:9
+ |
+LL | Pub.method();
+ | ^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:115:21
+ |
+LL | let value = <Priv as PubTr<_>>::method;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:117:9
+ |
+LL | value;
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:119:9
+ |
+LL | Priv.method();
+ | ^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:122:9
+ |
+LL | <Pub as PubTr>::CONST;
+ | ^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:124:9
+ |
+LL | <Pub as PubTr<_>>::CONST;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:126:9
+ |
+LL | <Priv as PubTr<_>>::CONST;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:129:13
+ |
+LL | let _: <Pub as PubTr>::AssocTy;
+ | ^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:129:16
+ |
+LL | let _: <Pub as PubTr>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:132:13
+ |
+LL | let _: <Pub as PubTr<_>>::AssocTy;
+ | ^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:132:16
+ |
+LL | let _: <Pub as PubTr<_>>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:135:13
+ |
+LL | let _: <Priv as PubTr<_>>::AssocTy;
+ | ^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:135:16
+ |
+LL | let _: <Priv as PubTr<_>>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:139:35
+ |
+LL | pub type InSignatureTy1 = <Pub as PubTr>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:141:35
+ |
+LL | pub type InSignatureTy2 = <Priv as PubTr<Pub>>::AssocTy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-trait.rs:143:14
+ |
+LL | impl PubTr for u8 {}
+ | ^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: aborting due to 35 previous errors
+
diff --git a/src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs b/src/test/ui/privacy/associated-item-privacy-type-binding.rs
similarity index 100%
rename from src/test/compile-fail/privacy/associated-item-privacy-type-binding.rs
rename to src/test/ui/privacy/associated-item-privacy-type-binding.rs
diff --git a/src/test/ui/privacy/associated-item-privacy-type-binding.stderr b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr
new file mode 100644
index 0000000..e762dc6
--- /dev/null
+++ b/src/test/ui/privacy/associated-item-privacy-type-binding.stderr
@@ -0,0 +1,146 @@
+error: type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:21:13
+ |
+LL | let _: Box<PubTr<AssocTy = u8>>;
+ | ^
+...
+LL | priv_trait::mac1!();
+ | -------------------- in this macro invocation
+
+error: type `(dyn priv_trait::PubTr<AssocTy=u8> + '<empty>)` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:21:16
+ |
+LL | let _: Box<PubTr<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac1!();
+ | -------------------- in this macro invocation
+
+error: type `(dyn priv_trait::PubTr<AssocTy=u8> + 'static)` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:24:31
+ |
+LL | type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac1!();
+ | -------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:26:31
+ |
+LL | trait InSignatureTr2: PubTr<AssocTy = u8> {}
+ | ^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac1!();
+ | -------------------- in this macro invocation
+
+error: type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:30:13
+ |
+LL | let _: Box<PrivTr<AssocTy = u8>>;
+ | ^
+...
+LL | priv_trait::mac2!();
+ | -------------------- in this macro invocation
+
+error: type `(dyn priv_trait::PrivTr<AssocTy=u8> + '<empty>)` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:30:16
+ |
+LL | let _: Box<PrivTr<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac2!();
+ | -------------------- in this macro invocation
+
+error: type `(dyn priv_trait::PrivTr<AssocTy=u8> + 'static)` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:33:31
+ |
+LL | type InSignatureTy1 = Box<PrivTr<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac2!();
+ | -------------------- in this macro invocation
+
+error: trait `priv_trait::PrivTr` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:35:31
+ |
+LL | trait InSignatureTr1: PrivTr<AssocTy = u8> {}
+ | ^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_trait::mac2!();
+ | -------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:54:13
+ |
+LL | let _: Box<PubTrWithParam<AssocTy = u8>>;
+ | ^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:54:16
+ |
+LL | let _: Box<PubTrWithParam<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:57:13
+ |
+LL | let _: Box<PubTr<AssocTy = u8>>;
+ | ^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:57:16
+ |
+LL | let _: Box<PubTr<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:60:35
+ |
+LL | pub type InSignatureTy1 = Box<PubTrWithParam<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:62:35
+ |
+LL | pub type InSignatureTy2 = Box<PubTr<AssocTy = u8>>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:64:31
+ |
+LL | trait InSignatureTr1: PubTrWithParam<AssocTy = u8> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: type `priv_parent_substs::Priv` is private
+ --> $DIR/associated-item-privacy-type-binding.rs:66:31
+ |
+LL | trait InSignatureTr2: PubTr<AssocTy = u8> {}
+ | ^^^^^^^^^^^^^^^^^^^
+...
+LL | priv_parent_substs::mac!();
+ | --------------------------- in this macro invocation
+
+error: aborting due to 16 previous errors
+
diff --git a/src/test/compile-fail/auxiliary/cci_class.rs b/src/test/ui/privacy/auxiliary/cci_class.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/cci_class.rs
rename to src/test/ui/privacy/auxiliary/cci_class.rs
diff --git a/src/test/compile-fail/auxiliary/cci_class_5.rs b/src/test/ui/privacy/auxiliary/cci_class_5.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/cci_class_5.rs
rename to src/test/ui/privacy/auxiliary/cci_class_5.rs
diff --git a/src/test/compile-fail/auxiliary/privacy_tuple_struct.rs b/src/test/ui/privacy/auxiliary/privacy_tuple_struct.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/privacy_tuple_struct.rs
rename to src/test/ui/privacy/auxiliary/privacy_tuple_struct.rs
diff --git a/src/test/compile-fail/auxiliary/private-inferred-type.rs b/src/test/ui/privacy/auxiliary/private-inferred-type.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/private-inferred-type.rs
rename to src/test/ui/privacy/auxiliary/private-inferred-type.rs
diff --git a/src/test/compile-fail/privacy/legacy-ctor-visibility.rs b/src/test/ui/privacy/legacy-ctor-visibility.rs
similarity index 100%
rename from src/test/compile-fail/privacy/legacy-ctor-visibility.rs
rename to src/test/ui/privacy/legacy-ctor-visibility.rs
diff --git a/src/test/ui/privacy/legacy-ctor-visibility.stderr b/src/test/ui/privacy/legacy-ctor-visibility.stderr
new file mode 100644
index 0000000..7652d65
--- /dev/null
+++ b/src/test/ui/privacy/legacy-ctor-visibility.stderr
@@ -0,0 +1,12 @@
+error: private struct constructors are not usable through re-exports in outer modules
+ --> $DIR/legacy-ctor-visibility.rs:23:13
+ |
+LL | S(10);
+ | ^
+ |
+ = note: #[deny(legacy_constructor_visibility)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #39207 <https://github.com/rust-lang/rust/issues/39207>
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/privacy-in-paths.rs b/src/test/ui/privacy/privacy-in-paths.rs
similarity index 100%
rename from src/test/compile-fail/privacy-in-paths.rs
rename to src/test/ui/privacy/privacy-in-paths.rs
diff --git a/src/test/ui/privacy/privacy-in-paths.stderr b/src/test/ui/privacy/privacy-in-paths.stderr
new file mode 100644
index 0000000..f0aa3d3
--- /dev/null
+++ b/src/test/ui/privacy/privacy-in-paths.stderr
@@ -0,0 +1,21 @@
+error[E0603]: module `bar` is private
+ --> $DIR/privacy-in-paths.rs:34:9
+ |
+LL | ::foo::bar::baz::f(); //~ERROR module `bar` is private
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `bar` is private
+ --> $DIR/privacy-in-paths.rs:35:9
+ |
+LL | ::foo::bar::S::f(); //~ERROR module `bar` is private
+ | ^^^^^^^^^^^^^^^^
+
+error[E0603]: trait `T` is private
+ --> $DIR/privacy-in-paths.rs:36:9
+ |
+LL | <() as ::foo::T>::Assoc::f(); //~ERROR trait `T` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/privacy-ns1.rs b/src/test/ui/privacy/privacy-ns1.rs
similarity index 100%
rename from src/test/compile-fail/privacy-ns1.rs
rename to src/test/ui/privacy/privacy-ns1.rs
diff --git a/src/test/ui/privacy/privacy-ns1.stderr b/src/test/ui/privacy/privacy-ns1.stderr
new file mode 100644
index 0000000..503cfbf
--- /dev/null
+++ b/src/test/ui/privacy/privacy-ns1.stderr
@@ -0,0 +1,60 @@
+error[E0423]: expected function, found trait `Bar`
+ --> $DIR/privacy-ns1.rs:30:5
+ |
+LL | Bar(); //~ ERROR expected function, found trait `Bar`
+ | ^^^ did you mean `Baz`?
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0573]: expected type, found function `Bar`
+ --> $DIR/privacy-ns1.rs:45:17
+ |
+LL | let _x: Box<Bar>; //~ ERROR expected type, found function `Bar`
+ | ^^^ did you mean `Baz`?
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0425]: cannot find function `Bar` in this scope
+ --> $DIR/privacy-ns1.rs:60:5
+ |
+LL | Bar(); //~ ERROR cannot find function `Bar` in this scope
+ | ^^^ did you mean `Baz`?
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0412]: cannot find type `Bar` in this scope
+ --> $DIR/privacy-ns1.rs:61:17
+ |
+LL | let _x: Box<Bar>; //~ ERROR cannot find type `Bar` in this scope
+ | ^^^ did you mean `Baz`?
+help: possible candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0412, E0423, E0425, E0573.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/compile-fail/privacy-ns2.rs b/src/test/ui/privacy/privacy-ns2.rs
similarity index 100%
rename from src/test/compile-fail/privacy-ns2.rs
rename to src/test/ui/privacy/privacy-ns2.rs
diff --git a/src/test/ui/privacy/privacy-ns2.stderr b/src/test/ui/privacy/privacy-ns2.stderr
new file mode 100644
index 0000000..0cd341d
--- /dev/null
+++ b/src/test/ui/privacy/privacy-ns2.stderr
@@ -0,0 +1,78 @@
+error[E0423]: expected function, found trait `Bar`
+ --> $DIR/privacy-ns2.rs:30:5
+ |
+LL | Bar(); //~ ERROR expected function, found trait `Bar`
+ | ^^^ not a function
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0423]: expected function, found trait `Bar`
+ --> $DIR/privacy-ns2.rs:36:5
+ |
+LL | Bar(); //~ ERROR expected function, found trait `Bar`
+ | ^^^ did you mean `Baz`?
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0573]: expected type, found function `Bar`
+ --> $DIR/privacy-ns2.rs:51:18
+ |
+LL | let _x : Box<Bar>; //~ ERROR expected type, found function `Bar`
+ | ^^^ not a type
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0573]: expected type, found function `Bar`
+ --> $DIR/privacy-ns2.rs:57:17
+ |
+LL | let _x: Box<Bar>; //~ ERROR expected type, found function `Bar`
+ | ^^^ did you mean `Baz`?
+help: possible better candidates are found in other modules, you can import them into scope
+ |
+LL | use foo1::Bar;
+ |
+LL | use foo2::Bar;
+ |
+LL | use foo3::Bar;
+ |
+
+error[E0603]: trait `Bar` is private
+ --> $DIR/privacy-ns2.rs:70:9
+ |
+LL | use foo3::Bar; //~ ERROR `Bar` is private
+ | ^^^^^^^^^
+
+error[E0603]: trait `Bar` is private
+ --> $DIR/privacy-ns2.rs:74:9
+ |
+LL | use foo3::Bar; //~ ERROR `Bar` is private
+ | ^^^^^^^^^
+
+error[E0603]: trait `Bar` is private
+ --> $DIR/privacy-ns2.rs:81:16
+ |
+LL | use foo3::{Bar,Baz}; //~ ERROR `Bar` is private
+ | ^^^
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0423, E0573, E0603.
+For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/compile-fail/privacy-sanity.rs b/src/test/ui/privacy/privacy-sanity.rs
similarity index 100%
rename from src/test/compile-fail/privacy-sanity.rs
rename to src/test/ui/privacy/privacy-sanity.rs
diff --git a/src/test/ui/privacy/privacy-sanity.stderr b/src/test/ui/privacy/privacy-sanity.stderr
new file mode 100644
index 0000000..fbfa15f
--- /dev/null
+++ b/src/test/ui/privacy/privacy-sanity.stderr
@@ -0,0 +1,123 @@
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:23:1
+ |
+LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:24:5
+ |
+LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:25:5
+ |
+LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:26:5
+ |
+LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:28:1
+ |
+LL | pub impl S { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual impl items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:33:1
+ |
+LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual foreign items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:49:5
+ |
+LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:50:9
+ |
+LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:51:9
+ |
+LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:52:9
+ |
+LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:54:5
+ |
+LL | pub impl S { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual impl items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:59:5
+ |
+LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual foreign items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:78:5
+ |
+LL | pub impl Tr for S { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:79:9
+ |
+LL | pub fn f() {} //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:80:9
+ |
+LL | pub const C: u8 = 0; //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:81:9
+ |
+LL | pub type T = u8; //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:83:5
+ |
+LL | pub impl S { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual impl items instead
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/privacy-sanity.rs:88:5
+ |
+LL | pub extern "C" { //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+ |
+ = note: place qualifiers on individual foreign items instead
+
+error: aborting due to 18 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/src/test/compile-fail/privacy-ufcs.rs b/src/test/ui/privacy/privacy-ufcs.rs
similarity index 100%
rename from src/test/compile-fail/privacy-ufcs.rs
rename to src/test/ui/privacy/privacy-ufcs.rs
diff --git a/src/test/ui/privacy/privacy-ufcs.stderr b/src/test/ui/privacy/privacy-ufcs.stderr
new file mode 100644
index 0000000..2030e2e
--- /dev/null
+++ b/src/test/ui/privacy/privacy-ufcs.stderr
@@ -0,0 +1,9 @@
+error[E0603]: trait `Bar` is private
+ --> $DIR/privacy-ufcs.rs:22:5
+ |
+LL | <i32 as ::foo::Bar>::baz(); //~ERROR trait `Bar` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/privacy1.rs b/src/test/ui/privacy/privacy1.rs
similarity index 100%
rename from src/test/compile-fail/privacy1.rs
rename to src/test/ui/privacy/privacy1.rs
diff --git a/src/test/ui/privacy/privacy1.stderr b/src/test/ui/privacy/privacy1.stderr
new file mode 100644
index 0000000..344f990
--- /dev/null
+++ b/src/test/ui/privacy/privacy1.stderr
@@ -0,0 +1,112 @@
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:128:24
+ |
+LL | use bar::baz::{foo, bar};
+ | ^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:128:29
+ |
+LL | use bar::baz::{foo, bar};
+ | ^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:137:13
+ |
+LL | use bar::baz;
+ | ^^^^^^^^
+
+error[E0603]: module `i` is private
+ --> $DIR/privacy1.rs:161:9
+ |
+LL | use self::foo::i::A; //~ ERROR: module `i` is private
+ | ^^^^^^^^^^^^^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:100:9
+ |
+LL | ::bar::baz::A::foo(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:101:9
+ |
+LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:103:9
+ |
+LL | ::bar::baz::A.foo2(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:104:9
+ |
+LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^
+
+error[E0603]: trait `B` is private
+ --> $DIR/privacy1.rs:108:9
+ |
+LL | ::bar::B::foo(); //~ ERROR: trait `B` is private
+ | ^^^^^^^^^^^^^
+
+error[E0603]: function `epriv` is private
+ --> $DIR/privacy1.rs:114:13
+ |
+LL | ::bar::epriv(); //~ ERROR: function `epriv` is private
+ | ^^^^^^^^^^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:123:9
+ |
+LL | ::bar::baz::foo(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^^^
+
+error[E0603]: module `baz` is private
+ --> $DIR/privacy1.rs:124:9
+ |
+LL | ::bar::baz::bar(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^^^
+
+error[E0603]: trait `B` is private
+ --> $DIR/privacy1.rs:153:10
+ |
+LL | impl ::bar::B for f32 { fn foo() -> f32 { 1.0 } }
+ | ^^^^^^^^
+
+error[E0624]: method `bar` is private
+ --> $DIR/privacy1.rs:73:9
+ |
+LL | self::baz::A::bar(); //~ ERROR: method `bar` is private
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0624]: method `bar` is private
+ --> $DIR/privacy1.rs:91:5
+ |
+LL | bar::A::bar(); //~ ERROR: method `bar` is private
+ | ^^^^^^^^^^^
+
+error[E0624]: method `bar` is private
+ --> $DIR/privacy1.rs:98:9
+ |
+LL | ::bar::A::bar(); //~ ERROR: method `bar` is private
+ | ^^^^^^^^^^^^^
+
+error[E0624]: method `bar` is private
+ --> $DIR/privacy1.rs:101:9
+ |
+LL | ::bar::baz::A::bar(); //~ ERROR: module `baz` is private
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0624]: method `bar2` is private
+ --> $DIR/privacy1.rs:104:23
+ |
+LL | ::bar::baz::A.bar2(); //~ ERROR: module `baz` is private
+ | ^^^^
+
+error: aborting due to 18 previous errors
+
+Some errors occurred: E0603, E0624.
+For more information about an error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/privacy2.rs b/src/test/ui/privacy/privacy2.rs
similarity index 100%
rename from src/test/compile-fail/privacy2.rs
rename to src/test/ui/privacy/privacy2.rs
diff --git a/src/test/ui/privacy/privacy2.stderr b/src/test/ui/privacy/privacy2.stderr
new file mode 100644
index 0000000..ec5567b
--- /dev/null
+++ b/src/test/ui/privacy/privacy2.stderr
@@ -0,0 +1,18 @@
+error[E0432]: unresolved import `bar::foo`
+ --> $DIR/privacy2.rs:27:9
+ |
+LL | use bar::foo;
+ | ^^^^^^^^ no `foo` in `bar`
+
+error[E0603]: function `foo` is private
+ --> $DIR/privacy2.rs:33:9
+ |
+LL | use bar::glob::foo;
+ | ^^^^^^^^^^^^^^
+
+error: requires `sized` lang_item
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0432, E0603.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/privacy3.rs b/src/test/ui/privacy/privacy3.rs
similarity index 100%
rename from src/test/compile-fail/privacy3.rs
rename to src/test/ui/privacy/privacy3.rs
diff --git a/src/test/ui/privacy/privacy3.stderr b/src/test/ui/privacy/privacy3.stderr
new file mode 100644
index 0000000..11c7161
--- /dev/null
+++ b/src/test/ui/privacy/privacy3.stderr
@@ -0,0 +1,11 @@
+error[E0432]: unresolved import `bar::gpriv`
+ --> $DIR/privacy3.rs:28:9
+ |
+LL | use bar::gpriv;
+ | ^^^^^^^^^^ no `gpriv` in `bar`
+
+error: requires `sized` lang_item
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/privacy4.rs b/src/test/ui/privacy/privacy4.rs
similarity index 100%
rename from src/test/compile-fail/privacy4.rs
rename to src/test/ui/privacy/privacy4.rs
diff --git a/src/test/ui/privacy/privacy4.stderr b/src/test/ui/privacy/privacy4.stderr
new file mode 100644
index 0000000..811f5d5
--- /dev/null
+++ b/src/test/ui/privacy/privacy4.stderr
@@ -0,0 +1,9 @@
+error[E0603]: module `glob` is private
+ --> $DIR/privacy4.rs:31:9
+ |
+LL | use bar::glob::gpriv; //~ ERROR: module `glob` is private
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/privacy5.rs b/src/test/ui/privacy/privacy5.rs
similarity index 100%
rename from src/test/compile-fail/privacy5.rs
rename to src/test/ui/privacy/privacy5.rs
diff --git a/src/test/ui/privacy/privacy5.stderr b/src/test/ui/privacy/privacy5.stderr
new file mode 100644
index 0000000..bcb6315
--- /dev/null
+++ b/src/test/ui/privacy/privacy5.stderr
@@ -0,0 +1,291 @@
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:61:13
+ |
+LL | let a = a::A(()); //~ ERROR tuple struct `A` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:62:13
+ |
+LL | let b = a::B(2); //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:63:13
+ |
+LL | let c = a::C(2, 3); //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:66:9
+ |
+LL | let a::A(()) = a; //~ ERROR tuple struct `A` is private
+ | ^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:67:9
+ |
+LL | let a::A(_) = a; //~ ERROR tuple struct `A` is private
+ | ^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:68:15
+ |
+LL | match a { a::A(()) => {} } //~ ERROR tuple struct `A` is private
+ | ^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:69:15
+ |
+LL | match a { a::A(_) => {} } //~ ERROR tuple struct `A` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:71:9
+ |
+LL | let a::B(_) = b; //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:72:9
+ |
+LL | let a::B(_b) = b; //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:73:15
+ |
+LL | match b { a::B(_) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:74:15
+ |
+LL | match b { a::B(_b) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:75:15
+ |
+LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:75:29
+ |
+LL | match b { a::B(1) => {} a::B(_) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:78:9
+ |
+LL | let a::C(_, _) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:79:9
+ |
+LL | let a::C(_a, _) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:80:9
+ |
+LL | let a::C(_, _b) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:81:9
+ |
+LL | let a::C(_a, _b) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:82:15
+ |
+LL | match c { a::C(_, _) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:83:15
+ |
+LL | match c { a::C(_a, _) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:84:15
+ |
+LL | match c { a::C(_, _b) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:85:15
+ |
+LL | match c { a::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:93:14
+ |
+LL | let a2 = a::A; //~ ERROR tuple struct `A` is private
+ | ^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:94:14
+ |
+LL | let b2 = a::B; //~ ERROR tuple struct `B` is private
+ | ^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:95:14
+ |
+LL | let c2 = a::C; //~ ERROR tuple struct `C` is private
+ | ^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:100:13
+ |
+LL | let a = other::A(()); //~ ERROR tuple struct `A` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:101:13
+ |
+LL | let b = other::B(2); //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:102:13
+ |
+LL | let c = other::C(2, 3); //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:105:9
+ |
+LL | let other::A(()) = a; //~ ERROR tuple struct `A` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:106:9
+ |
+LL | let other::A(_) = a; //~ ERROR tuple struct `A` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:107:15
+ |
+LL | match a { other::A(()) => {} } //~ ERROR tuple struct `A` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:108:15
+ |
+LL | match a { other::A(_) => {} } //~ ERROR tuple struct `A` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:110:9
+ |
+LL | let other::B(_) = b; //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:111:9
+ |
+LL | let other::B(_b) = b; //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:112:15
+ |
+LL | match b { other::B(_) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:113:15
+ |
+LL | match b { other::B(_b) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:114:15
+ |
+LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:114:33
+ |
+LL | match b { other::B(1) => {} other::B(_) => {} } //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:117:9
+ |
+LL | let other::C(_, _) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:118:9
+ |
+LL | let other::C(_a, _) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:119:9
+ |
+LL | let other::C(_, _b) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:120:9
+ |
+LL | let other::C(_a, _b) = c; //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:121:15
+ |
+LL | match c { other::C(_, _) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:122:15
+ |
+LL | match c { other::C(_a, _) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:123:15
+ |
+LL | match c { other::C(_, _b) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:124:15
+ |
+LL | match c { other::C(_a, _b) => {} } //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `A` is private
+ --> $DIR/privacy5.rs:132:14
+ |
+LL | let a2 = other::A; //~ ERROR tuple struct `A` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `B` is private
+ --> $DIR/privacy5.rs:133:14
+ |
+LL | let b2 = other::B; //~ ERROR tuple struct `B` is private
+ | ^^^^^^^^
+
+error[E0603]: tuple struct `C` is private
+ --> $DIR/privacy5.rs:134:14
+ |
+LL | let c2 = other::C; //~ ERROR tuple struct `C` is private
+ | ^^^^^^^^
+
+error: aborting due to 48 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/private-impl-method.rs b/src/test/ui/privacy/private-impl-method.rs
similarity index 100%
rename from src/test/compile-fail/private-impl-method.rs
rename to src/test/ui/privacy/private-impl-method.rs
diff --git a/src/test/ui/privacy/private-impl-method.stderr b/src/test/ui/privacy/private-impl-method.stderr
new file mode 100644
index 0000000..0e36c70
--- /dev/null
+++ b/src/test/ui/privacy/private-impl-method.stderr
@@ -0,0 +1,9 @@
+error[E0624]: method `foo` is private
+ --> $DIR/private-impl-method.rs:30:7
+ |
+LL | s.foo(); //~ ERROR method `foo` is private
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/private-in-public-assoc-ty.rs b/src/test/ui/privacy/private-in-public-assoc-ty.rs
similarity index 100%
rename from src/test/compile-fail/private-in-public-assoc-ty.rs
rename to src/test/ui/privacy/private-in-public-assoc-ty.rs
diff --git a/src/test/ui/privacy/private-in-public-assoc-ty.stderr b/src/test/ui/privacy/private-in-public-assoc-ty.stderr
new file mode 100644
index 0000000..a95547b
--- /dev/null
+++ b/src/test/ui/privacy/private-in-public-assoc-ty.stderr
@@ -0,0 +1,52 @@
+warning: private trait `m::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-assoc-ty.rs:25:5
+ |
+LL | / pub trait PubTr {
+LL | | //~^ WARN private trait `m::PrivTr` in public interface
+LL | | //~| WARN this was previously accepted
+LL | | //~| WARN private type `m::Priv` in public interface
+... |
+LL | | //~^ ERROR private type `m::Priv` in public interface
+LL | | }
+ | |_____^
+ |
+ = note: #[warn(private_in_public)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+warning: private type `m::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-assoc-ty.rs:25:5
+ |
+LL | / pub trait PubTr {
+LL | | //~^ WARN private trait `m::PrivTr` in public interface
+LL | | //~| WARN this was previously accepted
+LL | | //~| WARN private type `m::Priv` in public interface
+... |
+LL | | //~^ ERROR private type `m::Priv` in public interface
+LL | | }
+ | |_____^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error[E0446]: private type `m::Priv` in public interface
+ --> $DIR/private-in-public-assoc-ty.rs:34:9
+ |
+LL | struct Priv;
+ | - `m::Priv` declared as private
+...
+LL | type Alias4 = Priv;
+ | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `m::Priv` in public interface
+ --> $DIR/private-in-public-assoc-ty.rs:38:9
+ |
+LL | struct Priv;
+ | - `m::Priv` declared as private
+...
+LL | type Alias1 = Priv;
+ | ^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0446`.
diff --git a/src/test/compile-fail/private-in-public-ill-formed.rs b/src/test/ui/privacy/private-in-public-ill-formed.rs
similarity index 100%
rename from src/test/compile-fail/private-in-public-ill-formed.rs
rename to src/test/ui/privacy/private-in-public-ill-formed.rs
diff --git a/src/test/ui/privacy/private-in-public-ill-formed.stderr b/src/test/ui/privacy/private-in-public-ill-formed.stderr
new file mode 100644
index 0000000..649f5fc
--- /dev/null
+++ b/src/test/ui/privacy/private-in-public-ill-formed.stderr
@@ -0,0 +1,19 @@
+error[E0118]: no base type found for inherent implementation
+ --> $DIR/private-in-public-ill-formed.rs:24:10
+ |
+LL | impl <Priv as PrivTr>::AssocAlias { //~ ERROR no base type found for inherent implementation
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type
+ |
+ = note: either implement a trait on it or create a newtype to wrap it instead
+
+error[E0118]: no base type found for inherent implementation
+ --> $DIR/private-in-public-ill-formed.rs:40:10
+ |
+LL | impl <Priv as PrivTr>::AssocAlias { //~ ERROR no base type found for inherent implementation
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl requires a base type
+ |
+ = note: either implement a trait on it or create a newtype to wrap it instead
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0118`.
diff --git a/src/test/compile-fail/private-in-public-lint.rs b/src/test/ui/privacy/private-in-public-lint.rs
similarity index 100%
rename from src/test/compile-fail/private-in-public-lint.rs
rename to src/test/ui/privacy/private-in-public-lint.rs
diff --git a/src/test/ui/privacy/private-in-public-lint.stderr b/src/test/ui/privacy/private-in-public-lint.stderr
new file mode 100644
index 0000000..202cb34
--- /dev/null
+++ b/src/test/ui/privacy/private-in-public-lint.stderr
@@ -0,0 +1,21 @@
+error[E0446]: private type `m1::Priv` in public interface
+ --> $DIR/private-in-public-lint.rs:16:9
+ |
+LL | struct Priv;
+ | - `m1::Priv` declared as private
+...
+LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m1::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `m2::Priv` in public interface
+ --> $DIR/private-in-public-lint.rs:25:9
+ |
+LL | struct Priv;
+ | - `m2::Priv` declared as private
+...
+LL | pub fn f() -> Priv {Priv} //~ ERROR private type `m2::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0446`.
diff --git a/src/test/compile-fail/private-in-public-warn.rs b/src/test/ui/privacy/private-in-public-warn.rs
similarity index 100%
rename from src/test/compile-fail/private-in-public-warn.rs
rename to src/test/ui/privacy/private-in-public-warn.rs
diff --git a/src/test/ui/privacy/private-in-public-warn.stderr b/src/test/ui/privacy/private-in-public-warn.stderr
new file mode 100644
index 0000000..04e743a
--- /dev/null
+++ b/src/test/ui/privacy/private-in-public-warn.stderr
@@ -0,0 +1,329 @@
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:25:5
+ |
+LL | pub type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/private-in-public-warn.rs:15:9
+ |
+LL | #![deny(private_in_public)]
+ | ^^^^^^^^^^^^^^^^^
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:28:12
+ |
+LL | V1(Priv), //~ ERROR private type `types::Priv` in public interface
+ | ^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:30:14
+ |
+LL | V2 { field: Priv }, //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:34:9
+ |
+LL | const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public-warn.rs:36:9
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:37:9
+ |
+LL | fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:39:9
+ |
+LL | fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:43:9
+ |
+LL | pub static ES: Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:45:9
+ |
+LL | pub fn ef1(arg: Priv); //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `types::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:47:9
+ |
+LL | pub fn ef2() -> Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public-warn.rs:51:9
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | type Alias = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:60:5
+ |
+LL | pub type Alias<T: PrivTr> = T; //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:62:5
+ |
+LL | pub trait Tr1: PrivTr {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:64:5
+ |
+LL | pub trait Tr2<T: PrivTr> {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:66:5
+ |
+LL | / pub trait Tr3 {
+LL | | //~^ ERROR private trait `traits::PrivTr` in public interface
+LL | | //~| WARNING hard error
+LL | | type Alias: PrivTr;
+LL | | fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
+LL | | //~^ WARNING hard error
+LL | | }
+ | |_____^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:70:9
+ |
+LL | fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:73:5
+ |
+LL | impl<T: PrivTr> Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:75:5
+ |
+LL | impl<T: PrivTr> PubTr for Pub<T> {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits_where::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:84:5
+ |
+LL | pub type Alias<T> where T: PrivTr = T;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits_where::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:87:5
+ |
+LL | pub trait Tr2<T> where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits_where::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:91:9
+ |
+LL | fn f<T>(arg: T) where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits_where::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:95:5
+ |
+LL | impl<T> Pub<T> where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `traits_where::PrivTr` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:98:5
+ |
+LL | impl<T> PubTr for Pub<T> where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `generics::PrivTr<generics::Pub>` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:109:5
+ |
+LL | pub trait Tr1: PrivTr<Pub> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `generics::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:112:5
+ |
+LL | pub trait Tr2: PubTr<Priv> {} //~ ERROR private type `generics::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `generics::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:114:5
+ |
+LL | pub trait Tr3: PubTr<[Priv; 1]> {} //~ ERROR private type `generics::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `generics::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:116:5
+ |
+LL | pub trait Tr4: PubTr<Pub<Priv>> {} //~ ERROR private type `generics::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error[E0446]: private type `impls::Priv` in public interface
+ --> $DIR/private-in-public-warn.rs:143:9
+ |
+LL | struct Priv;
+ | - `impls::Priv` declared as private
+...
+LL | type Alias = Priv; //~ ERROR private type `impls::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: private type `aliases_pub::Priv` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:214:9
+ |
+LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error[E0446]: private type `aliases_pub::Priv` in public interface
+ --> $DIR/private-in-public-warn.rs:218:9
+ |
+LL | struct Priv;
+ | - `aliases_pub::Priv` declared as private
+...
+LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_pub::Priv` in public interface
+ --> $DIR/private-in-public-warn.rs:221:9
+ |
+LL | struct Priv;
+ | - `aliases_pub::Priv` declared as private
+...
+LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_pub::Priv` in public interface
+ --> $DIR/private-in-public-warn.rs:224:9
+ |
+LL | struct Priv;
+ | - `aliases_pub::Priv` declared as private
+...
+LL | type Check = Priv; //~ ERROR private type `aliases_pub::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: private trait `aliases_priv::PrivTr1` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:248:5
+ |
+LL | pub trait Tr1: PrivUseAliasTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private type `aliases_priv::Priv2` in public interface (error E0446)
+ --> $DIR/private-in-public-warn.rs:251:5
+ |
+LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: private trait `aliases_priv::PrivTr1<aliases_priv::Priv2>` in public interface (error E0445)
+ --> $DIR/private-in-public-warn.rs:251:5
+ |
+LL | pub trait Tr2: PrivUseAliasTr<PrivAlias> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: aborting due to 35 previous errors
+
+For more information about this error, try `rustc --explain E0446`.
diff --git a/src/test/compile-fail/private-in-public.rs b/src/test/ui/privacy/private-in-public.rs
similarity index 100%
rename from src/test/compile-fail/private-in-public.rs
rename to src/test/ui/privacy/private-in-public.rs
diff --git a/src/test/ui/privacy/private-in-public.stderr b/src/test/ui/privacy/private-in-public.stderr
new file mode 100644
index 0000000..586327f
--- /dev/null
+++ b/src/test/ui/privacy/private-in-public.stderr
@@ -0,0 +1,268 @@
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:23:5
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:24:5
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub static S: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:25:5
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:26:5
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:27:19
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub struct S1(pub Priv); //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:28:21
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub struct S2 { pub field: Priv } //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:30:9
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub const C: Priv = Priv; //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:31:9
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub fn f1(arg: Priv) {} //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `types::Priv` in public interface
+ --> $DIR/private-in-public.rs:32:9
+ |
+LL | struct Priv;
+ | - `types::Priv` declared as private
+...
+LL | pub fn f2() -> Priv { panic!() } //~ ERROR private type `types::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0445]: private trait `traits::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:41:5
+ |
+LL | pub enum E<T: PrivTr> { V(T) } //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:42:5
+ |
+LL | pub fn f<T: PrivTr>(arg: T) {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:43:5
+ |
+LL | pub struct S1<T: PrivTr>(T); //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:44:5
+ |
+LL | / impl<T: PrivTr> Pub<T> { //~ ERROR private trait `traits::PrivTr` in public interface
+LL | | pub fn f<U: PrivTr>(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface
+LL | | }
+ | |_____^ can't leak private trait
+
+error[E0445]: private trait `traits::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:45:9
+ |
+LL | pub fn f<U: PrivTr>(arg: U) {} //~ ERROR private trait `traits::PrivTr` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits_where::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:54:5
+ |
+LL | pub enum E<T> where T: PrivTr { V(T) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits_where::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:56:5
+ |
+LL | pub fn f<T>(arg: T) where T: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits_where::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:58:5
+ |
+LL | pub struct S1<T>(T) where T: PrivTr;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0445]: private trait `traits_where::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:60:5
+ |
+LL | / impl<T> Pub<T> where T: PrivTr {
+LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface
+LL | | pub fn f<U>(arg: U) where U: PrivTr {}
+LL | | //~^ ERROR private trait `traits_where::PrivTr` in public interface
+LL | | }
+ | |_____^ can't leak private trait
+
+error[E0445]: private trait `traits_where::PrivTr` in public interface
+ --> $DIR/private-in-public.rs:62:9
+ |
+LL | pub fn f<U>(arg: U) where U: PrivTr {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private trait
+
+error[E0446]: private type `generics::Priv` in public interface
+ --> $DIR/private-in-public.rs:73:5
+ |
+LL | struct Priv<T = u8>(T);
+ | - `generics::Priv` declared as private
+...
+LL | pub fn f1(arg: [Priv; 1]) {} //~ ERROR private type `generics::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `generics::Priv` in public interface
+ --> $DIR/private-in-public.rs:74:5
+ |
+LL | struct Priv<T = u8>(T);
+ | - `generics::Priv` declared as private
+...
+LL | pub fn f2(arg: Pub<Priv>) {} //~ ERROR private type `generics::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `generics::Priv<generics::Pub>` in public interface
+ --> $DIR/private-in-public.rs:75:5
+ |
+LL | struct Priv<T = u8>(T);
+ | - `generics::Priv<generics::Pub>` declared as private
+...
+LL | pub fn f3(arg: Priv<Pub>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `impls::Priv` in public interface
+ --> $DIR/private-in-public.rs:90:9
+ |
+LL | struct Priv;
+ | - `impls::Priv` declared as private
+...
+LL | pub fn f(arg: Priv) {} //~ ERROR private type `impls::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `<aliases_pub::Priv as aliases_pub::PrivTr>::Assoc` in public interface
+ --> $DIR/private-in-public.rs:114:5
+ |
+LL | trait PrivTr {
+ | - `<aliases_pub::Priv as aliases_pub::PrivTr>::Assoc` declared as private
+...
+LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_pub::Priv` in public interface
+ --> $DIR/private-in-public.rs:114:5
+ |
+LL | struct Priv;
+ | - `aliases_pub::Priv` declared as private
+...
+LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_pub::Priv` in public interface
+ --> $DIR/private-in-public.rs:119:9
+ |
+LL | struct Priv;
+ | - `aliases_pub::Priv` declared as private
+...
+LL | pub fn f(arg: Priv) {} //~ ERROR private type `aliases_pub::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_priv::Priv1` in public interface
+ --> $DIR/private-in-public.rs:141:5
+ |
+LL | struct Priv1;
+ | - `aliases_priv::Priv1` declared as private
+...
+LL | pub fn f1(arg: PrivUseAlias) {} //~ ERROR private type `aliases_priv::Priv1` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_priv::Priv2` in public interface
+ --> $DIR/private-in-public.rs:142:5
+ |
+LL | struct Priv2;
+ | - `aliases_priv::Priv2` declared as private
+...
+LL | pub fn f2(arg: PrivAlias) {} //~ ERROR private type `aliases_priv::Priv2` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `<aliases_priv::Priv as aliases_priv::PrivTr>::Assoc` in public interface
+ --> $DIR/private-in-public.rs:143:5
+ |
+LL | trait PrivTr {
+ | - `<aliases_priv::Priv as aliases_priv::PrivTr>::Assoc` declared as private
+...
+LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_priv::Priv` in public interface
+ --> $DIR/private-in-public.rs:143:5
+ |
+LL | struct Priv;
+ | - `aliases_priv::Priv` declared as private
+...
+LL | pub fn f3(arg: <Priv as PrivTr>::Assoc) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_params::Priv` in public interface
+ --> $DIR/private-in-public.rs:153:5
+ |
+LL | struct Priv;
+ | - `aliases_params::Priv` declared as private
+...
+LL | pub fn f2(arg: PrivAliasGeneric) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `aliases_params::Priv` in public interface
+ --> $DIR/private-in-public.rs:155:5
+ |
+LL | struct Priv;
+ | - `aliases_params::Priv` declared as private
+...
+LL | pub fn f3(arg: Result<u8>) {} //~ ERROR private type `aliases_params::Priv` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: aborting due to 32 previous errors
+
+Some errors occurred: E0445, E0446.
+For more information about an error, try `rustc --explain E0445`.
diff --git a/src/test/compile-fail/private-inferred-type-1.rs b/src/test/ui/privacy/private-inferred-type-1.rs
similarity index 100%
rename from src/test/compile-fail/private-inferred-type-1.rs
rename to src/test/ui/privacy/private-inferred-type-1.rs
diff --git a/src/test/ui/privacy/private-inferred-type-1.stderr b/src/test/ui/privacy/private-inferred-type-1.stderr
new file mode 100644
index 0000000..4036152
--- /dev/null
+++ b/src/test/ui/privacy/private-inferred-type-1.stderr
@@ -0,0 +1,14 @@
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type-1.rs:26:5
+ |
+LL | [].arr0_secret(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type-1.rs:27:5
+ |
+LL | None.ty_param_secret(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/private-inferred-type-2.rs b/src/test/ui/privacy/private-inferred-type-2.rs
similarity index 100%
rename from src/test/compile-fail/private-inferred-type-2.rs
rename to src/test/ui/privacy/private-inferred-type-2.rs
diff --git a/src/test/ui/privacy/private-inferred-type-2.stderr b/src/test/ui/privacy/private-inferred-type-2.stderr
new file mode 100644
index 0000000..0559473
--- /dev/null
+++ b/src/test/ui/privacy/private-inferred-type-2.stderr
@@ -0,0 +1,20 @@
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type-2.rs:26:5
+ |
+LL | m::Pub::get_priv; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type-2.rs:27:5
+ |
+LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: type `ext::Priv` is private
+ --> $DIR/private-inferred-type-2.rs:28:5
+ |
+LL | ext::Pub::static_method; //~ ERROR type `ext::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/private-inferred-type-3.rs b/src/test/ui/privacy/private-inferred-type-3.rs
similarity index 100%
rename from src/test/compile-fail/private-inferred-type-3.rs
rename to src/test/ui/privacy/private-inferred-type-3.rs
diff --git a/src/test/ui/privacy/private-inferred-type-3.stderr b/src/test/ui/privacy/private-inferred-type-3.stderr
new file mode 100644
index 0000000..3c37a7e
--- /dev/null
+++ b/src/test/ui/privacy/private-inferred-type-3.stderr
@@ -0,0 +1,58 @@
+error: type `fn() {ext::priv_fn}` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: static `PRIV_STATIC` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: type `ext::PrivEnum` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: type `fn() {<u8 as ext::PrivTrait>::method}` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: type `fn(u8) -> ext::PrivTupleStruct {ext::PrivTupleStruct::{{constructor}}}` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct::{{constructor}}}` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: type `for<'r> fn(&'r ext::Pub<u8>) {<ext::Pub<u8>>::priv_method}` is private
+ --> $DIR/private-inferred-type-3.rs:26:5
+ |
+LL | ext::m!();
+ | ^^^^^^^^^^
+ |
+ = 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: aborting due to 7 previous errors
+
diff --git a/src/test/compile-fail/private-inferred-type.rs b/src/test/ui/privacy/private-inferred-type.rs
similarity index 100%
rename from src/test/compile-fail/private-inferred-type.rs
rename to src/test/ui/privacy/private-inferred-type.rs
diff --git a/src/test/ui/privacy/private-inferred-type.stderr b/src/test/ui/privacy/private-inferred-type.stderr
new file mode 100644
index 0000000..abbe43f
--- /dev/null
+++ b/src/test/ui/privacy/private-inferred-type.stderr
@@ -0,0 +1,225 @@
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:107:9
+ |
+LL | let _: m::Alias; //~ ERROR type `m::Priv` is private
+ | ^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:107:12
+ |
+LL | let _: m::Alias; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:109:13
+ |
+LL | let _: <m::Alias as m::TraitWithAssocTy>::AssocTy; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:110:5
+ |
+LL | m::Alias {}; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:111:5
+ |
+LL | m::Pub { 0: m::Alias {} }; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:113:5
+ |
+LL | m::Pub::static_method; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:114:5
+ |
+LL | m::Pub::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:115:5
+ |
+LL | m::Pub(0u8).method_with_substs::<m::Alias>(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:116:17
+ |
+LL | m::Pub(0u8).method_with_priv_params(loop{}); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:117:5
+ |
+LL | <m::Alias as m::TraitWithAssocConst>::TRAIT_ASSOC_CONST; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:118:6
+ |
+LL | <m::Pub<m::Alias>>::INHERENT_ASSOC_CONST; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:119:5
+ |
+LL | <m::Pub<m::Alias>>::INHERENT_ASSOC_CONST_GENERIC_SELF; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:120:5
+ |
+LL | <m::Pub<m::Alias>>::static_method_generic_self; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:122:5
+ |
+LL | u8::pub_method; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^
+
+error: type `adjust::S2` is private
+ --> $DIR/private-inferred-type.rs:124:5
+ |
+LL | adjust::S1.method_s3(); //~ ERROR type `adjust::S2` is private
+ | ^^^^^^^^^^
+
+error: type `fn() {m::priv_fn}` is private
+ --> $DIR/private-inferred-type.rs:49:9
+ |
+LL | priv_fn; //~ ERROR type `fn() {m::priv_fn}` is private
+ | ^^^^^^^
+...
+LL | m::m!();
+ | -------- in this macro invocation
+
+error: type `m::PrivEnum` is private
+ --> $DIR/private-inferred-type.rs:51:9
+ |
+LL | PrivEnum::Variant; //~ ERROR type `m::PrivEnum` is private
+ | ^^^^^^^^^^^^^^^^^
+...
+LL | m::m!();
+ | -------- in this macro invocation
+
+error: type `fn() {<u8 as m::PrivTrait>::method}` is private
+ --> $DIR/private-inferred-type.rs:53:9
+ |
+LL | <u8 as PrivTrait>::method; //~ ERROR type `fn() {<u8 as m::PrivTrait>::method}` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | m::m!();
+ | -------- in this macro invocation
+
+error: type `fn(u8) -> m::PrivTupleStruct {m::PrivTupleStruct::{{constructor}}}` is private
+ --> $DIR/private-inferred-type.rs:55:9
+ |
+LL | PrivTupleStruct;
+ | ^^^^^^^^^^^^^^^
+...
+LL | m::m!();
+ | -------- in this macro invocation
+
+error: type `fn(u8) -> m::PubTupleStruct {m::PubTupleStruct::{{constructor}}}` is private
+ --> $DIR/private-inferred-type.rs:57:9
+ |
+LL | PubTupleStruct;
+ | ^^^^^^^^^^^^^^
+...
+LL | m::m!();
+ | -------- in this macro invocation
+
+error: type `for<'r> fn(&'r m::Pub<u8>) {<m::Pub<u8>>::priv_method}` is private
+ --> $DIR/private-inferred-type.rs:59:18
+ |
+LL | Pub(0u8).priv_method();
+ | ^^^^^^^^^^^
+...
+LL | m::m!();
+ | -------- in this macro invocation
+
+error: trait `m::Trait` is private
+ --> $DIR/private-inferred-type.rs:128:5
+ |
+LL | m::leak_anon1(); //~ ERROR trait `m::Trait` is private
+ | ^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:129:5
+ |
+LL | m::leak_anon2(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:130:5
+ |
+LL | m::leak_anon3(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^
+
+error: type `(dyn m::Trait + 'static)` is private
+ --> $DIR/private-inferred-type.rs:132:5
+ |
+LL | m::leak_dyn1(); //~ ERROR type `(dyn m::Trait + 'static)` is private
+ | ^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:133:5
+ |
+LL | m::leak_dyn2(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:134:5
+ |
+LL | m::leak_dyn3(); //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:137:13
+ |
+LL | let a = m::Alias {}; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:138:17
+ |
+LL | let mut b = a; //~ ERROR type `m::Priv` is private
+ | ^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:139:9
+ |
+LL | b = a; //~ ERROR type `m::Priv` is private
+ | ^
+
+error: type `m::Priv` is private
+ --> $DIR/private-inferred-type.rs:140:11
+ |
+LL | match a { //~ ERROR type `m::Priv` is private
+ | ^
+
+error[E0446]: private type `m::Priv` in public interface
+ --> $DIR/private-inferred-type.rs:71:36
+ |
+LL | struct Priv;
+ | - `m::Priv` declared as private
+...
+LL | impl TraitWithAssocTy for u8 { type AssocTy = Priv; }
+ | ^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `adjust::S2` in public interface
+ --> $DIR/private-inferred-type.rs:93:9
+ |
+LL | struct S2;
+ | - `adjust::S2` declared as private
+...
+LL | type Target = S2Alias; //~ ERROR private type `adjust::S2` in public interface
+ | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: aborting due to 33 previous errors
+
+For more information about this error, try `rustc --explain E0446`.
diff --git a/src/test/compile-fail/private-item-simple.rs b/src/test/ui/privacy/private-item-simple.rs
similarity index 100%
rename from src/test/compile-fail/private-item-simple.rs
rename to src/test/ui/privacy/private-item-simple.rs
diff --git a/src/test/ui/privacy/private-item-simple.stderr b/src/test/ui/privacy/private-item-simple.stderr
new file mode 100644
index 0000000..811b026
--- /dev/null
+++ b/src/test/ui/privacy/private-item-simple.stderr
@@ -0,0 +1,9 @@
+error[E0603]: function `f` is private
+ --> $DIR/private-item-simple.rs:16:5
+ |
+LL | a::f(); //~ ERROR function `f` is private
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/private-method-cross-crate.rs b/src/test/ui/privacy/private-method-cross-crate.rs
similarity index 100%
rename from src/test/compile-fail/private-method-cross-crate.rs
rename to src/test/ui/privacy/private-method-cross-crate.rs
diff --git a/src/test/ui/privacy/private-method-cross-crate.stderr b/src/test/ui/privacy/private-method-cross-crate.stderr
new file mode 100644
index 0000000..27d398c
--- /dev/null
+++ b/src/test/ui/privacy/private-method-cross-crate.stderr
@@ -0,0 +1,9 @@
+error[E0624]: method `nap` is private
+ --> $DIR/private-method-cross-crate.rs:17:8
+ |
+LL | nyan.nap(); //~ ERROR method `nap` is private
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/private-method-inherited.rs b/src/test/ui/privacy/private-method-inherited.rs
similarity index 100%
rename from src/test/compile-fail/private-method-inherited.rs
rename to src/test/ui/privacy/private-method-inherited.rs
diff --git a/src/test/ui/privacy/private-method-inherited.stderr b/src/test/ui/privacy/private-method-inherited.stderr
new file mode 100644
index 0000000..3f10750
--- /dev/null
+++ b/src/test/ui/privacy/private-method-inherited.stderr
@@ -0,0 +1,9 @@
+error[E0624]: method `f` is private
+ --> $DIR/private-method-inherited.rs:23:7
+ |
+LL | x.f(); //~ ERROR method `f` is private
+ | ^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/private-method.rs b/src/test/ui/privacy/private-method.rs
similarity index 100%
rename from src/test/compile-fail/private-method.rs
rename to src/test/ui/privacy/private-method.rs
diff --git a/src/test/ui/privacy/private-method.stderr b/src/test/ui/privacy/private-method.stderr
new file mode 100644
index 0000000..fce03d3
--- /dev/null
+++ b/src/test/ui/privacy/private-method.stderr
@@ -0,0 +1,9 @@
+error[E0624]: method `nap` is private
+ --> $DIR/private-method.rs:34:8
+ |
+LL | nyan.nap();
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/private-struct-field-cross-crate.rs b/src/test/ui/privacy/private-struct-field-cross-crate.rs
similarity index 100%
rename from src/test/compile-fail/private-struct-field-cross-crate.rs
rename to src/test/ui/privacy/private-struct-field-cross-crate.rs
diff --git a/src/test/ui/privacy/private-struct-field-cross-crate.stderr b/src/test/ui/privacy/private-struct-field-cross-crate.stderr
new file mode 100644
index 0000000..b9401ba
--- /dev/null
+++ b/src/test/ui/privacy/private-struct-field-cross-crate.stderr
@@ -0,0 +1,9 @@
+error[E0616]: field `meows` of struct `cci_class::kitties::cat` is private
+ --> $DIR/private-struct-field-cross-crate.rs:17:14
+ |
+LL | assert_eq!(nyan.meows, 52);
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/compile-fail/private-struct-field-ctor.rs b/src/test/ui/privacy/private-struct-field-ctor.rs
similarity index 100%
rename from src/test/compile-fail/private-struct-field-ctor.rs
rename to src/test/ui/privacy/private-struct-field-ctor.rs
diff --git a/src/test/ui/privacy/private-struct-field-ctor.stderr b/src/test/ui/privacy/private-struct-field-ctor.stderr
new file mode 100644
index 0000000..711d265
--- /dev/null
+++ b/src/test/ui/privacy/private-struct-field-ctor.stderr
@@ -0,0 +1,9 @@
+error[E0451]: field `x` of struct `a::Foo` is private
+ --> $DIR/private-struct-field-ctor.rs:18:22
+ |
+LL | let s = a::Foo { x: 1 }; //~ ERROR field `x` of struct `a::Foo` is private
+ | ^^^^ field `x` is private
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0451`.
diff --git a/src/test/compile-fail/private-struct-field-pattern.rs b/src/test/ui/privacy/private-struct-field-pattern.rs
similarity index 100%
rename from src/test/compile-fail/private-struct-field-pattern.rs
rename to src/test/ui/privacy/private-struct-field-pattern.rs
diff --git a/src/test/ui/privacy/private-struct-field-pattern.stderr b/src/test/ui/privacy/private-struct-field-pattern.stderr
new file mode 100644
index 0000000..bc09a2a
--- /dev/null
+++ b/src/test/ui/privacy/private-struct-field-pattern.stderr
@@ -0,0 +1,9 @@
+error[E0451]: field `x` of struct `a::Foo` is private
+ --> $DIR/private-struct-field-pattern.rs:25:15
+ |
+LL | Foo { x: _ } => {} //~ ERROR field `x` of struct `a::Foo` is private
+ | ^^^^ field `x` is private
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0451`.
diff --git a/src/test/compile-fail/private-struct-field.rs b/src/test/ui/privacy/private-struct-field.rs
similarity index 100%
rename from src/test/compile-fail/private-struct-field.rs
rename to src/test/ui/privacy/private-struct-field.rs
diff --git a/src/test/ui/privacy/private-struct-field.stderr b/src/test/ui/privacy/private-struct-field.stderr
new file mode 100644
index 0000000..db16e1b
--- /dev/null
+++ b/src/test/ui/privacy/private-struct-field.stderr
@@ -0,0 +1,9 @@
+error[E0616]: field `meows` of struct `cat::Cat` is private
+ --> $DIR/private-struct-field.rs:23:16
+ |
+LL | assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `cat::Cat` is private
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/compile-fail/private-type-in-interface.rs b/src/test/ui/privacy/private-type-in-interface.rs
similarity index 100%
rename from src/test/compile-fail/private-type-in-interface.rs
rename to src/test/ui/privacy/private-type-in-interface.rs
diff --git a/src/test/ui/privacy/private-type-in-interface.stderr b/src/test/ui/privacy/private-type-in-interface.stderr
new file mode 100644
index 0000000..5b12ed5
--- /dev/null
+++ b/src/test/ui/privacy/private-type-in-interface.stderr
@@ -0,0 +1,68 @@
+error: type `m::Priv` is private
+ --> $DIR/private-type-in-interface.rs:25:9
+ |
+LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-type-in-interface.rs:25:6
+ |
+LL | fn f(_: m::Alias) {} //~ ERROR type `m::Priv` is private
+ | ^
+
+error: type `ext::Priv` is private
+ --> $DIR/private-type-in-interface.rs:27:13
+ |
+LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private
+ | ^^^^^^^^^^
+
+error: type `ext::Priv` is private
+ --> $DIR/private-type-in-interface.rs:27:10
+ |
+LL | fn f_ext(_: ext::Alias) {} //~ ERROR type `ext::Priv` is private
+ | ^
+
+error: type `m::Priv` is private
+ --> $DIR/private-type-in-interface.rs:31:6
+ |
+LL | impl m::Alias {} //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^
+
+error: type `ext::Priv` is private
+ --> $DIR/private-type-in-interface.rs:32:14
+ |
+LL | impl Tr1 for ext::Alias {} //~ ERROR type `ext::Priv` is private
+ | ^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-type-in-interface.rs:33:10
+ |
+LL | type A = <m::Alias as m::Trait>::X; //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-type-in-interface.rs:37:11
+ |
+LL | fn g() -> impl Tr2<m::Alias> { 0 } //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^
+
+error: type `m::Priv` is private
+ --> $DIR/private-type-in-interface.rs:37:16
+ |
+LL | fn g() -> impl Tr2<m::Alias> { 0 } //~ ERROR type `m::Priv` is private
+ | ^^^^^^^^^^^^^
+
+error: type `ext::Priv` is private
+ --> $DIR/private-type-in-interface.rs:39:15
+ |
+LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 } //~ ERROR type `ext::Priv` is private
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: type `ext::Priv` is private
+ --> $DIR/private-type-in-interface.rs:39:20
+ |
+LL | fn g_ext() -> impl Tr2<ext::Alias> { 0 } //~ ERROR type `ext::Priv` is private
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 11 previous errors
+
diff --git a/src/test/compile-fail/private-variant-reexport.rs b/src/test/ui/privacy/private-variant-reexport.rs
similarity index 100%
rename from src/test/compile-fail/private-variant-reexport.rs
rename to src/test/ui/privacy/private-variant-reexport.rs
diff --git a/src/test/ui/privacy/private-variant-reexport.stderr b/src/test/ui/privacy/private-variant-reexport.stderr
new file mode 100644
index 0000000..11e13ab
--- /dev/null
+++ b/src/test/ui/privacy/private-variant-reexport.stderr
@@ -0,0 +1,29 @@
+error: variant `V` is private and cannot be re-exported
+ --> $DIR/private-variant-reexport.rs:12:13
+ |
+LL | pub use ::E::V; //~ ERROR variant `V` is private and cannot be re-exported
+ | ^^^^^^
+...
+LL | enum E { V }
+ | ------ help: consider making the enum public: `pub enum E`
+
+error: variant `V` is private and cannot be re-exported
+ --> $DIR/private-variant-reexport.rs:16:19
+ |
+LL | pub use ::E::{V}; //~ ERROR variant `V` is private and cannot be re-exported
+ | ^
+
+error: variant `V` is private and cannot be re-exported
+ --> $DIR/private-variant-reexport.rs:20:22
+ |
+LL | pub use ::E::V::{self}; //~ ERROR variant `V` is private and cannot be re-exported
+ | ^^^^
+
+error: enum is private and its variants cannot be re-exported
+ --> $DIR/private-variant-reexport.rs:24:13
+ |
+LL | pub use ::E::*; //~ ERROR enum is private and its variants cannot be re-exported
+ | ^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs b/src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs
similarity index 100%
rename from src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs
rename to src/test/ui/privacy/restricted/auxiliary/pub_restricted.rs
diff --git a/src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs b/src/test/ui/privacy/restricted/lookup-ignores-private.rs
similarity index 100%
rename from src/test/compile-fail/privacy/restricted/lookup-ignores-private.rs
rename to src/test/ui/privacy/restricted/lookup-ignores-private.rs
diff --git a/src/test/ui/privacy/restricted/lookup-ignores-private.stderr b/src/test/ui/privacy/restricted/lookup-ignores-private.stderr
new file mode 100644
index 0000000..7fc53e8
--- /dev/null
+++ b/src/test/ui/privacy/restricted/lookup-ignores-private.stderr
@@ -0,0 +1,12 @@
+error: compilation successful
+ --> $DIR/lookup-ignores-private.rs:40:1
+ |
+LL | / fn main() { //~ ERROR compilation successful
+LL | | let s = foo::S::default();
+LL | | let _: bool = s.x;
+LL | | let _: bool = s.f();
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/privacy/restricted/private-in-public.rs b/src/test/ui/privacy/restricted/private-in-public.rs
similarity index 100%
rename from src/test/compile-fail/privacy/restricted/private-in-public.rs
rename to src/test/ui/privacy/restricted/private-in-public.rs
diff --git a/src/test/ui/privacy/restricted/private-in-public.stderr b/src/test/ui/privacy/restricted/private-in-public.stderr
new file mode 100644
index 0000000..e0d3abd
--- /dev/null
+++ b/src/test/ui/privacy/restricted/private-in-public.stderr
@@ -0,0 +1,21 @@
+error[E0446]: private type `foo::Priv` in public interface
+ --> $DIR/private-in-public.rs:18:9
+ |
+LL | struct Priv;
+ | - `foo::Priv` declared as private
+...
+LL | pub(crate) fn g(_: Priv) {} //~ ERROR E0446
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error[E0446]: private type `foo::Priv` in public interface
+ --> $DIR/private-in-public.rs:19:9
+ |
+LL | struct Priv;
+ | - `foo::Priv` declared as private
+...
+LL | crate fn h(_: Priv) {} //~ ERROR E0446
+ | ^^^^^^^^^^^^^^^^^^^^^^ can't leak private type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0446`.
diff --git a/src/test/compile-fail/privacy/restricted/struct-literal-field.rs b/src/test/ui/privacy/restricted/struct-literal-field.rs
similarity index 100%
rename from src/test/compile-fail/privacy/restricted/struct-literal-field.rs
rename to src/test/ui/privacy/restricted/struct-literal-field.rs
diff --git a/src/test/ui/privacy/restricted/struct-literal-field.stderr b/src/test/ui/privacy/restricted/struct-literal-field.stderr
new file mode 100644
index 0000000..6d668c8
--- /dev/null
+++ b/src/test/ui/privacy/restricted/struct-literal-field.stderr
@@ -0,0 +1,9 @@
+error[E0451]: field `x` of struct `foo::bar::S` is private
+ --> $DIR/struct-literal-field.rs:28:9
+ |
+LL | S { x: 0 }; //~ ERROR private
+ | ^^^^ field `x` is private
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0451`.
diff --git a/src/test/compile-fail/privacy/restricted/test.rs b/src/test/ui/privacy/restricted/test.rs
similarity index 100%
rename from src/test/compile-fail/privacy/restricted/test.rs
rename to src/test/ui/privacy/restricted/test.rs
diff --git a/src/test/ui/privacy/restricted/test.stderr b/src/test/ui/privacy/restricted/test.stderr
new file mode 100644
index 0000000..67a95c3
--- /dev/null
+++ b/src/test/ui/privacy/restricted/test.stderr
@@ -0,0 +1,82 @@
+error[E0433]: failed to resolve. Maybe a missing `extern crate bad;`?
+ --> $DIR/test.rs:60:12
+ |
+LL | pub(in bad::path) mod m1 {} //~ ERROR failed to resolve. Maybe a missing `extern crate bad;`?
+ | ^^^ Maybe a missing `extern crate bad;`?
+
+error: visibilities can only be restricted to ancestor modules
+ --> $DIR/test.rs:61:12
+ |
+LL | pub(in foo) mod m2 {} //~ ERROR visibilities can only be restricted to ancestor modules
+ | ^^^
+
+error[E0364]: `f` is private, and cannot be re-exported
+ --> $DIR/test.rs:31:24
+ |
+LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported
+ | ^^^^^^^^^^^^^^^^
+ |
+note: consider marking `f` as `pub` in the imported module
+ --> $DIR/test.rs:31:24
+ |
+LL | pub(super) use foo::bar::f as g; //~ ERROR cannot be re-exported
+ | ^^^^^^^^^^^^^^^^
+
+error[E0603]: struct `Crate` is private
+ --> $DIR/test.rs:48:9
+ |
+LL | use pub_restricted::Crate; //~ ERROR private
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: function `f` is private
+ --> $DIR/test.rs:40:9
+ |
+LL | use foo::bar::f; //~ ERROR private
+ | ^^^^^^^^^^^
+
+error[E0616]: field `x` of struct `foo::bar::S` is private
+ --> $DIR/test.rs:41:5
+ |
+LL | S::default().x; //~ ERROR private
+ | ^^^^^^^^^^^^^^
+
+error[E0624]: method `f` is private
+ --> $DIR/test.rs:42:18
+ |
+LL | S::default().f(); //~ ERROR private
+ | ^
+
+error[E0624]: method `g` is private
+ --> $DIR/test.rs:43:5
+ |
+LL | S::g(); //~ ERROR private
+ | ^^^^
+
+error[E0616]: field `y` of struct `pub_restricted::Universe` is private
+ --> $DIR/test.rs:52:13
+ |
+LL | let _ = u.y; //~ ERROR private
+ | ^^^
+
+error[E0616]: field `z` of struct `pub_restricted::Universe` is private
+ --> $DIR/test.rs:53:13
+ |
+LL | let _ = u.z; //~ ERROR private
+ | ^^^
+
+error[E0624]: method `g` is private
+ --> $DIR/test.rs:55:7
+ |
+LL | u.g(); //~ ERROR private
+ | ^
+
+error[E0624]: method `h` is private
+ --> $DIR/test.rs:56:7
+ |
+LL | u.h(); //~ ERROR private
+ | ^
+
+error: aborting due to 12 previous errors
+
+Some errors occurred: E0364, E0433, E0603, E0616, E0624.
+For more information about an error, try `rustc --explain E0364`.
diff --git a/src/test/compile-fail/privacy/union-field-privacy-1.rs b/src/test/ui/privacy/union-field-privacy-1.rs
similarity index 100%
rename from src/test/compile-fail/privacy/union-field-privacy-1.rs
rename to src/test/ui/privacy/union-field-privacy-1.rs
diff --git a/src/test/ui/privacy/union-field-privacy-1.stderr b/src/test/ui/privacy/union-field-privacy-1.stderr
new file mode 100644
index 0000000..c93760a
--- /dev/null
+++ b/src/test/ui/privacy/union-field-privacy-1.stderr
@@ -0,0 +1,15 @@
+error[E0451]: field `c` of union `m::U` is private
+ --> $DIR/union-field-privacy-1.rs:22:20
+ |
+LL | let u = m::U { c: 0 }; //~ ERROR field `c` of union `m::U` is private
+ | ^^^^ field `c` is private
+
+error[E0451]: field `c` of union `m::U` is private
+ --> $DIR/union-field-privacy-1.rs:26:16
+ |
+LL | let m::U { c } = u; //~ ERROR field `c` of union `m::U` is private
+ | ^ field `c` is private
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0451`.
diff --git a/src/test/compile-fail/privacy/union-field-privacy-2.rs b/src/test/ui/privacy/union-field-privacy-2.rs
similarity index 100%
rename from src/test/compile-fail/privacy/union-field-privacy-2.rs
rename to src/test/ui/privacy/union-field-privacy-2.rs
diff --git a/src/test/ui/privacy/union-field-privacy-2.stderr b/src/test/ui/privacy/union-field-privacy-2.stderr
new file mode 100644
index 0000000..cc12483
--- /dev/null
+++ b/src/test/ui/privacy/union-field-privacy-2.stderr
@@ -0,0 +1,9 @@
+error[E0616]: field `c` of struct `m::U` is private
+ --> $DIR/union-field-privacy-2.rs:24:13
+ |
+LL | let c = u.c; //~ ERROR field `c` of struct `m::U` is private
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/compile-fail/ptr-coercion.rs b/src/test/ui/ptr-coercion.rs
similarity index 100%
rename from src/test/compile-fail/ptr-coercion.rs
rename to src/test/ui/ptr-coercion.rs
diff --git a/src/test/ui/ptr-coercion.stderr b/src/test/ui/ptr-coercion.stderr
new file mode 100644
index 0000000..c5ed80d
--- /dev/null
+++ b/src/test/ui/ptr-coercion.stderr
@@ -0,0 +1,30 @@
+error[E0308]: mismatched types
+ --> $DIR/ptr-coercion.rs:17:25
+ |
+LL | let x: *mut isize = x; //~ ERROR mismatched types
+ | ^ types differ in mutability
+ |
+ = note: expected type `*mut isize`
+ found type `*const isize`
+
+error[E0308]: mismatched types
+ --> $DIR/ptr-coercion.rs:23:25
+ |
+LL | let x: *mut isize = &42; //~ ERROR mismatched types
+ | ^^^ types differ in mutability
+ |
+ = note: expected type `*mut isize`
+ found type `&isize`
+
+error[E0308]: mismatched types
+ --> $DIR/ptr-coercion.rs:29:25
+ |
+LL | let x: *mut isize = x; //~ ERROR mismatched types
+ | ^ types differ in mutability
+ |
+ = note: expected type `*mut isize`
+ found type `*const isize`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/pub-ident-fn-2.rs b/src/test/ui/pub/pub-ident-fn-2.rs
similarity index 100%
rename from src/test/ui/pub-ident-fn-2.rs
rename to src/test/ui/pub/pub-ident-fn-2.rs
diff --git a/src/test/ui/pub-ident-fn-2.stderr b/src/test/ui/pub/pub-ident-fn-2.stderr
similarity index 100%
rename from src/test/ui/pub-ident-fn-2.stderr
rename to src/test/ui/pub/pub-ident-fn-2.stderr
diff --git a/src/test/ui/pub-ident-fn-or-struct-2.rs b/src/test/ui/pub/pub-ident-fn-or-struct-2.rs
similarity index 100%
rename from src/test/ui/pub-ident-fn-or-struct-2.rs
rename to src/test/ui/pub/pub-ident-fn-or-struct-2.rs
diff --git a/src/test/ui/pub-ident-fn-or-struct-2.stderr b/src/test/ui/pub/pub-ident-fn-or-struct-2.stderr
similarity index 100%
rename from src/test/ui/pub-ident-fn-or-struct-2.stderr
rename to src/test/ui/pub/pub-ident-fn-or-struct-2.stderr
diff --git a/src/test/ui/pub-ident-fn-or-struct.rs b/src/test/ui/pub/pub-ident-fn-or-struct.rs
similarity index 100%
rename from src/test/ui/pub-ident-fn-or-struct.rs
rename to src/test/ui/pub/pub-ident-fn-or-struct.rs
diff --git a/src/test/ui/pub-ident-fn-or-struct.stderr b/src/test/ui/pub/pub-ident-fn-or-struct.stderr
similarity index 100%
rename from src/test/ui/pub-ident-fn-or-struct.stderr
rename to src/test/ui/pub/pub-ident-fn-or-struct.stderr
diff --git a/src/test/ui/pub-ident-fn.fixed b/src/test/ui/pub/pub-ident-fn.fixed
similarity index 100%
rename from src/test/ui/pub-ident-fn.fixed
rename to src/test/ui/pub/pub-ident-fn.fixed
diff --git a/src/test/ui/pub-ident-fn.rs b/src/test/ui/pub/pub-ident-fn.rs
similarity index 100%
rename from src/test/ui/pub-ident-fn.rs
rename to src/test/ui/pub/pub-ident-fn.rs
diff --git a/src/test/ui/pub-ident-fn.stderr b/src/test/ui/pub/pub-ident-fn.stderr
similarity index 100%
rename from src/test/ui/pub-ident-fn.stderr
rename to src/test/ui/pub/pub-ident-fn.stderr
diff --git a/src/test/ui/pub-ident-struct.rs b/src/test/ui/pub/pub-ident-struct.rs
similarity index 100%
rename from src/test/ui/pub-ident-struct.rs
rename to src/test/ui/pub/pub-ident-struct.rs
diff --git a/src/test/ui/pub-ident-struct.stderr b/src/test/ui/pub/pub-ident-struct.stderr
similarity index 100%
rename from src/test/ui/pub-ident-struct.stderr
rename to src/test/ui/pub/pub-ident-struct.stderr
diff --git a/src/test/compile-fail/pub-reexport-priv-extern-crate.rs b/src/test/ui/pub/pub-reexport-priv-extern-crate.rs
similarity index 100%
rename from src/test/compile-fail/pub-reexport-priv-extern-crate.rs
rename to src/test/ui/pub/pub-reexport-priv-extern-crate.rs
diff --git a/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr
new file mode 100644
index 0000000..d298542b
--- /dev/null
+++ b/src/test/ui/pub/pub-reexport-priv-extern-crate.stderr
@@ -0,0 +1,30 @@
+error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
+ --> $DIR/pub-reexport-priv-extern-crate.rs:14:9
+ |
+LL | pub use core as reexported_core; //~ ERROR `core` is private, and cannot be re-exported
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: #[deny(pub_use_of_private_extern_crate)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
+ --> $DIR/pub-reexport-priv-extern-crate.rs:22:9
+ |
+LL | use foo1::core; //~ ERROR `core` is private, and cannot be re-exported
+ | ^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
+ --> $DIR/pub-reexport-priv-extern-crate.rs:30:13
+ |
+LL | pub use foo2::bar::core; //~ ERROR `core` is private, and cannot be re-exported
+ | ^^^^^^^^^^^^^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #34537 <https://github.com/rust-lang/rust/issues/34537>
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/qualified-path-params-2.rs b/src/test/ui/qualified/qualified-path-params-2.rs
similarity index 100%
rename from src/test/ui/qualified-path-params-2.rs
rename to src/test/ui/qualified/qualified-path-params-2.rs
diff --git a/src/test/ui/qualified-path-params-2.stderr b/src/test/ui/qualified/qualified-path-params-2.stderr
similarity index 100%
rename from src/test/ui/qualified-path-params-2.stderr
rename to src/test/ui/qualified/qualified-path-params-2.stderr
diff --git a/src/test/compile-fail/qualified-path-params.rs b/src/test/ui/qualified/qualified-path-params.rs
similarity index 100%
rename from src/test/compile-fail/qualified-path-params.rs
rename to src/test/ui/qualified/qualified-path-params.rs
diff --git a/src/test/ui/qualified/qualified-path-params.stderr b/src/test/ui/qualified/qualified-path-params.stderr
new file mode 100644
index 0000000..e76c373
--- /dev/null
+++ b/src/test/ui/qualified/qualified-path-params.stderr
@@ -0,0 +1,19 @@
+error[E0533]: expected unit struct/variant or constant, found method `<<S as Tr>::A>::f<u8>`
+ --> $DIR/qualified-path-params.rs:30:9
+ |
+LL | <S as Tr>::A::f::<u8> => {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0029]: only char and numeric types are allowed in range patterns
+ --> $DIR/qualified-path-params.rs:32:15
+ |
+LL | 0 ..= <S as Tr>::A::f::<u8> => {} //~ ERROR only char and numeric types are allowed in range
+ | ^^^^^^^^^^^^^^^^^^^^^ ranges require char or numeric types
+ |
+ = note: start type: {integer}
+ = note: end type: fn() {S::f::<u8>}
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0029, E0533.
+For more information about an error, try `rustc --explain E0029`.
diff --git a/src/test/compile-fail/question-mark-type-infer.rs b/src/test/ui/question-mark-type-infer.rs
similarity index 100%
rename from src/test/compile-fail/question-mark-type-infer.rs
rename to src/test/ui/question-mark-type-infer.rs
diff --git a/src/test/ui/question-mark-type-infer.stderr b/src/test/ui/question-mark-type-infer.stderr
new file mode 100644
index 0000000..53848ed
--- /dev/null
+++ b/src/test/ui/question-mark-type-infer.stderr
@@ -0,0 +1,9 @@
+error[E0284]: type annotations required: cannot resolve `<_ as std::ops::Try>::Ok == _`
+ --> $DIR/question-mark-type-infer.rs:22:5
+ |
+LL | l.iter().map(f).collect()? //~ ERROR type annotations required: cannot resolve
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0284`.
diff --git a/src/test/compile-fail/quote-with-interpolated.rs b/src/test/ui/quote-with-interpolated.rs
similarity index 100%
rename from src/test/compile-fail/quote-with-interpolated.rs
rename to src/test/ui/quote-with-interpolated.rs
diff --git a/src/test/ui/quote-with-interpolated.stderr b/src/test/ui/quote-with-interpolated.stderr
new file mode 100644
index 0000000..10b3fc0
--- /dev/null
+++ b/src/test/ui/quote-with-interpolated.stderr
@@ -0,0 +1,11 @@
+error: quote! with interpolated token
+ --> $DIR/quote-with-interpolated.rs:15:29
+ |
+LL | quote_expr!(cx, $bar) //~ ERROR quote! with interpolated token
+ | ^^^^
+...
+LL | foo!(bar);
+ | ---------- in this macro invocation
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/range-1.rs b/src/test/ui/range/range-1.rs
similarity index 100%
rename from src/test/compile-fail/range-1.rs
rename to src/test/ui/range/range-1.rs
diff --git a/src/test/ui/range/range-1.stderr b/src/test/ui/range/range-1.stderr
new file mode 100644
index 0000000..2e83bab
--- /dev/null
+++ b/src/test/ui/range/range-1.stderr
@@ -0,0 +1,28 @@
+error[E0308]: mismatched types
+ --> $DIR/range-1.rs:15:19
+ |
+LL | let _ = 0u32..10i32;
+ | ^^^^^ expected u32, found i32
+
+error[E0277]: the trait bound `bool: std::iter::Step` is not satisfied
+ --> $DIR/range-1.rs:19:14
+ |
+LL | for i in false..true {}
+ | ^^^^^^^^^^^ the trait `std::iter::Step` is not implemented for `bool`
+ |
+ = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::ops::Range<bool>`
+
+error[E0277]: the size for values of type `[{integer}]` cannot be known at compilation time
+ --> $DIR/range-1.rs:24:17
+ |
+LL | let range = *arr..;
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[{integer}]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::ops::RangeFrom`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/range-inclusive-pattern-precedence.rs b/src/test/ui/range/range-inclusive-pattern-precedence.rs
similarity index 100%
rename from src/test/ui/range-inclusive-pattern-precedence.rs
rename to src/test/ui/range/range-inclusive-pattern-precedence.rs
diff --git a/src/test/ui/range-inclusive-pattern-precedence.stderr b/src/test/ui/range/range-inclusive-pattern-precedence.stderr
similarity index 100%
rename from src/test/ui/range-inclusive-pattern-precedence.stderr
rename to src/test/ui/range/range-inclusive-pattern-precedence.stderr
diff --git a/src/test/compile-fail/range_traits-1.rs b/src/test/ui/range/range_traits-1.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-1.rs
rename to src/test/ui/range/range_traits-1.rs
diff --git a/src/test/ui/range/range_traits-1.stderr b/src/test/ui/range/range_traits-1.stderr
new file mode 100644
index 0000000..ee72dfe
--- /dev/null
+++ b/src/test/ui/range/range_traits-1.stderr
@@ -0,0 +1,105 @@
+error[E0277]: can't compare `std::ops::Range<usize>` with `std::ops::Range<usize>`
+ --> $DIR/range_traits-1.rs:15:5
+ |
+LL | a: Range<usize>,
+ | ^^^^^^^^^^^^^^^ no implementation for `std::ops::Range<usize> < std::ops::Range<usize>` and `std::ops::Range<usize> > std::ops::Range<usize>`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::Range<usize>`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error[E0277]: can't compare `std::ops::RangeTo<usize>` with `std::ops::RangeTo<usize>`
+ --> $DIR/range_traits-1.rs:18:5
+ |
+LL | b: RangeTo<usize>,
+ | ^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeTo<usize> < std::ops::RangeTo<usize>` and `std::ops::RangeTo<usize> > std::ops::RangeTo<usize>`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeTo<usize>`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error[E0277]: can't compare `std::ops::RangeFrom<usize>` with `std::ops::RangeFrom<usize>`
+ --> $DIR/range_traits-1.rs:21:5
+ |
+LL | c: RangeFrom<usize>,
+ | ^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeFrom<usize> < std::ops::RangeFrom<usize>` and `std::ops::RangeFrom<usize> > std::ops::RangeFrom<usize>`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFrom<usize>`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error[E0277]: can't compare `std::ops::RangeFull` with `std::ops::RangeFull`
+ --> $DIR/range_traits-1.rs:24:5
+ |
+LL | d: RangeFull,
+ | ^^^^^^^^^^^^ no implementation for `std::ops::RangeFull < std::ops::RangeFull` and `std::ops::RangeFull > std::ops::RangeFull`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeFull`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error[E0277]: can't compare `std::ops::RangeInclusive<usize>` with `std::ops::RangeInclusive<usize>`
+ --> $DIR/range_traits-1.rs:27:5
+ |
+LL | e: RangeInclusive<usize>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeInclusive<usize> < std::ops::RangeInclusive<usize>` and `std::ops::RangeInclusive<usize> > std::ops::RangeInclusive<usize>`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeInclusive<usize>`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error[E0277]: can't compare `std::ops::RangeToInclusive<usize>` with `std::ops::RangeToInclusive<usize>`
+ --> $DIR/range_traits-1.rs:30:5
+ |
+LL | f: RangeToInclusive<usize>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ no implementation for `std::ops::RangeToInclusive<usize> < std::ops::RangeToInclusive<usize>` and `std::ops::RangeToInclusive<usize> > std::ops::RangeToInclusive<usize>`
+ |
+ = help: the trait `std::cmp::PartialOrd` is not implemented for `std::ops::RangeToInclusive<usize>`
+ = note: required by `std::cmp::PartialOrd::partial_cmp`
+
+error[E0277]: the trait bound `std::ops::Range<usize>: std::cmp::Ord` is not satisfied
+ --> $DIR/range_traits-1.rs:15:5
+ |
+LL | a: Range<usize>,
+ | ^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::Range<usize>`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error[E0277]: the trait bound `std::ops::RangeTo<usize>: std::cmp::Ord` is not satisfied
+ --> $DIR/range_traits-1.rs:18:5
+ |
+LL | b: RangeTo<usize>,
+ | ^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeTo<usize>`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error[E0277]: the trait bound `std::ops::RangeFrom<usize>: std::cmp::Ord` is not satisfied
+ --> $DIR/range_traits-1.rs:21:5
+ |
+LL | c: RangeFrom<usize>,
+ | ^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeFrom<usize>`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error[E0277]: the trait bound `std::ops::RangeFull: std::cmp::Ord` is not satisfied
+ --> $DIR/range_traits-1.rs:24:5
+ |
+LL | d: RangeFull,
+ | ^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeFull`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error[E0277]: the trait bound `std::ops::RangeInclusive<usize>: std::cmp::Ord` is not satisfied
+ --> $DIR/range_traits-1.rs:27:5
+ |
+LL | e: RangeInclusive<usize>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeInclusive<usize>`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error[E0277]: the trait bound `std::ops::RangeToInclusive<usize>: std::cmp::Ord` is not satisfied
+ --> $DIR/range_traits-1.rs:30:5
+ |
+LL | f: RangeToInclusive<usize>,
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `std::ops::RangeToInclusive<usize>`
+ |
+ = note: required by `std::cmp::Ord::cmp`
+
+error: aborting due to 12 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/range_traits-2.rs b/src/test/ui/range/range_traits-2.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-2.rs
rename to src/test/ui/range/range_traits-2.rs
diff --git a/src/test/ui/range/range_traits-2.stderr b/src/test/ui/range/range_traits-2.stderr
new file mode 100644
index 0000000..0151ede
--- /dev/null
+++ b/src/test/ui/range/range_traits-2.stderr
@@ -0,0 +1,11 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/range_traits-2.rs:13:10
+ |
+LL | #[derive(Copy, Clone)] //~ ERROR Copy
+ | ^^^^
+LL | struct R(Range<usize>);
+ | ------------ this field does not implement `Copy`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0204`.
diff --git a/src/test/compile-fail/range_traits-3.rs b/src/test/ui/range/range_traits-3.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-3.rs
rename to src/test/ui/range/range_traits-3.rs
diff --git a/src/test/ui/range/range_traits-3.stderr b/src/test/ui/range/range_traits-3.stderr
new file mode 100644
index 0000000..a625fda
--- /dev/null
+++ b/src/test/ui/range/range_traits-3.stderr
@@ -0,0 +1,11 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/range_traits-3.rs:13:10
+ |
+LL | #[derive(Copy, Clone)] //~ ERROR Copy
+ | ^^^^
+LL | struct R(RangeFrom<usize>);
+ | ---------------- this field does not implement `Copy`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0204`.
diff --git a/src/test/compile-fail/range_traits-4.rs b/src/test/ui/range/range_traits-4.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-4.rs
rename to src/test/ui/range/range_traits-4.rs
diff --git a/src/test/ui/range/range_traits-4.stderr b/src/test/ui/range/range_traits-4.stderr
new file mode 100644
index 0000000..cf8ae67
--- /dev/null
+++ b/src/test/ui/range/range_traits-4.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/range_traits-4.rs:19:1
+ |
+LL | fn main() {} //~ ERROR success
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/range_traits-5.rs b/src/test/ui/range/range_traits-5.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-5.rs
rename to src/test/ui/range/range_traits-5.rs
diff --git a/src/test/ui/range/range_traits-5.stderr b/src/test/ui/range/range_traits-5.stderr
new file mode 100644
index 0000000..eadb3a0
--- /dev/null
+++ b/src/test/ui/range/range_traits-5.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/range_traits-5.rs:19:1
+ |
+LL | fn main() {} //~ ERROR success
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/range_traits-6.rs b/src/test/ui/range/range_traits-6.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-6.rs
rename to src/test/ui/range/range_traits-6.rs
diff --git a/src/test/ui/range/range_traits-6.stderr b/src/test/ui/range/range_traits-6.stderr
new file mode 100644
index 0000000..9470540
--- /dev/null
+++ b/src/test/ui/range/range_traits-6.stderr
@@ -0,0 +1,11 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/range_traits-6.rs:13:10
+ |
+LL | #[derive(Copy, Clone)] //~ ERROR Copy
+ | ^^^^
+LL | struct R(RangeInclusive<usize>);
+ | --------------------- this field does not implement `Copy`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0204`.
diff --git a/src/test/compile-fail/range_traits-7.rs b/src/test/ui/range/range_traits-7.rs
similarity index 100%
rename from src/test/compile-fail/range_traits-7.rs
rename to src/test/ui/range/range_traits-7.rs
diff --git a/src/test/ui/range/range_traits-7.stderr b/src/test/ui/range/range_traits-7.stderr
new file mode 100644
index 0000000..516667a
--- /dev/null
+++ b/src/test/ui/range/range_traits-7.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/range_traits-7.rs:19:1
+ |
+LL | fn main() {} //~ ERROR success
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/raw-literal-keywords.rs b/src/test/ui/raw/raw-literal-keywords.rs
similarity index 100%
rename from src/test/ui/raw-literal-keywords.rs
rename to src/test/ui/raw/raw-literal-keywords.rs
diff --git a/src/test/ui/raw-literal-keywords.stderr b/src/test/ui/raw/raw-literal-keywords.stderr
similarity index 100%
rename from src/test/ui/raw-literal-keywords.stderr
rename to src/test/ui/raw/raw-literal-keywords.stderr
diff --git a/src/test/ui/raw-literal-self.rs b/src/test/ui/raw/raw-literal-self.rs
similarity index 100%
rename from src/test/ui/raw-literal-self.rs
rename to src/test/ui/raw/raw-literal-self.rs
diff --git a/src/test/ui/raw-literal-self.stderr b/src/test/ui/raw/raw-literal-self.stderr
similarity index 100%
rename from src/test/ui/raw-literal-self.stderr
rename to src/test/ui/raw/raw-literal-self.stderr
diff --git a/src/test/ui/raw-literal-underscore.rs b/src/test/ui/raw/raw-literal-underscore.rs
similarity index 100%
rename from src/test/ui/raw-literal-underscore.rs
rename to src/test/ui/raw/raw-literal-underscore.rs
diff --git a/src/test/ui/raw-literal-underscore.stderr b/src/test/ui/raw/raw-literal-underscore.stderr
similarity index 100%
rename from src/test/ui/raw-literal-underscore.stderr
rename to src/test/ui/raw/raw-literal-underscore.stderr
diff --git a/src/test/ui/raw_string.rs b/src/test/ui/raw/raw_string.rs
similarity index 100%
rename from src/test/ui/raw_string.rs
rename to src/test/ui/raw/raw_string.rs
diff --git a/src/test/ui/raw_string.stderr b/src/test/ui/raw/raw_string.stderr
similarity index 100%
rename from src/test/ui/raw_string.stderr
rename to src/test/ui/raw/raw_string.stderr
diff --git a/src/test/compile-fail/auxiliary/recursive_reexports.rs b/src/test/ui/recursion/auxiliary/recursive_reexports.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/recursive_reexports.rs
rename to src/test/ui/recursion/auxiliary/recursive_reexports.rs
diff --git a/src/test/compile-fail/recursion.rs b/src/test/ui/recursion/recursion.rs
similarity index 100%
rename from src/test/compile-fail/recursion.rs
rename to src/test/ui/recursion/recursion.rs
diff --git a/src/test/ui/recursion/recursion.stderr b/src/test/ui/recursion/recursion.stderr
new file mode 100644
index 0000000..5953e5c
--- /dev/null
+++ b/src/test/ui/recursion/recursion.stderr
@@ -0,0 +1,14 @@
+error: reached the recursion limit while instantiating `test::<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Cons<Nil>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
+ --> $DIR/recursion.rs:22:1
+ |
+LL | / fn test<T:Dot> (n:isize, i:isize, first:T, second:T) ->isize { //~ ERROR recursion limit
+LL | | match n { 0 => {first.dot(second)}
+LL | | // FIXME(#4287) Error message should be here. It should be
+LL | | // a type error to instantiate `test` at a type other than T.
+LL | | _ => {test (n-1, i+1, Cons {head:2*i+1, tail:first}, Cons{head:i*i, tail:second})}
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/recursive-enum.rs b/src/test/ui/recursion/recursive-enum.rs
similarity index 100%
rename from src/test/compile-fail/recursive-enum.rs
rename to src/test/ui/recursion/recursive-enum.rs
diff --git a/src/test/ui/recursion/recursive-enum.stderr b/src/test/ui/recursion/recursive-enum.stderr
new file mode 100644
index 0000000..c06058b
--- /dev/null
+++ b/src/test/ui/recursion/recursive-enum.stderr
@@ -0,0 +1,13 @@
+error[E0072]: recursive type `list` has infinite size
+ --> $DIR/recursive-enum.rs:11:1
+ |
+LL | enum list<T> { cons(T, list<T>), nil }
+ | ^^^^^^^^^^^^ ------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `list` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/src/test/compile-fail/recursive-reexports.rs b/src/test/ui/recursion/recursive-reexports.rs
similarity index 100%
rename from src/test/compile-fail/recursive-reexports.rs
rename to src/test/ui/recursion/recursive-reexports.rs
diff --git a/src/test/ui/recursion/recursive-reexports.stderr b/src/test/ui/recursion/recursive-reexports.stderr
new file mode 100644
index 0000000..e6b8647
--- /dev/null
+++ b/src/test/ui/recursion/recursive-reexports.stderr
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `S` in module `recursive_reexports`
+ --> $DIR/recursive-reexports.rs:15:32
+ |
+LL | fn f() -> recursive_reexports::S {} //~ ERROR cannot find type `S` in module `recursive_reexports`
+ | ^ not found in `recursive_reexports`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
diff --git a/src/test/ui/recursive-requirements.rs b/src/test/ui/recursion/recursive-requirements.rs
similarity index 100%
rename from src/test/ui/recursive-requirements.rs
rename to src/test/ui/recursion/recursive-requirements.rs
diff --git a/src/test/ui/recursive-requirements.stderr b/src/test/ui/recursion/recursive-requirements.stderr
similarity index 100%
rename from src/test/ui/recursive-requirements.stderr
rename to src/test/ui/recursion/recursive-requirements.stderr
diff --git a/src/test/compile-fail/recursive-static-definition.rs b/src/test/ui/recursion/recursive-static-definition.rs
similarity index 100%
rename from src/test/compile-fail/recursive-static-definition.rs
rename to src/test/ui/recursion/recursive-static-definition.rs
diff --git a/src/test/ui/recursion/recursive-static-definition.stderr b/src/test/ui/recursion/recursive-static-definition.stderr
new file mode 100644
index 0000000..2ab93bf
--- /dev/null
+++ b/src/test/ui/recursion/recursive-static-definition.stderr
@@ -0,0 +1,11 @@
+error[E0391]: cycle detected when const-evaluating `FOO`
+ --> $DIR/recursive-static-definition.rs:11:23
+ |
+LL | pub static FOO: u32 = FOO;
+ | ^^^
+ |
+ = note: ...which again requires const-evaluating `FOO`, completing the cycle
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/recursive-types-are-not-uninhabited.rs b/src/test/ui/recursion/recursive-types-are-not-uninhabited.rs
similarity index 100%
rename from src/test/compile-fail/recursive-types-are-not-uninhabited.rs
rename to src/test/ui/recursion/recursive-types-are-not-uninhabited.rs
diff --git a/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
new file mode 100644
index 0000000..c4d4041
--- /dev/null
+++ b/src/test/ui/recursion/recursive-types-are-not-uninhabited.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in local binding: `Err(_)` not covered
+ --> $DIR/recursive-types-are-not-uninhabited.rs:16:9
+ |
+LL | let Ok(x) = res;
+ | ^^^^^ pattern `Err(_)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/ui/ref-suggestion.nll.stderr b/src/test/ui/ref-suggestion.nll.stderr
new file mode 100644
index 0000000..3fbd497
--- /dev/null
+++ b/src/test/ui/ref-suggestion.nll.stderr
@@ -0,0 +1,34 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/ref-suggestion.rs:14:5
+ |
+LL | let y = x;
+ | - value moved here
+LL | x; //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/ref-suggestion.rs:18:5
+ |
+LL | let mut y = x;
+ | - value moved here
+LL | x; //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/ref-suggestion.rs:26:5
+ |
+LL | (Some(y), ()) => {},
+ | - value moved here
+...
+LL | x; //~ ERROR use of partially moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/ref-suggestion.rs b/src/test/ui/ref-suggestion.rs
similarity index 100%
rename from src/test/compile-fail/ref-suggestion.rs
rename to src/test/ui/ref-suggestion.rs
diff --git a/src/test/ui/ref-suggestion.stderr b/src/test/ui/ref-suggestion.stderr
new file mode 100644
index 0000000..63ee203
--- /dev/null
+++ b/src/test/ui/ref-suggestion.stderr
@@ -0,0 +1,34 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/ref-suggestion.rs:14:5
+ |
+LL | let y = x;
+ | - value moved here
+LL | x; //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `x`
+ --> $DIR/ref-suggestion.rs:18:5
+ |
+LL | let mut y = x;
+ | ----- value moved here
+LL | x; //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error[E0382]: use of partially moved value: `x`
+ --> $DIR/ref-suggestion.rs:26:5
+ |
+LL | (Some(y), ()) => {},
+ | - value moved here
+...
+LL | x; //~ ERROR use of partially moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because the value has type `std::vec::Vec<i32>`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/refutable-pattern-errors.rs b/src/test/ui/refutable-pattern-errors.rs
similarity index 100%
rename from src/test/compile-fail/refutable-pattern-errors.rs
rename to src/test/ui/refutable-pattern-errors.rs
diff --git a/src/test/ui/refutable-pattern-errors.stderr b/src/test/ui/refutable-pattern-errors.stderr
new file mode 100644
index 0000000..c2d5fe0
--- /dev/null
+++ b/src/test/ui/refutable-pattern-errors.stderr
@@ -0,0 +1,15 @@
+error[E0005]: refutable pattern in function argument: `(_, _)` not covered
+ --> $DIR/refutable-pattern-errors.rs:12:9
+ |
+LL | fn func((1, (Some(1), 2..=3)): (isize, (Option<isize>, isize))) { }
+ | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+
+error[E0005]: refutable pattern in local binding: `(_, _)` not covered
+ --> $DIR/refutable-pattern-errors.rs:16:9
+ |
+LL | let (1, (Some(1), 2..=3)) = (1, (None, 2));
+ | ^^^^^^^^^^^^^^^^^^^^^ pattern `(_, _)` not covered
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/compile-fail/refutable-pattern-in-fn-arg.rs b/src/test/ui/refutable-pattern-in-fn-arg.rs
similarity index 100%
rename from src/test/compile-fail/refutable-pattern-in-fn-arg.rs
rename to src/test/ui/refutable-pattern-in-fn-arg.rs
diff --git a/src/test/ui/refutable-pattern-in-fn-arg.stderr b/src/test/ui/refutable-pattern-in-fn-arg.stderr
new file mode 100644
index 0000000..e035326
--- /dev/null
+++ b/src/test/ui/refutable-pattern-in-fn-arg.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in function argument: `_` not covered
+ --> $DIR/refutable-pattern-in-fn-arg.rs:12:14
+ |
+LL | let f = |3: isize| println!("hello");
+ | ^ pattern `_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/compile-fail/regions-fn-subtyping-return-static.rs b/src/test/ui/regions-fn-subtyping-return-static-fail.rs
similarity index 100%
rename from src/test/compile-fail/regions-fn-subtyping-return-static.rs
rename to src/test/ui/regions-fn-subtyping-return-static-fail.rs
diff --git a/src/test/ui/regions-fn-subtyping-return-static-fail.stderr b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr
new file mode 100644
index 0000000..ff4d00a
--- /dev/null
+++ b/src/test/ui/regions-fn-subtyping-return-static-fail.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-fn-subtyping-return-static-fail.rs:51:12
+ |
+LL | want_F(bar); //~ ERROR E0308
+ | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx
+ |
+ = note: expected type `for<'cx> fn(&'cx S) -> &'cx S`
+ found type `for<'a> fn(&'a S) -> &S {bar::<'_>}`
+
+error[E0308]: mismatched types
+ --> $DIR/regions-fn-subtyping-return-static-fail.rs:59:12
+ |
+LL | want_G(baz);
+ | ^^^ expected concrete lifetime, found bound lifetime parameter 'cx
+ |
+ = note: expected type `for<'cx> fn(&'cx S) -> &'static S`
+ found type `for<'r> fn(&'r S) -> &'r S {baz}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/auxiliary/rbmtp_cross_crate_lib.rs b/src/test/ui/regions/auxiliary/rbmtp_cross_crate_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/rbmtp_cross_crate_lib.rs
rename to src/test/ui/regions/auxiliary/rbmtp_cross_crate_lib.rs
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr
new file mode 100644
index 0000000..5f386e5
--- /dev/null
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.nll.stderr
@@ -0,0 +1,25 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/region-borrow-params-issue-29793-big.rs:81:43
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | --------- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+...
+LL | });
+ | - `x` dropped here while still borrowed
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/region-borrow-params-issue-29793-big.rs:81:54
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | --------- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+...
+LL | });
+ | - `y` dropped here while still borrowed
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr
new file mode 100644
index 0000000..23dc39d
--- /dev/null
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.ast.stderr
@@ -0,0 +1,29 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/region-borrow-params-issue-29793-big.rs:81:43
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | --------- ^ borrowed value does not live long enough
+ | |
+ | capture occurs here
+...
+LL | });
+ | - borrowed value dropped before borrower
+ |
+ = note: values in a scope are dropped in the opposite order they are created
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/region-borrow-params-issue-29793-big.rs:81:54
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | --------- ^ borrowed value does not live long enough
+ | |
+ | capture occurs here
+...
+LL | });
+ | - borrowed value dropped before borrower
+ |
+ = note: values in a scope are dropped in the opposite order they are created
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr
new file mode 100644
index 0000000..5f386e5
--- /dev/null
+++ b/src/test/ui/regions/region-borrow-params-issue-29793-big.mir.stderr
@@ -0,0 +1,25 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/region-borrow-params-issue-29793-big.rs:81:43
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | --------- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+...
+LL | });
+ | - `x` dropped here while still borrowed
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/region-borrow-params-issue-29793-big.rs:81:54
+ |
+LL | WrapB::new().set(|t: bool| if t { x } else { y }) // (separate errors for `x` vs `y`)
+ | --------- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+...
+LL | });
+ | - `y` dropped here while still borrowed
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/region-borrow-params-issue-29793-big.rs b/src/test/ui/regions/region-borrow-params-issue-29793-big.rs
similarity index 100%
rename from src/test/compile-fail/region-borrow-params-issue-29793-big.rs
rename to src/test/ui/regions/region-borrow-params-issue-29793-big.rs
diff --git a/src/test/ui/region-borrow-params-issue-29793-small.nll.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr
similarity index 100%
rename from src/test/ui/region-borrow-params-issue-29793-small.nll.stderr
rename to src/test/ui/regions/region-borrow-params-issue-29793-small.nll.stderr
diff --git a/src/test/ui/region-borrow-params-issue-29793-small.rs b/src/test/ui/regions/region-borrow-params-issue-29793-small.rs
similarity index 100%
rename from src/test/ui/region-borrow-params-issue-29793-small.rs
rename to src/test/ui/regions/region-borrow-params-issue-29793-small.rs
diff --git a/src/test/ui/region-borrow-params-issue-29793-small.stderr b/src/test/ui/regions/region-borrow-params-issue-29793-small.stderr
similarity index 100%
rename from src/test/ui/region-borrow-params-issue-29793-small.stderr
rename to src/test/ui/regions/region-borrow-params-issue-29793-small.stderr
diff --git a/src/test/compile-fail/region-bound-extra-bound-in-inherent-impl.rs b/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs
similarity index 100%
rename from src/test/compile-fail/region-bound-extra-bound-in-inherent-impl.rs
rename to src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.rs
diff --git a/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.stderr b/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.stderr
new file mode 100644
index 0000000..585ccf4
--- /dev/null
+++ b/src/test/ui/regions/region-bound-extra-bound-in-inherent-impl.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/region-bound-extra-bound-in-inherent-impl.rs:26:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr
new file mode 100644
index 0000000..da6ebaa
--- /dev/null
+++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.nll.stderr
@@ -0,0 +1,14 @@
+error[E0505]: cannot move out of `f` because it is borrowed
+ --> $DIR/region-bound-on-closure-outlives-call.rs:12:25
+ |
+LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f`
+ | --------------------^--
+ | || | |
+ | || | move out of `f` occurs here
+ | || borrow occurs due to use in closure
+ | |borrow of `f` occurs here
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/region-bound-on-closure-outlives-call.rs b/src/test/ui/regions/region-bound-on-closure-outlives-call.rs
similarity index 100%
rename from src/test/compile-fail/region-bound-on-closure-outlives-call.rs
rename to src/test/ui/regions/region-bound-on-closure-outlives-call.rs
diff --git a/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr
new file mode 100644
index 0000000..7adf68e
--- /dev/null
+++ b/src/test/ui/regions/region-bound-on-closure-outlives-call.stderr
@@ -0,0 +1,11 @@
+error[E0505]: cannot move out of `f` because it is borrowed
+ --> $DIR/region-bound-on-closure-outlives-call.rs:12:25
+ |
+LL | (|x| f(x))(call_rec(f)) //~ ERROR cannot move out of `f`
+ | --- ^ move out of `f` occurs here
+ | |
+ | borrow of `f` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/region-bound-same-bounds-in-trait-and-impl.rs b/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs
similarity index 100%
rename from src/test/compile-fail/region-bound-same-bounds-in-trait-and-impl.rs
rename to src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.rs
diff --git a/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.stderr b/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.stderr
new file mode 100644
index 0000000..ce9dd59
--- /dev/null
+++ b/src/test/ui/regions/region-bound-same-bounds-in-trait-and-impl.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/region-bound-same-bounds-in-trait-and-impl.rs:27:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/region-bounds-on-objects-and-type-parameters.rs b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs
similarity index 100%
rename from src/test/compile-fail/region-bounds-on-objects-and-type-parameters.rs
rename to src/test/ui/regions/region-bounds-on-objects-and-type-parameters.rs
diff --git a/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
new file mode 100644
index 0000000..7d1a836
--- /dev/null
+++ b/src/test/ui/regions/region-bounds-on-objects-and-type-parameters.stderr
@@ -0,0 +1,35 @@
+error[E0226]: only a single explicit lifetime bound is permitted
+ --> $DIR/region-bounds-on-objects-and-type-parameters.rs:31:22
+ |
+LL | z: Box<Is<'a>+'b+'c>,
+ | ^^
+
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/region-bounds-on-objects-and-type-parameters.rs:31:5
+ |
+LL | z: Box<Is<'a>+'b+'c>,
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 21:15
+ --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:15
+ |
+LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used
+ | ^^
+note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 21:12
+ --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:12
+ |
+LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used
+ | ^^
+
+error[E0392]: parameter `'c` is never used
+ --> $DIR/region-bounds-on-objects-and-type-parameters.rs:21:18
+ |
+LL | struct Foo<'a,'b,'c> { //~ ERROR parameter `'c` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'c` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0226, E0392, E0478.
+For more information about an error, try `rustc --explain E0226`.
diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr
new file mode 100644
index 0000000..9fc12ae
--- /dev/null
+++ b/src/test/ui/regions/region-invariant-static-error-reporting.nll.stderr
@@ -0,0 +1,22 @@
+warning: not reporting region error due to nll
+ --> $DIR/region-invariant-static-error-reporting.rs:24:15
+ |
+LL | let bad = if x.is_some() {
+ | _______________^
+LL | | x.unwrap()
+LL | | } else {
+LL | | mk_static()
+LL | | };
+ | |_____^
+
+error: borrowed data escapes outside of function
+ --> $DIR/region-invariant-static-error-reporting.rs:25:9
+ |
+LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
+ | - `x` is a reference that is only valid in the function body
+LL | let bad = if x.is_some() {
+LL | x.unwrap()
+ | ^^^^^^^^^^ `x` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/region-invariant-static-error-reporting.rs b/src/test/ui/regions/region-invariant-static-error-reporting.rs
similarity index 100%
rename from src/test/compile-fail/region-invariant-static-error-reporting.rs
rename to src/test/ui/regions/region-invariant-static-error-reporting.rs
diff --git a/src/test/ui/regions/region-invariant-static-error-reporting.stderr b/src/test/ui/regions/region-invariant-static-error-reporting.stderr
new file mode 100644
index 0000000..a1f6556
--- /dev/null
+++ b/src/test/ui/regions/region-invariant-static-error-reporting.stderr
@@ -0,0 +1,23 @@
+error[E0308]: if and else have incompatible types
+ --> $DIR/region-invariant-static-error-reporting.rs:24:15
+ |
+LL | let bad = if x.is_some() {
+ | _______________^
+LL | | x.unwrap()
+LL | | } else {
+LL | | mk_static()
+LL | | };
+ | |_____^ lifetime mismatch
+ |
+ = note: expected type `Invariant<'a>`
+ found type `Invariant<'static>`
+note: the lifetime 'a as defined on the function body at 23:10...
+ --> $DIR/region-invariant-static-error-reporting.rs:23:10
+ |
+LL | fn unify<'a>(x: Option<Invariant<'a>>, f: fn(Invariant<'a>)) {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr
new file mode 100644
index 0000000..9124347
--- /dev/null
+++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.nll.stderr
@@ -0,0 +1,24 @@
+warning: not reporting region error due to nll
+ --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:18:10
+ |
+LL | *x = *y; //~ ERROR E0623
+ | ^^
+
+warning: not reporting region error due to nll
+ --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:24:5
+ |
+LL | a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623]
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:30:43
+ |
+LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
+ | ^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+ found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/region-lifetime-bounds-on-fns-where-clause.rs
rename to src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs
diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
new file mode 100644
index 0000000..0ca7ee8
--- /dev/null
+++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.stderr
@@ -0,0 +1,31 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:18:10
+ |
+LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
+ | --------- --------- these two types are declared with different lifetimes...
+LL | // Illegal now because there is no `'b:'a` declaration.
+LL | *x = *y; //~ ERROR E0623
+ | ^^ ...but data from `y` flows into `x` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:24:7
+ |
+LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
+ | --------- --------- these two types are declared with different lifetimes...
+...
+LL | a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623]
+ | ^ ...but data from `y` flows into `x` here
+
+error[E0308]: mismatched types
+ --> $DIR/region-lifetime-bounds-on-fns-where-clause.rs:30:43
+ |
+LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
+ | ^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+ found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0308, E0623.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr
new file mode 100644
index 0000000..655b199
--- /dev/null
+++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.nll.stderr
@@ -0,0 +1,30 @@
+warning: not reporting region error due to nll
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:19:10
+ |
+LL | *x = *y; //~ ERROR E0623
+ | ^^
+
+warning: not reporting region error due to nll
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:20:10
+ |
+LL | *z = *y; //~ ERROR E0623
+ | ^^
+
+warning: not reporting region error due to nll
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:26:5
+ |
+LL | a(x, y, z); //~ ERROR 26:7: 26:8: lifetime mismatch [E0623]
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:32:56
+ |
+LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types
+ | ^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
+ found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/region-multiple-lifetime-bounds-on-fns-where-clause.rs
rename to src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.rs
diff --git a/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
new file mode 100644
index 0000000..26e24b2
--- /dev/null
+++ b/src/test/ui/regions/region-multiple-lifetime-bounds-on-fns-where-clause.stderr
@@ -0,0 +1,42 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:19:10
+ |
+LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
+ | --------- --------- these two types are declared with different lifetimes...
+LL | // Illegal now because there is no `'b:'a` declaration.
+LL | *x = *y; //~ ERROR E0623
+ | ^^ ...but data from `y` flows into `x` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:20:10
+ |
+LL | fn b<'a, 'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
+ | --------- ---------
+ | |
+ | these two types are declared with different lifetimes...
+...
+LL | *z = *y; //~ ERROR E0623
+ | ^^ ...but data from `y` flows into `z` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:26:7
+ |
+LL | fn c<'a,'b, 'c>(x: &mut &'a isize, y: &mut &'b isize, z: &mut &'c isize) {
+ | --------- --------- these two types are declared with different lifetimes...
+...
+LL | a(x, y, z); //~ ERROR 26:7: 26:8: lifetime mismatch [E0623]
+ | ^ ...but data from `y` flows into `x` here
+
+error[E0308]: mismatched types
+ --> $DIR/region-multiple-lifetime-bounds-on-fns-where-clause.rs:32:56
+ |
+LL | let _: fn(&mut &isize, &mut &isize, &mut &isize) = a; //~ ERROR mismatched types
+ | ^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `for<'r, 's, 't0, 't1, 't2, 't3> fn(&'r mut &'s isize, &'t0 mut &'t1 isize, &'t2 mut &'t3 isize)`
+ found type `for<'r, 's, 't0> fn(&'r mut &isize, &'s mut &isize, &'t0 mut &isize) {a::<'_, '_, '_>}`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0308, E0623.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/region-object-lifetime-1.rs b/src/test/ui/regions/region-object-lifetime-1.rs
similarity index 100%
rename from src/test/compile-fail/region-object-lifetime-1.rs
rename to src/test/ui/regions/region-object-lifetime-1.rs
diff --git a/src/test/ui/regions/region-object-lifetime-1.stderr b/src/test/ui/regions/region-object-lifetime-1.stderr
new file mode 100644
index 0000000..39deed3
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-1.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/region-object-lifetime-1.rs:28:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-object-lifetime-2.nll.stderr b/src/test/ui/regions/region-object-lifetime-2.nll.stderr
new file mode 100644
index 0000000..135a115
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-2.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/region-object-lifetime-2.rs:20:7
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/region-object-lifetime-2.rs:20:5
+ |
+LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/region-object-lifetime-2.rs b/src/test/ui/regions/region-object-lifetime-2.rs
similarity index 100%
rename from src/test/compile-fail/region-object-lifetime-2.rs
rename to src/test/ui/regions/region-object-lifetime-2.rs
diff --git a/src/test/ui/regions/region-object-lifetime-2.stderr b/src/test/ui/regions/region-object-lifetime-2.stderr
new file mode 100644
index 0000000..e396680
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-2.stderr
@@ -0,0 +1,30 @@
+error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
+ --> $DIR/region-object-lifetime-2.rs:20:7
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:42...
+ --> $DIR/region-object-lifetime-2.rs:19:42
+ |
+LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {
+ | ^^
+note: ...so that the type `(dyn Foo + 'a)` is not borrowed for too long
+ --> $DIR/region-object-lifetime-2.rs:20:5
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 19:45...
+ --> $DIR/region-object-lifetime-2.rs:19:45
+ |
+LL | fn borrowed_receiver_different_lifetimes<'a,'b>(x: &'a Foo) -> &'b () {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/region-object-lifetime-2.rs:20:5
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/compile-fail/region-object-lifetime-3.rs b/src/test/ui/regions/region-object-lifetime-3.rs
similarity index 100%
rename from src/test/compile-fail/region-object-lifetime-3.rs
rename to src/test/ui/regions/region-object-lifetime-3.rs
diff --git a/src/test/ui/regions/region-object-lifetime-3.stderr b/src/test/ui/regions/region-object-lifetime-3.stderr
new file mode 100644
index 0000000..9431e8f
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-3.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/region-object-lifetime-3.rs:28:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/region-object-lifetime-4.nll.stderr b/src/test/ui/regions/region-object-lifetime-4.nll.stderr
new file mode 100644
index 0000000..7bae6cc
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-4.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/region-object-lifetime-4.rs:22:7
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/region-object-lifetime-4.rs:22:5
+ |
+LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^^^^^ argument requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/region-object-lifetime-4.rs b/src/test/ui/regions/region-object-lifetime-4.rs
similarity index 100%
rename from src/test/compile-fail/region-object-lifetime-4.rs
rename to src/test/ui/regions/region-object-lifetime-4.rs
diff --git a/src/test/ui/regions/region-object-lifetime-4.stderr b/src/test/ui/regions/region-object-lifetime-4.stderr
new file mode 100644
index 0000000..ef62afb
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-4.stderr
@@ -0,0 +1,30 @@
+error[E0495]: cannot infer an appropriate lifetime for autoref due to conflicting requirements
+ --> $DIR/region-object-lifetime-4.rs:22:7
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 21:41...
+ --> $DIR/region-object-lifetime-4.rs:21:41
+ |
+LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/region-object-lifetime-4.rs:22:5
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 21:44...
+ --> $DIR/region-object-lifetime-4.rs:21:44
+ |
+LL | fn borrowed_receiver_related_lifetimes2<'a,'b>(x: &'a (Foo+'b)) -> &'b () {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/region-object-lifetime-4.rs:22:5
+ |
+LL | x.borrowed() //~ ERROR cannot infer
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/region-object-lifetime-5.nll.stderr b/src/test/ui/regions/region-object-lifetime-5.nll.stderr
new file mode 100644
index 0000000..3bfa5ec
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-5.nll.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `*x` does not live long enough
+ --> $DIR/region-object-lifetime-5.rs:21:5
+ |
+LL | x.borrowed() //~ ERROR `*x` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - `*x` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/region-object-lifetime-5.rs b/src/test/ui/regions/region-object-lifetime-5.rs
similarity index 100%
rename from src/test/compile-fail/region-object-lifetime-5.rs
rename to src/test/ui/regions/region-object-lifetime-5.rs
diff --git a/src/test/ui/regions/region-object-lifetime-5.stderr b/src/test/ui/regions/region-object-lifetime-5.stderr
new file mode 100644
index 0000000..2dbdacf
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-5.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `*x` does not live long enough
+ --> $DIR/region-object-lifetime-5.rs:21:5
+ |
+LL | x.borrowed() //~ ERROR `*x` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
new file mode 100644
index 0000000..8338cf6
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-in-coercion.nll.stderr
@@ -0,0 +1,74 @@
+warning: not reporting region error due to nll
+ --> $DIR/region-object-lifetime-in-coercion.rs:18:42
+ |
+LL | let x: Box<Foo + 'static> = Box::new(v);
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/region-object-lifetime-in-coercion.rs:24:14
+ |
+LL | Box::new(v)
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/region-object-lifetime-in-coercion.rs:31:14
+ |
+LL | Box::new(v)
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/region-object-lifetime-in-coercion.rs:36:14
+ |
+LL | Box::new(v)
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/region-object-lifetime-in-coercion.rs:18:33
+ |
+LL | fn a(v: &[u8]) -> Box<Foo + 'static> {
+ | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL | let x: Box<Foo + 'static> = Box::new(v);
+ | ^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/region-object-lifetime-in-coercion.rs:23:38
+ |
+LL | fn b(v: &[u8]) -> Box<Foo + 'static> {
+ | _________-----________________________^
+ | | |
+ | | help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL | | Box::new(v)
+LL | | //~^ ERROR explicit lifetime required in the type of `v` [E0621]
+LL | | }
+ | |_^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/region-object-lifetime-in-coercion.rs:28:28
+ |
+LL | fn c(v: &[u8]) -> Box<Foo> {
+ | _________-----______________^
+ | | |
+ | | help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL | | // same as previous case due to RFC 599
+LL | |
+LL | | Box::new(v)
+LL | | //~^ ERROR explicit lifetime required in the type of `v` [E0621]
+LL | | }
+ | |_^ lifetime `'static` required
+
+error: unsatisfied lifetime constraints
+ --> $DIR/region-object-lifetime-in-coercion.rs:35:41
+ |
+LL | fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {
+ | ______--_--______________________________^
+ | | | |
+ | | | lifetime `'b` defined here
+ | | lifetime `'a` defined here
+LL | | Box::new(v)
+LL | | //~^ ERROR cannot infer an appropriate lifetime due to conflicting
+LL | | }
+ | |_^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/region-object-lifetime-in-coercion.rs b/src/test/ui/regions/region-object-lifetime-in-coercion.rs
similarity index 100%
rename from src/test/compile-fail/region-object-lifetime-in-coercion.rs
rename to src/test/ui/regions/region-object-lifetime-in-coercion.rs
diff --git a/src/test/ui/regions/region-object-lifetime-in-coercion.stderr b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
new file mode 100644
index 0000000..ac8c4d3
--- /dev/null
+++ b/src/test/ui/regions/region-object-lifetime-in-coercion.stderr
@@ -0,0 +1,52 @@
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/region-object-lifetime-in-coercion.rs:18:33
+ |
+LL | fn a(v: &[u8]) -> Box<Foo + 'static> {
+ | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL | let x: Box<Foo + 'static> = Box::new(v);
+ | ^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/region-object-lifetime-in-coercion.rs:24:5
+ |
+LL | fn b(v: &[u8]) -> Box<Foo + 'static> {
+ | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+LL | Box::new(v)
+ | ^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/region-object-lifetime-in-coercion.rs:31:5
+ |
+LL | fn c(v: &[u8]) -> Box<Foo> {
+ | ----- help: add explicit lifetime `'static` to the type of `v`: `&'static [u8]`
+...
+LL | Box::new(v)
+ | ^^^^^^^^^^^ lifetime `'static` required
+
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/region-object-lifetime-in-coercion.rs:36:14
+ |
+LL | Box::new(v)
+ | ^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 35:6...
+ --> $DIR/region-object-lifetime-in-coercion.rs:35:6
+ |
+LL | fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected &[u8]
+ found &'a [u8]
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 35:9...
+ --> $DIR/region-object-lifetime-in-coercion.rs:35:9
+ |
+LL | fn d<'a,'b>(v: &'a [u8]) -> Box<Foo+'b> {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected std::boxed::Box<(dyn Foo + 'b)>
+ found std::boxed::Box<dyn Foo>
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0495, E0621.
+For more information about an error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-addr-of-arg.nll.stderr b/src/test/ui/regions/regions-addr-of-arg.nll.stderr
new file mode 100644
index 0000000..9bfc80c
--- /dev/null
+++ b/src/test/ui/regions/regions-addr-of-arg.nll.stderr
@@ -0,0 +1,27 @@
+error[E0597]: `a` does not live long enough
+ --> $DIR/regions-addr-of-arg.rs:15:30
+ |
+LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - `a` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `a` does not live long enough
+ --> $DIR/regions-addr-of-arg.rs:23:5
+ |
+LL | &a //~ ERROR `a` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - `a` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 22:8...
+ --> $DIR/regions-addr-of-arg.rs:22:8
+ |
+LL | fn zed<'a>(a: isize) -> &'a isize {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-addr-of-arg.rs b/src/test/ui/regions/regions-addr-of-arg.rs
similarity index 100%
rename from src/test/compile-fail/regions-addr-of-arg.rs
rename to src/test/ui/regions/regions-addr-of-arg.rs
diff --git a/src/test/ui/regions/regions-addr-of-arg.stderr b/src/test/ui/regions/regions-addr-of-arg.stderr
new file mode 100644
index 0000000..9158a4a
--- /dev/null
+++ b/src/test/ui/regions/regions-addr-of-arg.stderr
@@ -0,0 +1,27 @@
+error[E0597]: `a` does not live long enough
+ --> $DIR/regions-addr-of-arg.rs:15:31
+ |
+LL | let _p: &'static isize = &a; //~ ERROR `a` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `a` does not live long enough
+ --> $DIR/regions-addr-of-arg.rs:23:6
+ |
+LL | &a //~ ERROR `a` does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 22:8...
+ --> $DIR/regions-addr-of-arg.rs:22:8
+ |
+LL | fn zed<'a>(a: isize) -> &'a isize {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-addr-of-self.nll.stderr b/src/test/ui/regions/regions-addr-of-self.nll.stderr
new file mode 100644
index 0000000..cad1384
--- /dev/null
+++ b/src/test/ui/regions/regions-addr-of-self.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-addr-of-self.rs:17:37
+ |
+LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-addr-of-self.rs:17:37
+ |
+LL | pub fn chase_cat(&mut self) {
+ | - let's call the lifetime of this reference `'1`
+LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-addr-of-self.rs b/src/test/ui/regions/regions-addr-of-self.rs
similarity index 100%
rename from src/test/compile-fail/regions-addr-of-self.rs
rename to src/test/ui/regions/regions-addr-of-self.rs
diff --git a/src/test/ui/regions/regions-addr-of-self.stderr b/src/test/ui/regions/regions-addr-of-self.stderr
new file mode 100644
index 0000000..387aeeb
--- /dev/null
+++ b/src/test/ui/regions/regions-addr-of-self.stderr
@@ -0,0 +1,29 @@
+error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
+ --> $DIR/regions-addr-of-self.rs:17:37
+ |
+LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 16:5...
+ --> $DIR/regions-addr-of-self.rs:16:5
+ |
+LL | / pub fn chase_cat(&mut self) {
+LL | | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
+LL | | *p += 1;
+LL | | }
+ | |_____^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-addr-of-self.rs:17:37
+ |
+LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^^^^^^^^
+ = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-addr-of-self.rs:17:37
+ |
+LL | let p: &'static mut usize = &mut self.cats_chased; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
new file mode 100644
index 0000000..0ee8617
--- /dev/null
+++ b/src/test/ui/regions/regions-addr-of-upvar-self.nll.stderr
@@ -0,0 +1,40 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-addr-of-upvar-self.rs:20:41
+ |
+LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-addr-of-upvar-self.rs:20:41
+ |
+LL | let _f = || {
+ | -- lifetime `'1` represents this closure's body
+LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^ requires that `'1` must outlive `'static`
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-addr-of-upvar-self.rs:19:13
+ |
+LL | pub fn chase_cat(&mut self) {
+ | - let's call the lifetime of this reference `'1`
+LL | let _f = || {
+ | ^^ requires that `'1` must outlive `'static`
+
+error[E0597]: `self` does not live long enough
+ --> $DIR/regions-addr-of-upvar-self.rs:20:46
+ |
+LL | let _f = || {
+ | -- value captured here
+LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `self` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-addr-of-upvar-self.rs b/src/test/ui/regions/regions-addr-of-upvar-self.rs
similarity index 100%
rename from src/test/compile-fail/regions-addr-of-upvar-self.rs
rename to src/test/ui/regions/regions-addr-of-upvar-self.rs
diff --git a/src/test/ui/regions/regions-addr-of-upvar-self.stderr b/src/test/ui/regions/regions-addr-of-upvar-self.stderr
new file mode 100644
index 0000000..35e7212
--- /dev/null
+++ b/src/test/ui/regions/regions-addr-of-upvar-self.stderr
@@ -0,0 +1,26 @@
+error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
+ --> $DIR/regions-addr-of-upvar-self.rs:20:41
+ |
+LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime as defined on the body at 19:18...
+ --> $DIR/regions-addr-of-upvar-self.rs:19:18
+ |
+LL | let _f = || {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-addr-of-upvar-self.rs:20:41
+ |
+LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^
+ = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-addr-of-upvar-self.rs:20:41
+ |
+LL | let p: &'static mut usize = &mut self.food; //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr
new file mode 100644
index 0000000..f342155
--- /dev/null
+++ b/src/test/ui/regions/regions-adjusted-lvalue-op.nll.stderr
@@ -0,0 +1,23 @@
+error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
+ --> $DIR/regions-adjusted-lvalue-op.rs:24:16
+ |
+LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because
+ | -----------^^-
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+ | borrow later used here
+
+error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
+ --> $DIR/regions-adjusted-lvalue-op.rs:25:16
+ |
+LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because
+ | -----------^^-
+ | | | |
+ | | | immutable borrow occurs here
+ | | mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/compile-fail/regions-adjusted-lvalue-op.rs b/src/test/ui/regions/regions-adjusted-lvalue-op.rs
similarity index 100%
rename from src/test/compile-fail/regions-adjusted-lvalue-op.rs
rename to src/test/ui/regions/regions-adjusted-lvalue-op.rs
diff --git a/src/test/ui/regions/regions-adjusted-lvalue-op.stderr b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr
new file mode 100644
index 0000000..95228d9
--- /dev/null
+++ b/src/test/ui/regions/regions-adjusted-lvalue-op.stderr
@@ -0,0 +1,21 @@
+error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
+ --> $DIR/regions-adjusted-lvalue-op.rs:24:17
+ |
+LL | v[0].oh_no(&v); //~ ERROR cannot borrow `v` as immutable because
+ | - ^- mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error[E0502]: cannot borrow `v` as immutable because it is also borrowed as mutable
+ --> $DIR/regions-adjusted-lvalue-op.rs:25:17
+ |
+LL | (*v).oh_no(&v); //~ ERROR cannot borrow `v` as immutable because
+ | - ^- mutable borrow ends here
+ | | |
+ | | immutable borrow occurs here
+ | mutable borrow occurs here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0502`.
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs
new file mode 100644
index 0000000..96eb65d
--- /dev/null
+++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.rs
@@ -0,0 +1,56 @@
+// Copyright 2015 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-compare-mode-nll
+
+// Test that we are imposing the requirement that every associated
+// type of a bound that appears in the where clause on a struct must
+// outlive the location in which the type appears, even when the
+// associted type is in a supertype. Issue #22246.
+
+#![allow(dead_code)]
+
+///////////////////////////////////////////////////////////////////////////
+
+pub trait TheTrait {
+ type TheAssocType;
+}
+
+pub trait TheSubTrait : TheTrait {
+}
+
+pub struct TheType<'b> {
+ m: [fn(&'b()); 0]
+}
+
+impl<'b> TheTrait for TheType<'b> {
+ type TheAssocType = &'b ();
+}
+
+impl<'b> TheSubTrait for TheType<'b> {
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+pub struct WithAssoc<T:TheSubTrait> {
+ m: [T; 0]
+}
+
+fn with_assoc<'a,'b>() {
+ // For this type to be valid, the rules require that all
+ // associated types of traits that appear in `WithAssoc` must
+ // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
+ // which is &'b (), must outlive 'a.
+
+ let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
+}
+
+fn main() {
+}
diff --git a/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr
new file mode 100644
index 0000000..7b7881d
--- /dev/null
+++ b/src/test/ui/regions/regions-assoc-type-in-supertrait-outlives-container.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:52:12
+ |
+LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 46:15
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:46:15
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 46:18
+ --> $DIR/regions-assoc-type-in-supertrait-outlives-container.rs:46:18
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.rs
similarity index 100%
rename from src/test/compile-fail/regions-assoc-type-region-bound-in-trait-not-met.rs
rename to src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.rs
diff --git a/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr
new file mode 100644
index 0000000..2261e92
--- /dev/null
+++ b/src/test/ui/regions/regions-assoc-type-region-bound-in-trait-not-met.stderr
@@ -0,0 +1,49 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:24:10
+ |
+LL | impl<'a> Foo<'static> for &'a i32 {
+ | ^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 24:6...
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:24:6
+ |
+LL | impl<'a> Foo<'static> for &'a i32 {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected Foo<'static>
+ found Foo<'static>
+ = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that the type `&i32` will meet its required lifetime bounds
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:24:10
+ |
+LL | impl<'a> Foo<'static> for &'a i32 {
+ | ^^^^^^^^^^^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:13
+ |
+LL | impl<'a,'b> Foo<'b> for &'a i64 {
+ | ^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 29:6...
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:6
+ |
+LL | impl<'a,'b> Foo<'b> for &'a i64 {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected Foo<'b>
+ found Foo<'_>
+note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 29:9...
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:9
+ |
+LL | impl<'a,'b> Foo<'b> for &'a i64 {
+ | ^^
+note: ...so that the type `&i32` will meet its required lifetime bounds
+ --> $DIR/regions-assoc-type-region-bound-in-trait-not-met.rs:29:13
+ |
+LL | impl<'a,'b> Foo<'b> for &'a i64 {
+ | ^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.rs
similarity index 100%
rename from src/test/compile-fail/regions-assoc-type-static-bound-in-trait-not-met.rs
rename to src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.rs
diff --git a/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr
new file mode 100644
index 0000000..a7ae685
--- /dev/null
+++ b/src/test/ui/regions/regions-assoc-type-static-bound-in-trait-not-met.stderr
@@ -0,0 +1,24 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:19:10
+ |
+LL | impl<'a> Foo for &'a i32 {
+ | ^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 19:6...
+ --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:19:6
+ |
+LL | impl<'a> Foo for &'a i32 {
+ | ^^
+ = note: ...so that the types are compatible:
+ expected Foo
+ found Foo
+ = note: but, the lifetime must be valid for the static lifetime...
+note: ...so that the type `&i32` will meet its required lifetime bounds
+ --> $DIR/regions-assoc-type-static-bound-in-trait-not-met.rs:19:10
+ |
+LL | impl<'a> Foo for &'a i32 {
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs
new file mode 100644
index 0000000..8a15656
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.rs
@@ -0,0 +1,75 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test which of the builtin types are considered sendable. The tests
+// in this file all test region bound and lifetime violations that are
+// detected during type check.
+
+trait Dummy : 'static { }
+fn assert_send<T:'static>() { }
+
+// lifetime pointers with 'static lifetime are ok
+
+fn static_lifime_ok<'a,T,U:Send>(_: &'a isize) {
+ assert_send::<&'static isize>();
+ assert_send::<&'static str>();
+ assert_send::<&'static [isize]>();
+
+ // whether or not they are mutable
+ assert_send::<&'static mut isize>();
+}
+
+// otherwise lifetime pointers are not ok
+
+fn param_not_ok<'a>(x: &'a isize) {
+ assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime
+}
+
+fn param_not_ok1<'a>(_: &'a isize) {
+ assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime
+}
+
+fn param_not_ok2<'a>(_: &'a isize) {
+ assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime
+}
+
+// boxes are ok
+
+fn box_ok() {
+ assert_send::<Box<isize>>();
+ assert_send::<String>();
+ assert_send::<Vec<isize>>();
+}
+
+// but not if they own a bad thing
+
+fn box_with_region_not_ok<'a>() {
+ assert_send::<Box<&'a isize>>(); //~ ERROR does not fulfill the required lifetime
+}
+
+// raw pointers are ok unless they point at unsendable things
+
+fn unsafe_ok1<'a>(_: &'a isize) {
+ assert_send::<*const isize>();
+ assert_send::<*mut isize>();
+}
+
+fn unsafe_ok2<'a>(_: &'a isize) {
+ assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime
+}
+
+fn unsafe_ok3<'a>(_: &'a isize) {
+ assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime
+}
+
+fn main() {
+}
diff --git a/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr
new file mode 100644
index 0000000..2cd8270
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-by-trait-requiring-static.stderr
@@ -0,0 +1,51 @@
+error[E0477]: the type `&'a isize` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-by-trait-requiring-static.rs:34:5
+ |
+LL | assert_send::<&'a isize>(); //~ ERROR does not fulfill the required lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0477]: the type `&'a str` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-by-trait-requiring-static.rs:38:5
+ |
+LL | assert_send::<&'a str>(); //~ ERROR does not fulfill the required lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0477]: the type `&'a [isize]` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-by-trait-requiring-static.rs:42:5
+ |
+LL | assert_send::<&'a [isize]>(); //~ ERROR does not fulfill the required lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0477]: the type `std::boxed::Box<&'a isize>` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-by-trait-requiring-static.rs:56:5
+ |
+LL | assert_send::<Box<&'a isize>>(); //~ ERROR does not fulfill the required lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0477]: the type `*const &'a isize` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-by-trait-requiring-static.rs:67:5
+ |
+LL | assert_send::<*const &'a isize>(); //~ ERROR does not fulfill the required lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error[E0477]: the type `*mut &'a isize` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-by-trait-requiring-static.rs:71:5
+ |
+LL | assert_send::<*mut &'a isize>(); //~ ERROR does not fulfill the required lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0477`.
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr
new file mode 100644
index 0000000..553eede
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:30:7
+ |
+LL | a.bigger_region(b) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623]
+ | ^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:30:5
+ |
+LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) {
+ | -- -- lifetime `'y` defined here
+ | |
+ | lifetime `'x` defined here
+LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold.
+LL | a.bigger_region(b) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623]
+ | ^^^^^^^^^^^^^^^^^^ argument requires that `'y` must outlive `'x`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs
similarity index 100%
rename from src/test/compile-fail/regions-bounded-method-type-parameters-cross-crate.rs
rename to src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.rs
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr
new file mode 100644
index 0000000..898629d
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-method-type-parameters-cross-crate.stderr
@@ -0,0 +1,12 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-bounded-method-type-parameters-cross-crate.rs:30:7
+ |
+LL | fn call_bigger_region<'x, 'y>(a: Inv<'x>, b: Inv<'y>) {
+ | ------- ------- these two types are declared with different lifetimes...
+LL | // Here the value provided for 'y is 'y, and hence 'y:'x does not hold.
+LL | a.bigger_region(b) //~ ERROR 30:7: 30:20: lifetime mismatch [E0623]
+ | ^^^^^^^^^^^^^ ...but data from `b` flows into `a` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr
new file mode 100644
index 0000000..adcf492
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:30:7
+ |
+LL | f.method(b); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623]
+ | ^^^^^^
+
+error: borrowed data escapes outside of function
+ --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:30:5
+ |
+LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) {
+ | - - `b` is a reference that is only valid in the function body
+ | |
+ | `a` is declared here, outside of the function body
+LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold.
+LL | f.method(b); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623]
+ | ^^^^^^^^^^^ `b` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs
similarity index 100%
rename from src/test/compile-fail/regions-bounded-method-type-parameters-trait-bound.rs
rename to src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.rs
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr
new file mode 100644
index 0000000..f9f9c38
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-method-type-parameters-trait-bound.stderr
@@ -0,0 +1,12 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-bounded-method-type-parameters-trait-bound.rs:30:7
+ |
+LL | fn caller2<'a,'b,F:Foo<'a>>(a: Inv<'a>, b: Inv<'b>, f: F) {
+ | ------- ------- these two types are declared with different lifetimes...
+LL | // Here the value provided for 'y is 'b, and hence 'b:'a does not hold.
+LL | f.method(b); //~ ERROR 30:7: 30:13: lifetime mismatch [E0623]
+ | ^^^^^^ ...but data from `b` flows into `a` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.rs b/src/test/ui/regions/regions-bounded-method-type-parameters.rs
new file mode 100644
index 0000000..b53c80c
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-method-type-parameters.rs
@@ -0,0 +1,28 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// ignore-compare-mode-nll
+
+// Check that explicit region bounds are allowed on the various
+// nominal types (but not on other types) and that they are type
+// checked.
+
+struct Foo;
+
+impl Foo {
+ fn some_method<A:'static>(self) { }
+}
+
+fn caller<'a>(x: &isize) {
+ Foo.some_method::<&'a isize>();
+ //~^ ERROR does not fulfill the required lifetime
+}
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-bounded-method-type-parameters.stderr b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr
new file mode 100644
index 0000000..b8953a1
--- /dev/null
+++ b/src/test/ui/regions/regions-bounded-method-type-parameters.stderr
@@ -0,0 +1,11 @@
+error[E0477]: the type `&'a isize` does not fulfill the required lifetime
+ --> $DIR/regions-bounded-method-type-parameters.rs:24:9
+ |
+LL | Foo.some_method::<&'a isize>();
+ | ^^^^^^^^^^^
+ |
+ = note: type must satisfy the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0477`.
diff --git a/src/test/ui/regions/regions-bounds.nll.stderr b/src/test/ui/regions/regions-bounds.nll.stderr
new file mode 100644
index 0000000..a59a485
--- /dev/null
+++ b/src/test/ui/regions/regions-bounds.nll.stderr
@@ -0,0 +1,34 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-bounds.rs:19:12
+ |
+LL | return e; //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-bounds.rs:23:12
+ |
+LL | return e; //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-bounds.rs:19:12
+ |
+LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | return e; //~ ERROR mismatched types
+ | ^ returning this value requires that `'a` must outlive `'b`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-bounds.rs:23:12
+ |
+LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | return e; //~ ERROR mismatched types
+ | ^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/ui/regions/regions-bounds.rs
similarity index 100%
rename from src/test/compile-fail/regions-bounds.rs
rename to src/test/ui/regions/regions-bounds.rs
diff --git a/src/test/ui/regions/regions-bounds.stderr b/src/test/ui/regions/regions-bounds.stderr
new file mode 100644
index 0000000..7d5a47c
--- /dev/null
+++ b/src/test/ui/regions/regions-bounds.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-bounds.rs:19:12
+ |
+LL | return e; //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `an_enum<'b>`
+ found type `an_enum<'a>`
+note: the lifetime 'a as defined on the function body at 18:10...
+ --> $DIR/regions-bounds.rs:18:10
+ |
+LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 18:13
+ --> $DIR/regions-bounds.rs:18:13
+ |
+LL | fn a_fn1<'a,'b>(e: an_enum<'a>) -> an_enum<'b> {
+ | ^^
+
+error[E0308]: mismatched types
+ --> $DIR/regions-bounds.rs:23:12
+ |
+LL | return e; //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `a_class<'b>`
+ found type `a_class<'a>`
+note: the lifetime 'a as defined on the function body at 22:10...
+ --> $DIR/regions-bounds.rs:22:10
+ |
+LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 22:13
+ --> $DIR/regions-bounds.rs:22:13
+ |
+LL | fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr
new file mode 100644
index 0000000..5bec650
--- /dev/null
+++ b/src/test/ui/regions/regions-close-associated-type-into-object.nll.stderr
@@ -0,0 +1,60 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-associated-type-into-object.rs:25:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-associated-type-into-object.rs:32:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-associated-type-into-object.rs:38:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-associated-type-into-object.rs:45:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:25:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:32:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:38:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:45:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-close-associated-type-into-object.rs b/src/test/ui/regions/regions-close-associated-type-into-object.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-associated-type-into-object.rs
rename to src/test/ui/regions/regions-close-associated-type-into-object.rs
diff --git a/src/test/ui/regions/regions-close-associated-type-into-object.stderr b/src/test/ui/regions/regions-close-associated-type-into-object.stderr
new file mode 100644
index 0000000..9d56de4
--- /dev/null
+++ b/src/test/ui/regions/regions-close-associated-type-into-object.stderr
@@ -0,0 +1,56 @@
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:25:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+ --> $DIR/regions-close-associated-type-into-object.rs:25:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+error[E0310]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:32:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'static`...
+note: ...so that the type `std::boxed::Box<<T as Iter>::Item>` will meet its required lifetime bounds
+ --> $DIR/regions-close-associated-type-into-object.rs:32:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:38:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+note: ...so that the type `<T as Iter>::Item` will meet its required lifetime bounds
+ --> $DIR/regions-close-associated-type-into-object.rs:38:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+error[E0309]: the associated type `<T as Iter>::Item` may not live long enough
+ --> $DIR/regions-close-associated-type-into-object.rs:45:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<T as Iter>::Item: 'a`...
+note: ...so that the type `std::boxed::Box<<T as Iter>::Item>` will meet its required lifetime bounds
+ --> $DIR/regions-close-associated-type-into-object.rs:45:5
+ |
+LL | Box::new(item) //~ ERROR associated type `<T as Iter>::Item` may not live long enough
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr
new file mode 100644
index 0000000..84e4868
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-1.nll.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-1.rs:22:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | }
+ | - `*v` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-close-object-into-object-1.rs b/src/test/ui/regions/regions-close-object-into-object-1.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-object-into-object-1.rs
rename to src/test/ui/regions/regions-close-object-into-object-1.rs
diff --git a/src/test/ui/regions/regions-close-object-into-object-1.stderr b/src/test/ui/regions/regions-close-object-into-object-1.stderr
new file mode 100644
index 0000000..bd05a63
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-1.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-1.rs:22:12
+ |
+LL | box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr
new file mode 100644
index 0000000..701becc
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-2.nll.stderr
@@ -0,0 +1,30 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-2.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-close-object-into-object-2.rs:19:57
+ |
+LL | fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> {
+ | ______--_________________________________________________^
+ | | |
+ | | lifetime `'a` defined here
+LL | | box B(&*v) as Box<X> //~ ERROR cannot infer
+LL | | }
+ | |_^ returning this value requires that `'a` must outlive `'static`
+
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-2.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^ borrowed value does not live long enough
+LL | }
+ | - `*v` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-close-object-into-object-2.rs b/src/test/ui/regions/regions-close-object-into-object-2.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-object-into-object-2.rs
rename to src/test/ui/regions/regions-close-object-into-object-2.rs
diff --git a/src/test/ui/regions/regions-close-object-into-object-2.stderr b/src/test/ui/regions/regions-close-object-into-object-2.stderr
new file mode 100644
index 0000000..b2e44cd
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-2.stderr
@@ -0,0 +1,24 @@
+error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
+ --> $DIR/regions-close-object-into-object-2.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:6...
+ --> $DIR/regions-close-object-into-object-2.rs:19:6
+ |
+LL | fn g<'a, T: 'static>(v: Box<A<T>+'a>) -> Box<X+'static> {
+ | ^^
+note: ...so that the type `(dyn A<T> + 'a)` is not borrowed for too long
+ --> $DIR/regions-close-object-into-object-2.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^
+ = note: but, the lifetime must be valid for the static lifetime...
+ = note: ...so that the expression is assignable:
+ expected std::boxed::Box<(dyn X + 'static)>
+ found std::boxed::Box<dyn X>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr
new file mode 100644
index 0000000..62504ab
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-3.nll.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-3.rs:21:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | }
+ | - `*v` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-close-object-into-object-3.rs b/src/test/ui/regions/regions-close-object-into-object-3.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-object-into-object-3.rs
rename to src/test/ui/regions/regions-close-object-into-object-3.rs
diff --git a/src/test/ui/regions/regions-close-object-into-object-3.stderr b/src/test/ui/regions/regions-close-object-into-object-3.stderr
new file mode 100644
index 0000000..9e412e5
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-3.stderr
@@ -0,0 +1,13 @@
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-3.rs:21:12
+ |
+LL | box B(&*v) as Box<X> //~ ERROR `*v` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr
new file mode 100644
index 0000000..e01ae14
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-4.nll.stderr
@@ -0,0 +1,71 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-4.rs:20:5
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-4.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-4.rs:20:9
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-4.rs:20:9
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-4.rs:20:5
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-close-object-into-object-4.rs:19:51
+ |
+LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
+ | ______--___________________________________________^
+ | | |
+ | | lifetime `'a` defined here
+LL | | box B(&*v) as Box<X> //~ ERROR cannot infer
+LL | | }
+ | |_^ returning this value requires that `'a` must outlive `'static`
+
+error[E0310]: the parameter type `U` may not live long enough
+ --> $DIR/regions-close-object-into-object-4.rs:20:5
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `U: 'static`...
+
+error[E0310]: the parameter type `U` may not live long enough
+ --> $DIR/regions-close-object-into-object-4.rs:20:9
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `U: 'static`...
+
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-4.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^ borrowed value does not live long enough
+LL | }
+ | - `*v` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0310, E0597.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/regions-close-object-into-object-4.rs b/src/test/ui/regions/regions-close-object-into-object-4.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-object-into-object-4.rs
rename to src/test/ui/regions/regions-close-object-into-object-4.rs
diff --git a/src/test/ui/regions/regions-close-object-into-object-4.stderr b/src/test/ui/regions/regions-close-object-into-object-4.stderr
new file mode 100644
index 0000000..15e53f1
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-4.stderr
@@ -0,0 +1,24 @@
+error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
+ --> $DIR/regions-close-object-into-object-4.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 19:6...
+ --> $DIR/regions-close-object-into-object-4.rs:19:6
+ |
+LL | fn i<'a, T, U>(v: Box<A<U>+'a>) -> Box<X+'static> {
+ | ^^
+note: ...so that the type `(dyn A<U> + 'a)` is not borrowed for too long
+ --> $DIR/regions-close-object-into-object-4.rs:20:11
+ |
+LL | box B(&*v) as Box<X> //~ ERROR cannot infer
+ | ^^^
+ = note: but, the lifetime must be valid for the static lifetime...
+ = note: ...so that the expression is assignable:
+ expected std::boxed::Box<(dyn X + 'static)>
+ found std::boxed::Box<dyn X>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr
new file mode 100644
index 0000000..d7f9253
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-5.nll.stderr
@@ -0,0 +1,61 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-5.rs:27:11
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | box B(&*v) as Box<X>
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0597]: `*v` does not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:11
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `*v` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0310, E0597.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/regions-close-object-into-object-5.rs b/src/test/ui/regions/regions-close-object-into-object-5.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-object-into-object-5.rs
rename to src/test/ui/regions/regions-close-object-into-object-5.rs
diff --git a/src/test/ui/regions/regions-close-object-into-object-5.stderr b/src/test/ui/regions/regions-close-object-into-object-5.stderr
new file mode 100644
index 0000000..2c3cc60
--- /dev/null
+++ b/src/test/ui/regions/regions-close-object-into-object-5.stderr
@@ -0,0 +1,93 @@
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // oh dear!
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^
+ |
+note: ...so that the type `B<'_, T>` will meet its required lifetime bounds
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // oh dear!
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that it can be closed over into an object
+ --> $DIR/regions-close-object-into-object-5.rs:27:5
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // oh dear!
+LL | box B(&*v) as Box<X>
+ | ^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | box B(&*v) as Box<X>
+ | ^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // oh dear!
+LL | box B(&*v) as Box<X>
+ | ^^^^^^
+ |
+note: ...so that the reference type `&dyn A<T>` does not outlive the data it points at
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // oh dear!
+LL | box B(&*v) as Box<X>
+ | ^^^^^^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-close-object-into-object-5.rs:27:9
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-object-into-object-5.rs:27:11
+ |
+LL | fn f<'a, T, U>(v: Box<A<T>+'static>) -> Box<X+'static> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // oh dear!
+LL | box B(&*v) as Box<X>
+ | ^^^
+ |
+note: ...so that the type `(dyn A<T> + 'static)` is not borrowed for too long
+ --> $DIR/regions-close-object-into-object-5.rs:27:11
+ |
+LL | box B(&*v) as Box<X>
+ | ^^^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr
new file mode 100644
index 0000000..ff74d46
--- /dev/null
+++ b/src/test/ui/regions/regions-close-over-type-parameter-1.nll.stderr
@@ -0,0 +1,44 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^
+
+error[E0310]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `A: 'static`...
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `A: 'b`...
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-close-over-type-parameter-1.rs b/src/test/ui/regions/regions-close-over-type-parameter-1.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-over-type-parameter-1.rs
rename to src/test/ui/regions/regions-close-over-type-parameter-1.rs
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-1.stderr b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr
new file mode 100644
index 0000000..9158cf2
--- /dev/null
+++ b/src/test/ui/regions/regions-close-over-type-parameter-1.stderr
@@ -0,0 +1,60 @@
+error[E0310]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | fn make_object1<A:SomeTrait>(v: A) -> Box<SomeTrait+'static> {
+ | -- help: consider adding an explicit lifetime bound `A: 'static`...
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^
+ |
+note: ...so that the type `A` will meet its required lifetime bounds
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^
+
+error[E0310]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | fn make_object1<A:SomeTrait>(v: A) -> Box<SomeTrait+'static> {
+ | -- help: consider adding an explicit lifetime bound `A: 'static`...
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that it can be closed over into an object
+ --> $DIR/regions-close-over-type-parameter-1.rs:20:5
+ |
+LL | box v as Box<SomeTrait+'static>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box<SomeTrait+'b> {
+ | -- help: consider adding an explicit lifetime bound `A: 'b`...
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^
+ |
+note: ...so that the type `A` will meet its required lifetime bounds
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | fn make_object3<'a,'b,A:SomeTrait+'a>(v: A) -> Box<SomeTrait+'b> {
+ | -- help: consider adding an explicit lifetime bound `A: 'b`...
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that it can be closed over into an object
+ --> $DIR/regions-close-over-type-parameter-1.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'b>
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr
new file mode 100644
index 0000000..9e0dd9d
--- /dev/null
+++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'a> //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'a> //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `A: 'c`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-close-over-type-parameter-multiple.rs b/src/test/ui/regions/regions-close-over-type-parameter-multiple.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-over-type-parameter-multiple.rs
rename to src/test/ui/regions/regions-close-over-type-parameter-multiple.rs
diff --git a/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr
new file mode 100644
index 0000000..f85041e
--- /dev/null
+++ b/src/test/ui/regions/regions-close-over-type-parameter-multiple.stderr
@@ -0,0 +1,28 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'a> //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 28:20...
+ --> $DIR/regions-close-over-type-parameter-multiple.rs:28:20
+ |
+LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<SomeTrait+'c> {
+ | ^^
+note: ...so that the declared lifetime parameter bounds are satisfied
+ --> $DIR/regions-close-over-type-parameter-multiple.rs:30:5
+ |
+LL | box v as Box<SomeTrait+'a> //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: but, the lifetime must be valid for the lifetime 'c as defined on the function body at 28:26...
+ --> $DIR/regions-close-over-type-parameter-multiple.rs:28:26
+ |
+LL | fn make_object_bad<'a,'b,'c,A:SomeTrait+'a+'b>(v: A) -> Box<SomeTrait+'c> {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected std::boxed::Box<(dyn SomeTrait + 'c)>
+ found std::boxed::Box<dyn SomeTrait>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-close-param-into-object.nll.stderr b/src/test/ui/regions/regions-close-param-into-object.nll.stderr
new file mode 100644
index 0000000..260a4067
--- /dev/null
+++ b/src/test/ui/regions/regions-close-param-into-object.nll.stderr
@@ -0,0 +1,60 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-param-into-object.rs:16:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-param-into-object.rs:22:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-param-into-object.rs:28:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-close-param-into-object.rs:34:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:16:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:22:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'static`...
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:28:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'a`...
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:34:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `T: 'a`...
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-close-param-into-object.rs b/src/test/ui/regions/regions-close-param-into-object.rs
similarity index 100%
rename from src/test/compile-fail/regions-close-param-into-object.rs
rename to src/test/ui/regions/regions-close-param-into-object.rs
diff --git a/src/test/ui/regions/regions-close-param-into-object.stderr b/src/test/ui/regions/regions-close-param-into-object.stderr
new file mode 100644
index 0000000..72ed7ac
--- /dev/null
+++ b/src/test/ui/regions/regions-close-param-into-object.stderr
@@ -0,0 +1,64 @@
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:16:5
+ |
+LL | fn p1<T>(v: T) -> Box<X+'static>
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+...
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-close-param-into-object.rs:16:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:22:5
+ |
+LL | fn p2<T>(v: Box<T>) -> Box<X+'static>
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+...
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `std::boxed::Box<T>` will meet its required lifetime bounds
+ --> $DIR/regions-close-param-into-object.rs:22:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:28:5
+ |
+LL | fn p3<'a,T>(v: T) -> Box<X+'a>
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+...
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-close-param-into-object.rs:28:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-close-param-into-object.rs:34:5
+ |
+LL | fn p4<'a,T>(v: Box<T>) -> Box<X+'a>
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+...
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `std::boxed::Box<T>` will meet its required lifetime bounds
+ --> $DIR/regions-close-param-into-object.rs:34:5
+ |
+LL | Box::new(v) //~ ERROR parameter type `T` may not live long enough
+ | ^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0309, E0310.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-creating-enums.nll.stderr b/src/test/ui/regions/regions-creating-enums.nll.stderr
new file mode 100644
index 0000000..58dff9c
--- /dev/null
+++ b/src/test/ui/regions/regions-creating-enums.nll.stderr
@@ -0,0 +1,31 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-creating-enums.rs:33:17
+ |
+LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13...
+ --> $DIR/regions-creating-enums.rs:30:13
+ |
+LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize {
+ | ^^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-creating-enums.rs:38:17
+ |
+LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13...
+ --> $DIR/regions-creating-enums.rs:30:13
+ |
+LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/ui/regions/regions-creating-enums.rs
similarity index 100%
rename from src/test/compile-fail/regions-creating-enums.rs
rename to src/test/ui/regions/regions-creating-enums.rs
diff --git a/src/test/ui/regions/regions-creating-enums.stderr b/src/test/ui/regions/regions-creating-enums.stderr
new file mode 100644
index 0000000..7b08477
--- /dev/null
+++ b/src/test/ui/regions/regions-creating-enums.stderr
@@ -0,0 +1,33 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-creating-enums.rs:33:17
+ |
+LL | return &ast::num((*f)(x)); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13...
+ --> $DIR/regions-creating-enums.rs:30:13
+ |
+LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize {
+ | ^^
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-creating-enums.rs:38:17
+ |
+LL | return &ast::add(m_x, m_y); //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 30:13...
+ --> $DIR/regions-creating-enums.rs:30:13
+ |
+LL | fn map_nums<'a,'b, F>(x: &ast, f: &mut F) -> &'a ast<'b> where F: FnMut(usize) -> usize {
+ | ^^
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-creating-enums3.nll.stderr b/src/test/ui/regions/regions-creating-enums3.nll.stderr
new file mode 100644
index 0000000..462e415
--- /dev/null
+++ b/src/test/ui/regions/regions-creating-enums3.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-creating-enums3.rs:17:5
+ |
+LL | ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623]
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-creating-enums3.rs:17:5
+ |
+LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623]
+ | ^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-creating-enums3.rs b/src/test/ui/regions/regions-creating-enums3.rs
similarity index 100%
rename from src/test/compile-fail/regions-creating-enums3.rs
rename to src/test/ui/regions/regions-creating-enums3.rs
diff --git a/src/test/ui/regions/regions-creating-enums3.stderr b/src/test/ui/regions/regions-creating-enums3.stderr
new file mode 100644
index 0000000..b2cca9a
--- /dev/null
+++ b/src/test/ui/regions/regions-creating-enums3.stderr
@@ -0,0 +1,13 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-creating-enums3.rs:17:5
+ |
+LL | fn mk_add_bad1<'a,'b>(x: &'a ast<'a>, y: &'b ast<'b>) -> ast<'a> {
+ | ----------- -------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | ast::add(x, y) //~ ERROR 17:5: 17:19: lifetime mismatch [E0623]
+ | ^^^^^^^^^^^^^^ ...but data from `y` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-creating-enums4.nll.stderr b/src/test/ui/regions/regions-creating-enums4.nll.stderr
new file mode 100644
index 0000000..b82fdfd
--- /dev/null
+++ b/src/test/ui/regions/regions-creating-enums4.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-creating-enums4.rs:17:5
+ |
+LL | ast::add(x, y) //~ ERROR cannot infer
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-creating-enums4.rs:17:5
+ |
+LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | ast::add(x, y) //~ ERROR cannot infer
+ | ^^^^^^^^^^^^^^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-creating-enums4.rs b/src/test/ui/regions/regions-creating-enums4.rs
similarity index 100%
rename from src/test/compile-fail/regions-creating-enums4.rs
rename to src/test/ui/regions/regions-creating-enums4.rs
diff --git a/src/test/ui/regions/regions-creating-enums4.stderr b/src/test/ui/regions/regions-creating-enums4.stderr
new file mode 100644
index 0000000..729dc2f
--- /dev/null
+++ b/src/test/ui/regions/regions-creating-enums4.stderr
@@ -0,0 +1,26 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/regions-creating-enums4.rs:17:5
+ |
+LL | ast::add(x, y) //~ ERROR cannot infer
+ | ^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 16:16...
+ --> $DIR/regions-creating-enums4.rs:16:16
+ |
+LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected &ast<'_>
+ found &ast<'a>
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 16:19...
+ --> $DIR/regions-creating-enums4.rs:16:19
+ |
+LL | fn mk_add_bad2<'a,'b>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast<'b> {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected ast<'b>
+ found ast<'_>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-early-bound-error-method.nll.stderr b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr
new file mode 100644
index 0000000..cd2da8f
--- /dev/null
+++ b/src/test/ui/regions/regions-early-bound-error-method.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-early-bound-error-method.rs:30:9
+ |
+LL | g2.get()
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-early-bound-error-method.rs:30:9
+ |
+LL | impl<'a> Box<'a> {
+ | -- lifetime `'a` defined here
+LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
+ | -- lifetime `'b` defined here
+LL | g2.get()
+ | ^^^^^^^^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-early-bound-error-method.rs b/src/test/ui/regions/regions-early-bound-error-method.rs
similarity index 100%
rename from src/test/compile-fail/regions-early-bound-error-method.rs
rename to src/test/ui/regions/regions-early-bound-error-method.rs
diff --git a/src/test/ui/regions/regions-early-bound-error-method.stderr b/src/test/ui/regions/regions-early-bound-error-method.stderr
new file mode 100644
index 0000000..6c542ef
--- /dev/null
+++ b/src/test/ui/regions/regions-early-bound-error-method.stderr
@@ -0,0 +1,20 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/regions-early-bound-error-method.rs:30:9
+ |
+LL | g2.get()
+ | ^^^^^^^^
+ |
+note: ...the reference is valid for the lifetime 'a as defined on the impl at 28:6...
+ --> $DIR/regions-early-bound-error-method.rs:28:6
+ |
+LL | impl<'a> Box<'a> {
+ | ^^
+note: ...but the borrowed content is only valid for the lifetime 'b as defined on the method body at 29:11
+ --> $DIR/regions-early-bound-error-method.rs:29:11
+ |
+LL | fn or<'b,G:GetRef<'b>>(&self, g2: G) -> &'a isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/ui/regions/regions-early-bound-error.nll.stderr b/src/test/ui/regions/regions-early-bound-error.nll.stderr
new file mode 100644
index 0000000..7ba6151
--- /dev/null
+++ b/src/test/ui/regions/regions-early-bound-error.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-early-bound-error.rs:29:5
+ |
+LL | g1.get()
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-early-bound-error.rs:29:5
+ |
+LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | g1.get()
+ | ^^^^^^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-early-bound-error.rs b/src/test/ui/regions/regions-early-bound-error.rs
similarity index 100%
rename from src/test/compile-fail/regions-early-bound-error.rs
rename to src/test/ui/regions/regions-early-bound-error.rs
diff --git a/src/test/ui/regions/regions-early-bound-error.stderr b/src/test/ui/regions/regions-early-bound-error.stderr
new file mode 100644
index 0000000..579a7c9
--- /dev/null
+++ b/src/test/ui/regions/regions-early-bound-error.stderr
@@ -0,0 +1,20 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/regions-early-bound-error.rs:29:5
+ |
+LL | g1.get()
+ | ^^^^^^^^
+ |
+note: ...the reference is valid for the lifetime 'b as defined on the function body at 28:11...
+ --> $DIR/regions-early-bound-error.rs:28:11
+ |
+LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize {
+ | ^^
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 28:8
+ --> $DIR/regions-early-bound-error.rs:28:8
+ |
+LL | fn get<'a,'b,G:GetRef<'a, isize>>(g1: G, b: &'b isize) -> &'b isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/compile-fail/regions-enum-not-wf.rs b/src/test/ui/regions/regions-enum-not-wf.rs
similarity index 100%
rename from src/test/compile-fail/regions-enum-not-wf.rs
rename to src/test/ui/regions/regions-enum-not-wf.rs
diff --git a/src/test/ui/regions/regions-enum-not-wf.stderr b/src/test/ui/regions/regions-enum-not-wf.stderr
new file mode 100644
index 0000000..381a8aa
--- /dev/null
+++ b/src/test/ui/regions/regions-enum-not-wf.stderr
@@ -0,0 +1,64 @@
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-enum-not-wf.rs:16:18
+ |
+LL | enum Ref1<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | Ref1Variant1(&'a T) //~ ERROR the parameter type `T` may not live long enough
+ | ^^^^^
+ |
+note: ...so that the reference type `&'a T` does not outlive the data it points at
+ --> $DIR/regions-enum-not-wf.rs:16:18
+ |
+LL | Ref1Variant1(&'a T) //~ ERROR the parameter type `T` may not live long enough
+ | ^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-enum-not-wf.rs:21:25
+ |
+LL | enum Ref2<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | Ref2Variant1,
+LL | Ref2Variant2(isize, &'a T), //~ ERROR the parameter type `T` may not live long enough
+ | ^^^^^
+ |
+note: ...so that the reference type `&'a T` does not outlive the data it points at
+ --> $DIR/regions-enum-not-wf.rs:21:25
+ |
+LL | Ref2Variant2(isize, &'a T), //~ ERROR the parameter type `T` may not live long enough
+ | ^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-enum-not-wf.rs:29:32
+ |
+LL | enum RefIndirect<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | RefIndirectVariant1(isize, RefOk<'a,T>)
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-enum-not-wf.rs:29:32
+ |
+LL | RefIndirectVariant1(isize, RefOk<'a,T>)
+ | ^^^^^^^^^^^
+
+error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-enum-not-wf.rs:34:23
+ |
+LL | RefDoubleVariant1(&'a &'b T)
+ | ^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the enum at 33:16
+ --> $DIR/regions-enum-not-wf.rs:33:16
+ |
+LL | enum RefDouble<'a, 'b, T> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the enum at 33:20
+ --> $DIR/regions-enum-not-wf.rs:33:20
+ |
+LL | enum RefDouble<'a, 'b, T> {
+ | ^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0309, E0491.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-escape-method.nll.stderr b/src/test/ui/regions/regions-escape-method.nll.stderr
new file mode 100644
index 0000000..4603d15
--- /dev/null
+++ b/src/test/ui/regions/regions-escape-method.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-escape-method.rs:25:13
+ |
+LL | s.f(|p| p) //~ ERROR cannot infer
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-escape-method.rs:25:13
+ |
+LL | s.f(|p| p) //~ ERROR cannot infer
+ | -- ^ returning this value requires that `'1` must outlive `'2`
+ | ||
+ | |return type of closure is &'2 i32
+ | has type `&'1 i32`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-escape-method.rs b/src/test/ui/regions/regions-escape-method.rs
similarity index 100%
rename from src/test/compile-fail/regions-escape-method.rs
rename to src/test/ui/regions/regions-escape-method.rs
diff --git a/src/test/ui/regions/regions-escape-method.stderr b/src/test/ui/regions/regions-escape-method.stderr
new file mode 100644
index 0000000..fb0bf84
--- /dev/null
+++ b/src/test/ui/regions/regions-escape-method.stderr
@@ -0,0 +1,28 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/regions-escape-method.rs:25:13
+ |
+LL | s.f(|p| p) //~ ERROR cannot infer
+ | ^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 25:9...
+ --> $DIR/regions-escape-method.rs:25:9
+ |
+LL | s.f(|p| p) //~ ERROR cannot infer
+ | ^^^^^
+ = note: ...so that the expression is assignable:
+ expected &i32
+ found &i32
+note: but, the lifetime must be valid for the method call at 25:5...
+ --> $DIR/regions-escape-method.rs:25:5
+ |
+LL | s.f(|p| p) //~ ERROR cannot infer
+ | ^^^^^^^^^^
+note: ...so that a type/lifetime parameter is in scope here
+ --> $DIR/regions-escape-method.rs:25:5
+ |
+LL | s.f(|p| p) //~ ERROR cannot infer
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr
new file mode 100644
index 0000000..381f462
--- /dev/null
+++ b/src/test/ui/regions/regions-escape-via-trait-or-not.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-escape-via-trait-or-not.rs:28:14
+ |
+LL | with(|o| o) //~ ERROR cannot infer
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-escape-via-trait-or-not.rs:28:14
+ |
+LL | with(|o| o) //~ ERROR cannot infer
+ | -- ^ returning this value requires that `'1` must outlive `'2`
+ | ||
+ | |return type of closure is &'2 isize
+ | has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/ui/regions/regions-escape-via-trait-or-not.rs
similarity index 100%
rename from src/test/compile-fail/regions-escape-via-trait-or-not.rs
rename to src/test/ui/regions/regions-escape-via-trait-or-not.rs
diff --git a/src/test/ui/regions/regions-escape-via-trait-or-not.stderr b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr
new file mode 100644
index 0000000..60bd14b
--- /dev/null
+++ b/src/test/ui/regions/regions-escape-via-trait-or-not.stderr
@@ -0,0 +1,28 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/regions-escape-via-trait-or-not.rs:28:14
+ |
+LL | with(|o| o) //~ ERROR cannot infer
+ | ^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 28:10...
+ --> $DIR/regions-escape-via-trait-or-not.rs:28:10
+ |
+LL | with(|o| o) //~ ERROR cannot infer
+ | ^^^^^
+ = note: ...so that the expression is assignable:
+ expected &isize
+ found &isize
+note: but, the lifetime must be valid for the expression at 28:5...
+ --> $DIR/regions-escape-via-trait-or-not.rs:28:5
+ |
+LL | with(|o| o) //~ ERROR cannot infer
+ | ^^^^
+note: ...so type `fn([closure@$DIR/regions-escape-via-trait-or-not.rs:28:10: 28:15]) -> isize {with::<&isize, [closure@$DIR/regions-escape-via-trait-or-not.rs:28:10: 28:15]>}` of expression is valid during the expression
+ --> $DIR/regions-escape-via-trait-or-not.rs:28:5
+ |
+LL | with(|o| o) //~ ERROR cannot infer
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions-fn-subtyping-return-static.rs b/src/test/ui/regions/regions-fn-subtyping-return-static.rs
similarity index 100%
rename from src/test/ui/regions-fn-subtyping-return-static.rs
rename to src/test/ui/regions/regions-fn-subtyping-return-static.rs
diff --git a/src/test/ui/regions-fn-subtyping-return-static.stderr b/src/test/ui/regions/regions-fn-subtyping-return-static.stderr
similarity index 100%
rename from src/test/ui/regions-fn-subtyping-return-static.stderr
rename to src/test/ui/regions/regions-fn-subtyping-return-static.stderr
diff --git a/src/test/compile-fail/regions-free-region-ordering-callee-4.rs b/src/test/ui/regions/regions-free-region-ordering-callee-4.rs
similarity index 100%
rename from src/test/compile-fail/regions-free-region-ordering-callee-4.rs
rename to src/test/ui/regions/regions-free-region-ordering-callee-4.rs
diff --git a/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr
new file mode 100644
index 0000000..70970a9
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-callee-4.stderr
@@ -0,0 +1,24 @@
+error[E0491]: in type `&'a &'b usize`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-free-region-ordering-callee-4.rs:15:1
+ |
+LL | / fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
+LL | | //~^ ERROR reference has a longer lifetime than the data it references
+LL | | // Do not infer ordering from closure argument types.
+LL | | let z: Option<&'a &'b usize> = None;
+LL | | }
+ | |_^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 15:14
+ --> $DIR/regions-free-region-ordering-callee-4.rs:15:14
+ |
+LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 15:18
+ --> $DIR/regions-free-region-ordering-callee-4.rs:15:18
+ |
+LL | fn ordering4<'a, 'b, F>(a: &'a usize, b: &'b usize, x: F) where F: FnOnce(&'a &'b usize) {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr
new file mode 100644
index 0000000..3ef1be1
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-callee.nll.stderr
@@ -0,0 +1,36 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-free-region-ordering-callee.rs:23:5
+ |
+LL | &*y //~ ERROR 23:5: 23:8: lifetime mismatch [E0623]
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-free-region-ordering-callee.rs:28:24
+ |
+LL | let z: &'b usize = &*x;
+ | ^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-free-region-ordering-callee.rs:23:5
+ |
+LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | // However, it is not safe to assume that 'b <= 'a
+LL | &*y //~ ERROR 23:5: 23:8: lifetime mismatch [E0623]
+ | ^^^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-free-region-ordering-callee.rs:28:24
+ |
+LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | // Do not infer an ordering from the return value.
+LL | let z: &'b usize = &*x;
+ | ^^^ requires that `'a` must outlive `'b`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/regions-free-region-ordering-callee.rs b/src/test/ui/regions/regions-free-region-ordering-callee.rs
similarity index 100%
rename from src/test/compile-fail/regions-free-region-ordering-callee.rs
rename to src/test/ui/regions/regions-free-region-ordering-callee.rs
diff --git a/src/test/ui/regions/regions-free-region-ordering-callee.stderr b/src/test/ui/regions/regions-free-region-ordering-callee.stderr
new file mode 100644
index 0000000..13d94f9
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-callee.stderr
@@ -0,0 +1,25 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-free-region-ordering-callee.rs:23:5
+ |
+LL | fn ordering2<'a, 'b>(x: &'a &'b usize, y: &'a usize) -> &'b usize {
+ | ------------- ---------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | // However, it is not safe to assume that 'b <= 'a
+LL | &*y //~ ERROR 23:5: 23:8: lifetime mismatch [E0623]
+ | ^^^ ...but data from `x` is returned here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-free-region-ordering-callee.rs:28:24
+ |
+LL | fn ordering3<'a, 'b>(x: &'a usize, y: &'b usize) -> &'a &'b usize {
+ | --------- -------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | // Do not infer an ordering from the return value.
+LL | let z: &'b usize = &*x;
+ | ^^^ ...but data from `x` is returned here
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.rs b/src/test/ui/regions/regions-free-region-ordering-caller.rs
new file mode 100644
index 0000000..ee6cd6c
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-caller.rs
@@ -0,0 +1,32 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test various ways to construct a pointer with a longer lifetime
+// than the thing it points at and ensure that they result in
+// errors. See also regions-free-region-ordering-callee.rs
+
+struct Paramd<'a> { x: &'a usize }
+
+fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
+ let z: Option<&'b &'a usize> = None;//~ ERROR E0623
+}
+
+fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
+ let y: Paramd<'a> = Paramd { x: a };
+ let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623
+}
+
+fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
+ let z: Option<&'a &'b usize> = None;//~ ERROR E0623
+}
+
+fn main() {}
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller.stderr b/src/test/ui/regions/regions-free-region-ordering-caller.stderr
new file mode 100644
index 0000000..96502b6
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-caller.stderr
@@ -0,0 +1,32 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-free-region-ordering-caller.rs:20:12
+ |
+LL | fn call2<'a, 'b>(a: &'a usize, b: &'b usize) {
+ | --------- ---------
+ | |
+ | these two types are declared with different lifetimes...
+LL | let z: Option<&'b &'a usize> = None;//~ ERROR E0623
+ | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-free-region-ordering-caller.rs:25:12
+ |
+LL | fn call3<'a, 'b>(a: &'a usize, b: &'b usize) {
+ | --------- ---------
+ | |
+ | these two types are declared with different lifetimes...
+LL | let y: Paramd<'a> = Paramd { x: a };
+LL | let z: Option<&'b Paramd<'a>> = None;//~ ERROR E0623
+ | ^^^^^^^^^^^^^^^^^^^^^^ ...but data from `a` flows into `b` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-free-region-ordering-caller.rs:29:12
+ |
+LL | fn call4<'a, 'b>(a: &'a usize, b: &'b usize) {
+ | --------- --------- these two types are declared with different lifetimes...
+LL | let z: Option<&'a &'b usize> = None;//~ ERROR E0623
+ | ^^^^^^^^^^^^^^^^^^^^^ ...but data from `b` flows into `a` here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr
new file mode 100644
index 0000000..acf7a03
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-caller1.nll.stderr
@@ -0,0 +1,18 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-free-region-ordering-caller1.rs:19:27
+ |
+LL | let z: &'a & usize = &(&y);
+ | ^^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:10...
+ --> $DIR/regions-free-region-ordering-caller1.rs:15:10
+ |
+LL | fn call1<'a>(x: &'a usize) {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-free-region-ordering-caller1.rs b/src/test/ui/regions/regions-free-region-ordering-caller1.rs
similarity index 100%
rename from src/test/compile-fail/regions-free-region-ordering-caller1.rs
rename to src/test/ui/regions/regions-free-region-ordering-caller1.rs
diff --git a/src/test/ui/regions/regions-free-region-ordering-caller1.stderr b/src/test/ui/regions/regions-free-region-ordering-caller1.stderr
new file mode 100644
index 0000000..c0dff6e
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-caller1.stderr
@@ -0,0 +1,33 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-free-region-ordering-caller1.rs:19:27
+ |
+LL | let z: &'a & usize = &(&y);
+ | ^^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:10...
+ --> $DIR/regions-free-region-ordering-caller1.rs:15:10
+ |
+LL | fn call1<'a>(x: &'a usize) {
+ | ^^
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/regions-free-region-ordering-caller1.rs:19:29
+ |
+LL | let z: &'a & usize = &(&y);
+ | ^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 15:10...
+ --> $DIR/regions-free-region-ordering-caller1.rs:15:10
+ |
+LL | fn call1<'a>(x: &'a usize) {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr
new file mode 100644
index 0000000..0bc4bf4
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.nll.stderr
@@ -0,0 +1,21 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-free-region-ordering-incorrect.rs:27:15
+ |
+LL | None => &self.val //~ ERROR cannot infer
+ | ^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-free-region-ordering-incorrect.rs:25:5
+ |
+LL | impl<'b, T> Node<'b, T> {
+ | -- lifetime `'b` defined here
+LL | fn get<'a>(&'a self) -> &'b T {
+ | -- lifetime `'a` defined here
+LL | / match self.next {
+LL | | Some(ref next) => next.get(),
+LL | | None => &self.val //~ ERROR cannot infer
+LL | | }
+ | |_____^ returning this value requires that `'a` must outlive `'b`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-free-region-ordering-incorrect.rs b/src/test/ui/regions/regions-free-region-ordering-incorrect.rs
similarity index 100%
rename from src/test/compile-fail/regions-free-region-ordering-incorrect.rs
rename to src/test/ui/regions/regions-free-region-ordering-incorrect.rs
diff --git a/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr
new file mode 100644
index 0000000..3dce04e
--- /dev/null
+++ b/src/test/ui/regions/regions-free-region-ordering-incorrect.stderr
@@ -0,0 +1,33 @@
+error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
+ --> $DIR/regions-free-region-ordering-incorrect.rs:27:15
+ |
+LL | None => &self.val //~ ERROR cannot infer
+ | ^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the method body at 24:10...
+ --> $DIR/regions-free-region-ordering-incorrect.rs:24:10
+ |
+LL | fn get<'a>(&'a self) -> &'b T {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-free-region-ordering-incorrect.rs:27:15
+ |
+LL | None => &self.val //~ ERROR cannot infer
+ | ^^^^^^^^^
+note: but, the lifetime must be valid for the lifetime 'b as defined on the impl at 23:6...
+ --> $DIR/regions-free-region-ordering-incorrect.rs:23:6
+ |
+LL | impl<'b, T> Node<'b, T> {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-free-region-ordering-incorrect.rs:25:5
+ |
+LL | / match self.next {
+LL | | Some(ref next) => next.get(),
+LL | | None => &self.val //~ ERROR cannot infer
+LL | | }
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-glb-free-free.nll.stderr b/src/test/ui/regions/regions-glb-free-free.nll.stderr
new file mode 100644
index 0000000..a82ce96
--- /dev/null
+++ b/src/test/ui/regions/regions-glb-free-free.nll.stderr
@@ -0,0 +1,22 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-glb-free-free.rs:25:13
+ |
+LL | Flag { //~ ERROR 25:13: 30:14: explicit lifetime required in the type of `s` [E0621]
+ | ^^^^
+
+error[E0621]: explicit lifetime required in the type of `s`
+ --> $DIR/regions-glb-free-free.rs:25:13
+ |
+LL | pub fn set_desc(self, s: &str) -> Flag<'a> {
+ | ---- help: add explicit lifetime `'a` to the type of `s`: `&'a str`
+LL | / Flag { //~ ERROR 25:13: 30:14: explicit lifetime required in the type of `s` [E0621]
+LL | | name: self.name,
+LL | | desc: s,
+LL | | max_count: self.max_count,
+LL | | value: self.value
+LL | | }
+ | |_____________^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/ui/regions/regions-glb-free-free.rs
similarity index 100%
rename from src/test/compile-fail/regions-glb-free-free.rs
rename to src/test/ui/regions/regions-glb-free-free.rs
diff --git a/src/test/ui/regions/regions-glb-free-free.stderr b/src/test/ui/regions/regions-glb-free-free.stderr
new file mode 100644
index 0000000..48c95a8
--- /dev/null
+++ b/src/test/ui/regions/regions-glb-free-free.stderr
@@ -0,0 +1,16 @@
+error[E0621]: explicit lifetime required in the type of `s`
+ --> $DIR/regions-glb-free-free.rs:25:13
+ |
+LL | pub fn set_desc(self, s: &str) -> Flag<'a> {
+ | ---- help: add explicit lifetime `'a` to the type of `s`: `&'a str`
+LL | / Flag { //~ ERROR 25:13: 30:14: explicit lifetime required in the type of `s` [E0621]
+LL | | name: self.name,
+LL | | desc: s,
+LL | | max_count: self.max_count,
+LL | | value: self.value
+LL | | }
+ | |_____________^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs
new file mode 100644
index 0000000..01de3dd
--- /dev/null
+++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.rs
@@ -0,0 +1,42 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Illustrates the "projection gap": in this test, even though we know
+// that `T::Foo: 'x`, that does not tell us that `T: 'x`, because
+// there might be other ways for the caller of `func` to show that
+// `T::Foo: 'x` holds (e.g., where-clause).
+
+trait Trait1<'x> {
+ type Foo;
+}
+
+// calling this fn should trigger a check that the type argument
+// supplied is well-formed.
+fn wf<T>() { }
+
+fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
+{
+ wf::<&'x T>();
+ //~^ ERROR the parameter type `T` may not live long enough
+}
+
+fn caller2<'x, T:Trait1<'x>>(t: &'x T)
+{
+ wf::<&'x T::Foo>(); // OK
+}
+
+fn caller3<'x, T:Trait1<'x>>(t: &'x T::Foo)
+{
+ wf::<&'x T::Foo>(); // OK
+}
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr
new file mode 100644
index 0000000..e6efb4d
--- /dev/null
+++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-1.stderr
@@ -0,0 +1,18 @@
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-implied-bounds-projection-gap-1.rs:28:10
+ |
+LL | fn func<'x, T:Trait1<'x>>(t: &'x T::Foo)
+ | -- help: consider adding an explicit lifetime bound `T: 'x`...
+LL | {
+LL | wf::<&'x T>();
+ | ^^^^^
+ |
+note: ...so that the reference type `&'x T` does not outlive the data it points at
+ --> $DIR/regions-implied-bounds-projection-gap-1.rs:28:10
+ |
+LL | wf::<&'x T>();
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-implied-bounds-projection-gap-2.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs
similarity index 100%
rename from src/test/compile-fail/regions-implied-bounds-projection-gap-2.rs
rename to src/test/ui/regions/regions-implied-bounds-projection-gap-2.rs
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-2.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-2.stderr
new file mode 100644
index 0000000..7a38797
--- /dev/null
+++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-2.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/regions-implied-bounds-projection-gap-2.rs:33:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-implied-bounds-projection-gap-3.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs
similarity index 100%
rename from src/test/compile-fail/regions-implied-bounds-projection-gap-3.rs
rename to src/test/ui/regions/regions-implied-bounds-projection-gap-3.rs
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-3.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-3.stderr
new file mode 100644
index 0000000..1a12697
--- /dev/null
+++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-3.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/regions-implied-bounds-projection-gap-3.rs:33:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-implied-bounds-projection-gap-4.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs
similarity index 100%
rename from src/test/compile-fail/regions-implied-bounds-projection-gap-4.rs
rename to src/test/ui/regions/regions-implied-bounds-projection-gap-4.rs
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-4.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-4.stderr
new file mode 100644
index 0000000..85b1702
--- /dev/null
+++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-4.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/regions-implied-bounds-projection-gap-4.rs:33:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-implied-bounds-projection-gap-hr-1.rs b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs
similarity index 100%
rename from src/test/compile-fail/regions-implied-bounds-projection-gap-hr-1.rs
rename to src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.rs
diff --git a/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr
new file mode 100644
index 0000000..172a3cd
--- /dev/null
+++ b/src/test/ui/regions/regions-implied-bounds-projection-gap-hr-1.stderr
@@ -0,0 +1,23 @@
+error[E0491]: in type `&'x (dyn for<'z> Trait1<<T as Trait2<'y, 'z>>::Foo> + 'x)`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:31:1
+ |
+LL | / fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
+LL | | //~^ ERROR reference has a longer lifetime than the data it references
+LL | | {
+LL | | }
+ | |_^
+ |
+note: the pointer is valid for the lifetime 'x as defined on the function body at 31:11
+ --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:31:11
+ |
+LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
+ | ^^
+note: but the referenced data is only valid for the lifetime 'y as defined on the function body at 31:15
+ --> $DIR/regions-implied-bounds-projection-gap-hr-1.rs:31:15
+ |
+LL | fn callee<'x, 'y, T>(t: &'x for<'z> Trait1< <T as Trait2<'y, 'z>>::Foo >)
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-in-enums-anon.rs b/src/test/ui/regions/regions-in-enums-anon.rs
similarity index 100%
rename from src/test/compile-fail/regions-in-enums-anon.rs
rename to src/test/ui/regions/regions-in-enums-anon.rs
diff --git a/src/test/ui/regions/regions-in-enums-anon.stderr b/src/test/ui/regions/regions-in-enums-anon.stderr
new file mode 100644
index 0000000..f5630f8
--- /dev/null
+++ b/src/test/ui/regions/regions-in-enums-anon.stderr
@@ -0,0 +1,9 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/regions-in-enums-anon.rs:14:9
+ |
+LL | Bar(&isize) //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/compile-fail/regions-in-enums.rs b/src/test/ui/regions/regions-in-enums.rs
similarity index 100%
rename from src/test/compile-fail/regions-in-enums.rs
rename to src/test/ui/regions/regions-in-enums.rs
diff --git a/src/test/ui/regions/regions-in-enums.stderr b/src/test/ui/regions/regions-in-enums.stderr
new file mode 100644
index 0000000..cdc0b6c
--- /dev/null
+++ b/src/test/ui/regions/regions-in-enums.stderr
@@ -0,0 +1,15 @@
+error[E0261]: use of undeclared lifetime name `'foo`
+ --> $DIR/regions-in-enums.rs:23:9
+ |
+LL | X5(&'foo usize) //~ ERROR use of undeclared lifetime name `'foo`
+ | ^^^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-in-enums.rs:27:9
+ |
+LL | X6(&'a usize) //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/src/test/compile-fail/regions-in-structs-anon.rs b/src/test/ui/regions/regions-in-structs-anon.rs
similarity index 100%
rename from src/test/compile-fail/regions-in-structs-anon.rs
rename to src/test/ui/regions/regions-in-structs-anon.rs
diff --git a/src/test/ui/regions/regions-in-structs-anon.stderr b/src/test/ui/regions/regions-in-structs-anon.stderr
new file mode 100644
index 0000000..ecfac87
--- /dev/null
+++ b/src/test/ui/regions/regions-in-structs-anon.stderr
@@ -0,0 +1,9 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/regions-in-structs-anon.rs:14:8
+ |
+LL | x: &isize //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/compile-fail/regions-in-structs.rs b/src/test/ui/regions/regions-in-structs.rs
similarity index 100%
rename from src/test/compile-fail/regions-in-structs.rs
rename to src/test/ui/regions/regions-in-structs.rs
diff --git a/src/test/ui/regions/regions-in-structs.stderr b/src/test/ui/regions/regions-in-structs.stderr
new file mode 100644
index 0000000..679a219
--- /dev/null
+++ b/src/test/ui/regions/regions-in-structs.stderr
@@ -0,0 +1,15 @@
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-in-structs.rs:20:9
+ |
+LL | a: &'a isize, //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-in-structs.rs:21:9
+ |
+LL | b: &'a isize, //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.nll.stderr b/src/test/ui/regions/regions-infer-at-fn-not-param.nll.stderr
new file mode 100644
index 0000000..6bc3daf
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-at-fn-not-param.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-at-fn-not-param.rs:23:57
+ |
+LL | fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p }
+ | ^
+
+error[E0621]: explicit lifetime required in the type of `p`
+ --> $DIR/regions-infer-at-fn-not-param.rs:23:57
+ |
+LL | fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p }
+ | -------------- ^ lifetime `'a` required
+ | |
+ | help: add explicit lifetime `'a` to the type of `p`: `parameterized1<'a>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/regions-infer-at-fn-not-param.rs b/src/test/ui/regions/regions-infer-at-fn-not-param.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-at-fn-not-param.rs
rename to src/test/ui/regions/regions-infer-at-fn-not-param.rs
diff --git a/src/test/ui/regions/regions-infer-at-fn-not-param.stderr b/src/test/ui/regions/regions-infer-at-fn-not-param.stderr
new file mode 100644
index 0000000..f129ffa
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-at-fn-not-param.stderr
@@ -0,0 +1,11 @@
+error[E0621]: explicit lifetime required in the type of `p`
+ --> $DIR/regions-infer-at-fn-not-param.rs:23:57
+ |
+LL | fn take1<'a>(p: parameterized1) -> parameterized1<'a> { p }
+ | -------------- ^ lifetime `'a` required
+ | |
+ | help: add explicit lifetime `'a` to the type of `p`: `parameterized1<'a>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr
new file mode 100644
index 0000000..28bf252
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.nll.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `*p` does not live long enough
+ --> $DIR/regions-infer-borrow-scope-too-big.rs:22:22
+ |
+LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough
+ | ^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `*p` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:8...
+ --> $DIR/regions-infer-borrow-scope-too-big.rs:21:8
+ |
+LL | fn foo<'a>(p: Box<point>) -> &'a isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs b/src/test/ui/regions/regions-infer-borrow-scope-too-big.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
rename to src/test/ui/regions/regions-infer-borrow-scope-too-big.rs
diff --git a/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr
new file mode 100644
index 0000000..4c4a9b9
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-borrow-scope-too-big.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `*p` does not live long enough
+ --> $DIR/regions-infer-borrow-scope-too-big.rs:22:23
+ |
+LL | let xc = x_coord(&*p); //~ ERROR `*p` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 21:8...
+ --> $DIR/regions-infer-borrow-scope-too-big.rs:21:8
+ |
+LL | fn foo<'a>(p: Box<point>) -> &'a isize {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr
new file mode 100644
index 0000000..c71bd17
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-bound-from-trait-self.rs:56:9
+ |
+LL | check_bound(x, self)
+ | ^^^^^^^^^^^
+
+error[E0309]: the parameter type `Self` may not live long enough
+ --> $DIR/regions-infer-bound-from-trait-self.rs:56:9
+ |
+LL | check_bound(x, self)
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `Self: 'a`...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-infer-bound-from-trait-self.rs b/src/test/ui/regions/regions-infer-bound-from-trait-self.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-bound-from-trait-self.rs
rename to src/test/ui/regions/regions-infer-bound-from-trait-self.rs
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr b/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr
new file mode 100644
index 0000000..7b30f9a
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-bound-from-trait-self.stderr
@@ -0,0 +1,16 @@
+error[E0309]: the parameter type `Self` may not live long enough
+ --> $DIR/regions-infer-bound-from-trait-self.rs:56:9
+ |
+LL | check_bound(x, self)
+ | ^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `Self: 'a`...
+note: ...so that the type `Self` will meet its required lifetime bounds
+ --> $DIR/regions-infer-bound-from-trait-self.rs:56:9
+ |
+LL | check_bound(x, self)
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr
new file mode 100644
index 0000000..25f6903
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-bound-from-trait.nll.stderr
@@ -0,0 +1,31 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-bound-from-trait.rs:43:5
+ |
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-bound-from-trait.rs:47:5
+ |
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-infer-bound-from-trait.rs:43:5
+ |
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `A: 'a`...
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-infer-bound-from-trait.rs:47:5
+ |
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `A: 'a`...
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-infer-bound-from-trait.rs b/src/test/ui/regions/regions-infer-bound-from-trait.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-bound-from-trait.rs
rename to src/test/ui/regions/regions-infer-bound-from-trait.rs
diff --git a/src/test/ui/regions/regions-infer-bound-from-trait.stderr b/src/test/ui/regions/regions-infer-bound-from-trait.stderr
new file mode 100644
index 0000000..4c89f4b
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-bound-from-trait.stderr
@@ -0,0 +1,31 @@
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-infer-bound-from-trait.rs:43:5
+ |
+LL | fn bar1<'a,A>(x: Inv<'a>, a: A) {
+ | - help: consider adding an explicit lifetime bound `A: 'a`...
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `A` will meet its required lifetime bounds
+ --> $DIR/regions-infer-bound-from-trait.rs:43:5
+ |
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^
+
+error[E0309]: the parameter type `A` may not live long enough
+ --> $DIR/regions-infer-bound-from-trait.rs:47:5
+ |
+LL | fn bar2<'a,'b,A:Is<'b>>(x: Inv<'a>, y: Inv<'b>, a: A) {
+ | -- help: consider adding an explicit lifetime bound `A: 'a`...
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^
+ |
+note: ...so that the type `A` will meet its required lifetime bounds
+ --> $DIR/regions-infer-bound-from-trait.rs:47:5
+ |
+LL | check_bound(x, a) //~ ERROR parameter type `A` may not live long enough
+ | ^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-infer-call-3.nll.stderr b/src/test/ui/regions/regions-infer-call-3.nll.stderr
new file mode 100644
index 0000000..6069aca
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-call-3.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-call-3.rs:18:24
+ |
+LL | let z = with(|y| { select(x, y) });
+ | ^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-call-3.rs:18:24
+ |
+LL | let z = with(|y| { select(x, y) });
+ | -- ^^^^^^^^^^^^ returning this value requires that `'1` must outlive `'2`
+ | ||
+ | |return type of closure is &'2 isize
+ | has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-infer-call-3.rs b/src/test/ui/regions/regions-infer-call-3.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-call-3.rs
rename to src/test/ui/regions/regions-infer-call-3.rs
diff --git a/src/test/ui/regions/regions-infer-call-3.stderr b/src/test/ui/regions/regions-infer-call-3.stderr
new file mode 100644
index 0000000..d42e5bf
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-call-3.stderr
@@ -0,0 +1,30 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter 'r in function call due to conflicting requirements
+ --> $DIR/regions-infer-call-3.rs:18:24
+ |
+LL | let z = with(|y| { select(x, y) });
+ | ^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 18:18...
+ --> $DIR/regions-infer-call-3.rs:18:18
+ |
+LL | let z = with(|y| { select(x, y) });
+ | ^^^^^^^^^^^^^^^^^^^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-infer-call-3.rs:18:34
+ |
+LL | let z = with(|y| { select(x, y) });
+ | ^
+note: but, the lifetime must be valid for the call at 18:13...
+ --> $DIR/regions-infer-call-3.rs:18:13
+ |
+LL | let z = with(|y| { select(x, y) });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...so type `&isize` of expression is valid during the expression
+ --> $DIR/regions-infer-call-3.rs:18:13
+ |
+LL | let z = with(|y| { select(x, y) });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs
new file mode 100644
index 0000000..a16001b
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.rs
@@ -0,0 +1,40 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that a type which is contravariant with respect to its region
+// parameter yields an error when used in a covariant way.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+use std::marker;
+
+// This is contravariant with respect to 'a, meaning that
+// Contravariant<'foo> <: Contravariant<'static> because
+// 'foo <= 'static
+struct Contravariant<'a> {
+ marker: marker::PhantomData<&'a()>
+}
+
+fn use_<'short,'long>(c: Contravariant<'short>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+
+ // Test whether Contravariant<'short> <: Contravariant<'long>. Since
+ // 'short <= 'long, this would be true if the Contravariant type were
+ // covariant with respect to its parameter 'a.
+
+ let _: Contravariant<'long> = c; //~ ERROR E0623
+}
+
+fn main() {}
diff --git a/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr
new file mode 100644
index 0000000..675cbc5
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-contravariance-due-to-decl.stderr
@@ -0,0 +1,15 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-infer-contravariance-due-to-decl.rs:37:35
+ |
+LL | fn use_<'short,'long>(c: Contravariant<'short>,
+ | --------------------- these two types are declared with different lifetimes...
+LL | s: &'short isize,
+LL | l: &'long isize,
+ | ------------
+...
+LL | let _: Contravariant<'long> = c; //~ ERROR E0623
+ | ^ ...but data from `c` flows into `l` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs
new file mode 100644
index 0000000..f794063
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.rs
@@ -0,0 +1,37 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that a type which is covariant with respect to its region
+// parameter yields an error when used in a contravariant way.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+use std::marker;
+
+struct Covariant<'a> {
+ marker: marker::PhantomData<fn(&'a ())>
+}
+
+fn use_<'short,'long>(c: Covariant<'long>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+
+ // Test whether Covariant<'long> <: Covariant<'short>. Since
+ // 'short <= 'long, this would be true if the Covariant type were
+ // contravariant with respect to its parameter 'a.
+
+ let _: Covariant<'short> = c; //~ ERROR E0623
+}
+
+fn main() {}
diff --git a/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr
new file mode 100644
index 0000000..6b3673a
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-covariance-due-to-decl.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-infer-covariance-due-to-decl.rs:34:32
+ |
+LL | fn use_<'short,'long>(c: Covariant<'long>,
+ | ----------------
+LL | s: &'short isize,
+ | ------------- these two types are declared with different lifetimes...
+...
+LL | let _: Covariant<'short> = c; //~ ERROR E0623
+ | ^ ...but data from `s` flows into `c` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr
new file mode 100644
index 0000000..cf75416
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-invariance-due-to-decl.rs:22:5
+ |
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-invariance-due-to-decl.rs:22:5
+ |
+LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> {
+ | -- lifetime `'r` defined here
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-decl.rs b/src/test/ui/regions/regions-infer-invariance-due-to-decl.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-invariance-due-to-decl.rs
rename to src/test/ui/regions/regions-infer-invariance-due-to-decl.rs
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr
new file mode 100644
index 0000000..edd37b1
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-decl.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-invariance-due-to-decl.rs:22:5
+ |
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `invariant<'static>`
+ found type `invariant<'r>`
+note: the lifetime 'r as defined on the function body at 21:23...
+ --> $DIR/regions-infer-invariance-due-to-decl.rs:21:23
+ |
+LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr
new file mode 100644
index 0000000..6cd76f2
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:21:5
+ |
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:21:5
+ |
+LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> {
+ | -- lifetime `'r` defined here
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-invariance-due-to-mutability-3.rs
rename to src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.rs
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr
new file mode 100644
index 0000000..3a807b7
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-3.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:21:5
+ |
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `invariant<'static>`
+ found type `invariant<'r>`
+note: the lifetime 'r as defined on the function body at 20:23...
+ --> $DIR/regions-infer-invariance-due-to-mutability-3.rs:20:23
+ |
+LL | fn to_longer_lifetime<'r>(b_isize: invariant<'r>) -> invariant<'static> {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr
new file mode 100644
index 0000000..1e1daa5
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.nll.stderr
@@ -0,0 +1,16 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:21:5
+ |
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:21:5
+ |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+ | -- lifetime `'r` defined here
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^ returning this value requires that `'r` must outlive `'static`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-invariance-due-to-mutability-4.rs
rename to src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.rs
diff --git a/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr
new file mode 100644
index 0000000..fb47433
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-invariance-due-to-mutability-4.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:21:5
+ |
+LL | b_isize //~ ERROR mismatched types
+ | ^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Invariant<'static>`
+ found type `Invariant<'r>`
+note: the lifetime 'r as defined on the function body at 20:23...
+ --> $DIR/regions-infer-invariance-due-to-mutability-4.rs:20:23
+ |
+LL | fn to_longer_lifetime<'r>(b_isize: Invariant<'r>) -> Invariant<'static> {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-infer-not-param.nll.stderr b/src/test/ui/regions/regions-infer-not-param.nll.stderr
new file mode 100644
index 0000000..072be9b
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-not-param.nll.stderr
@@ -0,0 +1,38 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-not-param.rs:25:54
+ |
+LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-not-param.rs:29:63
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-not-param.rs:25:54
+ |
+LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types
+ | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b`
+ | |
+ | lifetime `'a` defined here
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-not-param.rs:29:63
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | -- -- lifetime `'b` defined here ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
+ | |
+ | lifetime `'a` defined here
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-infer-not-param.rs:29:63
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | -- -- lifetime `'b` defined here ^ returning this value requires that `'a` must outlive `'b`
+ | |
+ | lifetime `'a` defined here
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-not-param.rs
rename to src/test/ui/regions/regions-infer-not-param.rs
diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr
new file mode 100644
index 0000000..2a02951
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-not-param.stderr
@@ -0,0 +1,60 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-not-param.rs:25:54
+ |
+LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `direct<'b>`
+ found type `direct<'a>`
+note: the lifetime 'a as defined on the function body at 25:16...
+ --> $DIR/regions-infer-not-param.rs:25:16
+ |
+LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 25:19
+ --> $DIR/regions-infer-not-param.rs:25:19
+ |
+LL | fn take_direct<'a,'b>(p: direct<'a>) -> direct<'b> { p } //~ ERROR mismatched types
+ | ^^
+
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-not-param.rs:29:63
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `indirect2<'b>`
+ found type `indirect2<'a>`
+note: the lifetime 'a as defined on the function body at 29:19...
+ --> $DIR/regions-infer-not-param.rs:29:19
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the function body at 29:22
+ --> $DIR/regions-infer-not-param.rs:29:22
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^^
+
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-not-param.rs:29:63
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `indirect2<'b>`
+ found type `indirect2<'a>`
+note: the lifetime 'b as defined on the function body at 29:22...
+ --> $DIR/regions-infer-not-param.rs:29:22
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^^
+note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 29:19
+ --> $DIR/regions-infer-not-param.rs:29:19
+ |
+LL | fn take_indirect2<'a,'b>(p: indirect2<'a>) -> indirect2<'b> { p } //~ ERROR mismatched types
+ | ^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr
new file mode 100644
index 0000000..01ae291
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-paramd-indirect.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-infer-paramd-indirect.rs:33:18
+ |
+LL | self.f = b;
+ | ^
+
+error: borrowed data escapes outside of function
+ --> $DIR/regions-infer-paramd-indirect.rs:33:9
+ |
+LL | fn set_f_bad(&mut self, b: Box<b>) {
+ | --------- - `b` is a reference that is only valid in the function body
+ | |
+ | `self` is declared here, outside of the function body
+LL | self.f = b;
+ | ^^^^^^ `b` escapes the function body here
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-infer-paramd-indirect.rs b/src/test/ui/regions/regions-infer-paramd-indirect.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-paramd-indirect.rs
rename to src/test/ui/regions/regions-infer-paramd-indirect.rs
diff --git a/src/test/ui/regions/regions-infer-paramd-indirect.stderr b/src/test/ui/regions/regions-infer-paramd-indirect.stderr
new file mode 100644
index 0000000..602f309
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-paramd-indirect.stderr
@@ -0,0 +1,28 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-infer-paramd-indirect.rs:33:18
+ |
+LL | self.f = b;
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::boxed::Box<std::boxed::Box<&'a isize>>`
+ found type `std::boxed::Box<std::boxed::Box<&isize>>`
+note: the anonymous lifetime #2 defined on the method body at 32:5...
+ --> $DIR/regions-infer-paramd-indirect.rs:32:5
+ |
+LL | / fn set_f_bad(&mut self, b: Box<b>) {
+LL | | self.f = b;
+LL | | //~^ ERROR mismatched types
+LL | | //~| expected type `std::boxed::Box<std::boxed::Box<&'a isize>>`
+LL | | //~| found type `std::boxed::Box<std::boxed::Box<&isize>>`
+LL | | //~| lifetime mismatch
+LL | | }
+ | |_____^
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 27:6
+ --> $DIR/regions-infer-paramd-indirect.rs:27:6
+ |
+LL | impl<'a> set_f<'a> for c<'a> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr
new file mode 100644
index 0000000..fa358a9
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-proc-static-upvar.nll.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/regions-infer-proc-static-upvar.rs:20:13
+ |
+LL | let y = &x; //~ ERROR `x` does not live long enough
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - `x` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-infer-proc-static-upvar.rs b/src/test/ui/regions/regions-infer-proc-static-upvar.rs
similarity index 100%
rename from src/test/compile-fail/regions-infer-proc-static-upvar.rs
rename to src/test/ui/regions/regions-infer-proc-static-upvar.rs
diff --git a/src/test/ui/regions/regions-infer-proc-static-upvar.stderr b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr
new file mode 100644
index 0000000..93fe45e
--- /dev/null
+++ b/src/test/ui/regions/regions-infer-proc-static-upvar.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/regions-infer-proc-static-upvar.rs:20:14
+ |
+LL | let y = &x; //~ ERROR `x` does not live long enough
+ | ^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr
new file mode 100644
index 0000000..01f0cfa
--- /dev/null
+++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.nll.stderr
@@ -0,0 +1,24 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-lifetime-bounds-on-fns.rs:18:10
+ |
+LL | *x = *y; //~ ERROR E0623
+ | ^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-lifetime-bounds-on-fns.rs:24:5
+ |
+LL | a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623]
+ | ^
+
+error[E0308]: mismatched types
+ --> $DIR/regions-lifetime-bounds-on-fns.rs:30:43
+ |
+LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
+ | ^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+ found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs b/src/test/ui/regions/regions-lifetime-bounds-on-fns.rs
similarity index 100%
rename from src/test/compile-fail/regions-lifetime-bounds-on-fns.rs
rename to src/test/ui/regions/regions-lifetime-bounds-on-fns.rs
diff --git a/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr
new file mode 100644
index 0000000..1b600ef
--- /dev/null
+++ b/src/test/ui/regions/regions-lifetime-bounds-on-fns.stderr
@@ -0,0 +1,31 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-lifetime-bounds-on-fns.rs:18:10
+ |
+LL | fn b<'a, 'b>(x: &mut &'a isize, y: &mut &'b isize) {
+ | --------- --------- these two types are declared with different lifetimes...
+LL | // Illegal now because there is no `'b:'a` declaration.
+LL | *x = *y; //~ ERROR E0623
+ | ^^ ...but data from `y` flows into `x` here
+
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-lifetime-bounds-on-fns.rs:24:7
+ |
+LL | fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) {
+ | --------- --------- these two types are declared with different lifetimes...
+...
+LL | a(x, y); //~ ERROR 24:7: 24:8: lifetime mismatch [E0623]
+ | ^ ...but data from `y` flows into `x` here
+
+error[E0308]: mismatched types
+ --> $DIR/regions-lifetime-bounds-on-fns.rs:30:43
+ |
+LL | let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types
+ | ^ expected concrete lifetime, found bound lifetime parameter
+ |
+ = note: expected type `for<'r, 's, 't0, 't1> fn(&'r mut &'s isize, &'t0 mut &'t1 isize)`
+ found type `for<'r, 's> fn(&'r mut &isize, &'s mut &isize) {a::<'_, '_>}`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0308, E0623.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/regions-lifetime-of-struct-or-enum-variant.rs b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs
similarity index 100%
rename from src/test/compile-fail/regions-lifetime-of-struct-or-enum-variant.rs
rename to src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.rs
diff --git a/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr
new file mode 100644
index 0000000..390173e
--- /dev/null
+++ b/src/test/ui/regions/regions-lifetime-of-struct-or-enum-variant.stderr
@@ -0,0 +1,33 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:24:20
+ |
+LL | let testValue = &id(Test);
+ | ^^^^^^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 23:19...
+ --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:23:19
+ |
+LL | fn structLifetime<'a>() -> &'a Test {
+ | ^^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:30:20
+ |
+LL | let testValue = &id(MyEnum::Variant1);
+ | ^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 29:20...
+ --> $DIR/regions-lifetime-of-struct-or-enum-variant.rs:29:20
+ |
+LL | fn variantLifetime<'a>() -> &'a MyEnum {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-name-duplicated.rs b/src/test/ui/regions/regions-name-duplicated.rs
similarity index 100%
rename from src/test/compile-fail/regions-name-duplicated.rs
rename to src/test/ui/regions/regions-name-duplicated.rs
diff --git a/src/test/ui/regions/regions-name-duplicated.stderr b/src/test/ui/regions/regions-name-duplicated.stderr
new file mode 100644
index 0000000..ad945d5
--- /dev/null
+++ b/src/test/ui/regions/regions-name-duplicated.stderr
@@ -0,0 +1,11 @@
+error[E0263]: lifetime name `'a` declared twice in the same scope
+ --> $DIR/regions-name-duplicated.rs:11:16
+ |
+LL | struct Foo<'a, 'a> { //~ ERROR lifetime name `'a` declared twice
+ | -- ^^ declared twice
+ | |
+ | previous declaration here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0263`.
diff --git a/src/test/compile-fail/regions-name-static.rs b/src/test/ui/regions/regions-name-static.rs
similarity index 100%
rename from src/test/compile-fail/regions-name-static.rs
rename to src/test/ui/regions/regions-name-static.rs
diff --git a/src/test/ui/regions/regions-name-static.stderr b/src/test/ui/regions/regions-name-static.stderr
new file mode 100644
index 0000000..48077d6
--- /dev/null
+++ b/src/test/ui/regions/regions-name-static.stderr
@@ -0,0 +1,9 @@
+error[E0262]: invalid lifetime parameter name: `'static`
+ --> $DIR/regions-name-static.rs:11:12
+ |
+LL | struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static`
+ | ^^^^^^^ 'static is a reserved lifetime name
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0262`.
diff --git a/src/test/compile-fail/regions-name-undeclared.rs b/src/test/ui/regions/regions-name-undeclared.rs
similarity index 100%
rename from src/test/compile-fail/regions-name-undeclared.rs
rename to src/test/ui/regions/regions-name-undeclared.rs
diff --git a/src/test/ui/regions/regions-name-undeclared.stderr b/src/test/ui/regions/regions-name-undeclared.stderr
new file mode 100644
index 0000000..62fc5f5
--- /dev/null
+++ b/src/test/ui/regions/regions-name-undeclared.stderr
@@ -0,0 +1,69 @@
+error[E0261]: use of undeclared lifetime name `'b`
+ --> $DIR/regions-name-undeclared.rs:25:24
+ |
+LL | fn m4(&self, arg: &'b isize) { } //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'b`
+ --> $DIR/regions-name-undeclared.rs:26:12
+ |
+LL | fn m5(&'b self) { } //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'b`
+ --> $DIR/regions-name-undeclared.rs:27:27
+ |
+LL | fn m6(&self, arg: Foo<'b>) { } //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-name-undeclared.rs:35:22
+ |
+LL | type X = Option<&'a isize>; //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-name-undeclared.rs:37:13
+ |
+LL | E1(&'a isize) //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-name-undeclared.rs:40:13
+ |
+LL | f: &'a isize //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-name-undeclared.rs:42:14
+ |
+LL | fn f(a: &'a isize) { } //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-name-undeclared.rs:50:17
+ |
+LL | fn fn_types(a: &'a isize, //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'b`
+ --> $DIR/regions-name-undeclared.rs:52:36
+ |
+LL | &'b isize, //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'b`
+ --> $DIR/regions-name-undeclared.rs:55:36
+ |
+LL | &'b isize)>, //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-name-undeclared.rs:56:17
+ |
+LL | c: &'a isize) //~ ERROR undeclared lifetime
+ | ^^ undeclared lifetime
+
+error: aborting due to 11 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/src/test/ui/regions-nested-fns-2.nll.stderr b/src/test/ui/regions/regions-nested-fns-2.nll.stderr
similarity index 100%
rename from src/test/ui/regions-nested-fns-2.nll.stderr
rename to src/test/ui/regions/regions-nested-fns-2.nll.stderr
diff --git a/src/test/ui/regions-nested-fns-2.rs b/src/test/ui/regions/regions-nested-fns-2.rs
similarity index 100%
rename from src/test/ui/regions-nested-fns-2.rs
rename to src/test/ui/regions/regions-nested-fns-2.rs
diff --git a/src/test/ui/regions-nested-fns-2.stderr b/src/test/ui/regions/regions-nested-fns-2.stderr
similarity index 100%
rename from src/test/ui/regions-nested-fns-2.stderr
rename to src/test/ui/regions/regions-nested-fns-2.stderr
diff --git a/src/test/ui/regions/regions-nested-fns.nll.stderr b/src/test/ui/regions/regions-nested-fns.nll.stderr
new file mode 100644
index 0000000..d90015b
--- /dev/null
+++ b/src/test/ui/regions/regions-nested-fns.nll.stderr
@@ -0,0 +1,60 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-nested-fns.rs:24:27
+ |
+LL | if false { return x; } //~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-nested-fns.rs:15:18
+ |
+LL | let mut ay = &y; //~ ERROR E0495
+ | ^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-nested-fns.rs:20:9
+ |
+LL | let mut ay = &y; //~ ERROR E0495
+ | ------ lifetime `'2` appears in the type of `ay`
+LL |
+LL | ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+ | - has type `&'1 isize`
+...
+LL | ay = z;
+ | ^^^^^^ requires that `'1` must outlive `'2`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-nested-fns.rs:14:9
+ |
+LL | fn nested<'x>(x: &'x isize) {
+ | -- lifetime `'x` defined here
+LL | let y = 3;
+ | ^ requires that `'x` must outlive `'static`
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/regions-nested-fns.rs:15:18
+ |
+LL | let mut ay = &y; //~ ERROR E0495
+ | ^^ borrowed value does not live long enough
+...
+LL | }
+ | - `y` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: `y` does not live long enough
+ --> $DIR/regions-nested-fns.rs:19:15
+ |
+LL | ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+ | --- value captured here
+LL | ay = x;
+LL | ay = &y;
+ | ^ borrowed value does not live long enough
+...
+LL | }
+ | - `y` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-nested-fns.rs b/src/test/ui/regions/regions-nested-fns.rs
similarity index 100%
rename from src/test/compile-fail/regions-nested-fns.rs
rename to src/test/ui/regions/regions-nested-fns.rs
diff --git a/src/test/ui/regions/regions-nested-fns.stderr b/src/test/ui/regions/regions-nested-fns.stderr
new file mode 100644
index 0000000..93004b4
--- /dev/null
+++ b/src/test/ui/regions/regions-nested-fns.stderr
@@ -0,0 +1,61 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/regions-nested-fns.rs:15:18
+ |
+LL | let mut ay = &y; //~ ERROR E0495
+ | ^^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 17:54...
+ --> $DIR/regions-nested-fns.rs:17:54
+ |
+LL | ignore::<Box<for<'z> FnMut(&'z isize)>>(Box::new(|z| {
+ | ______________________________________________________^
+LL | | ay = x;
+LL | | ay = &y;
+LL | | ay = z;
+LL | | }));
+ | |_____^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-nested-fns.rs:20:14
+ |
+LL | ay = z;
+ | ^
+note: but, the lifetime must be valid for the anonymous lifetime #2 defined on the body at 23:68...
+ --> $DIR/regions-nested-fns.rs:23:68
+ |
+LL | ignore::< Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+ | ____________________________________________________________________^
+LL | | if false { return x; } //~ ERROR E0312
+LL | | if false { return ay; }
+LL | | return z;
+LL | | }));
+ | |_____^
+ = note: ...so that the types are compatible:
+ expected &isize
+ found &isize
+
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/regions-nested-fns.rs:24:27
+ |
+LL | if false { return x; } //~ ERROR E0312
+ | ^
+ |
+note: ...the reference is valid for the anonymous lifetime #2 defined on the body at 23:68...
+ --> $DIR/regions-nested-fns.rs:23:68
+ |
+LL | ignore::< Box<for<'z> FnMut(&'z isize) -> &'z isize>>(Box::new(|z| {
+ | ____________________________________________________________________^
+LL | | if false { return x; } //~ ERROR E0312
+LL | | if false { return ay; }
+LL | | return z;
+LL | | }));
+ | |_____^
+note: ...but the borrowed content is only valid for the lifetime 'x as defined on the function body at 13:11
+ --> $DIR/regions-nested-fns.rs:13:11
+ |
+LL | fn nested<'x>(x: &'x isize) {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0312, E0495.
+For more information about an error, try `rustc --explain E0312`.
diff --git a/src/test/compile-fail/regions-normalize-in-where-clause-list.rs b/src/test/ui/regions/regions-normalize-in-where-clause-list.rs
similarity index 100%
rename from src/test/compile-fail/regions-normalize-in-where-clause-list.rs
rename to src/test/ui/regions/regions-normalize-in-where-clause-list.rs
diff --git a/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr
new file mode 100644
index 0000000..ec153f1
--- /dev/null
+++ b/src/test/ui/regions/regions-normalize-in-where-clause-list.stderr
@@ -0,0 +1,26 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+ --> $DIR/regions-normalize-in-where-clause-list.rs:32:1
+ |
+LL | / fn bar<'a, 'b>() //~ ERROR cannot infer
+LL | | where <() as Project<'a, 'b>>::Item : Eq
+LL | | {
+LL | | }
+ | |_^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 32:8...
+ --> $DIR/regions-normalize-in-where-clause-list.rs:32:8
+ |
+LL | fn bar<'a, 'b>() //~ ERROR cannot infer
+ | ^^
+note: ...but the lifetime must also be valid for the lifetime 'b as defined on the function body at 32:12...
+ --> $DIR/regions-normalize-in-where-clause-list.rs:32:12
+ |
+LL | fn bar<'a, 'b>() //~ ERROR cannot infer
+ | ^^
+ = note: ...so that the types are compatible:
+ expected Project<'a, 'b>
+ found Project<'_, '_>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-enum-region-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-enum-region-rev.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.stderr b/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.stderr
new file mode 100644
index 0000000..5084097
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-region-rev.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a rev_variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-enum-region-rev.rs:24:11
+ |
+LL | V(&'a Foo<'b>) //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the enum at 23:14
+ --> $DIR/regions-outlives-nominal-type-enum-region-rev.rs:23:14
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the enum at 23:17
+ --> $DIR/regions-outlives-nominal-type-enum-region-rev.rs:23:17
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-enum-region.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-region.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-enum-region.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-enum-region.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-region.stderr b/src/test/ui/regions/regions-outlives-nominal-type-enum-region.stderr
new file mode 100644
index 0000000..ce187ed
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-region.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-enum-region.rs:24:11
+ |
+LL | V(&'a Foo<'b>) //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the enum at 23:14
+ --> $DIR/regions-outlives-nominal-type-enum-region.rs:23:14
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the enum at 23:17
+ --> $DIR/regions-outlives-nominal-type-enum-region.rs:23:17
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-enum-type-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-enum-type-rev.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.stderr b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.stderr
new file mode 100644
index 0000000..8636b89
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-type-rev.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a rev_variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-enum-type-rev.rs:24:11
+ |
+LL | V(&'a Foo<&'b i32>) //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the enum at 23:14
+ --> $DIR/regions-outlives-nominal-type-enum-type-rev.rs:23:14
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the enum at 23:17
+ --> $DIR/regions-outlives-nominal-type-enum-type-rev.rs:23:17
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-enum-type.rs b/src/test/ui/regions/regions-outlives-nominal-type-enum-type.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-enum-type.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-enum-type.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-enum-type.stderr b/src/test/ui/regions/regions-outlives-nominal-type-enum-type.stderr
new file mode 100644
index 0000000..c209547
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-enum-type.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-enum-type.rs:24:11
+ |
+LL | F(&'a Foo<&'b i32>) //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the enum at 23:14
+ --> $DIR/regions-outlives-nominal-type-enum-type.rs:23:14
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the enum at 23:17
+ --> $DIR/regions-outlives-nominal-type-enum-type.rs:23:17
+ |
+LL | enum Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-struct-region-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-struct-region-rev.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.stderr b/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.stderr
new file mode 100644
index 0000000..48980bd
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-region-rev.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a rev_variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-struct-region-rev.rs:24:9
+ |
+LL | f: &'a Foo<'b> //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 23:16
+ --> $DIR/regions-outlives-nominal-type-struct-region-rev.rs:23:16
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 23:19
+ --> $DIR/regions-outlives-nominal-type-struct-region-rev.rs:23:19
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-struct-region.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-region.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-struct-region.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-struct-region.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-region.stderr b/src/test/ui/regions/regions-outlives-nominal-type-struct-region.stderr
new file mode 100644
index 0000000..e2b3288
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-region.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a variant_struct_region::Foo<'b>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-struct-region.rs:24:9
+ |
+LL | f: &'a Foo<'b> //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 23:16
+ --> $DIR/regions-outlives-nominal-type-struct-region.rs:23:16
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 23:19
+ --> $DIR/regions-outlives-nominal-type-struct-region.rs:23:19
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-struct-type-rev.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-struct-type-rev.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.stderr b/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.stderr
new file mode 100644
index 0000000..2bf04ff
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-type-rev.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a rev_variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-struct-type-rev.rs:24:9
+ |
+LL | f: &'a Foo<&'b i32> //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 23:16
+ --> $DIR/regions-outlives-nominal-type-struct-type-rev.rs:23:16
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 23:19
+ --> $DIR/regions-outlives-nominal-type-struct-type-rev.rs:23:19
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-nominal-type-struct-type.rs b/src/test/ui/regions/regions-outlives-nominal-type-struct-type.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-nominal-type-struct-type.rs
rename to src/test/ui/regions/regions-outlives-nominal-type-struct-type.rs
diff --git a/src/test/ui/regions/regions-outlives-nominal-type-struct-type.stderr b/src/test/ui/regions/regions-outlives-nominal-type-struct-type.stderr
new file mode 100644
index 0000000..af9f1d3
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-nominal-type-struct-type.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a variant_struct_type::Foo<&'b i32>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-nominal-type-struct-type.rs:24:9
+ |
+LL | f: &'a Foo<&'b i32> //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 23:16
+ --> $DIR/regions-outlives-nominal-type-struct-type.rs:23:16
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 23:19
+ --> $DIR/regions-outlives-nominal-type-struct-type.rs:23:19
+ |
+LL | struct Bar<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr
new file mode 100644
index 0000000..db1508a
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.nll.stderr
@@ -0,0 +1,21 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:42:12
+ |
+LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:63:12
+ |
+LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: compilation successful
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:68:1
+ |
+LL | / fn main() {
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-outlives-projection-container-hrtb.rs b/src/test/ui/regions/regions-outlives-projection-container-hrtb.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-projection-container-hrtb.rs
rename to src/test/ui/regions/regions-outlives-projection-container-hrtb.rs
diff --git a/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr b/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr
new file mode 100644
index 0000000..32c9359
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-container-hrtb.stderr
@@ -0,0 +1,37 @@
+error[E0491]: in type `&'a WithHrAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:42:12
+ |
+LL | let _: &'a WithHrAssoc<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 39:15
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:39:15
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 39:18
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:39:18
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+
+error[E0491]: in type `&'a WithHrAssocSub<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:63:12
+ |
+LL | let _: &'a WithHrAssocSub<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 59:19
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:59:19
+ |
+LL | fn with_assoc_sub<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 59:22
+ --> $DIR/regions-outlives-projection-container-hrtb.rs:59:22
+ |
+LL | fn with_assoc_sub<'a,'b>() {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.rs b/src/test/ui/regions/regions-outlives-projection-container-wc.rs
new file mode 100644
index 0000000..79300d5
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-container-wc.rs
@@ -0,0 +1,51 @@
+// Copyright 2015 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-compare-mode-nll
+
+// Test that we are imposing the requirement that every associated
+// type of a bound that appears in the where clause on a struct must
+// outlive the location in which the type appears, even when the
+// constraint is in a where clause not a bound. Issue #22246.
+
+#![allow(dead_code)]
+
+///////////////////////////////////////////////////////////////////////////
+
+pub trait TheTrait {
+ type TheAssocType;
+}
+
+pub struct TheType<'b> {
+ m: [fn(&'b()); 0]
+}
+
+impl<'b> TheTrait for TheType<'b> {
+ type TheAssocType = &'b ();
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+pub struct WithAssoc<T> where T : TheTrait {
+ m: [T; 0]
+}
+
+fn with_assoc<'a,'b>() {
+ // For this type to be valid, the rules require that all
+ // associated types of traits that appear in `WithAssoc` must
+ // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
+ // which is &'b (), must outlive 'a.
+
+ let _: &'a WithAssoc<TheType<'b>> = loop { };
+ //~^ ERROR reference has a longer lifetime
+}
+
+fn main() {
+}
diff --git a/src/test/ui/regions/regions-outlives-projection-container-wc.stderr b/src/test/ui/regions/regions-outlives-projection-container-wc.stderr
new file mode 100644
index 0000000..d0680ec
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-container-wc.stderr
@@ -0,0 +1,20 @@
+error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container-wc.rs:46:12
+ |
+LL | let _: &'a WithAssoc<TheType<'b>> = loop { };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 40:15
+ --> $DIR/regions-outlives-projection-container-wc.rs:40:15
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 40:18
+ --> $DIR/regions-outlives-projection-container-wc.rs:40:18
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/ui/regions/regions-outlives-projection-container.rs b/src/test/ui/regions/regions-outlives-projection-container.rs
new file mode 100644
index 0000000..180a8b0
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-container.rs
@@ -0,0 +1,90 @@
+// Copyright 2015 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-compare-mode-nll
+
+// Test that we are imposing the requirement that every associated
+// type of a bound that appears in the where clause on a struct must
+// outlive the location in which the type appears. Issue #22246.
+
+// ignore-compare-mode-nll
+
+#![allow(dead_code)]
+#![feature(rustc_attrs)]
+
+///////////////////////////////////////////////////////////////////////////
+
+pub trait TheTrait {
+ type TheAssocType;
+}
+
+pub struct TheType<'b> {
+ m: [fn(&'b()); 0]
+}
+
+impl<'b> TheTrait for TheType<'b> {
+ type TheAssocType = &'b ();
+}
+
+///////////////////////////////////////////////////////////////////////////
+
+pub struct WithAssoc<T:TheTrait> {
+ m: [T; 0]
+}
+
+pub struct WithoutAssoc<T> {
+ m: [T; 0]
+}
+
+fn with_assoc<'a,'b>() {
+ // For this type to be valid, the rules require that all
+ // associated types of traits that appear in `WithAssoc` must
+ // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
+ // which is &'b (), must outlive 'a.
+
+ let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
+}
+
+fn with_assoc1<'a,'b>() where 'b : 'a {
+ // For this type to be valid, the rules require that all
+ // associated types of traits that appear in `WithAssoc` must
+ // outlive 'a. In this case, that means TheType<'b>::TheAssocType,
+ // which is &'b (), must outlive 'a, so 'b : 'a must hold, and
+ // that is in the where clauses, so we're fine.
+
+ let _: &'a WithAssoc<TheType<'b>> = loop { };
+}
+
+fn without_assoc<'a,'b>() {
+ // Here there are no associated types but there is a requirement
+ // that `'b:'a` holds because the `'b` appears in `TheType<'b>`.
+
+ let _: &'a WithoutAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
+}
+
+fn call_with_assoc<'a,'b>() {
+ // As `with_assoc`, but just checking that we impose the same rule
+ // on the value supplied for the type argument, even when there is
+ // no data.
+
+ call::<&'a WithAssoc<TheType<'b>>>();
+ //~^ ERROR reference has a longer lifetime
+}
+
+fn call_without_assoc<'a,'b>() {
+ // As `without_assoc`, but in a distinct scenario.
+
+ call::<&'a WithoutAssoc<TheType<'b>>>(); //~ ERROR reference has a longer lifetime
+}
+
+fn call<T>() { }
+
+fn main() {
+}
diff --git a/src/test/ui/regions/regions-outlives-projection-container.stderr b/src/test/ui/regions/regions-outlives-projection-container.stderr
new file mode 100644
index 0000000..4b8d445
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-container.stderr
@@ -0,0 +1,71 @@
+error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container.rs:52:12
+ |
+LL | let _: &'a WithAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 46:15
+ --> $DIR/regions-outlives-projection-container.rs:46:15
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 46:18
+ --> $DIR/regions-outlives-projection-container.rs:46:18
+ |
+LL | fn with_assoc<'a,'b>() {
+ | ^^
+
+error[E0491]: in type `&'a WithoutAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container.rs:69:12
+ |
+LL | let _: &'a WithoutAssoc<TheType<'b>> = loop { }; //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 65:18
+ --> $DIR/regions-outlives-projection-container.rs:65:18
+ |
+LL | fn without_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 65:21
+ --> $DIR/regions-outlives-projection-container.rs:65:21
+ |
+LL | fn without_assoc<'a,'b>() {
+ | ^^
+
+error[E0491]: in type `&'a WithAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container.rs:77:12
+ |
+LL | call::<&'a WithAssoc<TheType<'b>>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 72:20
+ --> $DIR/regions-outlives-projection-container.rs:72:20
+ |
+LL | fn call_with_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 72:23
+ --> $DIR/regions-outlives-projection-container.rs:72:23
+ |
+LL | fn call_with_assoc<'a,'b>() {
+ | ^^
+
+error[E0491]: in type `&'a WithoutAssoc<TheType<'b>>`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-outlives-projection-container.rs:84:12
+ |
+LL | call::<&'a WithoutAssoc<TheType<'b>>>(); //~ ERROR reference has a longer lifetime
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the function body at 81:23
+ --> $DIR/regions-outlives-projection-container.rs:81:23
+ |
+LL | fn call_without_assoc<'a,'b>() {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the function body at 81:26
+ --> $DIR/regions-outlives-projection-container.rs:81:26
+ |
+LL | fn call_without_assoc<'a,'b>() {
+ | ^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0491`.
diff --git a/src/test/compile-fail/regions-outlives-projection-hrtype.rs b/src/test/ui/regions/regions-outlives-projection-hrtype.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-projection-hrtype.rs
rename to src/test/ui/regions/regions-outlives-projection-hrtype.rs
diff --git a/src/test/ui/regions/regions-outlives-projection-hrtype.stderr b/src/test/ui/regions/regions-outlives-projection-hrtype.stderr
new file mode 100644
index 0000000..ba4e318
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-hrtype.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/regions-outlives-projection-hrtype.rs:36:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-outlives-projection-trait-def.rs b/src/test/ui/regions/regions-outlives-projection-trait-def.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-projection-trait-def.rs
rename to src/test/ui/regions/regions-outlives-projection-trait-def.rs
diff --git a/src/test/ui/regions/regions-outlives-projection-trait-def.stderr b/src/test/ui/regions/regions-outlives-projection-trait-def.stderr
new file mode 100644
index 0000000..0a4cbe6
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-projection-trait-def.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/regions-outlives-projection-trait-def.rs:31:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-outlives-scalar.rs b/src/test/ui/regions/regions-outlives-scalar.rs
similarity index 100%
rename from src/test/compile-fail/regions-outlives-scalar.rs
rename to src/test/ui/regions/regions-outlives-scalar.rs
diff --git a/src/test/ui/regions/regions-outlives-scalar.stderr b/src/test/ui/regions/regions-outlives-scalar.stderr
new file mode 100644
index 0000000..d754bdd
--- /dev/null
+++ b/src/test/ui/regions/regions-outlives-scalar.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/regions-outlives-scalar.rs:23:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr
new file mode 100644
index 0000000..c39d007
--- /dev/null
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.nll.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `line` does not live long enough
+ --> $DIR/regions-pattern-typing-issue-19552.rs:15:14
+ |
+LL | match [&*line] { //~ ERROR `line` does not live long enough
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `line` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-pattern-typing-issue-19552.rs b/src/test/ui/regions/regions-pattern-typing-issue-19552.rs
similarity index 100%
rename from src/test/compile-fail/regions-pattern-typing-issue-19552.rs
rename to src/test/ui/regions/regions-pattern-typing-issue-19552.rs
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr
new file mode 100644
index 0000000..cefedef
--- /dev/null
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19552.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `line` does not live long enough
+ --> $DIR/regions-pattern-typing-issue-19552.rs:15:14
+ |
+LL | match [&*line] { //~ ERROR `line` does not live long enough
+ | ^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr
new file mode 100644
index 0000000..2acac5d
--- /dev/null
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.nll.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `a1` because it is borrowed
+ --> $DIR/regions-pattern-typing-issue-19997.rs:20:13
+ |
+LL | match (&a1,) {
+ | --- borrow of `a1` occurs here
+LL | (&ref b0,) => {
+LL | a1 = &f; //[ast]~ ERROR cannot assign
+ | ^^^^^^^ assignment to borrowed `a1` occurs here
+LL | //[mir]~^ ERROR cannot assign to `a1` because it is borrowed
+LL | drop(b0);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr
new file mode 100644
index 0000000..c26a036
--- /dev/null
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.ast.stderr
@@ -0,0 +1,12 @@
+error[E0506]: cannot assign to `a1` because it is borrowed
+ --> $DIR/regions-pattern-typing-issue-19997.rs:20:13
+ |
+LL | match (&a1,) {
+ | -- borrow of `a1` occurs here
+LL | (&ref b0,) => {
+LL | a1 = &f; //[ast]~ ERROR cannot assign
+ | ^^^^^^^ assignment to borrowed `a1` occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr b/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr
new file mode 100644
index 0000000..2acac5d
--- /dev/null
+++ b/src/test/ui/regions/regions-pattern-typing-issue-19997.mir.stderr
@@ -0,0 +1,15 @@
+error[E0506]: cannot assign to `a1` because it is borrowed
+ --> $DIR/regions-pattern-typing-issue-19997.rs:20:13
+ |
+LL | match (&a1,) {
+ | --- borrow of `a1` occurs here
+LL | (&ref b0,) => {
+LL | a1 = &f; //[ast]~ ERROR cannot assign
+ | ^^^^^^^ assignment to borrowed `a1` occurs here
+LL | //[mir]~^ ERROR cannot assign to `a1` because it is borrowed
+LL | drop(b0);
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/regions-pattern-typing-issue-19997.rs b/src/test/ui/regions/regions-pattern-typing-issue-19997.rs
similarity index 100%
rename from src/test/compile-fail/regions-pattern-typing-issue-19997.rs
rename to src/test/ui/regions/regions-pattern-typing-issue-19997.rs
diff --git a/src/test/ui/regions/regions-proc-bound-capture.nll.stderr b/src/test/ui/regions/regions-proc-bound-capture.nll.stderr
new file mode 100644
index 0000000..00728aa
--- /dev/null
+++ b/src/test/ui/regions/regions-proc-bound-capture.nll.stderr
@@ -0,0 +1,21 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-proc-bound-capture.rs:19:14
+ |
+LL | Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621]
+ | ^^^^^^^^^^^^^
+
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/regions-proc-bound-capture.rs:17:62
+ |
+LL | fn static_proc(x: &isize) -> Box<FnMut()->(isize) + 'static> {
+ | ___________________------_____________________________________^
+ | | |
+ | | help: add explicit lifetime `'static` to the type of `x`: `&'static isize`
+LL | | // This is illegal, because the region bound on `proc` is 'static.
+LL | | Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621]
+LL | | }
+ | |_^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/regions-proc-bound-capture.rs b/src/test/ui/regions/regions-proc-bound-capture.rs
similarity index 100%
rename from src/test/compile-fail/regions-proc-bound-capture.rs
rename to src/test/ui/regions/regions-proc-bound-capture.rs
diff --git a/src/test/ui/regions/regions-proc-bound-capture.stderr b/src/test/ui/regions/regions-proc-bound-capture.stderr
new file mode 100644
index 0000000..b38543b
--- /dev/null
+++ b/src/test/ui/regions/regions-proc-bound-capture.stderr
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `x`
+ --> $DIR/regions-proc-bound-capture.rs:19:5
+ |
+LL | fn static_proc(x: &isize) -> Box<FnMut()->(isize) + 'static> {
+ | ------ help: add explicit lifetime `'static` to the type of `x`: `&'static isize`
+LL | // This is illegal, because the region bound on `proc` is 'static.
+LL | Box::new(move|| { *x }) //~ ERROR explicit lifetime required in the type of `x` [E0621]
+ | ^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr
new file mode 100644
index 0000000..37454ff
--- /dev/null
+++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.nll.stderr
@@ -0,0 +1,20 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:14:5
+ |
+LL | &mut ***p //~ ERROR 14:5: 14:14: lifetime mismatch [E0623]
+ | ^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:13:85
+ |
+LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize {
+ | ______________________--__--_________________________________________________________^
+ | | | |
+ | | | lifetime `'b` defined here
+ | | lifetime `'a` defined here
+LL | | &mut ***p //~ ERROR 14:5: 14:14: lifetime mismatch [E0623]
+LL | | }
+ | |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs
similarity index 100%
rename from src/test/compile-fail/regions-reborrow-from-shorter-mut-ref-mut-ref.rs
rename to src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.rs
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr
new file mode 100644
index 0000000..cddb60a
--- /dev/null
+++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref-mut-ref.stderr
@@ -0,0 +1,13 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-reborrow-from-shorter-mut-ref-mut-ref.rs:14:5
+ |
+LL | fn copy_borrowed_ptr<'a, 'b, 'c>(p: &'a mut &'b mut &'c mut isize) -> &'b mut isize {
+ | ----------------------------- -------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | &mut ***p //~ ERROR 14:5: 14:14: lifetime mismatch [E0623]
+ | ^^^^^^^^^ ...but data from `p` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr
new file mode 100644
index 0000000..455ee6f
--- /dev/null
+++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.nll.stderr
@@ -0,0 +1,20 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:16:5
+ |
+LL | &mut **p //~ ERROR 16:5: 16:13: lifetime mismatch [E0623]
+ | ^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:15:73
+ |
+LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize {
+ | ______________________--__--_____________________________________________^
+ | | | |
+ | | | lifetime `'b` defined here
+ | | lifetime `'a` defined here
+LL | | &mut **p //~ ERROR 16:5: 16:13: lifetime mismatch [E0623]
+LL | | }
+ | |_^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-reborrow-from-shorter-mut-ref.rs b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs
similarity index 100%
rename from src/test/compile-fail/regions-reborrow-from-shorter-mut-ref.rs
rename to src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.rs
diff --git a/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr
new file mode 100644
index 0000000..9f8d016
--- /dev/null
+++ b/src/test/ui/regions/regions-reborrow-from-shorter-mut-ref.stderr
@@ -0,0 +1,13 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-reborrow-from-shorter-mut-ref.rs:16:5
+ |
+LL | fn copy_borrowed_ptr<'a, 'b>(p: &'a mut &'b mut isize) -> &'b mut isize {
+ | --------------------- -------------
+ | |
+ | this parameter and the return type are declared with different lifetimes...
+LL | &mut **p //~ ERROR 16:5: 16:13: lifetime mismatch [E0623]
+ | ^^^^^^^^ ...but data from `p` is returned here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr
new file mode 100644
index 0000000..87fe858
--- /dev/null
+++ b/src/test/ui/regions/regions-ref-in-fn-arg.nll.stderr
@@ -0,0 +1,22 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-ref-in-fn-arg.rs:14:13
+ |
+LL | fn arg_item(box ref x: Box<isize>) -> &'static isize {
+ | ^^^^^^^^^ temporary value does not live long enough
+LL | x //~^ ERROR borrowed value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-ref-in-fn-arg.rs:21:11
+ |
+LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough
+ | ^^^^^^^^^ - temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-ref-in-fn-arg.rs b/src/test/ui/regions/regions-ref-in-fn-arg.rs
similarity index 100%
rename from src/test/compile-fail/regions-ref-in-fn-arg.rs
rename to src/test/ui/regions/regions-ref-in-fn-arg.rs
diff --git a/src/test/ui/regions/regions-ref-in-fn-arg.stderr b/src/test/ui/regions/regions-ref-in-fn-arg.stderr
new file mode 100644
index 0000000..0250f6e
--- /dev/null
+++ b/src/test/ui/regions/regions-ref-in-fn-arg.stderr
@@ -0,0 +1,24 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-ref-in-fn-arg.rs:14:17
+ |
+LL | fn arg_item(box ref x: Box<isize>) -> &'static isize {
+ | ^^^^^ borrowed value does not live long enough
+LL | x //~^ ERROR borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-ref-in-fn-arg.rs:21:15
+ |
+LL | with(|box ref x| x) //~ ERROR borrowed value does not live long enough
+ | ^^^^^ - borrowed value only lives until here
+ | |
+ | borrowed value does not live long enough
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr
new file mode 100644
index 0000000..29810f5
--- /dev/null
+++ b/src/test/ui/regions/regions-ret-borrowed-1.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-ret-borrowed-1.rs:20:14
+ |
+LL | with(|o| o)
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-ret-borrowed-1.rs:20:14
+ |
+LL | with(|o| o)
+ | -- ^ returning this value requires that `'1` must outlive `'2`
+ | ||
+ | |return type of closure is &'2 isize
+ | has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-ret-borrowed-1.rs b/src/test/ui/regions/regions-ret-borrowed-1.rs
similarity index 100%
rename from src/test/compile-fail/regions-ret-borrowed-1.rs
rename to src/test/ui/regions/regions-ret-borrowed-1.rs
diff --git a/src/test/ui/regions/regions-ret-borrowed-1.stderr b/src/test/ui/regions/regions-ret-borrowed-1.stderr
new file mode 100644
index 0000000..ac886bc
--- /dev/null
+++ b/src/test/ui/regions/regions-ret-borrowed-1.stderr
@@ -0,0 +1,28 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/regions-ret-borrowed-1.rs:20:14
+ |
+LL | with(|o| o)
+ | ^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 20:10...
+ --> $DIR/regions-ret-borrowed-1.rs:20:10
+ |
+LL | with(|o| o)
+ | ^^^^^
+ = note: ...so that the expression is assignable:
+ expected &isize
+ found &isize
+note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 19:14...
+ --> $DIR/regions-ret-borrowed-1.rs:19:14
+ |
+LL | fn return_it<'a>() -> &'a isize {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-ret-borrowed-1.rs:20:5
+ |
+LL | with(|o| o)
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-ret-borrowed.nll.stderr b/src/test/ui/regions/regions-ret-borrowed.nll.stderr
new file mode 100644
index 0000000..ab70e6a
--- /dev/null
+++ b/src/test/ui/regions/regions-ret-borrowed.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-ret-borrowed.rs:23:14
+ |
+LL | with(|o| o)
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-ret-borrowed.rs:23:14
+ |
+LL | with(|o| o)
+ | -- ^ returning this value requires that `'1` must outlive `'2`
+ | ||
+ | |return type of closure is &'2 isize
+ | has type `&'1 isize`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-ret-borrowed.rs b/src/test/ui/regions/regions-ret-borrowed.rs
similarity index 100%
rename from src/test/compile-fail/regions-ret-borrowed.rs
rename to src/test/ui/regions/regions-ret-borrowed.rs
diff --git a/src/test/ui/regions/regions-ret-borrowed.stderr b/src/test/ui/regions/regions-ret-borrowed.stderr
new file mode 100644
index 0000000..36c4ce7
--- /dev/null
+++ b/src/test/ui/regions/regions-ret-borrowed.stderr
@@ -0,0 +1,28 @@
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
+ --> $DIR/regions-ret-borrowed.rs:23:14
+ |
+LL | with(|o| o)
+ | ^
+ |
+note: first, the lifetime cannot outlive the anonymous lifetime #2 defined on the body at 23:10...
+ --> $DIR/regions-ret-borrowed.rs:23:10
+ |
+LL | with(|o| o)
+ | ^^^^^
+ = note: ...so that the expression is assignable:
+ expected &isize
+ found &isize
+note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 22:14...
+ --> $DIR/regions-ret-borrowed.rs:22:14
+ |
+LL | fn return_it<'a>() -> &'a isize {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/regions-ret-borrowed.rs:23:5
+ |
+LL | with(|o| o)
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/ui/regions/regions-ret.nll.stderr b/src/test/ui/regions/regions-ret.nll.stderr
new file mode 100644
index 0000000..cacc119
--- /dev/null
+++ b/src/test/ui/regions/regions-ret.nll.stderr
@@ -0,0 +1,19 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-ret.rs:14:13
+ |
+LL | return &id(3); //~ ERROR borrowed value does not live long enough
+ | ^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 13:1...
+ --> $DIR/regions-ret.rs:13:1
+ |
+LL | / fn f(_x: &isize) -> &isize {
+LL | | return &id(3); //~ ERROR borrowed value does not live long enough
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-ret.rs b/src/test/ui/regions/regions-ret.rs
similarity index 100%
rename from src/test/compile-fail/regions-ret.rs
rename to src/test/ui/regions/regions-ret.rs
diff --git a/src/test/ui/regions/regions-ret.stderr b/src/test/ui/regions/regions-ret.stderr
new file mode 100644
index 0000000..84515a9
--- /dev/null
+++ b/src/test/ui/regions/regions-ret.stderr
@@ -0,0 +1,20 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-ret.rs:14:13
+ |
+LL | return &id(3); //~ ERROR borrowed value does not live long enough
+ | ^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 13:1...
+ --> $DIR/regions-ret.rs:13:1
+ |
+LL | / fn f(_x: &isize) -> &isize {
+LL | | return &id(3); //~ ERROR borrowed value does not live long enough
+LL | | }
+ | |_^
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr
new file mode 100644
index 0000000..850226f
--- /dev/null
+++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24
+ |
+LL | let mut f = || &mut x; //~ ERROR cannot infer
+ | ^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24
+ |
+LL | let mut f = || &mut x; //~ ERROR cannot infer
+ | -- ^^^^^^ returning this value requires that `'1` must outlive `'2`
+ | ||
+ | |return type of closure is &'2 mut i32
+ | lifetime `'1` represents this closure's body
+ |
+ = note: closure implements `FnMut`, so references to captured variables can't escape the closure
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.rs
similarity index 100%
rename from src/test/compile-fail/regions-return-ref-to-upvar-issue-17403.rs
rename to src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.rs
diff --git a/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr
new file mode 100644
index 0000000..c841c96
--- /dev/null
+++ b/src/test/ui/regions/regions-return-ref-to-upvar-issue-17403.stderr
@@ -0,0 +1,30 @@
+error[E0495]: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24
+ |
+LL | let mut f = || &mut x; //~ ERROR cannot infer
+ | ^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime as defined on the body at 17:21...
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:21
+ |
+LL | let mut f = || &mut x; //~ ERROR cannot infer
+ | ^^^^^^^^^
+note: ...so that closure can access `x`
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:17:24
+ |
+LL | let mut f = || &mut x; //~ ERROR cannot infer
+ | ^^^^^^
+note: but, the lifetime must be valid for the call at 19:17...
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:19:17
+ |
+LL | let y = f();
+ | ^^^
+note: ...so type `&mut i32` of expression is valid during the expression
+ --> $DIR/regions-return-ref-to-upvar-issue-17403.rs:19:17
+ |
+LL | let y = f();
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/compile-fail/regions-return-stack-allocated-vec.rs b/src/test/ui/regions/regions-return-stack-allocated-vec.rs
similarity index 100%
rename from src/test/compile-fail/regions-return-stack-allocated-vec.rs
rename to src/test/ui/regions/regions-return-stack-allocated-vec.rs
diff --git a/src/test/ui/regions/regions-return-stack-allocated-vec.stderr b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr
new file mode 100644
index 0000000..77c1d17
--- /dev/null
+++ b/src/test/ui/regions/regions-return-stack-allocated-vec.stderr
@@ -0,0 +1,13 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-return-stack-allocated-vec.rs:14:6
+ |
+LL | &[x] //~ ERROR borrowed value does not live long enough
+ | ^^^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-static-bound.ll.nll.stderr b/src/test/ui/regions/regions-static-bound.ll.nll.stderr
new file mode 100644
index 0000000..326111a
--- /dev/null
+++ b/src/test/ui/regions/regions-static-bound.ll.nll.stderr
@@ -0,0 +1,46 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-static-bound.rs:19:5
+ |
+LL | t //[ll]~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-static-bound.rs:25:5
+ |
+LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+ | ^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-static-bound.rs:28:5
+ |
+LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-static-bound.rs:19:5
+ |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+ | -- lifetime `'a` defined here
+LL | t //[ll]~ ERROR E0312
+ | ^ returning this value requires that `'a` must outlive `'static`
+
+error[E0621]: explicit lifetime required in the type of `u`
+ --> $DIR/regions-static-bound.rs:25:5
+ |
+LL | fn error(u: &(), v: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+ | ^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/regions-static-bound.rs:28:5
+ |
+LL | fn error(u: &(), v: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+ | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/ui/regions/regions-static-bound.ll.stderr b/src/test/ui/regions/regions-static-bound.ll.stderr
new file mode 100644
index 0000000..4a11677
--- /dev/null
+++ b/src/test/ui/regions/regions-static-bound.ll.stderr
@@ -0,0 +1,34 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/regions-static-bound.rs:19:5
+ |
+LL | t //[ll]~ ERROR E0312
+ | ^
+ |
+ = note: ...the reference is valid for the static lifetime...
+note: ...but the borrowed content is only valid for the lifetime 'a as defined on the function body at 18:24
+ --> $DIR/regions-static-bound.rs:18:24
+ |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+ | ^^
+
+error[E0621]: explicit lifetime required in the type of `u`
+ --> $DIR/regions-static-bound.rs:25:5
+ |
+LL | fn error(u: &(), v: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+ | ^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/regions-static-bound.rs:28:5
+ |
+LL | fn error(u: &(), v: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+ | ^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0312, E0621.
+For more information about an error, try `rustc --explain E0312`.
diff --git a/src/test/ui/regions/regions-static-bound.nll.stderr b/src/test/ui/regions/regions-static-bound.nll.stderr
new file mode 100644
index 0000000..326111a
--- /dev/null
+++ b/src/test/ui/regions/regions-static-bound.nll.stderr
@@ -0,0 +1,46 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-static-bound.rs:19:5
+ |
+LL | t //[ll]~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-static-bound.rs:25:5
+ |
+LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+ | ^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-static-bound.rs:28:5
+ |
+LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+ | ^^^^^^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-static-bound.rs:19:5
+ |
+LL | fn static_id_wrong_way<'a>(t: &'a ()) -> &'static () where 'static: 'a {
+ | -- lifetime `'a` defined here
+LL | t //[ll]~ ERROR E0312
+ | ^ returning this value requires that `'a` must outlive `'static`
+
+error[E0621]: explicit lifetime required in the type of `u`
+ --> $DIR/regions-static-bound.rs:25:5
+ |
+LL | fn error(u: &(), v: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `u`: `&'static ()`
+LL | static_id(&u); //[ll]~ ERROR explicit lifetime required in the type of `u` [E0621]
+ | ^^^^^^^^^^^^^ lifetime `'static` required
+
+error[E0621]: explicit lifetime required in the type of `v`
+ --> $DIR/regions-static-bound.rs:28:5
+ |
+LL | fn error(u: &(), v: &()) {
+ | --- help: add explicit lifetime `'static` to the type of `v`: `&'static ()`
+...
+LL | static_id_indirect(&v); //[ll]~ ERROR explicit lifetime required in the type of `v` [E0621]
+ | ^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/regions-static-bound.rs b/src/test/ui/regions/regions-static-bound.rs
similarity index 100%
rename from src/test/compile-fail/regions-static-bound.rs
rename to src/test/ui/regions/regions-static-bound.rs
diff --git a/src/test/ui/regions/regions-steal-closure.nll.stderr b/src/test/ui/regions/regions-steal-closure.nll.stderr
new file mode 100644
index 0000000..ed70e38
--- /dev/null
+++ b/src/test/ui/regions/regions-steal-closure.nll.stderr
@@ -0,0 +1,15 @@
+error[E0597]: `i` does not live long enough
+ --> $DIR/regions-steal-closure.rs:24:28
+ |
+LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough
+ | -- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+LL | };
+ | - `i` dropped here while still borrowed
+LL | cl_box.cl.call_mut(());
+ | --------- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-steal-closure.rs b/src/test/ui/regions/regions-steal-closure.rs
similarity index 100%
rename from src/test/compile-fail/regions-steal-closure.rs
rename to src/test/ui/regions/regions-steal-closure.rs
diff --git a/src/test/ui/regions/regions-steal-closure.stderr b/src/test/ui/regions/regions-steal-closure.stderr
new file mode 100644
index 0000000..44843d1
--- /dev/null
+++ b/src/test/ui/regions/regions-steal-closure.stderr
@@ -0,0 +1,16 @@
+error[E0597]: `i` does not live long enough
+ --> $DIR/regions-steal-closure.rs:24:28
+ |
+LL | box_it(Box::new(|| i += 1)) //~ ERROR `i` does not live long enough
+ | -- ^ borrowed value does not live long enough
+ | |
+ | capture occurs here
+LL | };
+ | - borrowed value only lives until here
+LL | cl_box.cl.call_mut(());
+LL | }
+ | - borrowed value needs to live until here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-struct-not-wf.lexical.stderr b/src/test/ui/regions/regions-struct-not-wf.lexical.stderr
new file mode 100644
index 0000000..9433b8b
--- /dev/null
+++ b/src/test/ui/regions/regions-struct-not-wf.lexical.stderr
@@ -0,0 +1,49 @@
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-struct-not-wf.rs:19:5
+ |
+LL | struct Ref<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | field: &'a T
+ | ^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'a T` does not outlive the data it points at
+ --> $DIR/regions-struct-not-wf.rs:19:5
+ |
+LL | field: &'a T
+ | ^^^^^^^^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-struct-not-wf.rs:29:5
+ |
+LL | struct RefIndirect<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | field: RefOk<'a, T>
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-struct-not-wf.rs:29:5
+ |
+LL | field: RefOk<'a, T>
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-struct-not-wf.rs:35:5
+ |
+LL | field: &'a &'b T
+ | ^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 34:18
+ --> $DIR/regions-struct-not-wf.rs:34:18
+ |
+LL | struct DoubleRef<'a, 'b, T> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 34:22
+ --> $DIR/regions-struct-not-wf.rs:34:22
+ |
+LL | struct DoubleRef<'a, 'b, T> {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0309, E0491.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/ui/regions/regions-struct-not-wf.nll.stderr b/src/test/ui/regions/regions-struct-not-wf.nll.stderr
new file mode 100644
index 0000000..9433b8b
--- /dev/null
+++ b/src/test/ui/regions/regions-struct-not-wf.nll.stderr
@@ -0,0 +1,49 @@
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-struct-not-wf.rs:19:5
+ |
+LL | struct Ref<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | field: &'a T
+ | ^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'a T` does not outlive the data it points at
+ --> $DIR/regions-struct-not-wf.rs:19:5
+ |
+LL | field: &'a T
+ | ^^^^^^^^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/regions-struct-not-wf.rs:29:5
+ |
+LL | struct RefIndirect<'a, T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | field: RefOk<'a, T>
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that the type `T` will meet its required lifetime bounds
+ --> $DIR/regions-struct-not-wf.rs:29:5
+ |
+LL | field: RefOk<'a, T>
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0491]: in type `&'a &'b T`, reference has a longer lifetime than the data it references
+ --> $DIR/regions-struct-not-wf.rs:35:5
+ |
+LL | field: &'a &'b T
+ | ^^^^^^^^^^^^^^^^
+ |
+note: the pointer is valid for the lifetime 'a as defined on the struct at 34:18
+ --> $DIR/regions-struct-not-wf.rs:34:18
+ |
+LL | struct DoubleRef<'a, 'b, T> {
+ | ^^
+note: but the referenced data is only valid for the lifetime 'b as defined on the struct at 34:22
+ --> $DIR/regions-struct-not-wf.rs:34:22
+ |
+LL | struct DoubleRef<'a, 'b, T> {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0309, E0491.
+For more information about an error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/regions-struct-not-wf.rs b/src/test/ui/regions/regions-struct-not-wf.rs
similarity index 100%
rename from src/test/compile-fail/regions-struct-not-wf.rs
rename to src/test/ui/regions/regions-struct-not-wf.rs
diff --git a/src/test/compile-fail/regions-trait-1.rs b/src/test/ui/regions/regions-trait-1.rs
similarity index 100%
rename from src/test/compile-fail/regions-trait-1.rs
rename to src/test/ui/regions/regions-trait-1.rs
diff --git a/src/test/ui/regions/regions-trait-1.stderr b/src/test/ui/regions/regions-trait-1.stderr
new file mode 100644
index 0000000..dbc47a5
--- /dev/null
+++ b/src/test/ui/regions/regions-trait-1.stderr
@@ -0,0 +1,24 @@
+error[E0308]: method not compatible with trait
+ --> $DIR/regions-trait-1.rs:26:5
+ |
+LL | fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `fn(&has_ctxt<'a>) -> &ctxt`
+ found type `fn(&has_ctxt<'a>) -> &'a ctxt`
+note: the lifetime 'a as defined on the impl at 22:6...
+ --> $DIR/regions-trait-1.rs:22:6
+ |
+LL | impl<'a> get_ctxt for has_ctxt<'a> {
+ | ^^
+note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 26:5
+ --> $DIR/regions-trait-1.rs:26:5
+ |
+LL | / fn get_ctxt(&self) -> &'a ctxt { //~ ERROR method not compatible with trait
+LL | | self.c
+LL | | }
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr
new file mode 100644
index 0000000..99bee4a
--- /dev/null
+++ b/src/test/ui/regions/regions-trait-object-subtyping.nll.stderr
@@ -0,0 +1,39 @@
+warning: not reporting region error due to nll
+ --> $DIR/regions-trait-object-subtyping.rs:25:5
+ |
+LL | x //~ ERROR lifetime bound not satisfied
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/regions-trait-object-subtyping.rs:32:5
+ |
+LL | x //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-trait-object-subtyping.rs:23:51
+ |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+ | _________--_--_____________________________________^
+ | | | |
+ | | | lifetime `'b` defined here
+ | | lifetime `'a` defined here
+LL | | // Without knowing 'a:'b, we can't coerce
+LL | | x //~ ERROR lifetime bound not satisfied
+LL | | //~^ ERROR cannot infer an appropriate lifetime
+LL | | }
+ | |_^ returning this value requires that `'a` must outlive `'b`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/regions-trait-object-subtyping.rs:32:5
+ |
+LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | // We can't coerce because it is packed in `Wrapper`
+LL | x //~ ERROR mismatched types
+ | ^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/regions-trait-object-subtyping.rs b/src/test/ui/regions/regions-trait-object-subtyping.rs
similarity index 100%
rename from src/test/compile-fail/regions-trait-object-subtyping.rs
rename to src/test/ui/regions/regions-trait-object-subtyping.rs
diff --git a/src/test/ui/regions/regions-trait-object-subtyping.stderr b/src/test/ui/regions/regions-trait-object-subtyping.stderr
new file mode 100644
index 0000000..1b07885
--- /dev/null
+++ b/src/test/ui/regions/regions-trait-object-subtyping.stderr
@@ -0,0 +1,65 @@
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/regions-trait-object-subtyping.rs:25:5
+ |
+LL | x //~ ERROR lifetime bound not satisfied
+ | ^
+ |
+note: lifetime parameter instantiated with the lifetime 'a as defined on the function body at 23:9
+ --> $DIR/regions-trait-object-subtyping.rs:23:9
+ |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+ | ^^
+note: but lifetime parameter must outlive the lifetime 'b as defined on the function body at 23:12
+ --> $DIR/regions-trait-object-subtyping.rs:23:12
+ |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+ | ^^
+
+error[E0495]: cannot infer an appropriate lifetime for automatic coercion due to conflicting requirements
+ --> $DIR/regions-trait-object-subtyping.rs:25:5
+ |
+LL | x //~ ERROR lifetime bound not satisfied
+ | ^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 23:9...
+ --> $DIR/regions-trait-object-subtyping.rs:23:9
+ |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+ | ^^
+note: ...so that the type `(dyn Dummy + 'a)` is not borrowed for too long
+ --> $DIR/regions-trait-object-subtyping.rs:25:5
+ |
+LL | x //~ ERROR lifetime bound not satisfied
+ | ^
+note: but, the lifetime must be valid for the lifetime 'b as defined on the function body at 23:12...
+ --> $DIR/regions-trait-object-subtyping.rs:23:12
+ |
+LL | fn foo3<'a,'b>(x: &'a mut Dummy) -> &'b mut Dummy {
+ | ^^
+ = note: ...so that the expression is assignable:
+ expected &'b mut (dyn Dummy + 'b)
+ found &mut (dyn Dummy + 'b)
+
+error[E0308]: mismatched types
+ --> $DIR/regions-trait-object-subtyping.rs:32:5
+ |
+LL | x //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `Wrapper<&'b mut (dyn Dummy + 'b)>`
+ found type `Wrapper<&'a mut (dyn Dummy + 'a)>`
+note: the lifetime 'b as defined on the function body at 30:15...
+ --> $DIR/regions-trait-object-subtyping.rs:30:15
+ |
+LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'a as defined on the function body at 30:9
+ --> $DIR/regions-trait-object-subtyping.rs:30:9
+ |
+LL | fn foo4<'a:'b,'b>(x: Wrapper<&'a mut Dummy>) -> Wrapper<&'b mut Dummy> {
+ | ^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0308, E0478, E0495.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/regions/regions-trait-variance.nll.stderr b/src/test/ui/regions/regions-trait-variance.nll.stderr
new file mode 100644
index 0000000..c610394
--- /dev/null
+++ b/src/test/ui/regions/regions-trait-variance.nll.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `*b` does not live long enough
+ --> $DIR/regions-trait-variance.rs:47:18
+ |
+LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough
+ | ^^^ borrowed value does not live long enough
+LL | make_a(bb)
+LL | }
+ | - `*b` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 43:16...
+ --> $DIR/regions-trait-variance.rs:43:16
+ |
+LL | fn make_make_a<'a>() -> A<'a> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-trait-variance.rs b/src/test/ui/regions/regions-trait-variance.rs
similarity index 100%
rename from src/test/compile-fail/regions-trait-variance.rs
rename to src/test/ui/regions/regions-trait-variance.rs
diff --git a/src/test/ui/regions/regions-trait-variance.stderr b/src/test/ui/regions/regions-trait-variance.stderr
new file mode 100644
index 0000000..cd48d6b
--- /dev/null
+++ b/src/test/ui/regions/regions-trait-variance.stderr
@@ -0,0 +1,18 @@
+error[E0597]: `*b` does not live long enough
+ --> $DIR/regions-trait-variance.rs:47:19
+ |
+LL | let bb: &B = &*b; //~ ERROR `*b` does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | make_a(bb)
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the lifetime 'a as defined on the function body at 43:16...
+ --> $DIR/regions-trait-variance.rs:43:16
+ |
+LL | fn make_make_a<'a>() -> A<'a> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-undeclared.rs b/src/test/ui/regions/regions-undeclared.rs
similarity index 100%
rename from src/test/compile-fail/regions-undeclared.rs
rename to src/test/ui/regions/regions-undeclared.rs
diff --git a/src/test/ui/regions/regions-undeclared.stderr b/src/test/ui/regions/regions-undeclared.stderr
new file mode 100644
index 0000000..9870f32
--- /dev/null
+++ b/src/test/ui/regions/regions-undeclared.stderr
@@ -0,0 +1,33 @@
+error[E0261]: use of undeclared lifetime name `'blk`
+ --> $DIR/regions-undeclared.rs:11:14
+ |
+LL | static c_x: &'blk isize = &22; //~ ERROR use of undeclared lifetime name `'blk`
+ | ^^^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-undeclared.rs:14:10
+ |
+LL | Foo(&'a isize), //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-undeclared.rs:15:10
+ |
+LL | Bar(&'a isize), //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-undeclared.rs:18:15
+ |
+LL | fn fnDecl(x: &'a isize, //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/regions-undeclared.rs:19:15
+ |
+LL | y: &'a isize) //~ ERROR use of undeclared lifetime name `'a`
+ | ^^ undeclared lifetime
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0261`.
diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr
new file mode 100644
index 0000000..54b1a6f
--- /dev/null
+++ b/src/test/ui/regions/regions-var-type-out-of-scope.nll.stderr
@@ -0,0 +1,15 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-var-type-out-of-scope.rs:19:14
+ |
+LL | x = &id(3); //~ ERROR borrowed value does not live long enough
+ | ^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+LL | assert_eq!(*x, 3);
+ | ------------------ borrow later used here
+ |
+ = 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: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/regions-var-type-out-of-scope.rs b/src/test/ui/regions/regions-var-type-out-of-scope.rs
similarity index 100%
rename from src/test/compile-fail/regions-var-type-out-of-scope.rs
rename to src/test/ui/regions/regions-var-type-out-of-scope.rs
diff --git a/src/test/ui/regions/regions-var-type-out-of-scope.stderr b/src/test/ui/regions/regions-var-type-out-of-scope.stderr
new file mode 100644
index 0000000..92a6451
--- /dev/null
+++ b/src/test/ui/regions/regions-var-type-out-of-scope.stderr
@@ -0,0 +1,16 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/regions-var-type-out-of-scope.rs:19:14
+ |
+LL | x = &id(3); //~ ERROR borrowed value does not live long enough
+ | ^^^^^- temporary value dropped here while still borrowed
+ | |
+ | temporary value does not live long enough
+...
+LL | }
+ | - temporary value needs to live until here
+ |
+ = note: consider using a `let` binding to increase its lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs
new file mode 100644
index 0000000..a028bae
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.rs
@@ -0,0 +1,40 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that a type which is covariant with respect to its region
+// parameter yields an error when used in a contravariant way.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+// `S` is contravariant with respect to both parameters.
+struct S<'a, 'b> {
+ f: &'a isize,
+ g: &'b isize,
+}
+
+fn use_<'short,'long>(c: S<'long, 'short>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+
+ let _: S<'long, 'short> = c; // OK
+ let _: S<'short, 'short> = c; // OK
+
+ // Test whether S<_,'short> <: S<_,'long>. Since
+ // 'short <= 'long, this would be true if the Contravariant type were
+ // covariant with respect to its parameter 'a.
+
+ let _: S<'long, 'long> = c; //~ ERROR E0623
+}
+
+fn main() {}
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr
new file mode 100644
index 0000000..fd1d3ab
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant-in-second-position.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-variance-contravariant-use-covariant-in-second-position.rs:37:30
+ |
+LL | fn use_<'short,'long>(c: S<'long, 'short>,
+ | ----------------
+ | |
+ | this type is declared with multiple lifetimes...
+...
+LL | let _: S<'long, 'long> = c; //~ ERROR E0623
+ | ^ ...but data with one lifetime flows into the other here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs
new file mode 100644
index 0000000..84c4e52
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.rs
@@ -0,0 +1,38 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that a type which is covariant with respect to its region
+// parameter yields an error when used in a contravariant way.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+// This is contravariant with respect to 'a, meaning that
+// Contravariant<'long> <: Contravariant<'short> iff
+// 'short <= 'long
+struct Contravariant<'a> {
+ f: &'a isize
+}
+
+fn use_<'short,'long>(c: Contravariant<'short>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+
+ // Test whether Contravariant<'short> <: Contravariant<'long>. Since
+ // 'short <= 'long, this would be true if the Contravariant type were
+ // covariant with respect to its parameter 'a.
+
+ let _: Contravariant<'long> = c; //~ ERROR E0623
+}
+
+fn main() {}
diff --git a/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr
new file mode 100644
index 0000000..a1e4913
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-contravariant-use-covariant.stderr
@@ -0,0 +1,15 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-variance-contravariant-use-covariant.rs:35:35
+ |
+LL | fn use_<'short,'long>(c: Contravariant<'short>,
+ | --------------------- these two types are declared with different lifetimes...
+LL | s: &'short isize,
+LL | l: &'long isize,
+ | ------------
+...
+LL | let _: Contravariant<'long> = c; //~ ERROR E0623
+ | ^ ...but data from `c` flows into `l` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs
new file mode 100644
index 0000000..824a442
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.rs
@@ -0,0 +1,38 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that a type which is covariant with respect to its region
+// parameter yields an error when used in a contravariant way.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+// This is covariant with respect to 'a, meaning that
+// Covariant<'foo> <: Covariant<'static> because
+// 'foo <= 'static
+struct Covariant<'a> {
+ f: extern "Rust" fn(&'a isize)
+}
+
+fn use_<'short,'long>(c: Covariant<'long>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+
+ // Test whether Covariant<'long> <: Covariant<'short>. Since
+ // 'short <= 'long, this would be true if the Covariant type were
+ // contravariant with respect to its parameter 'a.
+
+ let _: Covariant<'short> = c; //~ ERROR E0623
+}
+
+fn main() {}
diff --git a/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr
new file mode 100644
index 0000000..fc1c6c3
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-covariant-use-contravariant.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-variance-covariant-use-contravariant.rs:35:32
+ |
+LL | fn use_<'short,'long>(c: Covariant<'long>,
+ | ----------------
+LL | s: &'short isize,
+ | ------------- these two types are declared with different lifetimes...
+...
+LL | let _: Covariant<'short> = c; //~ ERROR E0623
+ | ^ ...but data from `s` flows into `c` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs
new file mode 100644
index 0000000..9c6db33
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.rs
@@ -0,0 +1,35 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that an invariant region parameter used in a contravariant way
+// yields an error.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+struct Invariant<'a> {
+ f: &'a mut &'a isize
+}
+
+fn use_<'short,'long>(c: Invariant<'long>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+
+ // Test whether Invariant<'long> <: Invariant<'short>. Since
+ // 'short <= 'long, this would be true if the Invariant type were
+ // contravariant with respect to its parameter 'a.
+
+ let _: Invariant<'short> = c; //~ ERROR E0623
+}
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr
new file mode 100644
index 0000000..6b67e6b
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-invariant-use-contravariant.stderr
@@ -0,0 +1,14 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/regions-variance-invariant-use-contravariant.rs:32:32
+ |
+LL | fn use_<'short,'long>(c: Invariant<'long>,
+ | ----------------
+LL | s: &'short isize,
+ | ------------- these two types are declared with different lifetimes...
+...
+LL | let _: Invariant<'short> = c; //~ ERROR E0623
+ | ^ ...but data from `s` flows into `c` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.rs b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs
new file mode 100644
index 0000000..ed393de
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.rs
@@ -0,0 +1,32 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that a type which is invariant with respect to its region
+// parameter used in a covariant way yields an error.
+//
+// Note: see variance-regions-*.rs for the tests that check that the
+// variance inference works in the first place.
+
+struct Invariant<'a> {
+ f: &'a mut &'a isize
+}
+
+fn use_<'b>(c: Invariant<'b>) {
+
+ // For this assignment to be legal, Invariant<'b> <: Invariant<'static>.
+ // Since 'b <= 'static, this would be true if Invariant were covariant
+ // with respect to its parameter 'a.
+
+ let _: Invariant<'static> = c; //~ ERROR mismatched types
+}
+
+fn main() { }
diff --git a/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr
new file mode 100644
index 0000000..5b50f4b
--- /dev/null
+++ b/src/test/ui/regions/regions-variance-invariant-use-covariant.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/regions-variance-invariant-use-covariant.rs:29:33
+ |
+LL | let _: Invariant<'static> = c; //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `Invariant<'static>`
+ found type `Invariant<'b>`
+note: the lifetime 'b as defined on the function body at 23:9...
+ --> $DIR/regions-variance-invariant-use-covariant.rs:23:9
+ |
+LL | fn use_<'b>(c: Invariant<'b>) {
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/regions-wf-trait-object.rs b/src/test/ui/regions/regions-wf-trait-object.rs
similarity index 100%
rename from src/test/compile-fail/regions-wf-trait-object.rs
rename to src/test/ui/regions/regions-wf-trait-object.rs
diff --git a/src/test/ui/regions/regions-wf-trait-object.stderr b/src/test/ui/regions/regions-wf-trait-object.stderr
new file mode 100644
index 0000000..caaa902
--- /dev/null
+++ b/src/test/ui/regions/regions-wf-trait-object.stderr
@@ -0,0 +1,20 @@
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/regions-wf-trait-object.rs:17:5
+ |
+LL | x: Box<TheTrait<'a>+'b> //~ ERROR E0478
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime 'b as defined on the struct at 16:15
+ --> $DIR/regions-wf-trait-object.rs:16:15
+ |
+LL | struct Foo<'a,'b> {
+ | ^^
+note: but lifetime parameter must outlive the lifetime 'a as defined on the struct at 16:12
+ --> $DIR/regions-wf-trait-object.rs:16:12
+ |
+LL | struct Foo<'a,'b> {
+ | ^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0478`.
diff --git a/src/test/compile-fail/reject-specialized-drops-8142.rs b/src/test/ui/reject-specialized-drops-8142.rs
similarity index 100%
rename from src/test/compile-fail/reject-specialized-drops-8142.rs
rename to src/test/ui/reject-specialized-drops-8142.rs
diff --git a/src/test/ui/reject-specialized-drops-8142.stderr b/src/test/ui/reject-specialized-drops-8142.stderr
new file mode 100644
index 0000000..c0f1525
--- /dev/null
+++ b/src/test/ui/reject-specialized-drops-8142.stderr
@@ -0,0 +1,115 @@
+error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl.
+ --> $DIR/reject-specialized-drops-8142.rs:29:1
+ |
+LL | / impl<'al,'adds_bnd:'al> Drop for K<'al,'adds_bnd> { // REJECT
+LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl.
+LL | | fn drop(&mut self) { } }
+ | |____________________________^
+ |
+note: The same requirement must be part of the struct/enum definition
+ --> $DIR/reject-specialized-drops-8142.rs:15:1
+ |
+LL | struct K<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0367]: The requirement `'adds_bnd : 'al` is added only by the Drop impl.
+ --> $DIR/reject-specialized-drops-8142.rs:33:1
+ |
+LL | / impl<'al,'adds_bnd> Drop for L<'al,'adds_bnd> where 'adds_bnd:'al { // REJECT
+LL | | //~^ ERROR The requirement `'adds_bnd : 'al` is added only by the Drop impl.
+LL | | fn drop(&mut self) { } }
+ | |____________________________^
+ |
+note: The same requirement must be part of the struct/enum definition
+ --> $DIR/reject-specialized-drops-8142.rs:16:1
+ |
+LL | struct L<'l1,'l2> { x: &'l1 i8, y: &'l2 u8 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/reject-specialized-drops-8142.rs:39:1
+ |
+LL | impl Drop for N<'static> { fn drop(&mut self) { } } // REJECT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `N<'n>`
+ found type `N<'static>`
+note: the lifetime 'n as defined on the struct at 18:10...
+ --> $DIR/reject-specialized-drops-8142.rs:18:10
+ |
+LL | struct N<'n> { x: &'n i8 }
+ | ^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0366]: Implementations of Drop cannot be specialized
+ --> $DIR/reject-specialized-drops-8142.rs:46:1
+ |
+LL | impl Drop for P<i8> { fn drop(&mut self) { } } // REJECT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: Use same sequence of generic type and region parameters that is on the struct/enum definition
+ --> $DIR/reject-specialized-drops-8142.rs:20:1
+ |
+LL | struct P<Tp> { x: *const Tp }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0367]: The requirement `Adds_bnd: Bound` is added only by the Drop impl.
+ --> $DIR/reject-specialized-drops-8142.rs:49:1
+ |
+LL | impl<Adds_bnd:Bound> Drop for Q<Adds_bnd> { fn drop(&mut self) { } } // REJECT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: The same requirement must be part of the struct/enum definition
+ --> $DIR/reject-specialized-drops-8142.rs:21:1
+ |
+LL | struct Q<Tq> { x: *const Tq }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0367]: The requirement `Adds_rbnd : 'rbnd` is added only by the Drop impl.
+ --> $DIR/reject-specialized-drops-8142.rs:52:1
+ |
+LL | impl<'rbnd,Adds_rbnd:'rbnd> Drop for R<Adds_rbnd> { fn drop(&mut self) { } } // REJECT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: The same requirement must be part of the struct/enum definition
+ --> $DIR/reject-specialized-drops-8142.rs:22:1
+ |
+LL | struct R<Tr> { x: *const Tr }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0366]: Implementations of Drop cannot be specialized
+ --> $DIR/reject-specialized-drops-8142.rs:61:1
+ |
+LL | impl<One> Drop for V<One,One> { fn drop(&mut self) { } } // REJECT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: Use same sequence of generic type and region parameters that is on the struct/enum definition
+ --> $DIR/reject-specialized-drops-8142.rs:26:1
+ |
+LL | struct V<Tva, Tvb> { x: *const Tva, y: *const Tvb }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'lw` due to conflicting requirements
+ --> $DIR/reject-specialized-drops-8142.rs:64:1
+ |
+LL | impl<'lw> Drop for W<'lw,'lw> { fn drop(&mut self) { } } // REJECT
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'l1 as defined on the struct at 27:10...
+ --> $DIR/reject-specialized-drops-8142.rs:27:10
+ |
+LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
+ | ^^^
+note: ...but the lifetime must also be valid for the lifetime 'l2 as defined on the struct at 27:15...
+ --> $DIR/reject-specialized-drops-8142.rs:27:15
+ |
+LL | struct W<'l1, 'l2> { x: &'l1 i8, y: &'l2 u8 }
+ | ^^^
+ = note: ...so that the types are compatible:
+ expected W<'l1, 'l2>
+ found W<'_, '_>
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0308, E0366, E0367, E0495.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/removing-extern-crate.fixed b/src/test/ui/removing-extern-crate.fixed
index 83b35ce..90427b0 100644
--- a/src/test/ui/removing-extern-crate.fixed
+++ b/src/test/ui/removing-extern-crate.fixed
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: --edition 2018
+// edition:2018
// aux-build:removing-extern-crate.rs
// run-rustfix
// compile-pass
diff --git a/src/test/ui/removing-extern-crate.rs b/src/test/ui/removing-extern-crate.rs
index 2947908..3905d28 100644
--- a/src/test/ui/removing-extern-crate.rs
+++ b/src/test/ui/removing-extern-crate.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: --edition 2018
+// edition:2018
// aux-build:removing-extern-crate.rs
// run-rustfix
// compile-pass
diff --git a/src/test/compile-fail/repeat-to-run-dtor-twice.rs b/src/test/ui/repeat-to-run-dtor-twice.rs
similarity index 100%
rename from src/test/compile-fail/repeat-to-run-dtor-twice.rs
rename to src/test/ui/repeat-to-run-dtor-twice.rs
diff --git a/src/test/ui/repeat-to-run-dtor-twice.stderr b/src/test/ui/repeat-to-run-dtor-twice.stderr
new file mode 100644
index 0000000..408c28a
--- /dev/null
+++ b/src/test/ui/repeat-to-run-dtor-twice.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `Foo: std::marker::Copy` is not satisfied
+ --> $DIR/repeat-to-run-dtor-twice.rs:27:13
+ |
+LL | let _ = [ a; 5 ];
+ | ^^^^^^^^ the trait `std::marker::Copy` is not implemented for `Foo`
+ |
+ = note: the `Copy` trait is required because the repeated element will be copied
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/repeat_count.rs b/src/test/ui/repeat_count.rs
similarity index 100%
rename from src/test/compile-fail/repeat_count.rs
rename to src/test/ui/repeat_count.rs
diff --git a/src/test/ui/repeat_count.stderr b/src/test/ui/repeat_count.stderr
new file mode 100644
index 0000000..4852023
--- /dev/null
+++ b/src/test/ui/repeat_count.stderr
@@ -0,0 +1,64 @@
+error[E0435]: attempt to use a non-constant value in a constant
+ --> $DIR/repeat_count.rs:15:17
+ |
+LL | let a = [0; n];
+ | ^ non-constant value
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:17:17
+ |
+LL | let b = [0; ()];
+ | ^^ expected usize, found ()
+ |
+ = note: expected type `usize`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:22:17
+ |
+LL | let c = [0; true];
+ | ^^^^ expected usize, found bool
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:25:17
+ |
+LL | let d = [0; 0.5];
+ | ^^^ expected usize, found floating-point variable
+ |
+ = note: expected type `usize`
+ found type `{float}`
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:30:17
+ |
+LL | let e = [0; "foo"];
+ | ^^^^^ expected usize, found reference
+ |
+ = note: expected type `usize`
+ found type `&'static str`
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:35:17
+ |
+LL | let f = [0; -4_isize];
+ | ^^^^^^^^ expected usize, found isize
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:38:23
+ |
+LL | let f = [0_usize; -1_isize];
+ | ^^^^^^^^ expected usize, found isize
+
+error[E0308]: mismatched types
+ --> $DIR/repeat_count.rs:44:17
+ |
+LL | let g = [0; G { g: () }];
+ | ^^^^^^^^^^^ expected usize, found struct `main::G`
+ |
+ = note: expected type `usize`
+ found type `main::G`
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0308, E0435.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/repr-align-assign.fixed b/src/test/ui/repr/repr-align-assign.fixed
similarity index 100%
rename from src/test/ui/repr-align-assign.fixed
rename to src/test/ui/repr/repr-align-assign.fixed
diff --git a/src/test/ui/repr-align-assign.rs b/src/test/ui/repr/repr-align-assign.rs
similarity index 100%
rename from src/test/ui/repr-align-assign.rs
rename to src/test/ui/repr/repr-align-assign.rs
diff --git a/src/test/ui/repr-align-assign.stderr b/src/test/ui/repr/repr-align-assign.stderr
similarity index 100%
rename from src/test/ui/repr-align-assign.stderr
rename to src/test/ui/repr/repr-align-assign.stderr
diff --git a/src/test/compile-fail/repr-align.rs b/src/test/ui/repr/repr-align.rs
similarity index 100%
rename from src/test/compile-fail/repr-align.rs
rename to src/test/ui/repr/repr-align.rs
diff --git a/src/test/ui/repr/repr-align.stderr b/src/test/ui/repr/repr-align.stderr
new file mode 100644
index 0000000..2195789
--- /dev/null
+++ b/src/test/ui/repr/repr-align.stderr
@@ -0,0 +1,21 @@
+error[E0589]: invalid `repr(align)` attribute: not an unsuffixed integer
+ --> $DIR/repr-align.rs:12:8
+ |
+LL | #[repr(align(16.0))] //~ ERROR: invalid `repr(align)` attribute: not an unsuffixed integer
+ | ^^^^^^^^^^^
+
+error[E0589]: invalid `repr(align)` attribute: not a power of two
+ --> $DIR/repr-align.rs:15:8
+ |
+LL | #[repr(align(15))] //~ ERROR: invalid `repr(align)` attribute: not a power of two
+ | ^^^^^^^^^
+
+error[E0589]: invalid `repr(align)` attribute: larger than 2^29
+ --> $DIR/repr-align.rs:18:8
+ |
+LL | #[repr(align(4294967296))] //~ ERROR: invalid `repr(align)` attribute: larger than 2^29
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0589`.
diff --git a/src/test/compile-fail/repr-packed-contains-align.rs b/src/test/ui/repr/repr-packed-contains-align.rs
similarity index 100%
rename from src/test/compile-fail/repr-packed-contains-align.rs
rename to src/test/ui/repr/repr-packed-contains-align.rs
diff --git a/src/test/ui/repr/repr-packed-contains-align.stderr b/src/test/ui/repr/repr-packed-contains-align.stderr
new file mode 100644
index 0000000..4558cf2
--- /dev/null
+++ b/src/test/ui/repr/repr-packed-contains-align.stderr
@@ -0,0 +1,59 @@
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:28:1
+ |
+LL | struct SC(SA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+ | ^^^^^^^^^^^^^^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:31:1
+ |
+LL | struct SD(SB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+ | ^^^^^^^^^^^^^^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:34:1
+ |
+LL | struct SE(UA); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+ | ^^^^^^^^^^^^^^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:37:1
+ |
+LL | struct SF(UB); //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+ | ^^^^^^^^^^^^^^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:40:1
+ |
+LL | / union UC { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+LL | | a: UA
+LL | | }
+ | |_^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:45:1
+ |
+LL | / union UD { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+LL | | n: UB
+LL | | }
+ | |_^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:50:1
+ |
+LL | / union UE { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+LL | | a: SA
+LL | | }
+ | |_^
+
+error[E0588]: packed type cannot transitively contain a `[repr(align)]` type
+ --> $DIR/repr-packed-contains-align.rs:55:1
+ |
+LL | / union UF { //~ ERROR: packed type cannot transitively contain a `[repr(align)]` type
+LL | | n: SB
+LL | | }
+ | |_^
+
+error: aborting due to 8 previous errors
+
+For more information about this error, try `rustc --explain E0588`.
diff --git a/src/test/compile-fail/repr-transparent-other-items.rs b/src/test/ui/repr/repr-transparent-other-items.rs
similarity index 100%
rename from src/test/compile-fail/repr-transparent-other-items.rs
rename to src/test/ui/repr/repr-transparent-other-items.rs
diff --git a/src/test/ui/repr/repr-transparent-other-items.stderr b/src/test/ui/repr/repr-transparent-other-items.stderr
new file mode 100644
index 0000000..e5889cf
--- /dev/null
+++ b/src/test/ui/repr/repr-transparent-other-items.stderr
@@ -0,0 +1,73 @@
+error[E0601]: `main` function not found in crate `repr_transparent_other_items`
+ |
+ = note: consider adding a `main` function to `$DIR/repr-transparent-other-items.rs`
+
+error[E0517]: attribute should be applied to struct
+ --> $DIR/repr-transparent-other-items.rs:13:8
+ |
+LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum
+ | ^^^^^^^^^^^
+LL | enum Void {} //~| ERROR should be applied to struct
+ | ------------ not a struct
+
+error[E0517]: attribute should be applied to struct
+ --> $DIR/repr-transparent-other-items.rs:16:8
+ |
+LL | #[repr(transparent)] //~ ERROR should be applied to struct
+ | ^^^^^^^^^^^
+LL | / enum FieldlessEnum {
+LL | | Foo,
+LL | | Bar,
+LL | | }
+ | |_- not a struct
+
+error[E0517]: attribute should be applied to struct
+ --> $DIR/repr-transparent-other-items.rs:22:8
+ |
+LL | #[repr(transparent)] //~ ERROR should be applied to struct
+ | ^^^^^^^^^^^
+LL | / enum Enum {
+LL | | Foo(String),
+LL | | Bar(u32),
+LL | | }
+ | |_- not a struct
+
+error[E0517]: attribute should be applied to struct
+ --> $DIR/repr-transparent-other-items.rs:28:8
+ |
+LL | #[repr(transparent)] //~ ERROR should be applied to struct
+ | ^^^^^^^^^^^
+LL | / union Foo {
+LL | | u: u32,
+LL | | s: i32
+LL | | }
+ | |_- not a struct
+
+error[E0517]: attribute should be applied to struct
+ --> $DIR/repr-transparent-other-items.rs:34:8
+ |
+LL | #[repr(transparent)] //~ ERROR should be applied to struct
+ | ^^^^^^^^^^^
+LL | fn cant_repr_this() {}
+ | ---------------------- not a struct
+
+error[E0517]: attribute should be applied to struct
+ --> $DIR/repr-transparent-other-items.rs:37:8
+ |
+LL | #[repr(transparent)] //~ ERROR should be applied to struct
+ | ^^^^^^^^^^^
+LL | static CANT_REPR_THIS: u32 = 0;
+ | ------------------------------- not a struct
+
+error[E0084]: unsupported representation for zero-variant enum
+ --> $DIR/repr-transparent-other-items.rs:13:1
+ |
+LL | #[repr(transparent)] //~ ERROR unsupported representation for zero-variant enum
+ | ^^^^^^^^^^^^^^^^^^^^
+LL | enum Void {} //~| ERROR should be applied to struct
+ | ------------ zero-variant enum
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0084, E0517, E0601.
+For more information about an error, try `rustc --explain E0084`.
diff --git a/src/test/compile-fail/repr-transparent-other-reprs.rs b/src/test/ui/repr/repr-transparent-other-reprs.rs
similarity index 100%
rename from src/test/compile-fail/repr-transparent-other-reprs.rs
rename to src/test/ui/repr/repr-transparent-other-reprs.rs
diff --git a/src/test/ui/repr/repr-transparent-other-reprs.stderr b/src/test/ui/repr/repr-transparent-other-reprs.stderr
new file mode 100644
index 0000000..40f41c4
--- /dev/null
+++ b/src/test/ui/repr/repr-transparent-other-reprs.stderr
@@ -0,0 +1,34 @@
+error[E0601]: `main` function not found in crate `repr_transparent_other_reprs`
+ |
+ = note: consider adding a `main` function to `$DIR/repr-transparent-other-reprs.rs`
+
+error[E0692]: transparent struct cannot have other repr hints
+ --> $DIR/repr-transparent-other-reprs.rs:15:8
+ |
+LL | #[repr(transparent, C)] //~ ERROR cannot have other repr
+ | ^^^^^^^^^^^ ^
+
+error[E0692]: transparent struct cannot have other repr hints
+ --> $DIR/repr-transparent-other-reprs.rs:20:8
+ |
+LL | #[repr(transparent, packed)] //~ ERROR cannot have other repr
+ | ^^^^^^^^^^^ ^^^^^^
+
+error[E0692]: transparent struct cannot have other repr hints
+ --> $DIR/repr-transparent-other-reprs.rs:23:8
+ |
+LL | #[repr(transparent, align(2))] //~ ERROR cannot have other repr
+ | ^^^^^^^^^^^ ^^^^^^^^
+
+error[E0692]: transparent struct cannot have other repr hints
+ --> $DIR/repr-transparent-other-reprs.rs:26:8
+ |
+LL | #[repr(transparent)] //~ ERROR cannot have other repr
+ | ^^^^^^^^^^^
+LL | #[repr(C)]
+ | ^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0601, E0692.
+For more information about an error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/repr-transparent.rs b/src/test/ui/repr/repr-transparent.rs
similarity index 100%
rename from src/test/compile-fail/repr-transparent.rs
rename to src/test/ui/repr/repr-transparent.rs
diff --git a/src/test/ui/repr/repr-transparent.stderr b/src/test/ui/repr/repr-transparent.stderr
new file mode 100644
index 0000000..0f62088
--- /dev/null
+++ b/src/test/ui/repr/repr-transparent.stderr
@@ -0,0 +1,76 @@
+error[E0601]: `main` function not found in crate `repr_transparent`
+ |
+ = note: consider adding a `main` function to `$DIR/repr-transparent.rs`
+
+error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0
+ --> $DIR/repr-transparent.rs:21:1
+ |
+LL | struct NoFields; //~ ERROR needs exactly one non-zero-sized field
+ | ^^^^^^^^^^^^^^^^
+ |
+ = note: non-zero-sized field
+
+error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0
+ --> $DIR/repr-transparent.rs:24:1
+ |
+LL | struct ContainsOnlyZst(()); //~ ERROR needs exactly one non-zero-sized field
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: non-zero-sized field
+
+error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0
+ --> $DIR/repr-transparent.rs:27:1
+ |
+LL | struct ContainsOnlyZstArray([bool; 0]); //~ ERROR needs exactly one non-zero-sized field
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: non-zero-sized field
+
+error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 0
+ --> $DIR/repr-transparent.rs:30:1
+ |
+LL | struct ContainsMultipleZst(PhantomData<*const i32>, NoFields);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: non-zero-sized field
+
+error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2
+ --> $DIR/repr-transparent.rs:34:1
+ |
+LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: non-zero-sized field
+ --> $DIR/repr-transparent.rs:34:23
+ |
+LL | struct MultipleNonZst(u8, u8); //~ ERROR needs exactly one non-zero-sized field
+ | ^^ ^^
+
+error[E0690]: transparent struct needs exactly one non-zero-sized field, but has 2
+ --> $DIR/repr-transparent.rs:40:1
+ |
+LL | pub struct StructWithProjection(f32, <f32 as Mirror>::It);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: non-zero-sized field
+ --> $DIR/repr-transparent.rs:40:33
+ |
+LL | pub struct StructWithProjection(f32, <f32 as Mirror>::It);
+ | ^^^ ^^^^^^^^^^^^^^^^^^^
+
+error[E0691]: zero-sized field in transparent struct has alignment larger than 1
+ --> $DIR/repr-transparent.rs:44:32
+ |
+LL | struct NontrivialAlignZst(u32, [u16; 0]); //~ ERROR alignment larger than 1
+ | ^^^^^^^^
+
+error[E0691]: zero-sized field in transparent struct has alignment larger than 1
+ --> $DIR/repr-transparent.rs:50:24
+ |
+LL | struct GenericAlign<T>(ZstAlign32<T>, u32); //~ ERROR alignment larger than 1
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0601, E0690, E0691.
+For more information about an error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/required-lang-item.rs b/src/test/ui/required-lang-item.rs
similarity index 100%
rename from src/test/compile-fail/required-lang-item.rs
rename to src/test/ui/required-lang-item.rs
diff --git a/src/test/ui/required-lang-item.stderr b/src/test/ui/required-lang-item.stderr
new file mode 100644
index 0000000..83764a9
--- /dev/null
+++ b/src/test/ui/required-lang-item.stderr
@@ -0,0 +1,4 @@
+error: requires `start` lang_item
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/reserved-attr-on-macro.rs b/src/test/ui/reserved/reserved-attr-on-macro.rs
similarity index 100%
rename from src/test/compile-fail/reserved-attr-on-macro.rs
rename to src/test/ui/reserved/reserved-attr-on-macro.rs
diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr
new file mode 100644
index 0000000..e8bfcc0
--- /dev/null
+++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr
@@ -0,0 +1,11 @@
+error[E0658]: unless otherwise specified, attributes with the prefix `rustc_` are reserved for internal compiler diagnostics (see issue #29642)
+ --> $DIR/reserved-attr-on-macro.rs:11:1
+ |
+LL | #[rustc_attribute_should_be_reserved] //~ ERROR attributes with the prefix `rustc_` are reserved
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(rustc_attrs)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/reserved-become.rs b/src/test/ui/reserved/reserved-become.rs
similarity index 100%
rename from src/test/compile-fail/reserved-become.rs
rename to src/test/ui/reserved/reserved-become.rs
diff --git a/src/test/ui/reserved/reserved-become.stderr b/src/test/ui/reserved/reserved-become.stderr
new file mode 100644
index 0000000..fa9a960
--- /dev/null
+++ b/src/test/ui/reserved/reserved-become.stderr
@@ -0,0 +1,8 @@
+error: expected pattern, found reserved keyword `become`
+ --> $DIR/reserved-become.rs:12:9
+ |
+LL | let become = 0;
+ | ^^^^^^ expected pattern
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/resolve/issue-5035-2.stderr b/src/test/ui/resolve/issue-5035-2.stderr
index 21c0a62..9e7fca0 100644
--- a/src/test/ui/resolve/issue-5035-2.stderr
+++ b/src/test/ui/resolve/issue-5035-2.stderr
@@ -5,8 +5,9 @@
| ^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `(dyn I + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
error: aborting due to previous error
diff --git a/src/test/compile-fail/resolve-bad-import-prefix.rs b/src/test/ui/resolve/resolve-bad-import-prefix.rs
similarity index 100%
rename from src/test/compile-fail/resolve-bad-import-prefix.rs
rename to src/test/ui/resolve/resolve-bad-import-prefix.rs
diff --git a/src/test/ui/resolve/resolve-bad-import-prefix.stderr b/src/test/ui/resolve/resolve-bad-import-prefix.stderr
new file mode 100644
index 0000000..76d0c03
--- /dev/null
+++ b/src/test/ui/resolve/resolve-bad-import-prefix.stderr
@@ -0,0 +1,24 @@
+error[E0577]: expected module or enum, found struct `S`
+ --> $DIR/resolve-bad-import-prefix.rs:20:5
+ |
+LL | use S::{}; //~ ERROR expected module or enum, found struct `S`
+ | -^^^^
+ | |
+ | did you mean `E`?
+
+error[E0577]: expected module or enum, found trait `Tr`
+ --> $DIR/resolve-bad-import-prefix.rs:21:5
+ |
+LL | use Tr::{}; //~ ERROR expected module or enum, found trait `Tr`
+ | ^^^^^^ not a module or enum
+
+error[E0578]: cannot find module or enum `Nonexistent` in the crate root
+ --> $DIR/resolve-bad-import-prefix.rs:22:5
+ |
+LL | use Nonexistent::{}; //~ ERROR cannot find module or enum `Nonexistent` in the crate root
+ | ^^^^^^^^^^^ not found in the crate root
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0577, E0578.
+For more information about an error, try `rustc --explain E0577`.
diff --git a/src/test/compile-fail/resolve-bad-visibility.rs b/src/test/ui/resolve/resolve-bad-visibility.rs
similarity index 100%
rename from src/test/compile-fail/resolve-bad-visibility.rs
rename to src/test/ui/resolve/resolve-bad-visibility.rs
diff --git a/src/test/ui/resolve/resolve-bad-visibility.stderr b/src/test/ui/resolve/resolve-bad-visibility.stderr
new file mode 100644
index 0000000..aa48171
--- /dev/null
+++ b/src/test/ui/resolve/resolve-bad-visibility.stderr
@@ -0,0 +1,34 @@
+error: visibilities can only be restricted to ancestor modules
+ --> $DIR/resolve-bad-visibility.rs:16:8
+ |
+LL | pub(in std::vec) struct F; //~ ERROR visibilities can only be restricted to ancestor modules
+ | ^^^^^^^^
+
+error[E0577]: expected module, found enum `E`
+ --> $DIR/resolve-bad-visibility.rs:14:8
+ |
+LL | pub(in E) struct S; //~ ERROR expected module, found enum `E`
+ | ^ not a module
+
+error[E0577]: expected module, found trait `Tr`
+ --> $DIR/resolve-bad-visibility.rs:15:8
+ |
+LL | pub(in Tr) struct Z; //~ ERROR expected module, found trait `Tr`
+ | ^^ not a module
+
+error[E0578]: cannot find module `nonexistent` in the crate root
+ --> $DIR/resolve-bad-visibility.rs:17:8
+ |
+LL | pub(in nonexistent) struct G; //~ ERROR cannot find module `nonexistent` in the crate root
+ | ^^^^^^^^^^^ not found in the crate root
+
+error[E0578]: cannot find module `too_soon` in the crate root
+ --> $DIR/resolve-bad-visibility.rs:18:8
+ |
+LL | pub(in too_soon) struct H; //~ ERROR cannot find module `too_soon` in the crate root
+ | ^^^^^^^^ not found in the crate root
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0577, E0578.
+For more information about an error, try `rustc --explain E0577`.
diff --git a/src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.rs
similarity index 100%
rename from src/test/compile-fail/resolve-conflict-extern-crate-vs-extern-crate.rs
rename to src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.rs
diff --git a/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr
new file mode 100644
index 0000000..5f21b44
--- /dev/null
+++ b/src/test/ui/resolve/resolve-conflict-extern-crate-vs-extern-crate.stderr
@@ -0,0 +1,15 @@
+error[E0259]: the name `std` is defined multiple times
+ --> $DIR/resolve-conflict-extern-crate-vs-extern-crate.rs:12:1
+ |
+LL | extern crate std;
+ | ^^^^^^^^^^^^^^^^^ `std` reimported here
+ |
+ = note: `std` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | extern crate std as other_std;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0259`.
diff --git a/src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.rs
similarity index 100%
rename from src/test/compile-fail/resolve-conflict-import-vs-extern-crate.rs
rename to src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.rs
diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr
new file mode 100644
index 0000000..9978e75
--- /dev/null
+++ b/src/test/ui/resolve/resolve-conflict-import-vs-extern-crate.stderr
@@ -0,0 +1,15 @@
+error[E0254]: the name `std` is defined multiple times
+ --> $DIR/resolve-conflict-import-vs-extern-crate.rs:11:5
+ |
+LL | use std::slice as std; //~ ERROR the name `std` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^ `std` reimported here
+ |
+ = note: `std` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use std::slice as std as other_std; //~ ERROR the name `std` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0254`.
diff --git a/src/test/compile-fail/resolve-conflict-import-vs-import.rs b/src/test/ui/resolve/resolve-conflict-import-vs-import.rs
similarity index 100%
rename from src/test/compile-fail/resolve-conflict-import-vs-import.rs
rename to src/test/ui/resolve/resolve-conflict-import-vs-import.rs
diff --git a/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr
new file mode 100644
index 0000000..80ccb9a
--- /dev/null
+++ b/src/test/ui/resolve/resolve-conflict-import-vs-import.stderr
@@ -0,0 +1,17 @@
+error[E0252]: the name `transmute` is defined multiple times
+ --> $DIR/resolve-conflict-import-vs-import.rs:12:5
+ |
+LL | use std::mem::transmute;
+ | ------------------- previous import of the value `transmute` here
+LL | use std::mem::transmute;
+ | ^^^^^^^^^^^^^^^^^^^ `transmute` reimported here
+ |
+ = note: `transmute` must be defined only once in the value namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use std::mem::transmute as other_transmute;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0252`.
diff --git a/src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.rs
similarity index 100%
rename from src/test/compile-fail/resolve-conflict-item-vs-extern-crate.rs
rename to src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.rs
diff --git a/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr
new file mode 100644
index 0000000..d9ad248
--- /dev/null
+++ b/src/test/ui/resolve/resolve-conflict-item-vs-extern-crate.stderr
@@ -0,0 +1,15 @@
+error[E0260]: the name `std` is defined multiple times
+ --> $DIR/resolve-conflict-item-vs-extern-crate.rs:12:1
+ |
+LL | mod std {} //~ ERROR the name `std` is defined multiple times
+ | ^^^^^^^ `std` redefined here
+ |
+ = note: `std` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | as other_std// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0260`.
diff --git a/src/test/ui/resolve-conflict-item-vs-import.rs b/src/test/ui/resolve/resolve-conflict-item-vs-import.rs
similarity index 100%
rename from src/test/ui/resolve-conflict-item-vs-import.rs
rename to src/test/ui/resolve/resolve-conflict-item-vs-import.rs
diff --git a/src/test/ui/resolve-conflict-item-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-item-vs-import.stderr
similarity index 100%
rename from src/test/ui/resolve-conflict-item-vs-import.stderr
rename to src/test/ui/resolve/resolve-conflict-item-vs-import.stderr
diff --git a/src/test/compile-fail/resolve-conflict-type-vs-import.rs b/src/test/ui/resolve/resolve-conflict-type-vs-import.rs
similarity index 100%
rename from src/test/compile-fail/resolve-conflict-type-vs-import.rs
rename to src/test/ui/resolve/resolve-conflict-type-vs-import.rs
diff --git a/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr
new file mode 100644
index 0000000..1e8df8f
--- /dev/null
+++ b/src/test/ui/resolve/resolve-conflict-type-vs-import.stderr
@@ -0,0 +1,18 @@
+error[E0255]: the name `Iter` is defined multiple times
+ --> $DIR/resolve-conflict-type-vs-import.rs:13:1
+ |
+LL | use std::slice::Iter;
+ | ---------------- previous import of the type `Iter` here
+LL |
+LL | struct Iter;
+ | ^^^^^^^^^^^^ `Iter` redefined here
+ |
+ = note: `Iter` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use std::slice::Iter as OtherIter;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0255`.
diff --git a/src/test/compile-fail/resolve-inconsistent-binding-mode.rs b/src/test/ui/resolve/resolve-inconsistent-binding-mode.rs
similarity index 100%
rename from src/test/compile-fail/resolve-inconsistent-binding-mode.rs
rename to src/test/ui/resolve/resolve-inconsistent-binding-mode.rs
diff --git a/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr
new file mode 100644
index 0000000..e36eea2
--- /dev/null
+++ b/src/test/ui/resolve/resolve-inconsistent-binding-mode.stderr
@@ -0,0 +1,53 @@
+error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
+ --> $DIR/resolve-inconsistent-binding-mode.rs:17:32
+ |
+LL | opts::a(ref i) | opts::b(i) => {}
+ | - ^ bound in different ways
+ | |
+ | first binding
+
+error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
+ --> $DIR/resolve-inconsistent-binding-mode.rs:26:32
+ |
+LL | opts::a(ref i) | opts::b(i) => {}
+ | - ^ bound in different ways
+ | |
+ | first binding
+
+error[E0409]: variable `i` is bound in inconsistent ways within the same match arm
+ --> $DIR/resolve-inconsistent-binding-mode.rs:35:40
+ |
+LL | opts::a(ref mut i) | opts::b(ref i) => {}
+ | - first binding ^ bound in different ways
+
+error[E0308]: mismatched types
+ --> $DIR/resolve-inconsistent-binding-mode.rs:17:32
+ |
+LL | opts::a(ref i) | opts::b(i) => {}
+ | ^ expected &isize, found isize
+ |
+ = note: expected type `&isize`
+ found type `isize`
+
+error[E0308]: mismatched types
+ --> $DIR/resolve-inconsistent-binding-mode.rs:26:32
+ |
+LL | opts::a(ref i) | opts::b(i) => {}
+ | ^ expected &isize, found isize
+ |
+ = note: expected type `&isize`
+ found type `isize`
+
+error[E0308]: mismatched types
+ --> $DIR/resolve-inconsistent-binding-mode.rs:35:36
+ |
+LL | opts::a(ref mut i) | opts::b(ref i) => {}
+ | ^^^^^ types differ in mutability
+ |
+ = note: expected type `&mut isize`
+ found type `&isize`
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0308, E0409.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/ui/resolve-inconsistent-names.rs b/src/test/ui/resolve/resolve-inconsistent-names.rs
similarity index 100%
rename from src/test/ui/resolve-inconsistent-names.rs
rename to src/test/ui/resolve/resolve-inconsistent-names.rs
diff --git a/src/test/ui/resolve-inconsistent-names.stderr b/src/test/ui/resolve/resolve-inconsistent-names.stderr
similarity index 100%
rename from src/test/ui/resolve-inconsistent-names.stderr
rename to src/test/ui/resolve/resolve-inconsistent-names.stderr
diff --git a/src/test/compile-fail/resolve-label.rs b/src/test/ui/resolve/resolve-label.rs
similarity index 100%
rename from src/test/compile-fail/resolve-label.rs
rename to src/test/ui/resolve/resolve-label.rs
diff --git a/src/test/ui/resolve/resolve-label.stderr b/src/test/ui/resolve/resolve-label.stderr
new file mode 100644
index 0000000..a7b8975
--- /dev/null
+++ b/src/test/ui/resolve/resolve-label.stderr
@@ -0,0 +1,9 @@
+error[E0426]: use of undeclared label `'l`
+ --> $DIR/resolve-label.rs:15:23
+ |
+LL | break 'l; //~ ERROR use of undeclared label
+ | ^^ undeclared label `'l`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0426`.
diff --git a/src/test/compile-fail/resolve-primitive-fallback.rs b/src/test/ui/resolve/resolve-primitive-fallback.rs
similarity index 100%
rename from src/test/compile-fail/resolve-primitive-fallback.rs
rename to src/test/ui/resolve/resolve-primitive-fallback.rs
diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr
new file mode 100644
index 0000000..2d85236
--- /dev/null
+++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr
@@ -0,0 +1,22 @@
+error[E0423]: expected value, found builtin type `u16`
+ --> $DIR/resolve-primitive-fallback.rs:13:23
+ |
+LL | std::mem::size_of(u16);
+ | ^^^ not a value
+
+error[E0412]: cannot find type `u8` in the crate root
+ --> $DIR/resolve-primitive-fallback.rs:18:14
+ |
+LL | let _: ::u8;
+ | ^^ not found in the crate root
+
+error[E0061]: this function takes 0 parameters but 1 parameter was supplied
+ --> $DIR/resolve-primitive-fallback.rs:13:5
+ |
+LL | std::mem::size_of(u16);
+ | ^^^^^^^^^^^^^^^^^^^^^^ expected 0 parameters
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0061, E0412, E0423.
+For more information about an error, try `rustc --explain E0061`.
diff --git a/src/test/compile-fail/resolve-self-in-impl-2.rs b/src/test/ui/resolve/resolve-self-in-impl-2.rs
similarity index 100%
rename from src/test/compile-fail/resolve-self-in-impl-2.rs
rename to src/test/ui/resolve/resolve-self-in-impl-2.rs
diff --git a/src/test/ui/resolve/resolve-self-in-impl-2.stderr b/src/test/ui/resolve/resolve-self-in-impl-2.stderr
new file mode 100644
index 0000000..183b9b6
--- /dev/null
+++ b/src/test/ui/resolve/resolve-self-in-impl-2.stderr
@@ -0,0 +1,16 @@
+error[E0411]: expected trait, found self type `Self`
+ --> $DIR/resolve-self-in-impl-2.rs:14:6
+ |
+LL | impl Self for S {} //~ ERROR expected trait, found self type `Self`
+ | ^^^^ `Self` is only available in traits and impls
+
+error[E0405]: cannot find trait `N` in `Self`
+ --> $DIR/resolve-self-in-impl-2.rs:15:12
+ |
+LL | impl Self::N for S {} //~ ERROR cannot find trait `N` in `Self`
+ | ^ not found in `Self`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0405, E0411.
+For more information about an error, try `rustc --explain E0405`.
diff --git a/src/test/compile-fail/resolve-self-in-impl.rs b/src/test/ui/resolve/resolve-self-in-impl.rs
similarity index 100%
rename from src/test/compile-fail/resolve-self-in-impl.rs
rename to src/test/ui/resolve/resolve-self-in-impl.rs
diff --git a/src/test/ui/resolve/resolve-self-in-impl.stderr b/src/test/ui/resolve/resolve-self-in-impl.stderr
new file mode 100644
index 0000000..3fa3848
--- /dev/null
+++ b/src/test/ui/resolve/resolve-self-in-impl.stderr
@@ -0,0 +1,43 @@
+error[E0391]: cycle detected when processing `<impl at $DIR/resolve-self-in-impl.rs:24:1: 24:20>`
+ --> $DIR/resolve-self-in-impl.rs:24:13
+ |
+LL | impl Tr for Self {} //~ ERROR cycle detected
+ | ^^^^
+ |
+ = note: ...which again requires processing `<impl at $DIR/resolve-self-in-impl.rs:24:1: 24:20>`, completing the cycle
+
+error[E0391]: cycle detected when processing `<impl at $DIR/resolve-self-in-impl.rs:25:1: 25:23>`
+ --> $DIR/resolve-self-in-impl.rs:25:15
+ |
+LL | impl Tr for S<Self> {} //~ ERROR cycle detected
+ | ^^^^
+ |
+ = note: ...which again requires processing `<impl at $DIR/resolve-self-in-impl.rs:25:1: 25:23>`, completing the cycle
+
+error[E0391]: cycle detected when processing `<impl at $DIR/resolve-self-in-impl.rs:26:1: 26:13>`
+ --> $DIR/resolve-self-in-impl.rs:26:6
+ |
+LL | impl Self {} //~ ERROR cycle detected
+ | ^^^^
+ |
+ = note: ...which again requires processing `<impl at $DIR/resolve-self-in-impl.rs:26:1: 26:13>`, completing the cycle
+
+error[E0391]: cycle detected when processing `<impl at $DIR/resolve-self-in-impl.rs:27:1: 27:16>`
+ --> $DIR/resolve-self-in-impl.rs:27:8
+ |
+LL | impl S<Self> {} //~ ERROR cycle detected
+ | ^^^^
+ |
+ = note: ...which again requires processing `<impl at $DIR/resolve-self-in-impl.rs:27:1: 27:16>`, completing the cycle
+
+error[E0391]: cycle detected when processing `<impl at $DIR/resolve-self-in-impl.rs:28:1: 28:26>`
+ --> $DIR/resolve-self-in-impl.rs:28:1
+ |
+LL | impl Tr<Self::A> for S {} //~ ERROR cycle detected
+ | ^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: ...which again requires processing `<impl at $DIR/resolve-self-in-impl.rs:28:1: 28:26>`, completing the cycle
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0391`.
diff --git a/src/test/compile-fail/resolve-type-param-in-item-in-trait.rs b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs
similarity index 100%
rename from src/test/compile-fail/resolve-type-param-in-item-in-trait.rs
rename to src/test/ui/resolve/resolve-type-param-in-item-in-trait.rs
diff --git a/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr
new file mode 100644
index 0000000..73ee710
--- /dev/null
+++ b/src/test/ui/resolve/resolve-type-param-in-item-in-trait.stderr
@@ -0,0 +1,45 @@
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/resolve-type-param-in-item-in-trait.rs:18:22
+ |
+LL | trait TraitA<A> {
+ | - type variable from outer function
+LL | fn outer(&self) {
+ | ----- try adding a local type parameter in this method instead
+LL | enum Foo<B> {
+LL | Variance(A)
+ | ^ use of type variable from outer function
+
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/resolve-type-param-in-item-in-trait.rs:26:23
+ |
+LL | trait TraitB<A> {
+ | - type variable from outer function
+LL | fn outer(&self) {
+ | ----- try adding a local type parameter in this method instead
+LL | struct Foo<B>(A);
+ | ^ use of type variable from outer function
+
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/resolve-type-param-in-item-in-trait.rs:33:28
+ |
+LL | trait TraitC<A> {
+ | - type variable from outer function
+LL | fn outer(&self) {
+ | ----- try adding a local type parameter in this method instead
+LL | struct Foo<B> { a: A }
+ | ^ use of type variable from outer function
+
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/resolve-type-param-in-item-in-trait.rs:40:22
+ |
+LL | trait TraitD<A> {
+ | - type variable from outer function
+LL | fn outer(&self) {
+LL | fn foo<B>(a: A) { }
+ | ------ ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `foo<B, A>`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/src/test/compile-fail/resolve-unknown-trait.rs b/src/test/ui/resolve/resolve-unknown-trait.rs
similarity index 100%
rename from src/test/compile-fail/resolve-unknown-trait.rs
rename to src/test/ui/resolve/resolve-unknown-trait.rs
diff --git a/src/test/ui/resolve/resolve-unknown-trait.stderr b/src/test/ui/resolve/resolve-unknown-trait.stderr
new file mode 100644
index 0000000..8a2d791
--- /dev/null
+++ b/src/test/ui/resolve/resolve-unknown-trait.stderr
@@ -0,0 +1,26 @@
+error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope
+ --> $DIR/resolve-unknown-trait.rs:12:18
+ |
+LL | trait NewTrait : SomeNonExistentTrait {}
+ | ^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope
+ --> $DIR/resolve-unknown-trait.rs:15:6
+ |
+LL | impl SomeNonExistentTrait for isize {}
+ | ^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error[E0405]: cannot find trait `SomeNonExistentTrait` in this scope
+ --> $DIR/resolve-unknown-trait.rs:18:8
+ |
+LL | fn f<T:SomeNonExistentTrait>() {}
+ | ^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error[E0601]: `main` function not found in crate `resolve_unknown_trait`
+ |
+ = note: consider adding a `main` function to `$DIR/resolve-unknown-trait.rs`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0405, E0601.
+For more information about an error, try `rustc --explain E0405`.
diff --git a/src/test/compile-fail/resolve-variant-assoc-item.rs b/src/test/ui/resolve/resolve-variant-assoc-item.rs
similarity index 100%
rename from src/test/compile-fail/resolve-variant-assoc-item.rs
rename to src/test/ui/resolve/resolve-variant-assoc-item.rs
diff --git a/src/test/ui/resolve/resolve-variant-assoc-item.stderr b/src/test/ui/resolve/resolve-variant-assoc-item.stderr
new file mode 100644
index 0000000..a80a7c3
--- /dev/null
+++ b/src/test/ui/resolve/resolve-variant-assoc-item.stderr
@@ -0,0 +1,15 @@
+error[E0433]: failed to resolve. Not a module `V`
+ --> $DIR/resolve-variant-assoc-item.rs:15:8
+ |
+LL | E::V::associated_item; //~ ERROR failed to resolve. Not a module `V`
+ | ^ Not a module `V`
+
+error[E0433]: failed to resolve. Not a module `V`
+ --> $DIR/resolve-variant-assoc-item.rs:16:5
+ |
+LL | V::associated_item; //~ ERROR failed to resolve. Not a module `V`
+ | ^ Not a module `V`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/resolve/token-error-correct-2.stderr b/src/test/ui/resolve/token-error-correct-2.stderr
index 7abc1ba..fcd4b48 100644
--- a/src/test/ui/resolve/token-error-correct-2.stderr
+++ b/src/test/ui/resolve/token-error-correct-2.stderr
@@ -1,14 +1,11 @@
error: incorrect close delimiter: `)`
--> $DIR/token-error-correct-2.rs:16:5
|
-LL | ) //~ ERROR: incorrect close delimiter: `)`
- | ^
- |
-note: unclosed delimiter
- --> $DIR/token-error-correct-2.rs:14:12
- |
LL | if foo {
- | ^
+ | - unclosed delimiter
+LL | //~^ ERROR: cannot find value `foo`
+LL | ) //~ ERROR: incorrect close delimiter: `)`
+ | ^ incorrect close delimiter
error[E0425]: cannot find value `foo` in this scope
--> $DIR/token-error-correct-2.rs:14:8
diff --git a/src/test/ui/resolve/token-error-correct-3.stderr b/src/test/ui/resolve/token-error-correct-3.stderr
index 24186d9..a546c27 100644
--- a/src/test/ui/resolve/token-error-correct-3.stderr
+++ b/src/test/ui/resolve/token-error-correct-3.stderr
@@ -1,14 +1,11 @@
error: incorrect close delimiter: `}`
--> $DIR/token-error-correct-3.rs:30:9
|
-LL | } else { //~ ERROR: incorrect close delimiter: `}`
- | ^
- |
-note: unclosed delimiter
- --> $DIR/token-error-correct-3.rs:24:21
- |
LL | callback(path.as_ref(); //~ ERROR expected one of
- | ^
+ | - unclosed delimiter
+...
+LL | } else { //~ ERROR: incorrect close delimiter: `}`
+ | ^ incorrect close delimiter
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
--> $DIR/token-error-correct-3.rs:24:35
diff --git a/src/test/ui/resolve/token-error-correct.rs b/src/test/ui/resolve/token-error-correct.rs
index c88f823..39c664e 100644
--- a/src/test/ui/resolve/token-error-correct.rs
+++ b/src/test/ui/resolve/token-error-correct.rs
@@ -15,4 +15,3 @@
//~^ ERROR: expected expression, found `;`
}
//~^ ERROR: incorrect close delimiter: `}`
-//~| ERROR: incorrect close delimiter: `}`
diff --git a/src/test/ui/resolve/token-error-correct.stderr b/src/test/ui/resolve/token-error-correct.stderr
index c6d32c6..1e246b6 100644
--- a/src/test/ui/resolve/token-error-correct.stderr
+++ b/src/test/ui/resolve/token-error-correct.stderr
@@ -1,26 +1,11 @@
error: incorrect close delimiter: `}`
--> $DIR/token-error-correct.rs:16:1
|
-LL | }
- | ^
- |
-note: unclosed delimiter
- --> $DIR/token-error-correct.rs:14:12
- |
LL | foo(bar(;
- | ^
-
-error: incorrect close delimiter: `}`
- --> $DIR/token-error-correct.rs:16:1
- |
+ | - unclosed delimiter
+LL | //~^ ERROR: expected expression, found `;`
LL | }
- | ^
- |
-note: unclosed delimiter
- --> $DIR/token-error-correct.rs:14:8
- |
-LL | foo(bar(;
- | ^
+ | ^ incorrect close delimiter
error: expected expression, found `;`
--> $DIR/token-error-correct.rs:14:13
@@ -28,5 +13,5 @@
LL | foo(bar(;
| ^ expected expression
-error: aborting due to 3 previous errors
+error: aborting due to 2 previous errors
diff --git a/src/test/compile-fail/resolve_self_super_hint.rs b/src/test/ui/resolve_self_super_hint.rs
similarity index 100%
rename from src/test/compile-fail/resolve_self_super_hint.rs
rename to src/test/ui/resolve_self_super_hint.rs
diff --git a/src/test/ui/resolve_self_super_hint.stderr b/src/test/ui/resolve_self_super_hint.stderr
new file mode 100644
index 0000000..8538da0
--- /dev/null
+++ b/src/test/ui/resolve_self_super_hint.stderr
@@ -0,0 +1,32 @@
+error[E0432]: unresolved import `alloc`
+ --> $DIR/resolve_self_super_hint.rs:16:9
+ |
+LL | use alloc::HashMap;
+ | ^^^^^ Did you mean `self::alloc`?
+
+error[E0432]: unresolved import `alloc`
+ --> $DIR/resolve_self_super_hint.rs:20:13
+ |
+LL | use alloc::HashMap;
+ | ^^^^^ Did you mean `a::alloc`?
+
+error[E0432]: unresolved import `alloc`
+ --> $DIR/resolve_self_super_hint.rs:24:17
+ |
+LL | use alloc::HashMap;
+ | ^^^^^ Did you mean `a::alloc`?
+
+error[E0432]: unresolved import `alloc`
+ --> $DIR/resolve_self_super_hint.rs:28:21
+ |
+LL | use alloc::HashMap;
+ | ^^^^^ Did you mean `a::alloc`?
+
+error[E0601]: `main` function not found in crate `resolve_self_super_hint`
+ |
+ = note: consider adding a `main` function to `$DIR/resolve_self_super_hint.rs`
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0432, E0601.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/ret-non-nil.rs b/src/test/ui/ret-non-nil.rs
similarity index 100%
rename from src/test/compile-fail/ret-non-nil.rs
rename to src/test/ui/ret-non-nil.rs
diff --git a/src/test/ui/ret-non-nil.stderr b/src/test/ui/ret-non-nil.stderr
new file mode 100644
index 0000000..01f126b
--- /dev/null
+++ b/src/test/ui/ret-non-nil.stderr
@@ -0,0 +1,9 @@
+error[E0069]: `return;` in a function whose return type is not `()`
+ --> $DIR/ret-non-nil.rs:15:19
+ |
+LL | fn g() -> isize { return; }
+ | ^^^^^^ return type is not ()
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0069`.
diff --git a/src/test/compile-fail/retslot-cast.rs b/src/test/ui/retslot-cast.rs
similarity index 100%
rename from src/test/compile-fail/retslot-cast.rs
rename to src/test/ui/retslot-cast.rs
diff --git a/src/test/ui/retslot-cast.stderr b/src/test/ui/retslot-cast.stderr
new file mode 100644
index 0000000..34f6e11
--- /dev/null
+++ b/src/test/ui/retslot-cast.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/retslot-cast.rs:24:5
+ |
+LL | inner(x) //~ ERROR mismatched types
+ | ^^^^^^^^ expected trait `std::iter::Iterator<Item=()>`, found trait `std::iter::Iterator<Item=()> + std::marker::Send`
+ |
+ = note: expected type `std::option::Option<&dyn std::iter::Iterator<Item=()>>`
+ found type `std::option::Option<&dyn std::iter::Iterator<Item=()> + std::marker::Send>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/return-from-diverging.rs b/src/test/ui/return/return-from-diverging.rs
similarity index 100%
rename from src/test/compile-fail/return-from-diverging.rs
rename to src/test/ui/return/return-from-diverging.rs
diff --git a/src/test/ui/return/return-from-diverging.stderr b/src/test/ui/return/return-from-diverging.stderr
new file mode 100644
index 0000000..d965d73
--- /dev/null
+++ b/src/test/ui/return/return-from-diverging.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/return-from-diverging.rs:14:12
+ |
+LL | return "wow"; //~ ERROR mismatched types
+ | ^^^^^ expected !, found reference
+ |
+ = note: expected type `!`
+ found type `&'static str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/return-match-array-const.rs b/src/test/ui/return/return-match-array-const.rs
similarity index 100%
rename from src/test/ui/return-match-array-const.rs
rename to src/test/ui/return/return-match-array-const.rs
diff --git a/src/test/ui/return-match-array-const.stderr b/src/test/ui/return/return-match-array-const.stderr
similarity index 100%
rename from src/test/ui/return-match-array-const.stderr
rename to src/test/ui/return/return-match-array-const.stderr
diff --git a/src/test/ui/return-type.rs b/src/test/ui/return/return-type.rs
similarity index 100%
rename from src/test/ui/return-type.rs
rename to src/test/ui/return/return-type.rs
diff --git a/src/test/ui/return-type.stderr b/src/test/ui/return/return-type.stderr
similarity index 100%
rename from src/test/ui/return-type.stderr
rename to src/test/ui/return/return-type.stderr
diff --git a/src/test/compile-fail/return-unit-from-diverging.rs b/src/test/ui/return/return-unit-from-diverging.rs
similarity index 100%
rename from src/test/compile-fail/return-unit-from-diverging.rs
rename to src/test/ui/return/return-unit-from-diverging.rs
diff --git a/src/test/ui/return/return-unit-from-diverging.stderr b/src/test/ui/return/return-unit-from-diverging.stderr
new file mode 100644
index 0000000..38d4ca3
--- /dev/null
+++ b/src/test/ui/return/return-unit-from-diverging.stderr
@@ -0,0 +1,9 @@
+error[E0069]: `return;` in a function whose return type is not `()`
+ --> $DIR/return-unit-from-diverging.rs:15:5
+ |
+LL | return; //~ ERROR in a function whose return type is not
+ | ^^^^^^ return type is not ()
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0069`.
diff --git a/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-main-i32.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.rs
similarity index 100%
rename from src/test/compile-fail/rfc-1937-termination-trait/termination-trait-main-i32.rs
rename to src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.rs
diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr
new file mode 100644
index 0000000..6f780d1
--- /dev/null
+++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-main-i32.stderr
@@ -0,0 +1,11 @@
+error[E0277]: `main` has invalid return type `i32`
+ --> $DIR/termination-trait-main-i32.rs:11:14
+ |
+LL | fn main() -> i32 {
+ | ^^^ `main` can only return types that implement `std::process::Termination`
+ |
+ = help: consider using `()`, or a `Result`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/rfc-1937-termination-trait/termination-trait-not-satisfied.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.rs
similarity index 100%
rename from src/test/compile-fail/rfc-1937-termination-trait/termination-trait-not-satisfied.rs
rename to src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.rs
diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr
new file mode 100644
index 0000000..e1b1737
--- /dev/null
+++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-not-satisfied.stderr
@@ -0,0 +1,11 @@
+error[E0277]: `main` has invalid return type `ReturnType`
+ --> $DIR/termination-trait-not-satisfied.rs:13:14
+ |
+LL | fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType`
+ | ^^^^^^^^^^ `main` can only return types that implement `std::process::Termination`
+ |
+ = help: consider using `()`, or a `Result`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/auxiliary/enums.rs
rename to src/test/ui/rfc-2008-non-exhaustive/auxiliary/enums.rs
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/auxiliary/structs.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/structs.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/auxiliary/structs.rs
rename to src/test/ui/rfc-2008-non-exhaustive/auxiliary/structs.rs
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/auxiliary/variants.rs b/src/test/ui/rfc-2008-non-exhaustive/auxiliary/variants.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/auxiliary/variants.rs
rename to src/test/ui/rfc-2008-non-exhaustive/auxiliary/variants.rs
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/enum.rs b/src/test/ui/rfc-2008-non-exhaustive/enum.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/enum.rs
rename to src/test/ui/rfc-2008-non-exhaustive/enum.rs
diff --git a/src/test/ui/rfc-2008-non-exhaustive/enum.stderr b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr
new file mode 100644
index 0000000..5276746
--- /dev/null
+++ b/src/test/ui/rfc-2008-non-exhaustive/enum.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `_` not covered
+ --> $DIR/enum.rs:19:11
+ |
+LL | match enum_unit {
+ | ^^^^^^^^^ pattern `_` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/invalid-attribute.rs b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/invalid-attribute.rs
rename to src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.rs
diff --git a/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr
new file mode 100644
index 0000000..d75ad9e
--- /dev/null
+++ b/src/test/ui/rfc-2008-non-exhaustive/invalid-attribute.stderr
@@ -0,0 +1,34 @@
+error[E0702]: attribute should be empty
+ --> $DIR/invalid-attribute.rs:13:1
+ |
+LL | #[non_exhaustive(anything)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | //~^ ERROR attribute should be empty [E0702]
+LL | struct Foo;
+ | ----------- not empty
+
+error[E0701]: attribute can only be applied to a struct or enum
+ --> $DIR/invalid-attribute.rs:17:1
+ |
+LL | #[non_exhaustive]
+ | ^^^^^^^^^^^^^^^^^
+LL | //~^ ERROR attribute can only be applied to a struct or enum [E0701]
+LL | trait Bar { }
+ | ------------- not a struct or enum
+
+error[E0701]: attribute can only be applied to a struct or enum
+ --> $DIR/invalid-attribute.rs:21:1
+ |
+LL | #[non_exhaustive]
+ | ^^^^^^^^^^^^^^^^^
+LL | //~^ ERROR attribute can only be applied to a struct or enum [E0701]
+LL | / union Baz {
+LL | | f1: u16,
+LL | | f2: u16
+LL | | }
+ | |_- not a struct or enum
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0701, E0702.
+For more information about an error, try `rustc --explain E0701`.
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/structs.rs b/src/test/ui/rfc-2008-non-exhaustive/structs.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/structs.rs
rename to src/test/ui/rfc-2008-non-exhaustive/structs.rs
diff --git a/src/test/ui/rfc-2008-non-exhaustive/structs.stderr b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr
new file mode 100644
index 0000000..c0f7e27
--- /dev/null
+++ b/src/test/ui/rfc-2008-non-exhaustive/structs.stderr
@@ -0,0 +1,64 @@
+error[E0423]: expected function, found struct `TupleStruct`
+ --> $DIR/structs.rs:30:14
+ |
+LL | let ts = TupleStruct(640, 480);
+ | ^^^^^^^^^^^ constructor is not visible here due to private fields
+
+error[E0423]: expected value, found struct `UnitStruct`
+ --> $DIR/structs.rs:39:14
+ |
+LL | let us = UnitStruct;
+ | ^^^^^^^^^^ constructor is not visible here due to private fields
+
+error[E0603]: tuple struct `TupleStruct` is private
+ --> $DIR/structs.rs:33:23
+ |
+LL | let ts_explicit = structs::TupleStruct(640, 480);
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: unit struct `UnitStruct` is private
+ --> $DIR/structs.rs:42:23
+ |
+LL | let us_explicit = structs::UnitStruct;
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0639]: cannot create non-exhaustive struct using struct expression
+ --> $DIR/structs.rs:17:14
+ |
+LL | let fr = FunctionalRecord {
+ | ______________^
+LL | | //~^ ERROR cannot create non-exhaustive struct
+LL | | first_field: 1920,
+LL | | second_field: 1080,
+LL | | ..FunctionalRecord::default()
+LL | | };
+ | |_____^
+
+error[E0639]: cannot create non-exhaustive struct using struct expression
+ --> $DIR/structs.rs:24:14
+ |
+LL | let ns = NormalStruct { first_field: 640, second_field: 480 };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0638]: `..` required with struct marked as non-exhaustive
+ --> $DIR/structs.rs:27:9
+ |
+LL | let NormalStruct { first_field, second_field } = ns;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0638]: `..` required with struct marked as non-exhaustive
+ --> $DIR/structs.rs:36:9
+ |
+LL | let TupleStruct { 0: first_field, 1: second_field } = ts;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0638]: `..` required with struct marked as non-exhaustive
+ --> $DIR/structs.rs:45:9
+ |
+LL | let UnitStruct { } = us;
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0423, E0603, E0638, E0639.
+For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/variants.rs b/src/test/ui/rfc-2008-non-exhaustive/variants.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/variants.rs
rename to src/test/ui/rfc-2008-non-exhaustive/variants.rs
diff --git a/src/test/compile-fail/rfc-2008-non-exhaustive/variants_create.rs b/src/test/ui/rfc-2008-non-exhaustive/variants_create.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2008-non-exhaustive/variants_create.rs
rename to src/test/ui/rfc-2008-non-exhaustive/variants_create.rs
diff --git a/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr b/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr
new file mode 100644
index 0000000..1e4e094
--- /dev/null
+++ b/src/test/ui/rfc-2008-non-exhaustive/variants_create.stderr
@@ -0,0 +1,20 @@
+error: #[non_exhaustive] is not yet supported on variants
+ --> $DIR/variants_create.rs:19:23
+ |
+LL | #[non_exhaustive] Unit,
+ | ^^^^
+
+error: #[non_exhaustive] is not yet supported on variants
+ --> $DIR/variants_create.rs:21:23
+ |
+LL | #[non_exhaustive] Tuple(u32),
+ | ^^^^^^^^^^
+
+error: #[non_exhaustive] is not yet supported on variants
+ --> $DIR/variants_create.rs:23:23
+ |
+LL | #[non_exhaustive] Struct { field: u32 }
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs
new file mode 100644
index 0000000..a44ca9d
--- /dev/null
+++ b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.rs
@@ -0,0 +1,23 @@
+// 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.
+
+#![feature(crate_in_paths)]
+
+struct S;
+
+pub mod m {
+ fn f() {
+ let s = ::m::crate::S; //~ ERROR failed to resolve
+ let s1 = ::crate::S; //~ ERROR failed to resolve
+ let s2 = crate::S; // no error
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr
new file mode 100644
index 0000000..f16c849
--- /dev/null
+++ b/src/test/ui/rfc-2126-crate-paths/crate-path-non-absolute.stderr
@@ -0,0 +1,15 @@
+error[E0433]: failed to resolve. `crate` in paths can only be used in start position
+ --> $DIR/crate-path-non-absolute.rs:17:22
+ |
+LL | let s = ::m::crate::S; //~ ERROR failed to resolve
+ | ^^^^^ `crate` in paths can only be used in start position
+
+error[E0433]: failed to resolve. global paths cannot start with `crate`
+ --> $DIR/crate-path-non-absolute.rs:18:20
+ |
+LL | let s1 = ::crate::S; //~ ERROR failed to resolve
+ | ^^^^^ global paths cannot start with `crate`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs
new file mode 100644
index 0000000..3ebb3a2
--- /dev/null
+++ b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.rs
@@ -0,0 +1,16 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(crate_in_paths)]
+
+fn main() {
+ let crate = 0;
+ //~^ ERROR expected unit struct/variant or constant, found module `crate`
+}
diff --git a/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr
new file mode 100644
index 0000000..ec44fb4
--- /dev/null
+++ b/src/test/ui/rfc-2126-crate-paths/keyword-crate-as-identifier.stderr
@@ -0,0 +1,9 @@
+error[E0532]: expected unit struct/variant or constant, found module `crate`
+ --> $DIR/keyword-crate-as-identifier.rs:14:9
+ |
+LL | let crate = 0;
+ | ^^^^^ not a unit struct/variant or constant
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0532`.
diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/ui/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs
rename to src/test/ui/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs
diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs
rename to src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.rs
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr
new file mode 100644
index 0000000..27a69ec
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-1.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `xcrate`
+ --> $DIR/non-existent-1.rs:13:5
+ |
+LL | use xcrate::S; //~ ERROR can't find crate for `xcrate`
+ | ^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs
rename to src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.rs
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr
new file mode 100644
index 0000000..eb96d5f
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-2.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `xcrate`
+ --> $DIR/non-existent-2.rs:14:15
+ |
+LL | let s = ::xcrate::S; //~ ERROR can't find crate for `xcrate`
+ | ^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs
rename to src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.rs
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr
new file mode 100644
index 0000000..434bde7
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/non-existent-3.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `ycrate`
+ --> $DIR/non-existent-3.rs:13:5
+ |
+LL | use ycrate; //~ ERROR can't find crate for `ycrate`
+ | ^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs
new file mode 100644
index 0000000..69fc4b4
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.rs
@@ -0,0 +1,20 @@
+// 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.
+
+// aux-build:xcrate.rs
+// edition:2018
+
+use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
+use *; //~ ERROR cannot glob-import all possible crates
+
+fn main() {
+ let s = ::xcrate; //~ ERROR expected value, found module `xcrate`
+ //~^ NOTE not a value
+}
diff --git a/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr
new file mode 100644
index 0000000..cfb1a0a
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-absolute-paths/single-segment.stderr
@@ -0,0 +1,21 @@
+error: crate root imports need to be explicitly named: `use crate as name;`
+ --> $DIR/single-segment.rs:14:5
+ |
+LL | use crate; //~ ERROR crate root imports need to be explicitly named: `use crate as name;`
+ | ^^^^^
+
+error: cannot glob-import all possible crates
+ --> $DIR/single-segment.rs:15:5
+ |
+LL | use *; //~ ERROR cannot glob-import all possible crates
+ | ^
+
+error[E0423]: expected value, found module `xcrate`
+ --> $DIR/single-segment.rs:18:13
+ |
+LL | let s = ::xcrate; //~ ERROR expected value, found module `xcrate`
+ | ^^^^^^^^ not a value
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/src/test/compile-fail/rfc-2126-extern-in-paths/auxiliary/xcrate.rs b/src/test/ui/rfc-2126-extern-in-paths/auxiliary/xcrate.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-in-paths/auxiliary/xcrate.rs
rename to src/test/ui/rfc-2126-extern-in-paths/auxiliary/xcrate.rs
diff --git a/src/test/compile-fail/rfc-2126-extern-in-paths/non-existent-1.rs b/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-in-paths/non-existent-1.rs
rename to src/test/ui/rfc-2126-extern-in-paths/non-existent-1.rs
diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr b/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr
new file mode 100644
index 0000000..c25698c
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-in-paths/non-existent-1.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `xcrate`
+ --> $DIR/non-existent-1.rs:13:13
+ |
+LL | use extern::xcrate::S; //~ ERROR can't find crate for `xcrate`
+ | ^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/compile-fail/rfc-2126-extern-in-paths/non-existent-2.rs b/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-in-paths/non-existent-2.rs
rename to src/test/ui/rfc-2126-extern-in-paths/non-existent-2.rs
diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr b/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr
new file mode 100644
index 0000000..b7ca889
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-in-paths/non-existent-2.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `xcrate`
+ --> $DIR/non-existent-2.rs:14:21
+ |
+LL | let s = extern::xcrate::S; //~ ERROR can't find crate for `xcrate`
+ | ^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/compile-fail/rfc-2126-extern-in-paths/non-existent-3.rs b/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.rs
similarity index 100%
rename from src/test/compile-fail/rfc-2126-extern-in-paths/non-existent-3.rs
rename to src/test/ui/rfc-2126-extern-in-paths/non-existent-3.rs
diff --git a/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr b/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr
new file mode 100644
index 0000000..fbea89a
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-in-paths/non-existent-3.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `ycrate`
+ --> $DIR/non-existent-3.rs:13:13
+ |
+LL | use extern::ycrate; //~ ERROR can't find crate for `ycrate`
+ | ^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/ui/rfc-2126-extern-in-paths/single-segment.rs b/src/test/ui/rfc-2126-extern-in-paths/single-segment.rs
new file mode 100644
index 0000000..017844a
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-in-paths/single-segment.rs
@@ -0,0 +1,22 @@
+// 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.
+
+// aux-build:xcrate.rs
+
+#![feature(extern_in_paths)]
+
+use extern; //~ ERROR unresolved import `extern`
+ //~^ NOTE no `extern` in the root
+use extern::*; //~ ERROR cannot glob-import all possible crates
+
+fn main() {
+ let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate`
+ //~^ NOTE not a value
+}
diff --git a/src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr b/src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr
new file mode 100644
index 0000000..8b1dd89
--- /dev/null
+++ b/src/test/ui/rfc-2126-extern-in-paths/single-segment.stderr
@@ -0,0 +1,22 @@
+error: cannot glob-import all possible crates
+ --> $DIR/single-segment.rs:17:5
+ |
+LL | use extern::*; //~ ERROR cannot glob-import all possible crates
+ | ^^^^^^^^^
+
+error[E0432]: unresolved import `extern`
+ --> $DIR/single-segment.rs:15:5
+ |
+LL | use extern; //~ ERROR unresolved import `extern`
+ | ^^^^^^ no `extern` in the root
+
+error[E0423]: expected value, found module `extern::xcrate`
+ --> $DIR/single-segment.rs:20:13
+ |
+LL | let s = extern::xcrate; //~ ERROR expected value, found module `extern::xcrate`
+ | ^^^^^^^^^^^^^^ not a value
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0423, E0432.
+For more information about an error, try `rustc --explain E0423`.
diff --git a/src/test/ui/rfc1445/feature-gate.no_gate.stderr b/src/test/ui/rfc1445/feature-gate.no_gate.stderr
new file mode 100644
index 0000000..1141b79
--- /dev/null
+++ b/src/test/ui/rfc1445/feature-gate.no_gate.stderr
@@ -0,0 +1,11 @@
+error[E0658]: the semantics of constant patterns is not yet settled (see issue #31434)
+ --> $DIR/feature-gate.rs:23:1
+ |
+LL | #[structural_match] //[no_gate]~ ERROR semantics of constant patterns is not yet settled
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(structural_match)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/rfc1445/feature-gate.rs b/src/test/ui/rfc1445/feature-gate.rs
similarity index 100%
rename from src/test/compile-fail/rfc1445/feature-gate.rs
rename to src/test/ui/rfc1445/feature-gate.rs
diff --git a/src/test/ui/rfc1445/feature-gate.with_gate.stderr b/src/test/ui/rfc1445/feature-gate.with_gate.stderr
new file mode 100644
index 0000000..8783516
--- /dev/null
+++ b/src/test/ui/rfc1445/feature-gate.with_gate.stderr
@@ -0,0 +1,14 @@
+error: compilation successful
+ --> $DIR/feature-gate.rs:31:1
+ |
+LL | / fn main() { //[with_gate]~ ERROR compilation successful
+LL | | let y = Foo { x: 1 };
+LL | | match y {
+LL | | FOO => { }
+LL | | _ => { }
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rfc1445/match-forbidden-without-eq.rs b/src/test/ui/rfc1445/match-forbidden-without-eq.rs
similarity index 100%
rename from src/test/compile-fail/rfc1445/match-forbidden-without-eq.rs
rename to src/test/ui/rfc1445/match-forbidden-without-eq.rs
diff --git a/src/test/ui/rfc1445/match-forbidden-without-eq.stderr b/src/test/ui/rfc1445/match-forbidden-without-eq.stderr
new file mode 100644
index 0000000..a2cb536
--- /dev/null
+++ b/src/test/ui/rfc1445/match-forbidden-without-eq.stderr
@@ -0,0 +1,18 @@
+error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
+ --> $DIR/match-forbidden-without-eq.rs:23:9
+ |
+LL | FOO => { }
+ | ^^^
+
+warning: floating-point types cannot be used in patterns
+ --> $DIR/match-forbidden-without-eq.rs:30:9
+ |
+LL | f32::INFINITY => { }
+ | ^^^^^^^^^^^^^
+ |
+ = note: #[warn(illegal_floating_point_literal_pattern)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #41620 <https://github.com/rust-lang/rust/issues/41620>
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rfc1445/match-requires-both-partialeq-and-eq.rs b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs
similarity index 100%
rename from src/test/compile-fail/rfc1445/match-requires-both-partialeq-and-eq.rs
rename to src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.rs
diff --git a/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr
new file mode 100644
index 0000000..60f3191
--- /dev/null
+++ b/src/test/ui/rfc1445/match-requires-both-partialeq-and-eq.stderr
@@ -0,0 +1,8 @@
+error: to use a constant of type `Foo` in a pattern, `Foo` must be annotated with `#[derive(PartialEq, Eq)]`
+ --> $DIR/match-requires-both-partialeq-and-eq.rs:27:9
+ |
+LL | FOO => { }
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.rs b/src/test/ui/rfc1598-generic-associated-types/collections.rs
index e71166e..a6dbb03 100644
--- a/src/test/ui/rfc1598-generic-associated-types/collections.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/collections.rs
@@ -9,10 +9,11 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
#![feature(associated_type_defaults)]
-//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
-//follow-up PR
+// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
+// follow-up PR.
// A Collection trait and collection families. Based on
// http://smallcultfollowing.com/babysteps/blog/2016/11/03/
diff --git a/src/test/ui/rfc1598-generic-associated-types/collections.stderr b/src/test/ui/rfc1598-generic-associated-types/collections.stderr
index 8c31ab2..0e7d6ac 100644
--- a/src/test/ui/rfc1598-generic-associated-types/collections.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/collections.stderr
@@ -1,29 +1,35 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/collections.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0109]: type parameters are not allowed on this type
- --> $DIR/collections.rs:65:90
+ --> $DIR/collections.rs:66:90
|
LL | fn floatify<C>(ints: &C) -> <<C as Collection<i32>>::Family as CollectionFamily>::Member<f32>
| ^^^ type parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/collections.rs:77:69
+ --> $DIR/collections.rs:78:69
|
LL | fn floatify_sibling<C>(ints: &C) -> <C as Collection<i32>>::Sibling<f32>
| ^^^ type parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/collections.rs:26:71
+ --> $DIR/collections.rs:27:71
|
LL | <<Self as Collection<T>>::Family as CollectionFamily>::Member<U>;
| ^ type parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/collections.rs:33:50
+ --> $DIR/collections.rs:34:50
|
LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter>;
| ^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/collections.rs:59:50
+ --> $DIR/collections.rs:60:50
|
LL | fn iterate<'iter>(&'iter self) -> Self::Iter<'iter> {
| ^^^^^ lifetime parameter not allowed
diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs
index 04294100..88a660b 100644
--- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.rs
@@ -9,11 +9,12 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
use std::ops::Deref;
-//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
-//follow-up PR
+// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
+// follow-up PR.
trait Foo {
type Bar<'a, 'b>;
diff --git a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
index 1746122..5c85698 100644
--- a/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/construct_with_other_type.stderr
@@ -1,17 +1,23 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/construct_with_other_type.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/construct_with_other_type.rs:26:46
+ --> $DIR/construct_with_other_type.rs:27:46
|
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/construct_with_other_type.rs:26:63
+ --> $DIR/construct_with_other_type.rs:27:63
|
LL | type Baa<'a>: Deref<Target = <Self::Quux<'a> as Foo>::Bar<'a, 'static>>;
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/construct_with_other_type.rs:34:40
+ --> $DIR/construct_with_other_type.rs:35:40
|
LL | type Baa<'a> = &'a <T as Foo>::Bar<'a, 'static>;
| ^^ lifetime parameter not allowed
diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs
index b12c075..d8a2a1b 100644
--- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.rs
@@ -9,6 +9,7 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
trait Foo {
type Bar<,>;
diff --git a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr
index aff3044..2670c3a 100644
--- a/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/empty_generics.stderr
@@ -1,8 +1,14 @@
error: expected one of `>`, identifier, or lifetime, found `,`
- --> $DIR/empty_generics.rs:14:14
+ --> $DIR/empty_generics.rs:15:14
|
LL | type Bar<,>;
| ^ expected one of `>`, identifier, or lifetime here
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/empty_generics.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error: aborting due to previous error
diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs
new file mode 100644
index 0000000..7f48408
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// run-pass
+
+#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
+
+fn main() {}
diff --git a/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr
new file mode 100644
index 0000000..67682dc
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/gat-incomplete-warning.stderr
@@ -0,0 +1,6 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/gat-incomplete-warning.rs:13:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr
new file mode 100644
index 0000000..97d5482
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/generic-associated-types-where.stderr
@@ -0,0 +1,6 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/generic-associated-types-where.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs
index 263b3cb..267272d 100644
--- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.rs
@@ -9,11 +9,12 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
use std::ops::Deref;
-//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
-//follow-up PR
+// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
+// follow-up PR.
trait Iterable {
type Item<'a>;
diff --git a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
index d48c214..79b2990 100644
--- a/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr
@@ -1,29 +1,35 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0261]: use of undeclared lifetime name `'b`
- --> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37
+ --> $DIR/generic_associated_type_undeclared_lifetimes.rs:23:37
|
LL | + Deref<Target = Self::Item<'b>>;
| ^^ undeclared lifetime
error[E0261]: use of undeclared lifetime name `'undeclared`
- --> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41
+ --> $DIR/generic_associated_type_undeclared_lifetimes.rs:27:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
| ^^^^^^^^^^^ undeclared lifetime
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/generic_associated_type_undeclared_lifetimes.rs:20:47
+ --> $DIR/generic_associated_type_undeclared_lifetimes.rs:21:47
|
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/generic_associated_type_undeclared_lifetimes.rs:22:37
+ --> $DIR/generic_associated_type_undeclared_lifetimes.rs:23:37
|
LL | + Deref<Target = Self::Item<'b>>;
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/generic_associated_type_undeclared_lifetimes.rs:26:41
+ --> $DIR/generic_associated_type_undeclared_lifetimes.rs:27:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
| ^^^^^^^^^^^ lifetime parameter not allowed
diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.rs b/src/test/ui/rfc1598-generic-associated-types/iterable.rs
index 38967db..b52b6e0 100644
--- a/src/test/ui/rfc1598-generic-associated-types/iterable.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/iterable.rs
@@ -9,11 +9,12 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
use std::ops::Deref;
-//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
-//follow-up PR
+// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
+// follow-up PR.
trait Iterable {
type Item<'a>;
diff --git a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr
index 737a29e..de3563c 100644
--- a/src/test/ui/rfc1598-generic-associated-types/iterable.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/iterable.stderr
@@ -1,35 +1,41 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/iterable.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/iterable.rs:20:47
+ --> $DIR/iterable.rs:21:47
|
LL | type Iter<'a>: Iterator<Item = Self::Item<'a>>;
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/iterable.rs:49:53
+ --> $DIR/iterable.rs:50:53
|
LL | fn make_iter<'a, I: Iterable>(it: &'a I) -> I::Iter<'a> {
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/iterable.rs:54:60
+ --> $DIR/iterable.rs:55:60
|
LL | fn get_first<'a, I: Iterable>(it: &'a I) -> Option<I::Item<'a>> {
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/iterable.rs:23:41
+ --> $DIR/iterable.rs:24:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'a>;
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/iterable.rs:32:41
+ --> $DIR/iterable.rs:33:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/iterable.rs:43:41
+ --> $DIR/iterable.rs:44:41
|
LL | fn iter<'a>(&'a self) -> Self::Iter<'a> {
| ^^ lifetime parameter not allowed
diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs
index 51527d4..82e82e6 100644
--- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.rs
@@ -9,12 +9,13 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
#![feature(associated_type_defaults)]
-//FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
-//follow-up PR
+// FIXME(#44265): "lifetime parameters are not allowed on this type" errors will be addressed in a
+// follow-up PR.
-//FIXME(#44265): Update expected errors once E110 is resolved, now does not get past `trait Foo`
+// FIXME(#44265): Update expected errors once E110 is resolved, now does not get past `trait Foo`.
trait Foo {
type A<'a>;
diff --git a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
index c8d37a5..e47daf2 100644
--- a/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/parameter_number_and_kind.stderr
@@ -1,29 +1,35 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/parameter_number_and_kind.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:26:27
+ --> $DIR/parameter_number_and_kind.rs:27:27
|
LL | type FOk<T> = Self::E<'static, T>;
| ^^^^^^^ lifetime parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:26:36
+ --> $DIR/parameter_number_and_kind.rs:27:36
|
LL | type FOk<T> = Self::E<'static, T>;
| ^ type parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:29:26
+ --> $DIR/parameter_number_and_kind.rs:30:26
|
LL | type FErr1 = Self::E<'static, 'static>; // Error
| ^^^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:31:29
+ --> $DIR/parameter_number_and_kind.rs:32:29
|
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^^^^^^^ lifetime parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/parameter_number_and_kind.rs:31:38
+ --> $DIR/parameter_number_and_kind.rs:32:38
|
LL | type FErr2<T> = Self::E<'static, T, u32>; // Error
| ^ type parameter not allowed
diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs
index cbeeb1d..0300ad0 100644
--- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.rs
@@ -9,8 +9,9 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
-//FIXME(#44265): "type parameter not allowed" errors will be addressed in a follow-up PR
+// FIXME(#44265): "type parameter not allowed" errors will be addressed in a follow-up PR.
use std::rc::Rc;
use std::sync::Arc;
diff --git a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr
index 3e772ee..3be0481 100644
--- a/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/pointer_family.stderr
@@ -1,23 +1,29 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/pointer_family.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0109]: type parameters are not allowed on this type
- --> $DIR/pointer_family.rs:46:21
+ --> $DIR/pointer_family.rs:47:21
|
LL | bar: P::Pointer<String>,
| ^^^^^^ type parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/pointer_family.rs:21:42
+ --> $DIR/pointer_family.rs:22:42
|
LL | fn new<T>(value: T) -> Self::Pointer<T>;
| ^ type parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/pointer_family.rs:29:42
+ --> $DIR/pointer_family.rs:30:42
|
LL | fn new<T>(value: T) -> Self::Pointer<T> {
| ^ type parameter not allowed
error[E0109]: type parameters are not allowed on this type
- --> $DIR/pointer_family.rs:39:42
+ --> $DIR/pointer_family.rs:40:42
|
LL | fn new<T>(value: T) -> Self::Pointer<T> {
| ^ type parameter not allowed
diff --git a/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr b/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr
new file mode 100644
index 0000000..f2d626f
--- /dev/null
+++ b/src/test/ui/rfc1598-generic-associated-types/shadowing.stderr
@@ -0,0 +1,6 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/shadowing.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
index 522ddb5..aa90886 100644
--- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
+++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.rs
@@ -9,8 +9,9 @@
// except according to those terms.
#![feature(generic_associated_types)]
+//~^ WARNING the feature `generic_associated_types` is incomplete
-//FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a
+// FIXME(#44265): "lifetime parameter not allowed on this type" errors will be addressed in a
// follow-up PR
use std::fmt::Display;
diff --git a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr
index 12e206c..4aca8d4 100644
--- a/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr
+++ b/src/test/ui/rfc1598-generic-associated-types/streaming_iterator.stderr
@@ -1,29 +1,35 @@
+warning: the feature `generic_associated_types` is incomplete and may cause the compiler to crash
+ --> $DIR/streaming_iterator.rs:11:12
+ |
+LL | #![feature(generic_associated_types)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/streaming_iterator.rs:27:41
+ --> $DIR/streaming_iterator.rs:28:41
|
LL | bar: <T as StreamingIterator>::Item<'static>,
| ^^^^^^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/streaming_iterator.rs:35:64
+ --> $DIR/streaming_iterator.rs:36:64
|
LL | fn foo<T>(iter: T) where T: StreamingIterator, for<'a> T::Item<'a>: Display { /* ... */ }
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/streaming_iterator.rs:21:48
+ --> $DIR/streaming_iterator.rs:22:48
|
LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>>;
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/streaming_iterator.rs:47:37
+ --> $DIR/streaming_iterator.rs:48:37
|
LL | type Item<'a> = (usize, I::Item<'a>);
| ^^ lifetime parameter not allowed
error[E0110]: lifetime parameters are not allowed on this type
- --> $DIR/streaming_iterator.rs:49:48
+ --> $DIR/streaming_iterator.rs:50:48
|
LL | fn next<'a>(&'a self) -> Option<Self::Item<'a>> {
| ^^ lifetime parameter not allowed
diff --git a/src/test/compile-fail/rfc1623.rs b/src/test/ui/rfc1623.rs
similarity index 100%
rename from src/test/compile-fail/rfc1623.rs
rename to src/test/ui/rfc1623.rs
diff --git a/src/test/ui/rfc1623.stderr b/src/test/ui/rfc1623.stderr
new file mode 100644
index 0000000..3815558
--- /dev/null
+++ b/src/test/ui/rfc1623.stderr
@@ -0,0 +1,19 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/rfc1623.rs:17:42
+ |
+LL | static NON_ELIDABLE_FN: &fn(&u8, &u8) -> &u8 =
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/rfc1623.rs:19:39
+ |
+LL | &(non_elidable as fn(&u8, &u8) -> &u8);
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/compile-fail/rfc1717/missing-link-attr.rs b/src/test/ui/rfc1717/missing-link-attr.rs
similarity index 100%
rename from src/test/compile-fail/rfc1717/missing-link-attr.rs
rename to src/test/ui/rfc1717/missing-link-attr.rs
diff --git a/src/test/ui/rfc1717/missing-link-attr.stderr b/src/test/ui/rfc1717/missing-link-attr.stderr
new file mode 100644
index 0000000..30555e8
--- /dev/null
+++ b/src/test/ui/rfc1717/missing-link-attr.stderr
@@ -0,0 +1,4 @@
+error: renaming of the library `foo` was specified, however this crate contains no #[link(...)] attributes referencing this library.
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rfc1717/multiple-renames.rs b/src/test/ui/rfc1717/multiple-renames.rs
similarity index 100%
rename from src/test/compile-fail/rfc1717/multiple-renames.rs
rename to src/test/ui/rfc1717/multiple-renames.rs
diff --git a/src/test/ui/rfc1717/multiple-renames.stderr b/src/test/ui/rfc1717/multiple-renames.stderr
new file mode 100644
index 0000000..4e5a364
--- /dev/null
+++ b/src/test/ui/rfc1717/multiple-renames.stderr
@@ -0,0 +1,4 @@
+error: multiple renamings were specified for library `foo` .
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rfc1717/rename-to-empty.rs b/src/test/ui/rfc1717/rename-to-empty.rs
similarity index 100%
rename from src/test/compile-fail/rfc1717/rename-to-empty.rs
rename to src/test/ui/rfc1717/rename-to-empty.rs
diff --git a/src/test/ui/rfc1717/rename-to-empty.stderr b/src/test/ui/rfc1717/rename-to-empty.stderr
new file mode 100644
index 0000000..aca839d
--- /dev/null
+++ b/src/test/ui/rfc1717/rename-to-empty.stderr
@@ -0,0 +1,4 @@
+error: an empty renaming target was specified for library `foo`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rmeta-lib-pass.rs b/src/test/ui/rmeta-lib-pass.rs
similarity index 100%
rename from src/test/compile-fail/rmeta-lib-pass.rs
rename to src/test/ui/rmeta-lib-pass.rs
diff --git a/src/test/compile-fail/rmeta-pass.rs b/src/test/ui/rmeta-pass.rs
similarity index 100%
rename from src/test/compile-fail/rmeta-pass.rs
rename to src/test/ui/rmeta-pass.rs
diff --git a/src/test/compile-fail/rmeta-priv-warn.rs b/src/test/ui/rmeta-priv-warn.rs
similarity index 100%
rename from src/test/compile-fail/rmeta-priv-warn.rs
rename to src/test/ui/rmeta-priv-warn.rs
diff --git a/src/test/compile-fail/rmeta.rs b/src/test/ui/rmeta.rs
similarity index 100%
rename from src/test/compile-fail/rmeta.rs
rename to src/test/ui/rmeta.rs
diff --git a/src/test/ui/rmeta.stderr b/src/test/ui/rmeta.stderr
new file mode 100644
index 0000000..fa154f8
--- /dev/null
+++ b/src/test/ui/rmeta.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `Foo` in this scope
+ --> $DIR/rmeta.rs:17:13
+ |
+LL | let _ = Foo; //~ ERROR cannot find value `Foo` in this scope
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/rmeta_lib.rs b/src/test/ui/rmeta_lib.rs
similarity index 100%
rename from src/test/compile-fail/rmeta_lib.rs
rename to src/test/ui/rmeta_lib.rs
diff --git a/src/test/ui/rmeta_lib.stderr b/src/test/ui/rmeta_lib.stderr
new file mode 100644
index 0000000..8a9179c
--- /dev/null
+++ b/src/test/ui/rmeta_lib.stderr
@@ -0,0 +1,4 @@
+error: crate `rmeta_meta` required to be available in rlib format, but was not found in this form
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rmeta_meta_main.rs b/src/test/ui/rmeta_meta_main.rs
similarity index 100%
rename from src/test/compile-fail/rmeta_meta_main.rs
rename to src/test/ui/rmeta_meta_main.rs
diff --git a/src/test/ui/rmeta_meta_main.stderr b/src/test/ui/rmeta_meta_main.stderr
new file mode 100644
index 0000000..f246a8b
--- /dev/null
+++ b/src/test/ui/rmeta_meta_main.stderr
@@ -0,0 +1,9 @@
+error[E0560]: struct `rmeta_meta::Foo` has no field named `field2`
+ --> $DIR/rmeta_meta_main.rs:23:19
+ |
+LL | let _ = Foo { field2: 42 }; //~ ERROR struct `rmeta_meta::Foo` has no field named `field2`
+ | ^^^^^^ field does not exist - did you mean `field`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0560`.
diff --git a/src/test/ui/rust-2018/async-ident-allowed.rs b/src/test/ui/rust-2018/async-ident-allowed.rs
index fd4eae1..3bc4684 100644
--- a/src/test/ui/rust-2018/async-ident-allowed.rs
+++ b/src/test/ui/rust-2018/async-ident-allowed.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: --edition 2015
+// edition:2015
#![deny(rust_2018_compatibility)]
diff --git a/src/test/ui/rust-2018/edition-lint-paths.fixed b/src/test/ui/rust-2018/edition-lint-paths.fixed
index ecc7190..8a2b9c1 100644
--- a/src/test/ui/rust-2018/edition-lint-paths.fixed
+++ b/src/test/ui/rust-2018/edition-lint-paths.fixed
@@ -68,7 +68,7 @@
//~^ ERROR absolute
//~| WARN this was previously accepted
let x = bar::Bar;
- let x = ::crate::bar::Bar;
+ let x = crate::bar::Bar;
let x = self::bar::Bar;
foo::test();
diff --git a/src/test/ui/rust-2018/edition-lint-paths.rs b/src/test/ui/rust-2018/edition-lint-paths.rs
index c08be85..b6e5d5a 100644
--- a/src/test/ui/rust-2018/edition-lint-paths.rs
+++ b/src/test/ui/rust-2018/edition-lint-paths.rs
@@ -68,7 +68,7 @@
//~^ ERROR absolute
//~| WARN this was previously accepted
let x = bar::Bar;
- let x = ::crate::bar::Bar;
+ let x = crate::bar::Bar;
let x = self::bar::Bar;
foo::test();
diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed
index 4f99c12..fc81ab0 100644
--- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed
+++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.fixed
@@ -10,12 +10,11 @@
// aux-build:edition-lint-paths.rs
// run-rustfix
-// compile-flags:--edition 2018
+// edition:2018
// The "normal case". Ideally we would remove the `extern crate` here,
// but we don't.
-#![feature(rust_2018_preview)]
#![deny(rust_2018_idioms)]
#![allow(dead_code)]
diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs
index 9c1235a..72751f2 100644
--- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs
+++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.rs
@@ -10,12 +10,11 @@
// aux-build:edition-lint-paths.rs
// run-rustfix
-// compile-flags:--edition 2018
+// edition:2018
// The "normal case". Ideally we would remove the `extern crate` here,
// but we don't.
-#![feature(rust_2018_preview)]
#![deny(rust_2018_idioms)]
#![allow(dead_code)]
diff --git a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr
index b3afa2b..0ecfd4e 100644
--- a/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr
+++ b/src/test/ui/rust-2018/extern-crate-idiomatic-in-2018.stderr
@@ -1,18 +1,18 @@
error: unused extern crate
- --> $DIR/extern-crate-idiomatic-in-2018.rs:22:1
+ --> $DIR/extern-crate-idiomatic-in-2018.rs:21:1
|
LL | extern crate edition_lint_paths;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it
|
note: lint level defined here
- --> $DIR/extern-crate-idiomatic-in-2018.rs:19:9
+ --> $DIR/extern-crate-idiomatic-in-2018.rs:18:9
|
LL | #![deny(rust_2018_idioms)]
| ^^^^^^^^^^^^^^^^
= note: #[deny(unused_extern_crates)] implied by #[deny(rust_2018_idioms)]
error: `extern crate` is not idiomatic in the new edition
- --> $DIR/extern-crate-idiomatic-in-2018.rs:25:1
+ --> $DIR/extern-crate-idiomatic-in-2018.rs:24:1
|
LL | extern crate edition_lint_paths as bar;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: convert it to a `use`
diff --git a/src/test/ui/rust-2018/issue-52202-use-suggestions.rs b/src/test/ui/rust-2018/issue-52202-use-suggestions.rs
index 5acd19c..deb8041 100644
--- a/src/test/ui/rust-2018/issue-52202-use-suggestions.rs
+++ b/src/test/ui/rust-2018/issue-52202-use-suggestions.rs
@@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: --edition 2018
+// edition:2018
// The local `use` suggestion should start with `crate::` (but the
// standard-library suggestions should not, obviously).
diff --git a/src/test/ui/rust-2018/macro-use-warned-against.rs b/src/test/ui/rust-2018/macro-use-warned-against.rs
index f504194..ce4c696 100644
--- a/src/test/ui/rust-2018/macro-use-warned-against.rs
+++ b/src/test/ui/rust-2018/macro-use-warned-against.rs
@@ -13,7 +13,6 @@
// compile-pass
#![warn(macro_use_extern_crate, unused)]
-#![feature(use_extern_macros)]
#[macro_use] //~ WARN should be replaced at use sites with a `use` statement
extern crate macro_use_warned_against;
diff --git a/src/test/ui/rust-2018/macro-use-warned-against.stderr b/src/test/ui/rust-2018/macro-use-warned-against.stderr
index 7af404f..da69daf 100644
--- a/src/test/ui/rust-2018/macro-use-warned-against.stderr
+++ b/src/test/ui/rust-2018/macro-use-warned-against.stderr
@@ -1,5 +1,5 @@
warning: deprecated `#[macro_use]` directive used to import macros should be replaced at use sites with a `use` statement to import the macro instead
- --> $DIR/macro-use-warned-against.rs:18:1
+ --> $DIR/macro-use-warned-against.rs:17:1
|
LL | #[macro_use] //~ WARN should be replaced at use sites with a `use` statement
| ^^^^^^^^^^^^
@@ -11,7 +11,7 @@
| ^^^^^^^^^^^^^^^^^^^^^^
warning: unused `#[macro_use]` import
- --> $DIR/macro-use-warned-against.rs:20:1
+ --> $DIR/macro-use-warned-against.rs:19:1
|
LL | #[macro_use] //~ WARN unused `#[macro_use]`
| ^^^^^^^^^^^^
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
new file mode 100644
index 0000000..e0992c9
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.rs
@@ -0,0 +1,31 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+// This test is similar to `ambiguity-macros.rs`, but nested in a module.
+
+mod foo {
+ pub use std::io;
+ //~^ ERROR `std` import is ambiguous
+
+ macro_rules! m {
+ () => {
+ mod std {
+ pub struct io;
+ }
+ }
+ }
+ m!();
+}
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
new file mode 100644
index 0000000..154ee41
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros-nested.stderr
@@ -0,0 +1,16 @@
+error: `std` import is ambiguous
+ --> $DIR/ambiguity-macros-nested.rs:18:13
+ |
+LL | pub use std::io;
+ | ^^^ can refer to external crate `::std`
+...
+LL | / mod std {
+LL | | pub struct io;
+LL | | }
+ | |_____________- can refer to `self::std`
+ |
+ = help: write `::std` or `self::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs
new file mode 100644
index 0000000..9439d92
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.rs
@@ -0,0 +1,29 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+// This test is similar to `ambiguity.rs`, but with macros defining local items.
+
+use std::io;
+//~^ ERROR `std` import is ambiguous
+
+macro_rules! m {
+ () => {
+ mod std {
+ pub struct io;
+ }
+ }
+}
+m!();
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
new file mode 100644
index 0000000..3c0d560
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-macros.stderr
@@ -0,0 +1,16 @@
+error: `std` import is ambiguous
+ --> $DIR/ambiguity-macros.rs:17:5
+ |
+LL | use std::io;
+ | ^^^ can refer to external crate `::std`
+...
+LL | / mod std {
+LL | | pub struct io;
+LL | | }
+ | |_________- can refer to `self::std`
+ |
+ = help: write `::std` or `self::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs
new file mode 100644
index 0000000..1756acc
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.rs
@@ -0,0 +1,26 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+// This test is similar to `ambiguity.rs`, but nested in a module.
+
+mod foo {
+ pub use std::io;
+ //~^ ERROR `std` import is ambiguous
+
+ mod std {
+ pub struct io;
+ }
+}
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
new file mode 100644
index 0000000..a607eeb
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity-nested.stderr
@@ -0,0 +1,16 @@
+error: `std` import is ambiguous
+ --> $DIR/ambiguity-nested.rs:18:13
+ |
+LL | pub use std::io;
+ | ^^^ can refer to external crate `::std`
+...
+LL | / mod std {
+LL | | pub struct io;
+LL | | }
+ | |_____- can refer to `self::std`
+ |
+ = help: write `::std` or `self::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity.rs b/src/test/ui/rust-2018/uniform-paths/ambiguity.rs
new file mode 100644
index 0000000..9ae3d79
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity.rs
@@ -0,0 +1,22 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+use std::io;
+//~^ ERROR `std` import is ambiguous
+
+mod std {
+ pub struct io;
+}
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr b/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr
new file mode 100644
index 0000000..c65db30
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/ambiguity.stderr
@@ -0,0 +1,16 @@
+error: `std` import is ambiguous
+ --> $DIR/ambiguity.rs:15:5
+ |
+LL | use std::io;
+ | ^^^ can refer to external crate `::std`
+...
+LL | / mod std {
+LL | | pub struct io;
+LL | | }
+ | |_- can refer to `self::std`
+ |
+ = help: write `::std` or `self::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
new file mode 100644
index 0000000..ee141d4
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.rs
@@ -0,0 +1,31 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+enum Foo { A, B }
+
+struct std;
+
+fn main() {
+ enum Foo {}
+ use Foo::*;
+ //~^ ERROR `Foo` import is ambiguous
+
+ let _ = (A, B);
+
+ fn std() {}
+ enum std {}
+ use std as foo;
+ //~^ ERROR `std` import is ambiguous
+ //~| ERROR `std` import is ambiguous
+}
diff --git a/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
new file mode 100644
index 0000000..86d95f2
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/block-scoped-shadow.stderr
@@ -0,0 +1,45 @@
+error: `Foo` import is ambiguous
+ --> $DIR/block-scoped-shadow.rs:21:9
+ |
+LL | enum Foo { A, B }
+ | ----------------- can refer to `self::Foo`
+...
+LL | enum Foo {}
+ | ----------- shadowed by block-scoped `Foo`
+LL | use Foo::*;
+ | ^^^
+ |
+ = help: write `self::Foo` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: `std` import is ambiguous
+ --> $DIR/block-scoped-shadow.rs:28:9
+ |
+LL | struct std;
+ | ----------- can refer to `self::std`
+...
+LL | enum std {}
+ | ----------- shadowed by block-scoped `std`
+LL | use std as foo;
+ | ^^^ can refer to external crate `::std`
+ |
+ = help: write `::std` or `self::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: `std` import is ambiguous
+ --> $DIR/block-scoped-shadow.rs:28:9
+ |
+LL | struct std;
+ | ----------- can refer to `self::std`
+...
+LL | fn std() {}
+ | ----------- shadowed by block-scoped `std`
+LL | enum std {}
+LL | use std as foo;
+ | ^^^
+ |
+ = help: write `self::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/ui/rust-2018/uniform-paths/redundant.rs b/src/test/ui/rust-2018/uniform-paths/redundant.rs
new file mode 100644
index 0000000..8f384b7
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/redundant.rs
@@ -0,0 +1,17 @@
+// 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.
+
+// edition:2018
+
+#![feature(uniform_paths)]
+
+use std;
+
+fn main() {}
diff --git a/src/test/ui/rust-2018/uniform-paths/redundant.stderr b/src/test/ui/rust-2018/uniform-paths/redundant.stderr
new file mode 100644
index 0000000..dd38407
--- /dev/null
+++ b/src/test/ui/rust-2018/uniform-paths/redundant.stderr
@@ -0,0 +1,14 @@
+error: `std` import is redundant
+ --> $DIR/redundant.rs:15:5
+ |
+LL | use std;
+ | ^^^
+ | |
+ | refers to external crate `::std`
+ | defines `self::std`, shadowing itself
+ |
+ = help: remove or write `::std` explicitly instead
+ = note: relative `use` paths enabled by `#![feature(uniform_paths)]`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rust-unstable-column-gated.rs b/src/test/ui/rust-unstable-column-gated.rs
similarity index 100%
rename from src/test/compile-fail/rust-unstable-column-gated.rs
rename to src/test/ui/rust-unstable-column-gated.rs
diff --git a/src/test/ui/rust-unstable-column-gated.stderr b/src/test/ui/rust-unstable-column-gated.stderr
new file mode 100644
index 0000000..785fcd7
--- /dev/null
+++ b/src/test/ui/rust-unstable-column-gated.stderr
@@ -0,0 +1,8 @@
+error: the __rust_unstable_column macro is unstable
+ --> $DIR/rust-unstable-column-gated.rs:12:20
+ |
+LL | println!("{}", __rust_unstable_column!());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rustc-args-required-const.rs b/src/test/ui/rustc-args-required-const.rs
similarity index 100%
rename from src/test/compile-fail/rustc-args-required-const.rs
rename to src/test/ui/rustc-args-required-const.rs
diff --git a/src/test/ui/rustc-args-required-const.stderr b/src/test/ui/rustc-args-required-const.stderr
new file mode 100644
index 0000000..07f2d88
--- /dev/null
+++ b/src/test/ui/rustc-args-required-const.stderr
@@ -0,0 +1,14 @@
+error: argument 1 is required to be a constant
+ --> $DIR/rustc-args-required-const.rs:33:5
+ |
+LL | foo(a); //~ ERROR: argument 1 is required to be a constant
+ | ^^^^^^
+
+error: argument 2 is required to be a constant
+ --> $DIR/rustc-args-required-const.rs:35:5
+ |
+LL | bar(a, a); //~ ERROR: argument 2 is required to be a constant
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/rustc-args-required-const2.rs b/src/test/ui/rustc-args-required-const2.rs
similarity index 100%
rename from src/test/compile-fail/rustc-args-required-const2.rs
rename to src/test/ui/rustc-args-required-const2.rs
diff --git a/src/test/ui/rustc-args-required-const2.stderr b/src/test/ui/rustc-args-required-const2.stderr
new file mode 100644
index 0000000..766f8ad
--- /dev/null
+++ b/src/test/ui/rustc-args-required-const2.stderr
@@ -0,0 +1,8 @@
+error: this function can only be invoked directly, not through a function pointer
+ --> $DIR/rustc-args-required-const2.rs:18:13
+ |
+LL | let a = foo; //~ ERROR: this function can only be invoked directly
+ | ^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/rustc-error.rs b/src/test/ui/rustc-error.rs
similarity index 100%
rename from src/test/compile-fail/rustc-error.rs
rename to src/test/ui/rustc-error.rs
diff --git a/src/test/ui/rustc-error.stderr b/src/test/ui/rustc-error.stderr
new file mode 100644
index 0000000..7456d2a
--- /dev/null
+++ b/src/test/ui/rustc-error.stderr
@@ -0,0 +1,10 @@
+error: compilation successful
+ --> $DIR/rustc-error.rs:14:1
+ |
+LL | / fn main() {
+LL | | //~^ ERROR compilation successful
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/safe-extern-statics-mut.rs b/src/test/ui/safe-extern-statics-mut.rs
similarity index 100%
rename from src/test/compile-fail/safe-extern-statics-mut.rs
rename to src/test/ui/safe-extern-statics-mut.rs
diff --git a/src/test/ui/safe-extern-statics-mut.stderr b/src/test/ui/safe-extern-statics-mut.stderr
new file mode 100644
index 0000000..f48dce6
--- /dev/null
+++ b/src/test/ui/safe-extern-statics-mut.stderr
@@ -0,0 +1,35 @@
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/safe-extern-statics-mut.rs:21:13
+ |
+LL | let b = B; //~ ERROR use of mutable static is unsafe
+ | ^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/safe-extern-statics-mut.rs:22:14
+ |
+LL | let rb = &B; //~ ERROR use of mutable static is unsafe
+ | ^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/safe-extern-statics-mut.rs:23:14
+ |
+LL | let xb = XB; //~ ERROR use of mutable static is unsafe
+ | ^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/safe-extern-statics-mut.rs:24:15
+ |
+LL | let xrb = &XB; //~ ERROR use of mutable static is unsafe
+ | ^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/safe-extern-statics.rs b/src/test/ui/safe-extern-statics.rs
similarity index 100%
rename from src/test/compile-fail/safe-extern-statics.rs
rename to src/test/ui/safe-extern-statics.rs
diff --git a/src/test/ui/safe-extern-statics.stderr b/src/test/ui/safe-extern-statics.stderr
new file mode 100644
index 0000000..657d579
--- /dev/null
+++ b/src/test/ui/safe-extern-statics.stderr
@@ -0,0 +1,43 @@
+error: use of extern static is unsafe and requires unsafe function or block (error E0133)
+ --> $DIR/safe-extern-statics.rs:23:13
+ |
+LL | let a = A; //~ ERROR use of extern static is unsafe
+ | ^
+ |
+ = note: #[deny(safe_extern_statics)] on by default
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
+ = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error: use of extern static is unsafe and requires unsafe function or block (error E0133)
+ --> $DIR/safe-extern-statics.rs:25:14
+ |
+LL | let ra = &A; //~ ERROR use of extern static is unsafe
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
+ = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error: use of extern static is unsafe and requires unsafe function or block (error E0133)
+ --> $DIR/safe-extern-statics.rs:27:14
+ |
+LL | let xa = XA; //~ ERROR use of extern static is unsafe
+ | ^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
+ = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error: use of extern static is unsafe and requires unsafe function or block (error E0133)
+ --> $DIR/safe-extern-statics.rs:29:15
+ |
+LL | let xra = &XA; //~ ERROR use of extern static is unsafe
+ | ^^^
+ |
+ = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+ = note: for more information, see issue #36247 <https://github.com/rust-lang/rust/issues/36247>
+ = note: extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/ui/self-impl.rs b/src/test/ui/self/self-impl.rs
similarity index 100%
rename from src/test/ui/self-impl.rs
rename to src/test/ui/self/self-impl.rs
diff --git a/src/test/ui/self-impl.stderr b/src/test/ui/self/self-impl.stderr
similarity index 100%
rename from src/test/ui/self-impl.stderr
rename to src/test/ui/self/self-impl.stderr
diff --git a/src/test/compile-fail/self-infer.rs b/src/test/ui/self/self-infer.rs
similarity index 100%
rename from src/test/compile-fail/self-infer.rs
rename to src/test/ui/self/self-infer.rs
diff --git a/src/test/ui/self/self-infer.stderr b/src/test/ui/self/self-infer.stderr
new file mode 100644
index 0000000..642e0de
--- /dev/null
+++ b/src/test/ui/self/self-infer.stderr
@@ -0,0 +1,15 @@
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> $DIR/self-infer.rs:14:16
+ |
+LL | fn f(self: _) {} //~ERROR the type placeholder `_` is not allowed within types on item sig
+ | ^ not allowed in type signatures
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> $DIR/self-infer.rs:15:17
+ |
+LL | fn g(self: &_) {} //~ERROR the type placeholder `_` is not allowed within types on item sig
+ | ^ not allowed in type signatures
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0121`.
diff --git a/src/test/compile-fail/self-vs-path-ambiguity.rs b/src/test/ui/self/self-vs-path-ambiguity.rs
similarity index 100%
rename from src/test/compile-fail/self-vs-path-ambiguity.rs
rename to src/test/ui/self/self-vs-path-ambiguity.rs
diff --git a/src/test/ui/self/self-vs-path-ambiguity.stderr b/src/test/ui/self/self-vs-path-ambiguity.stderr
new file mode 100644
index 0000000..7651743
--- /dev/null
+++ b/src/test/ui/self/self-vs-path-ambiguity.stderr
@@ -0,0 +1,8 @@
+error: unexpected lifetime `'a` in pattern
+ --> $DIR/self-vs-path-ambiguity.rs:19:11
+ |
+LL | fn i(&'a self::S: &S) {} //~ ERROR unexpected lifetime `'a` in pattern
+ | ^^ unexpected lifetime
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/self_type_keyword-2.rs b/src/test/ui/self/self_type_keyword-2.rs
similarity index 100%
rename from src/test/compile-fail/self_type_keyword-2.rs
rename to src/test/ui/self/self_type_keyword-2.rs
diff --git a/src/test/ui/self/self_type_keyword-2.stderr b/src/test/ui/self/self_type_keyword-2.stderr
new file mode 100644
index 0000000..972e5bd
--- /dev/null
+++ b/src/test/ui/self/self_type_keyword-2.stderr
@@ -0,0 +1,28 @@
+error[E0432]: unresolved import `self::Self`
+ --> $DIR/self_type_keyword-2.rs:11:5
+ |
+LL | use self::Self as Foo; //~ ERROR unresolved import `self::Self`
+ | ^^^^^^^^^^^^^^^^^ no `Self` in the root
+
+error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
+ --> $DIR/self_type_keyword-2.rs:14:9
+ |
+LL | let Self = 5;
+ | ^^^^ not found in this scope
+
+error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
+ --> $DIR/self_type_keyword-2.rs:18:9
+ |
+LL | Self => (),
+ | ^^^^ not found in this scope
+
+error[E0531]: cannot find unit struct/variant or constant `Self` in this scope
+ --> $DIR/self_type_keyword-2.rs:20:18
+ |
+LL | Foo { x: Self } => (),
+ | ^^^^ not found in this scope
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0432, E0531.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/self_type_keyword.rs b/src/test/ui/self/self_type_keyword.rs
similarity index 100%
rename from src/test/compile-fail/self_type_keyword.rs
rename to src/test/ui/self/self_type_keyword.rs
diff --git a/src/test/ui/self/self_type_keyword.stderr b/src/test/ui/self/self_type_keyword.stderr
new file mode 100644
index 0000000..4a7b9a6
--- /dev/null
+++ b/src/test/ui/self/self_type_keyword.stderr
@@ -0,0 +1,62 @@
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:14:10
+ |
+LL | struct Self;
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:25:13
+ |
+LL | ref Self => (),
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:27:13
+ |
+LL | mut Self => (),
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:29:17
+ |
+LL | ref mut Self => (),
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:33:15
+ |
+LL | Foo { Self } => (),
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:39:26
+ |
+LL | extern crate core as Self;
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:44:32
+ |
+LL | use std::option::Option as Self;
+ | ^^^^ expected identifier, found keyword
+
+error: expected identifier, found keyword `Self`
+ --> $DIR/self_type_keyword.rs:49:11
+ |
+LL | trait Self {}
+ | ^^^^ expected identifier, found keyword
+
+error: lifetimes cannot use keyword names
+ --> $DIR/self_type_keyword.rs:18:12
+ |
+LL | struct Bar<'Self>;
+ | ^^^^^
+
+error: cannot find macro `Self!` in this scope
+ --> $DIR/self_type_keyword.rs:31:9
+ |
+LL | Self!() => (),
+ | ^^^^
+
+error: aborting due to 10 previous errors
+
diff --git a/src/test/compile-fail/seq-args.rs b/src/test/ui/seq-args.rs
similarity index 100%
rename from src/test/compile-fail/seq-args.rs
rename to src/test/ui/seq-args.rs
diff --git a/src/test/ui/seq-args.stderr b/src/test/ui/seq-args.stderr
new file mode 100644
index 0000000..dc9d0a7
--- /dev/null
+++ b/src/test/ui/seq-args.stderr
@@ -0,0 +1,15 @@
+error[E0244]: wrong number of type arguments: expected 0, found 1
+ --> $DIR/seq-args.rs:14:9
+ |
+LL | impl<T> seq<T> for Vec<T> { //~ ERROR wrong number of type arguments
+ | ^^^^^^ expected no type arguments
+
+error[E0244]: wrong number of type arguments: expected 0, found 1
+ --> $DIR/seq-args.rs:17:6
+ |
+LL | impl seq<bool> for u32 { //~ ERROR wrong number of type arguments
+ | ^^^^^^^^^ expected no type arguments
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0244`.
diff --git a/src/test/ui/shadowed-lifetime.rs b/src/test/ui/shadowed/shadowed-lifetime.rs
similarity index 100%
rename from src/test/ui/shadowed-lifetime.rs
rename to src/test/ui/shadowed/shadowed-lifetime.rs
diff --git a/src/test/ui/shadowed-lifetime.stderr b/src/test/ui/shadowed/shadowed-lifetime.stderr
similarity index 100%
rename from src/test/ui/shadowed-lifetime.stderr
rename to src/test/ui/shadowed/shadowed-lifetime.stderr
diff --git a/src/test/compile-fail/shadowed-trait-methods.rs b/src/test/ui/shadowed/shadowed-trait-methods.rs
similarity index 100%
rename from src/test/compile-fail/shadowed-trait-methods.rs
rename to src/test/ui/shadowed/shadowed-trait-methods.rs
diff --git a/src/test/ui/shadowed/shadowed-trait-methods.stderr b/src/test/ui/shadowed/shadowed-trait-methods.stderr
new file mode 100644
index 0000000..910f125
--- /dev/null
+++ b/src/test/ui/shadowed/shadowed-trait-methods.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no method named `f` found for type `()` in the current scope
+ --> $DIR/shadowed-trait-methods.rs:23:8
+ |
+LL | ().f() //~ ERROR no method
+ | ^
+ |
+ = help: items from traits can only be used if the trait is in scope
+help: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ |
+LL | use foo::T;
+ |
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/ui/shadowed-type-parameter.rs b/src/test/ui/shadowed/shadowed-type-parameter.rs
similarity index 100%
rename from src/test/ui/shadowed-type-parameter.rs
rename to src/test/ui/shadowed/shadowed-type-parameter.rs
diff --git a/src/test/ui/shadowed-type-parameter.stderr b/src/test/ui/shadowed/shadowed-type-parameter.stderr
similarity index 100%
rename from src/test/ui/shadowed-type-parameter.stderr
rename to src/test/ui/shadowed/shadowed-type-parameter.stderr
diff --git a/src/test/compile-fail/shadowed-use-visibility.rs b/src/test/ui/shadowed/shadowed-use-visibility.rs
similarity index 100%
rename from src/test/compile-fail/shadowed-use-visibility.rs
rename to src/test/ui/shadowed/shadowed-use-visibility.rs
diff --git a/src/test/ui/shadowed/shadowed-use-visibility.stderr b/src/test/ui/shadowed/shadowed-use-visibility.stderr
new file mode 100644
index 0000000..5764ed7
--- /dev/null
+++ b/src/test/ui/shadowed/shadowed-use-visibility.stderr
@@ -0,0 +1,15 @@
+error[E0603]: module `bar` is private
+ --> $DIR/shadowed-use-visibility.rs:19:9
+ |
+LL | use foo::bar::f as g; //~ ERROR module `bar` is private
+ | ^^^^^^^^^^^^^^^^
+
+error[E0603]: module `f` is private
+ --> $DIR/shadowed-use-visibility.rs:25:5
+ |
+LL | use bar::f::f; //~ ERROR module `f` is private
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/shadowing-in-the-same-pattern.rs b/src/test/ui/shadowed/shadowing-in-the-same-pattern.rs
similarity index 100%
rename from src/test/compile-fail/shadowing-in-the-same-pattern.rs
rename to src/test/ui/shadowed/shadowing-in-the-same-pattern.rs
diff --git a/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr
new file mode 100644
index 0000000..4672289
--- /dev/null
+++ b/src/test/ui/shadowed/shadowing-in-the-same-pattern.stderr
@@ -0,0 +1,15 @@
+error[E0416]: identifier `a` is bound more than once in the same pattern
+ --> $DIR/shadowing-in-the-same-pattern.rs:13:10
+ |
+LL | fn f((a, a): (isize, isize)) {} //~ ERROR identifier `a` is bound more than once
+ | ^ used in a pattern more than once
+
+error[E0416]: identifier `a` is bound more than once in the same pattern
+ --> $DIR/shadowing-in-the-same-pattern.rs:16:13
+ |
+LL | let (a, a) = (1, 1); //~ ERROR identifier `a` is bound more than once
+ | ^ used in a pattern more than once
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0416`.
diff --git a/src/test/compile-fail/shift-various-bad-types.rs b/src/test/ui/shift-various-bad-types.rs
similarity index 100%
rename from src/test/compile-fail/shift-various-bad-types.rs
rename to src/test/ui/shift-various-bad-types.rs
diff --git a/src/test/ui/shift-various-bad-types.stderr b/src/test/ui/shift-various-bad-types.stderr
new file mode 100644
index 0000000..7798b61
--- /dev/null
+++ b/src/test/ui/shift-various-bad-types.stderr
@@ -0,0 +1,34 @@
+error[E0277]: no implementation for `{integer} >> char`
+ --> $DIR/shift-various-bad-types.rs:19:8
+ |
+LL | 22 >> p.char;
+ | ^^ no implementation for `{integer} >> char`
+ |
+ = help: the trait `std::ops::Shr<char>` is not implemented for `{integer}`
+
+error[E0277]: no implementation for `{integer} >> &str`
+ --> $DIR/shift-various-bad-types.rs:22:8
+ |
+LL | 22 >> p.str;
+ | ^^ no implementation for `{integer} >> &str`
+ |
+ = help: the trait `std::ops::Shr<&str>` is not implemented for `{integer}`
+
+error[E0277]: no implementation for `{integer} >> &Panolpy`
+ --> $DIR/shift-various-bad-types.rs:25:8
+ |
+LL | 22 >> p;
+ | ^^ no implementation for `{integer} >> &Panolpy`
+ |
+ = help: the trait `std::ops::Shr<&Panolpy>` is not implemented for `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/shift-various-bad-types.rs:35:18
+ |
+LL | let _: i32 = 22_i64 >> 1_i32;
+ | ^^^^^^^^^^^^^^^ expected i32, found i64
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/should-fail-no_gate_irrefutable_if_let_pattern.rs b/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.rs
similarity index 100%
rename from src/test/compile-fail/should-fail-no_gate_irrefutable_if_let_pattern.rs
rename to src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.rs
diff --git a/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.stderr b/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.stderr
new file mode 100644
index 0000000..d8570ad
--- /dev/null
+++ b/src/test/ui/should-fail-no_gate_irrefutable_if_let_pattern.stderr
@@ -0,0 +1,9 @@
+error[E0162]: irrefutable if-let pattern
+ --> $DIR/should-fail-no_gate_irrefutable_if_let_pattern.rs:13:12
+ |
+LL | if let _ = 5 {}
+ | ^ irrefutable pattern
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0162`.
diff --git a/src/test/compile-fail/should-fail-with_gate_irrefutable_pattern_deny.rs b/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.rs
similarity index 100%
rename from src/test/compile-fail/should-fail-with_gate_irrefutable_pattern_deny.rs
rename to src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.rs
diff --git a/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.stderr b/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.stderr
new file mode 100644
index 0000000..9dc0d19
--- /dev/null
+++ b/src/test/ui/should-fail-with_gate_irrefutable_pattern_deny.stderr
@@ -0,0 +1,10 @@
+error: irrefutable if-let pattern
+ --> $DIR/should-fail-with_gate_irrefutable_pattern_deny.rs:15:5
+ |
+LL | if let _ = 5 {}
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: #[deny(irrefutable_let_patterns)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/simd-intrinsic-declaration-type.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-declaration-type.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.stderr
new file mode 100644
index 0000000..4a8fd2d
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-declaration-type.stderr
@@ -0,0 +1,75 @@
+error[E0442]: intrinsic argument 1 has wrong type: found `u16`, expected `i16`
+ --> $DIR/simd-intrinsic-declaration-type.rs:42:9
+ |
+LL | fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 2 has wrong type: found `u16`, expected `i16`
+ --> $DIR/simd-intrinsic-declaration-type.rs:42:9
+ |
+LL | fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic return value has wrong type: found `u16`, expected `i16`
+ --> $DIR/simd-intrinsic-declaration-type.rs:42:9
+ |
+LL | fn x86_mm_adds_epi16(x: u16x8, y: u16x8) -> u16x8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 1 has wrong type: found `i16`, expected `u16`
+ --> $DIR/simd-intrinsic-declaration-type.rs:46:9
+ |
+LL | fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 2 has wrong type: found `i16`, expected `u16`
+ --> $DIR/simd-intrinsic-declaration-type.rs:46:9
+ |
+LL | fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic return value has wrong type: found `i16`, expected `u16`
+ --> $DIR/simd-intrinsic-declaration-type.rs:46:9
+ |
+LL | fn x86_mm_adds_epu16(x: i16x8, y: i16x8) -> i16x8;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 1 has wrong type: found vector with length 16, expected length 8
+ --> $DIR/simd-intrinsic-declaration-type.rs:54:5
+ |
+LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 2 has wrong type: found vector with length 4, expected length 8
+ --> $DIR/simd-intrinsic-declaration-type.rs:54:5
+ |
+LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic return value has wrong type: found vector with length 2, expected length 8
+ --> $DIR/simd-intrinsic-declaration-type.rs:54:5
+ |
+LL | fn x86_mm_adds_epi16(x: i8x16, y: i32x4) -> i64x2;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 1 has wrong type: found `i32`, expected `f32`
+ --> $DIR/simd-intrinsic-declaration-type.rs:61:5
+ |
+LL | fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic argument 2 has wrong type: found `i32`, expected `f32`
+ --> $DIR/simd-intrinsic-declaration-type.rs:61:5
+ |
+LL | fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0442]: intrinsic return value has wrong type: found `i32`, expected `f32`
+ --> $DIR/simd-intrinsic-declaration-type.rs:61:5
+ |
+LL | fn x86_mm_max_ps(x: i32x4, y: i32x4) -> i32x4;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
+For more information about this error, try `rustc --explain E0442`.
diff --git a/src/test/compile-fail/simd-intrinsic-generic-arithmetic.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-generic-arithmetic.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr
new file mode 100644
index 0000000..f81fa75
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-arithmetic.stderr
@@ -0,0 +1,87 @@
+error[E0511]: invalid monomorphization of `simd_add` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:72:9
+ |
+LL | simd_add(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_sub` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:74:9
+ |
+LL | simd_sub(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_mul` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:76:9
+ |
+LL | simd_mul(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_div` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:78:9
+ |
+LL | simd_div(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shl` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:80:9
+ |
+LL | simd_shl(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shr` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:82:9
+ |
+LL | simd_shr(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_and` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:84:9
+ |
+LL | simd_and(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_or` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:86:9
+ |
+LL | simd_or(0, 0);
+ | ^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_xor` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:88:9
+ |
+LL | simd_xor(0, 0);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shl` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:92:9
+ |
+LL | simd_shl(z, z);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shr` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:94:9
+ |
+LL | simd_shr(z, z);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_and` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:96:9
+ |
+LL | simd_and(z, z);
+ | ^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_or` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:98:9
+ |
+LL | simd_or(z, z);
+ | ^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_xor` intrinsic: unsupported operation on `f32x4` with element `f32`
+ --> $DIR/simd-intrinsic-generic-arithmetic.rs:100:9
+ |
+LL | simd_xor(z, z);
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to 14 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/simd-intrinsic-generic-cast.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-generic-cast.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr
new file mode 100644
index 0000000..6ad5ac7
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-cast.stderr
@@ -0,0 +1,27 @@
+error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-cast.rs:42:9
+ |
+LL | simd_cast::<i32, i32>(0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-cast.rs:44:9
+ |
+LL | simd_cast::<i32, i32x4>(0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-cast.rs:46:9
+ |
+LL | simd_cast::<i32x4, i32>(x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_cast` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i32x8` with length 8
+ --> $DIR/simd-intrinsic-generic-cast.rs:48:9
+ |
+LL | simd_cast::<_, i32x8>(x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/simd-intrinsic-generic-comparison.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-generic-comparison.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr
new file mode 100644
index 0000000..06eb94a
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-comparison.stderr
@@ -0,0 +1,111 @@
+error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:36:9
+ |
+LL | simd_eq::<i32, i32>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:38:9
+ |
+LL | simd_ne::<i32, i32>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:40:9
+ |
+LL | simd_lt::<i32, i32>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:42:9
+ |
+LL | simd_le::<i32, i32>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:44:9
+ |
+LL | simd_gt::<i32, i32>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:46:9
+ |
+LL | simd_ge::<i32, i32>(0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:49:9
+ |
+LL | simd_eq::<_, i32>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:51:9
+ |
+LL | simd_ne::<_, i32>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:53:9
+ |
+LL | simd_lt::<_, i32>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:55:9
+ |
+LL | simd_le::<_, i32>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:57:9
+ |
+LL | simd_gt::<_, i32>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected SIMD return type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-comparison.rs:59:9
+ |
+LL | simd_ge::<_, i32>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_eq` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
+ --> $DIR/simd-intrinsic-generic-comparison.rs:62:9
+ |
+LL | simd_eq::<_, i16x8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ne` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
+ --> $DIR/simd-intrinsic-generic-comparison.rs:64:9
+ |
+LL | simd_ne::<_, i16x8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_lt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
+ --> $DIR/simd-intrinsic-generic-comparison.rs:66:9
+ |
+LL | simd_lt::<_, i16x8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_le` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
+ --> $DIR/simd-intrinsic-generic-comparison.rs:68:9
+ |
+LL | simd_le::<_, i16x8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_gt` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
+ --> $DIR/simd-intrinsic-generic-comparison.rs:70:9
+ |
+LL | simd_gt::<_, i16x8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_ge` intrinsic: expected return type with length 4 (same as input type `i32x4`), found `i16x8` with length 8
+ --> $DIR/simd-intrinsic-generic-comparison.rs:72:9
+ |
+LL | simd_ge::<_, i16x8>(x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 18 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/simd-intrinsic-generic-elements.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-generic-elements.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr
new file mode 100644
index 0000000..5a2def2
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-elements.stderr
@@ -0,0 +1,93 @@
+error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:63:9
+ |
+LL | simd_insert(0, 0, 0);
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_insert` intrinsic: expected inserted type `i32` (element of input `i32x4`), found `f64`
+ --> $DIR/simd-intrinsic-generic-elements.rs:65:9
+ |
+LL | simd_insert(x, 0, 1.0);
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_extract` intrinsic: expected return type `i32` (element of input `i32x4`), found `f32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:67:9
+ |
+LL | simd_extract::<_, f32>(x, 0);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:70:9
+ |
+LL | simd_shuffle2::<i32, i32>(0, 0, [0; 2]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:72:9
+ |
+LL | simd_shuffle3::<i32, i32>(0, 0, [0; 3]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:74:9
+ |
+LL | simd_shuffle4::<i32, i32>(0, 0, [0; 4]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected SIMD input type, found non-SIMD `i32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:76:9
+ |
+LL | simd_shuffle8::<i32, i32>(0, 0, [0; 8]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x2` with element type `f32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:79:9
+ |
+LL | simd_shuffle2::<_, f32x2>(x, x, [0; 2]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x3` with element type `f32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:81:9
+ |
+LL | simd_shuffle3::<_, f32x3>(x, x, [0; 3]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x4` with element type `f32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:83:9
+ |
+LL | simd_shuffle4::<_, f32x4>(x, x, [0; 4]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return element type `i32` (element of input `i32x4`), found `f32x8` with element type `f32`
+ --> $DIR/simd-intrinsic-generic-elements.rs:85:9
+ |
+LL | simd_shuffle8::<_, f32x8>(x, x, [0; 8]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle2` intrinsic: expected return type of length 2, found `i32x8` with length 8
+ --> $DIR/simd-intrinsic-generic-elements.rs:88:9
+ |
+LL | simd_shuffle2::<_, i32x8>(x, x, [0; 2]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle3` intrinsic: expected return type of length 3, found `i32x4` with length 4
+ --> $DIR/simd-intrinsic-generic-elements.rs:90:9
+ |
+LL | simd_shuffle3::<_, i32x4>(x, x, [0; 3]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle4` intrinsic: expected return type of length 4, found `i32x3` with length 3
+ --> $DIR/simd-intrinsic-generic-elements.rs:92:9
+ |
+LL | simd_shuffle4::<_, i32x3>(x, x, [0; 4]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_shuffle8` intrinsic: expected return type of length 8, found `i32x2` with length 2
+ --> $DIR/simd-intrinsic-generic-elements.rs:94:9
+ |
+LL | simd_shuffle8::<_, i32x2>(x, x, [0; 8]);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 15 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/simd-intrinsic-generic-reduction.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-generic-reduction.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr
new file mode 100644
index 0000000..47b1e9d
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-reduction.stderr
@@ -0,0 +1,75 @@
+error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: accumulator of simd_reduce_add_ordered is not 0.0
+ --> $DIR/simd-intrinsic-generic-reduction.rs:46:9
+ |
+LL | simd_reduce_add_ordered(z, 2_f32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: accumulator of simd_reduce_mul_ordered is not 1.0
+ --> $DIR/simd-intrinsic-generic-reduction.rs:48:9
+ |
+LL | simd_reduce_mul_ordered(z, 3_f32);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:51:22
+ |
+LL | let _: f32 = simd_reduce_and(x);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:53:22
+ |
+LL | let _: f32 = simd_reduce_or(x);
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: expected return type `u32` (element of input `u32x4`), found `f32`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:55:22
+ |
+LL | let _: f32 = simd_reduce_xor(x);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_and` intrinsic: unsupported simd_reduce_and from `f32x4` with element `f32` to `f32`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:58:22
+ |
+LL | let _: f32 = simd_reduce_and(z);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_or` intrinsic: unsupported simd_reduce_or from `f32x4` with element `f32` to `f32`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:60:22
+ |
+LL | let _: f32 = simd_reduce_or(z);
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_xor` intrinsic: unsupported simd_reduce_xor from `f32x4` with element `f32` to `f32`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:62:22
+ |
+LL | let _: f32 = simd_reduce_xor(z);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_all` intrinsic: unsupported simd_reduce_all from `f32x4` with element `f32` to `bool`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:65:23
+ |
+LL | let _: bool = simd_reduce_all(z);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_any` intrinsic: unsupported simd_reduce_any from `f32x4` with element `f32` to `bool`
+ --> $DIR/simd-intrinsic-generic-reduction.rs:67:23
+ |
+LL | let _: bool = simd_reduce_any(z);
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_add_ordered` intrinsic: accumulator of simd_reduce_add_ordered is not a constant
+ --> $DIR/simd-intrinsic-generic-reduction.rs:77:5
+ |
+LL | simd_reduce_add_ordered(z, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_reduce_mul_ordered` intrinsic: accumulator of simd_reduce_mul_ordered is not a constant
+ --> $DIR/simd-intrinsic-generic-reduction.rs:79:5
+ |
+LL | simd_reduce_mul_ordered(z, x);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 12 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/simd-intrinsic-generic-select.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-generic-select.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr
new file mode 100644
index 0000000..61e4202
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-generic-select.stderr
@@ -0,0 +1,21 @@
+error[E0511]: invalid monomorphization of `simd_select` intrinsic: mismatched lengths: mask length `8` != other vector length `4`
+ --> $DIR/simd-intrinsic-generic-select.rs:47:9
+ |
+LL | simd_select(m8, x, x);
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `u32`, expected `i_`
+ --> $DIR/simd-intrinsic-generic-select.rs:50:9
+ |
+LL | simd_select(x, x, x);
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0511]: invalid monomorphization of `simd_select` intrinsic: mask element type is `f32`, expected `i_`
+ --> $DIR/simd-intrinsic-generic-select.rs:53:9
+ |
+LL | simd_select(z, z, z);
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0511`.
diff --git a/src/test/compile-fail/simd-intrinsic-single-nominal-type.rs b/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs
similarity index 100%
rename from src/test/compile-fail/simd-intrinsic-single-nominal-type.rs
rename to src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.rs
diff --git a/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.stderr b/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.stderr
new file mode 100644
index 0000000..0692aa7
--- /dev/null
+++ b/src/test/ui/simd-intrinsic/simd-intrinsic-single-nominal-type.stderr
@@ -0,0 +1,15 @@
+error[E0443]: intrinsic return value has wrong type: found `B`, expected `A` which was used for this vector type previously in this signature
+ --> $DIR/simd-intrinsic-single-nominal-type.rs:23:5
+ |
+LL | fn x86_mm_adds_epi16(x: A, y: A) -> B;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0443]: intrinsic argument 2 has wrong type: found `B`, expected `A` which was used for this vector type previously in this signature
+ --> $DIR/simd-intrinsic-single-nominal-type.rs:25:5
+ |
+LL | fn x86_mm_subs_epi16(x: A, y: B) -> A;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0443`.
diff --git a/src/test/compile-fail/simd-type-generic-monomorphisation.rs b/src/test/ui/simd-type-generic-monomorphisation.rs
similarity index 100%
rename from src/test/compile-fail/simd-type-generic-monomorphisation.rs
rename to src/test/ui/simd-type-generic-monomorphisation.rs
diff --git a/src/test/ui/simd-type-generic-monomorphisation.stderr b/src/test/ui/simd-type-generic-monomorphisation.stderr
new file mode 100644
index 0000000..2a74506
--- /dev/null
+++ b/src/test/ui/simd-type-generic-monomorphisation.stderr
@@ -0,0 +1,4 @@
+error: monomorphising SIMD type `Simd2<X>` with a non-machine element type `X`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/simd-type.rs b/src/test/ui/simd-type.rs
similarity index 100%
rename from src/test/compile-fail/simd-type.rs
rename to src/test/ui/simd-type.rs
diff --git a/src/test/ui/simd-type.stderr b/src/test/ui/simd-type.stderr
new file mode 100644
index 0000000..5899f4a
--- /dev/null
+++ b/src/test/ui/simd-type.stderr
@@ -0,0 +1,22 @@
+error[E0075]: SIMD vector cannot be empty
+ --> $DIR/simd-type.rs:14:1
+ |
+LL | struct empty; //~ ERROR SIMD vector cannot be empty
+ | ^^^^^^^^^^^^^
+
+error[E0076]: SIMD vector should be homogeneous
+ --> $DIR/simd-type.rs:17:1
+ |
+LL | struct i64f64(i64, f64); //~ ERROR SIMD vector should be homogeneous
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ SIMD elements must have the same type
+
+error[E0077]: SIMD vector element type should be machine type
+ --> $DIR/simd-type.rs:20:1
+ |
+LL | struct int4(isize, isize, isize, isize); //~ ERROR SIMD vector element type should be machine type
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0075, E0076, E0077.
+For more information about an error, try `rustc --explain E0075`.
diff --git a/src/test/compile-fail/single-primitive-inherent-impl.rs b/src/test/ui/single-primitive-inherent-impl.rs
similarity index 100%
rename from src/test/compile-fail/single-primitive-inherent-impl.rs
rename to src/test/ui/single-primitive-inherent-impl.rs
diff --git a/src/test/ui/single-primitive-inherent-impl.stderr b/src/test/ui/single-primitive-inherent-impl.stderr
new file mode 100644
index 0000000..b781ee8
--- /dev/null
+++ b/src/test/ui/single-primitive-inherent-impl.stderr
@@ -0,0 +1,19 @@
+error[E0390]: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive
+ --> $DIR/single-primitive-inherent-impl.rs:21:1
+ |
+LL | / impl str {
+LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive
+LL | | }
+ | |_^
+ |
+help: consider using a trait to implement these methods
+ --> $DIR/single-primitive-inherent-impl.rs:21:1
+ |
+LL | / impl str {
+LL | | //~^ error: only a single inherent implementation marked with `#[lang = "str"]` is allowed for the `str` primitive
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0390`.
diff --git a/src/test/compile-fail/sized-cycle-note.rs b/src/test/ui/sized-cycle-note.rs
similarity index 100%
rename from src/test/compile-fail/sized-cycle-note.rs
rename to src/test/ui/sized-cycle-note.rs
diff --git a/src/test/ui/sized-cycle-note.stderr b/src/test/ui/sized-cycle-note.stderr
new file mode 100644
index 0000000..9665715
--- /dev/null
+++ b/src/test/ui/sized-cycle-note.stderr
@@ -0,0 +1,23 @@
+error[E0072]: recursive type `Baz` has infinite size
+ --> $DIR/sized-cycle-note.rs:19:1
+ |
+LL | struct Baz { q: Option<Foo> }
+ | ^^^^^^^^^^ -------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Baz` representable
+
+error[E0072]: recursive type `Foo` has infinite size
+ --> $DIR/sized-cycle-note.rs:21:1
+ |
+LL | struct Foo { q: Option<Baz> }
+ | ^^^^^^^^^^ -------------- recursive without indirection
+ | |
+ | recursive type has infinite size
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `Foo` representable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/src/test/compile-fail/slice-2.rs b/src/test/ui/slice-2.rs
similarity index 100%
rename from src/test/compile-fail/slice-2.rs
rename to src/test/ui/slice-2.rs
diff --git a/src/test/ui/slice-2.stderr b/src/test/ui/slice-2.stderr
new file mode 100644
index 0000000..e0f34da
--- /dev/null
+++ b/src/test/ui/slice-2.stderr
@@ -0,0 +1,27 @@
+error[E0608]: cannot index into a value of type `Foo`
+ --> $DIR/slice-2.rs:17:6
+ |
+LL | &x[..]; //~ ERROR cannot index into a value of type `Foo`
+ | ^^^^^
+
+error[E0608]: cannot index into a value of type `Foo`
+ --> $DIR/slice-2.rs:18:6
+ |
+LL | &x[Foo..]; //~ ERROR cannot index into a value of type `Foo`
+ | ^^^^^^^^
+
+error[E0608]: cannot index into a value of type `Foo`
+ --> $DIR/slice-2.rs:19:6
+ |
+LL | &x[..Foo]; //~ ERROR cannot index into a value of type `Foo`
+ | ^^^^^^^^
+
+error[E0608]: cannot index into a value of type `Foo`
+ --> $DIR/slice-2.rs:20:6
+ |
+LL | &x[Foo..Foo]; //~ ERROR cannot index into a value of type `Foo`
+ | ^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0608`.
diff --git a/src/test/ui/slice-mut-2.nll.stderr b/src/test/ui/slice-mut-2.nll.stderr
new file mode 100644
index 0000000..98d9297
--- /dev/null
+++ b/src/test/ui/slice-mut-2.nll.stderr
@@ -0,0 +1,12 @@
+error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference
+ --> $DIR/slice-mut-2.rs:17:18
+ |
+LL | let x: &[isize] = &[1, 2, 3, 4, 5];
+ | ---------------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3, 4, 5]`
+...
+LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable
+ | ^ `x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/slice-mut-2.rs b/src/test/ui/slice-mut-2.rs
similarity index 100%
rename from src/test/compile-fail/slice-mut-2.rs
rename to src/test/ui/slice-mut-2.rs
diff --git a/src/test/ui/slice-mut-2.stderr b/src/test/ui/slice-mut-2.stderr
new file mode 100644
index 0000000..4483c6f
--- /dev/null
+++ b/src/test/ui/slice-mut-2.stderr
@@ -0,0 +1,9 @@
+error[E0596]: cannot borrow immutable borrowed content `*x` as mutable
+ --> $DIR/slice-mut-2.rs:17:18
+ |
+LL | let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/slice-mut.rs b/src/test/ui/slice-mut.rs
similarity index 100%
rename from src/test/compile-fail/slice-mut.rs
rename to src/test/ui/slice-mut.rs
diff --git a/src/test/ui/slice-mut.stderr b/src/test/ui/slice-mut.stderr
new file mode 100644
index 0000000..59b7095
--- /dev/null
+++ b/src/test/ui/slice-mut.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/slice-mut.rs:17:22
+ |
+LL | let y: &mut[_] = &x[2..4];
+ | ^^^^^^^^ types differ in mutability
+ |
+ = note: expected type `&mut [_]`
+ found type `&[isize]`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/slightly-nice-generic-literal-messages.rs b/src/test/ui/slightly-nice-generic-literal-messages.rs
similarity index 100%
rename from src/test/compile-fail/slightly-nice-generic-literal-messages.rs
rename to src/test/ui/slightly-nice-generic-literal-messages.rs
diff --git a/src/test/ui/slightly-nice-generic-literal-messages.stderr b/src/test/ui/slightly-nice-generic-literal-messages.stderr
new file mode 100644
index 0000000..463eb98
--- /dev/null
+++ b/src/test/ui/slightly-nice-generic-literal-messages.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/slightly-nice-generic-literal-messages.rs:17:9
+ |
+LL | 1 => {}
+ | ^ expected struct `Foo`, found integral variable
+ |
+ = note: expected type `Foo<{float}, _>`
+ found type `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
index c7dbc04..a05a391 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
@@ -31,6 +31,9 @@
error[E0507]: cannot move out of captured variable in an `FnMut` closure
--> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13
|
+LL | let mut f = move |g: Box<FnMut(isize)>, b: isize| {
+ | ----- captured outer variable
+...
LL | foo(f);
| ^ cannot move out of captured variable in an `FnMut` closure
diff --git a/src/test/compile-fail/specialization/README.md b/src/test/ui/specialization/README.md
similarity index 100%
rename from src/test/compile-fail/specialization/README.md
rename to src/test/ui/specialization/README.md
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-feature-gate-default.rs b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.rs
similarity index 100%
rename from src/test/compile-fail/specialization/defaultimpl/specialization-feature-gate-default.rs
rename to src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.rs
diff --git a/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr
new file mode 100644
index 0000000..d924669
--- /dev/null
+++ b/src/test/ui/specialization/defaultimpl/specialization-feature-gate-default.stderr
@@ -0,0 +1,13 @@
+error[E0658]: specialization is unstable (see issue #31844)
+ --> $DIR/specialization-feature-gate-default.rs:17:1
+ |
+LL | / default impl<T> Foo for T { //~ ERROR specialization is unstable
+LL | | fn foo(&self) {}
+LL | | }
+ | |_^
+ |
+ = help: add #![feature(specialization)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-no-default.rs b/src/test/ui/specialization/defaultimpl/specialization-no-default.rs
similarity index 100%
rename from src/test/compile-fail/specialization/defaultimpl/specialization-no-default.rs
rename to src/test/ui/specialization/defaultimpl/specialization-no-default.rs
diff --git a/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr
new file mode 100644
index 0000000..98f5e6d
--- /dev/null
+++ b/src/test/ui/specialization/defaultimpl/specialization-no-default.stderr
@@ -0,0 +1,70 @@
+error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:32:5
+ |
+LL | / impl<T> Foo for T {
+LL | | fn foo(&self) {}
+LL | | fn bar(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn foo(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo`
+ |
+ = note: to specialize, `foo` in the parent `impl` must be marked `default`
+
+error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:35:5
+ |
+LL | / impl<T> Foo for T {
+LL | | fn foo(&self) {}
+LL | | fn bar(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn bar(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar`
+ |
+ = note: to specialize, `bar` in the parent `impl` must be marked `default`
+
+error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:51:5
+ |
+LL | / impl<T> Bar for T {
+LL | | type T = u8;
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | type T = (); //~ ERROR E0520
+ | ^^^^^^^^^^^^ cannot specialize default item `T`
+ |
+ = note: to specialize, `T` in the parent `impl` must be marked `default`
+
+error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:71:5
+ |
+LL | / impl<T: Clone> Baz for T {
+LL | | fn baz(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn baz(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz`
+ |
+ = note: to specialize, `baz` in the parent `impl` must be marked `default`
+
+error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:92:5
+ |
+LL | / impl<T: Clone> Redundant for T {
+LL | | fn redundant(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn redundant(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant`
+ |
+ = note: to specialize, `redundant` in the parent `impl` must be marked `default`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0520`.
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs
similarity index 100%
rename from src/test/compile-fail/specialization/defaultimpl/specialization-trait-item-not-implemented.rs
rename to src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.rs
diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr
new file mode 100644
index 0000000..c3c2a98
--- /dev/null
+++ b/src/test/ui/specialization/defaultimpl/specialization-trait-item-not-implemented.stderr
@@ -0,0 +1,12 @@
+error[E0046]: not all trait items implemented, missing: `foo_two`
+ --> $DIR/specialization-trait-item-not-implemented.rs:28:1
+ |
+LL | fn foo_two(&self) -> &'static str;
+ | ---------------------------------- `foo_two` from trait
+...
+LL | impl Foo for MyStruct {}
+ | ^^^^^^^^^^^^^^^^^^^^^ missing `foo_two` in implementation
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0046`.
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-trait-not-implemented.rs b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs
similarity index 100%
rename from src/test/compile-fail/specialization/defaultimpl/specialization-trait-not-implemented.rs
rename to src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.rs
diff --git a/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr
new file mode 100644
index 0000000..bc597e9
--- /dev/null
+++ b/src/test/ui/specialization/defaultimpl/specialization-trait-not-implemented.stderr
@@ -0,0 +1,18 @@
+error[E0599]: no method named `foo_one` found for type `MyStruct` in the current scope
+ --> $DIR/specialization-trait-not-implemented.rs:32:29
+ |
+LL | struct MyStruct;
+ | ---------------- method `foo_one` not found for this
+...
+LL | println!("{}", MyStruct.foo_one());
+ | ^^^^^^^
+ |
+ = note: the method `foo_one` exists but the following trait bounds were not satisfied:
+ `MyStruct : Foo`
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `foo_one`, perhaps you need to implement it:
+ candidate #1: `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/specialization/defaultimpl/specialization-wfcheck.rs b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.rs
similarity index 100%
rename from src/test/compile-fail/specialization/defaultimpl/specialization-wfcheck.rs
rename to src/test/ui/specialization/defaultimpl/specialization-wfcheck.rs
diff --git a/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr
new file mode 100644
index 0000000..a623e97
--- /dev/null
+++ b/src/test/ui/specialization/defaultimpl/specialization-wfcheck.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the trait bound `U: std::cmp::Eq` is not satisfied
+ --> $DIR/specialization-wfcheck.rs:17:17
+ |
+LL | default impl<U> Foo<'static, U> for () {}
+ | ^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::cmp::Eq` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/specialization/defaultimpl/validation.rs b/src/test/ui/specialization/defaultimpl/validation.rs
similarity index 100%
rename from src/test/compile-fail/specialization/defaultimpl/validation.rs
rename to src/test/ui/specialization/defaultimpl/validation.rs
diff --git a/src/test/ui/specialization/defaultimpl/validation.stderr b/src/test/ui/specialization/defaultimpl/validation.stderr
new file mode 100644
index 0000000..54b92da
--- /dev/null
+++ b/src/test/ui/specialization/defaultimpl/validation.stderr
@@ -0,0 +1,34 @@
+error: inherent impls cannot be default
+ --> $DIR/validation.rs:17:1
+ |
+LL | default impl S {} //~ ERROR inherent impls cannot be default
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = note: only trait implementations may be annotated with default
+
+error[E0601]: `main` function not found in crate `validation`
+ |
+ = note: consider adding a `main` function to `$DIR/validation.rs`
+
+error: impls of auto traits cannot be default
+ --> $DIR/validation.rs:19:1
+ |
+LL | default unsafe impl Send for S {} //~ ERROR impls of auto traits cannot be default
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: impls of auto traits cannot be default
+ --> $DIR/validation.rs:20:1
+ |
+LL | default impl !Send for Z {} //~ ERROR impls of auto traits cannot be default
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`)
+ --> $DIR/validation.rs:23:1
+ |
+LL | default impl !Tr for S {} //~ ERROR negative impls are only allowed for auto traits
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0192, E0601.
+For more information about an error, try `rustc --explain E0192`.
diff --git a/src/test/compile-fail/specialization/issue-52050.rs b/src/test/ui/specialization/issue-52050.rs
similarity index 100%
rename from src/test/compile-fail/specialization/issue-52050.rs
rename to src/test/ui/specialization/issue-52050.rs
diff --git a/src/test/ui/specialization/issue-52050.stderr b/src/test/ui/specialization/issue-52050.stderr
new file mode 100644
index 0000000..eee571f
--- /dev/null
+++ b/src/test/ui/specialization/issue-52050.stderr
@@ -0,0 +1,18 @@
+error[E0119]: conflicting implementations of trait `IntoPyDictPointer` for type `()`:
+ --> $DIR/issue-52050.rs:38:1
+ |
+LL | / impl<I> IntoPyDictPointer for I
+LL | | where
+LL | | I: Iterator,
+LL | | {
+LL | | }
+ | |_- first implementation here
+LL |
+LL | impl IntoPyDictPointer for () //~ ERROR conflicting implementations
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()`
+ |
+ = note: upstream crates may add new impl of trait `std::iter::Iterator` for type `()` in future versions
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/specialization/specialization-default-projection.rs b/src/test/ui/specialization/specialization-default-projection.rs
similarity index 100%
rename from src/test/compile-fail/specialization/specialization-default-projection.rs
rename to src/test/ui/specialization/specialization-default-projection.rs
diff --git a/src/test/ui/specialization/specialization-default-projection.stderr b/src/test/ui/specialization/specialization-default-projection.stderr
new file mode 100644
index 0000000..38b5139
--- /dev/null
+++ b/src/test/ui/specialization/specialization-default-projection.stderr
@@ -0,0 +1,29 @@
+error[E0308]: mismatched types
+ --> $DIR/specialization-default-projection.rs:31:5
+ |
+LL | fn generic<T>() -> <T as Foo>::Assoc {
+ | ----------------- expected `<T as Foo>::Assoc` because of return type
+...
+LL | () //~ ERROR mismatched types
+ | ^^ expected associated type, found ()
+ |
+ = note: expected type `<T as Foo>::Assoc`
+ found type `()`
+
+error[E0308]: mismatched types
+ --> $DIR/specialization-default-projection.rs:38:5
+ |
+LL | fn monomorphic() -> () {
+ | -- expected `()` because of return type
+...
+LL | generic::<()>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^- help: try adding a semicolon: `;`
+ | |
+ | expected (), found associated type
+ |
+ = note: expected type `()`
+ found type `<() as Foo>::Assoc`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/specialization/specialization-default-types.rs b/src/test/ui/specialization/specialization-default-types.rs
similarity index 100%
rename from src/test/compile-fail/specialization/specialization-default-types.rs
rename to src/test/ui/specialization/specialization-default-types.rs
diff --git a/src/test/ui/specialization/specialization-default-types.stderr b/src/test/ui/specialization/specialization-default-types.stderr
new file mode 100644
index 0000000..a9abc1f
--- /dev/null
+++ b/src/test/ui/specialization/specialization-default-types.stderr
@@ -0,0 +1,25 @@
+error[E0308]: mismatched types
+ --> $DIR/specialization-default-types.rs:25:9
+ |
+LL | default fn generate(self) -> Self::Output {
+ | ------------ expected `<T as Example>::Output` because of return type
+LL | Box::new(self) //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^ expected associated type, found struct `std::boxed::Box`
+ |
+ = note: expected type `<T as Example>::Output`
+ found type `std::boxed::Box<T>`
+
+error[E0308]: mismatched types
+ --> $DIR/specialization-default-types.rs:35:5
+ |
+LL | fn trouble<T>(t: T) -> Box<T> {
+ | ------ expected `std::boxed::Box<T>` because of return type
+LL | Example::generate(t) //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ expected struct `std::boxed::Box`, found associated type
+ |
+ = note: expected type `std::boxed::Box<T>`
+ found type `<T as Example>::Output`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/specialization-feature-gate-default.rs b/src/test/ui/specialization/specialization-feature-gate-default.rs
similarity index 100%
rename from src/test/ui/specialization-feature-gate-default.rs
rename to src/test/ui/specialization/specialization-feature-gate-default.rs
diff --git a/src/test/ui/specialization-feature-gate-default.stderr b/src/test/ui/specialization/specialization-feature-gate-default.stderr
similarity index 100%
rename from src/test/ui/specialization-feature-gate-default.stderr
rename to src/test/ui/specialization/specialization-feature-gate-default.stderr
diff --git a/src/test/ui/specialization-feature-gate-overlap.rs b/src/test/ui/specialization/specialization-feature-gate-overlap.rs
similarity index 100%
rename from src/test/ui/specialization-feature-gate-overlap.rs
rename to src/test/ui/specialization/specialization-feature-gate-overlap.rs
diff --git a/src/test/ui/specialization-feature-gate-overlap.stderr b/src/test/ui/specialization/specialization-feature-gate-overlap.stderr
similarity index 100%
rename from src/test/ui/specialization-feature-gate-overlap.stderr
rename to src/test/ui/specialization/specialization-feature-gate-overlap.stderr
diff --git a/src/test/compile-fail/specialization/specialization-no-default.rs b/src/test/ui/specialization/specialization-no-default.rs
similarity index 100%
rename from src/test/compile-fail/specialization/specialization-no-default.rs
rename to src/test/ui/specialization/specialization-no-default.rs
diff --git a/src/test/ui/specialization/specialization-no-default.stderr b/src/test/ui/specialization/specialization-no-default.stderr
new file mode 100644
index 0000000..880c2e5
--- /dev/null
+++ b/src/test/ui/specialization/specialization-no-default.stderr
@@ -0,0 +1,70 @@
+error[E0520]: `foo` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:32:5
+ |
+LL | / impl<T> Foo for T {
+LL | | fn foo(&self) {}
+LL | | fn bar(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn foo(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^ cannot specialize default item `foo`
+ |
+ = note: to specialize, `foo` in the parent `impl` must be marked `default`
+
+error[E0520]: `bar` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:35:5
+ |
+LL | / impl<T> Foo for T {
+LL | | fn foo(&self) {}
+LL | | fn bar(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn bar(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^ cannot specialize default item `bar`
+ |
+ = note: to specialize, `bar` in the parent `impl` must be marked `default`
+
+error[E0520]: `T` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:51:5
+ |
+LL | / impl<T> Bar for T {
+LL | | type T = u8;
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | type T = (); //~ ERROR E0520
+ | ^^^^^^^^^^^^ cannot specialize default item `T`
+ |
+ = note: to specialize, `T` in the parent `impl` must be marked `default`
+
+error[E0520]: `baz` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:71:5
+ |
+LL | / impl<T: Clone> Baz for T {
+LL | | fn baz(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | fn baz(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^ cannot specialize default item `baz`
+ |
+ = note: to specialize, `baz` in the parent `impl` must be marked `default`
+
+error[E0520]: `redundant` specializes an item from a parent `impl`, but that item is not marked `default`
+ --> $DIR/specialization-no-default.rs:92:5
+ |
+LL | / impl<T: Clone> Redundant for T {
+LL | | fn redundant(&self) {}
+LL | | }
+ | |_- parent `impl` is here
+...
+LL | default fn redundant(&self) {} //~ ERROR E0520
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot specialize default item `redundant`
+ |
+ = note: to specialize, `redundant` in the parent `impl` must be marked `default`
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0520`.
diff --git a/src/test/compile-fail/specialization/specialization-overlap-negative.rs b/src/test/ui/specialization/specialization-overlap-negative.rs
similarity index 100%
rename from src/test/compile-fail/specialization/specialization-overlap-negative.rs
rename to src/test/ui/specialization/specialization-overlap-negative.rs
diff --git a/src/test/ui/specialization/specialization-overlap-negative.stderr b/src/test/ui/specialization/specialization-overlap-negative.stderr
new file mode 100644
index 0000000..2b85ba5
--- /dev/null
+++ b/src/test/ui/specialization/specialization-overlap-negative.stderr
@@ -0,0 +1,11 @@
+error[E0119]: conflicting implementations of trait `std::marker::Send` for type `TestType<_>`:
+ --> $DIR/specialization-overlap-negative.rs:19:1
+ |
+LL | unsafe impl<T: Clone> Send for TestType<T> {}
+ | ------------------------------------------ first implementation here
+LL | impl<T: MyTrait> !Send for TestType<T> {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `TestType<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/specialization/specialization-overlap.rs b/src/test/ui/specialization/specialization-overlap.rs
similarity index 100%
rename from src/test/compile-fail/specialization/specialization-overlap.rs
rename to src/test/ui/specialization/specialization-overlap.rs
diff --git a/src/test/ui/specialization/specialization-overlap.stderr b/src/test/ui/specialization/specialization-overlap.stderr
new file mode 100644
index 0000000..6830b7d
--- /dev/null
+++ b/src/test/ui/specialization/specialization-overlap.stderr
@@ -0,0 +1,35 @@
+error[E0119]: conflicting implementations of trait `Foo` for type `std::vec::Vec<_>`:
+ --> $DIR/specialization-overlap.rs:15:1
+ |
+LL | impl<T: Clone> Foo for T {}
+ | ------------------------ first implementation here
+LL | impl<T> Foo for Vec<T> {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `std::vec::Vec<_>`
+
+error[E0119]: conflicting implementations of trait `Bar` for type `(u8, u8)`:
+ --> $DIR/specialization-overlap.rs:19:1
+ |
+LL | impl<T> Bar for (T, u8) {}
+ | ----------------------- first implementation here
+LL | impl<T> Bar for (u8, T) {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `(u8, u8)`
+
+error[E0119]: conflicting implementations of trait `Baz<u8>` for type `u8`:
+ --> $DIR/specialization-overlap.rs:23:1
+ |
+LL | impl<T> Baz<T> for u8 {}
+ | --------------------- first implementation here
+LL | impl<T> Baz<u8> for T {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `u8`
+
+error[E0119]: conflicting implementations of trait `Qux`:
+ --> $DIR/specialization-overlap.rs:27:1
+ |
+LL | impl<T: Clone> Qux for T {}
+ | ------------------------ first implementation here
+LL | impl<T: Eq> Qux for T {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/specialization/specialization-polarity.rs b/src/test/ui/specialization/specialization-polarity.rs
similarity index 100%
rename from src/test/compile-fail/specialization/specialization-polarity.rs
rename to src/test/ui/specialization/specialization-polarity.rs
diff --git a/src/test/ui/specialization/specialization-polarity.stderr b/src/test/ui/specialization/specialization-polarity.stderr
new file mode 100644
index 0000000..a462730
--- /dev/null
+++ b/src/test/ui/specialization/specialization-polarity.stderr
@@ -0,0 +1,19 @@
+error[E0119]: conflicting implementations of trait `Foo` for type `u8`:
+ --> $DIR/specialization-polarity.rs:19:1
+ |
+LL | impl<T> Foo for T {}
+ | ----------------- first implementation here
+LL | impl !Foo for u8 {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^^ conflicting implementation for `u8`
+
+error[E0119]: conflicting implementations of trait `Bar` for type `u8`:
+ --> $DIR/specialization-polarity.rs:24:1
+ |
+LL | impl<T> !Bar for T {}
+ | ------------------ first implementation here
+LL | impl Bar for u8 {} //~ ERROR E0119
+ | ^^^^^^^^^^^^^^^ conflicting implementation for `u8`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/src/test/compile-fail/auxiliary/stability_attribute_issue.rs b/src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/stability_attribute_issue.rs
rename to src/test/ui/stability-attribute/auxiliary/stability_attribute_issue.rs
diff --git a/src/test/compile-fail/stability-attribute-issue-43027.rs b/src/test/ui/stability-attribute/stability-attribute-issue-43027.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-issue-43027.rs
rename to src/test/ui/stability-attribute/stability-attribute-issue-43027.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr
new file mode 100644
index 0000000..bdfdd9c
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-issue-43027.stderr
@@ -0,0 +1,8 @@
+error: This node does not have a stability attribute
+ --> $DIR/stability-attribute-issue-43027.rs:15:23
+ |
+LL | pub struct Reverse<T>(pub T); //~ ERROR This node does not have a stability attribute
+ | ^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/stability-attribute-issue.rs b/src/test/ui/stability-attribute/stability-attribute-issue.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-issue.rs
rename to src/test/ui/stability-attribute/stability-attribute-issue.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-issue.stderr b/src/test/ui/stability-attribute/stability-attribute-issue.stderr
new file mode 100644
index 0000000..15e9192
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-issue.stderr
@@ -0,0 +1,19 @@
+error[E0658]: use of unstable library feature 'unstable_test_feature' (see issue #1)
+ --> $DIR/stability-attribute-issue.rs:20:5
+ |
+LL | unstable();
+ | ^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error[E0658]: use of unstable library feature 'unstable_test_feature': message (see issue #2)
+ --> $DIR/stability-attribute-issue.rs:22:5
+ |
+LL | unstable_msg();
+ | ^^^^^^^^^^^^
+ |
+ = help: add #![feature(unstable_test_feature)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/stability-attribute-non-staged-force-unstable.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-non-staged-force-unstable.rs
rename to src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr
new file mode 100644
index 0000000..479f2ff
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-non-staged-force-unstable.stderr
@@ -0,0 +1,20 @@
+error: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged-force-unstable.rs:13:1
+ |
+LL | #[unstable] //~ ERROR: stability attributes may not be used
+ | ^^^^^^^^^^^
+
+error: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged-force-unstable.rs:14:1
+ |
+LL | #[stable] //~ ERROR: stability attributes may not be used
+ | ^^^^^^^^^
+
+error: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged-force-unstable.rs:15:1
+ |
+LL | #[rustc_deprecated] //~ ERROR: stability attributes may not be used
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/stability-attribute-non-staged.rs b/src/test/ui/stability-attribute/stability-attribute-non-staged.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-non-staged.rs
rename to src/test/ui/stability-attribute/stability-attribute-non-staged.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr
new file mode 100644
index 0000000..f2a9879
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-non-staged.stderr
@@ -0,0 +1,20 @@
+error: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged.rs:11:1
+ |
+LL | #[unstable] //~ ERROR: stability attributes may not be used
+ | ^^^^^^^^^^^
+
+error: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged.rs:12:1
+ |
+LL | #[stable] //~ ERROR: stability attributes may not be used
+ | ^^^^^^^^^
+
+error: stability attributes may not be used outside of the standard library
+ --> $DIR/stability-attribute-non-staged.rs:13:1
+ |
+LL | #[rustc_deprecated] //~ ERROR: stability attributes may not be used
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/stability-attribute-sanity-2.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-2.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-sanity-2.rs
rename to src/test/ui/stability-attribute/stability-attribute-sanity-2.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr
new file mode 100644
index 0000000..a9d70e2
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-2.stderr
@@ -0,0 +1,22 @@
+error[E0538]: multiple 'feature' items
+ --> $DIR/stability-attribute-sanity-2.rs:17:25
+ |
+LL | #[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items
+ | ^^^^^^^^^^^^^
+
+error[E0541]: unknown meta item 'sinse'
+ --> $DIR/stability-attribute-sanity-2.rs:20:25
+ |
+LL | #[stable(feature = "a", sinse = "1.0.0")] //~ ERROR unknown meta item 'sinse'
+ | ^^^^^^^^^^^^^^^ expected one of `since`, `note`
+
+error[E0545]: incorrect 'issue'
+ --> $DIR/stability-attribute-sanity-2.rs:23:1
+ |
+LL | #[unstable(feature = "a", issue = "no")] //~ ERROR incorrect 'issue'
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0538, E0541, E0545.
+For more information about an error, try `rustc --explain E0538`.
diff --git a/src/test/compile-fail/stability-attribute-sanity-3.rs b/src/test/ui/stability-attribute/stability-attribute-sanity-3.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-sanity-3.rs
rename to src/test/ui/stability-attribute/stability-attribute-sanity-3.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr
new file mode 100644
index 0000000..b5b5847
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity-3.stderr
@@ -0,0 +1,10 @@
+error: This node does not have a stability attribute
+ --> $DIR/stability-attribute-sanity-3.rs:18:1
+ |
+LL | / macro_rules! mac { //~ ERROR This node does not have a stability attribute
+LL | | () => ()
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/stability-attribute-sanity.rs b/src/test/ui/stability-attribute/stability-attribute-sanity.rs
similarity index 100%
rename from src/test/compile-fail/stability-attribute-sanity.rs
rename to src/test/ui/stability-attribute/stability-attribute-sanity.rs
diff --git a/src/test/ui/stability-attribute/stability-attribute-sanity.stderr b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
new file mode 100644
index 0000000..f9d301f
--- /dev/null
+++ b/src/test/ui/stability-attribute/stability-attribute-sanity.stderr
@@ -0,0 +1,142 @@
+error[E0541]: unknown meta item 'reason'
+ --> $DIR/stability-attribute-sanity.rs:18:42
+ |
+LL | #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541]
+ | ^^^^^^ expected one of `since`, `note`
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:21:29
+ |
+LL | #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539]
+ | ^^^^^
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:24:14
+ |
+LL | #[stable(feature, since = "a")] //~ ERROR incorrect meta item [E0539]
+ | ^^^^^^^
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:27:29
+ |
+LL | #[stable(feature = "a", since(b))] //~ ERROR incorrect meta item [E0539]
+ | ^^^^^^^^
+
+error[E0539]: incorrect meta item
+ --> $DIR/stability-attribute-sanity.rs:30:14
+ |
+LL | #[stable(feature(b), since = "a")] //~ ERROR incorrect meta item [E0539]
+ | ^^^^^^^^^^
+
+error[E0548]: incorrect stability attribute type
+ --> $DIR/stability-attribute-sanity.rs:35:5
+ |
+LL | #[unstable] //~ ERROR incorrect stability attribute type [E0548]
+ | ^^^^^^^^^^^
+
+error[E0548]: incorrect stability attribute type
+ --> $DIR/stability-attribute-sanity.rs:38:5
+ |
+LL | #[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548]
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0548]: incorrect stability attribute type
+ --> $DIR/stability-attribute-sanity.rs:41:5
+ |
+LL | #[stable] //~ ERROR incorrect stability attribute type [E0548]
+ | ^^^^^^^^^
+
+error[E0548]: incorrect stability attribute type
+ --> $DIR/stability-attribute-sanity.rs:44:5
+ |
+LL | #[stable = "a"] //~ ERROR incorrect stability attribute type [E0548]
+ | ^^^^^^^^^^^^^^^
+
+error[E0548]: incorrect stability attribute type
+ --> $DIR/stability-attribute-sanity.rs:48:5
+ |
+LL | #[rustc_deprecated] //~ ERROR incorrect stability attribute type [E0548]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0548]: incorrect stability attribute type
+ --> $DIR/stability-attribute-sanity.rs:52:5
+ |
+LL | #[rustc_deprecated = "a"] //~ ERROR incorrect stability attribute type [E0548]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0546]: missing 'feature'
+ --> $DIR/stability-attribute-sanity.rs:57:5
+ |
+LL | #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0547]: missing 'issue'
+ --> $DIR/stability-attribute-sanity.rs:60:5
+ |
+LL | #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0546]: missing 'feature'
+ --> $DIR/stability-attribute-sanity.rs:63:5
+ |
+LL | #[stable(since = "a")] //~ ERROR missing 'feature' [E0546]
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+ --> $DIR/stability-attribute-sanity.rs:68:5
+ |
+LL | #[stable(feature = "a")] //~ ERROR missing 'since' [E0542]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0542]: missing 'since'
+ --> $DIR/stability-attribute-sanity.rs:72:5
+ |
+LL | #[rustc_deprecated(reason = "a")] //~ ERROR missing 'since' [E0542]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:77:1
+ |
+LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:81:1
+ |
+LL | #[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0544]: multiple stability levels
+ --> $DIR/stability-attribute-sanity.rs:85:1
+ |
+LL | #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0540]: multiple rustc_deprecated attributes
+ --> $DIR/stability-attribute-sanity.rs:93:1
+ |
+LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0553]: multiple rustc_const_unstable attributes
+ --> $DIR/stability-attribute-sanity.rs:93:1
+ |
+LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: Invalid stability or deprecation version found
+ --> $DIR/stability-attribute-sanity.rs:93:1
+ |
+LL | pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0549]: rustc_deprecated attribute must be paired with either stable or unstable attribute
+ --> $DIR/stability-attribute-sanity.rs:98:1
+ |
+LL | fn deprecated_without_unstable_or_stable() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 23 previous errors
+
+Some errors occurred: E0539, E0540, E0541, E0542, E0544, E0546, E0547, E0548, E0549...
+For more information about an error, try `rustc --explain E0539`.
diff --git a/src/test/compile-fail/stable-features.rs b/src/test/ui/stable-features.rs
similarity index 100%
rename from src/test/compile-fail/stable-features.rs
rename to src/test/ui/stable-features.rs
diff --git a/src/test/ui/stable-features.stderr b/src/test/ui/stable-features.stderr
new file mode 100644
index 0000000..53d642c
--- /dev/null
+++ b/src/test/ui/stable-features.stderr
@@ -0,0 +1,20 @@
+error: the feature `test_accepted_feature` has been stable since 1.0.0 and no longer requires an attribute to enable
+ --> $DIR/stable-features.rs:16:12
+ |
+LL | #![feature(test_accepted_feature)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/stable-features.rs:14:9
+ |
+LL | #![deny(stable_features)]
+ | ^^^^^^^^^^^^^^^
+
+error: the feature `rust1` has been stable since 1.0.0 and no longer requires an attribute to enable
+ --> $DIR/stable-features.rs:19:12
+ |
+LL | #![feature(rust1)]
+ | ^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/static-priv-by-default.rs b/src/test/ui/static/auxiliary/static-priv-by-default.rs
similarity index 100%
rename from src/test/compile-fail/static-priv-by-default.rs
rename to src/test/ui/static/auxiliary/static-priv-by-default.rs
diff --git a/src/test/compile-fail/auxiliary/static_priv_by_default.rs b/src/test/ui/static/auxiliary/static_priv_by_default.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/static_priv_by_default.rs
rename to src/test/ui/static/auxiliary/static_priv_by_default.rs
diff --git a/src/test/compile-fail/static-closures.rs b/src/test/ui/static/static-closures.rs
similarity index 100%
rename from src/test/compile-fail/static-closures.rs
rename to src/test/ui/static/static-closures.rs
diff --git a/src/test/ui/static/static-closures.stderr b/src/test/ui/static/static-closures.stderr
new file mode 100644
index 0000000..761d837
--- /dev/null
+++ b/src/test/ui/static/static-closures.stderr
@@ -0,0 +1,9 @@
+error[E0697]: closures cannot be static
+ --> $DIR/static-closures.rs:12:5
+ |
+LL | static || {};
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0697`.
diff --git a/src/test/compile-fail/static-drop-scope.rs b/src/test/ui/static/static-drop-scope.rs
similarity index 100%
rename from src/test/compile-fail/static-drop-scope.rs
rename to src/test/ui/static/static-drop-scope.rs
diff --git a/src/test/ui/static/static-drop-scope.stderr b/src/test/ui/static/static-drop-scope.stderr
new file mode 100644
index 0000000..ce15823
--- /dev/null
+++ b/src/test/ui/static/static-drop-scope.stderr
@@ -0,0 +1,60 @@
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/static-drop-scope.rs:19:60
+ |
+LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
+ | ^^^^^^^^ statics cannot evaluate destructors
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-drop-scope.rs:19:60
+ |
+LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
+ | ^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/static-drop-scope.rs:23:59
+ |
+LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
+ | ^^^^^^^^ constants cannot evaluate destructors
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-drop-scope.rs:23:59
+ |
+LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
+ | ^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/static-drop-scope.rs:27:28
+ |
+LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1;
+ | ^^^^^^^^^^^^^ statics cannot evaluate destructors
+
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/static-drop-scope.rs:30:27
+ |
+LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1;
+ | ^^^^^^^^^^^^^ constants cannot evaluate destructors
+
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/static-drop-scope.rs:33:24
+ |
+LL | const fn const_drop<T>(_: T) {}
+ | ^ constant functions cannot evaluate destructors
+
+error[E0493]: destructors cannot be evaluated at compile-time
+ --> $DIR/static-drop-scope.rs:37:5
+ |
+LL | (x, ()).1
+ | ^^^^^^^ constant functions cannot evaluate destructors
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0493, E0597.
+For more information about an error, try `rustc --explain E0493`.
diff --git a/src/test/compile-fail/static-items-cant-move.rs b/src/test/ui/static/static-items-cant-move.rs
similarity index 100%
rename from src/test/compile-fail/static-items-cant-move.rs
rename to src/test/ui/static/static-items-cant-move.rs
diff --git a/src/test/ui/static/static-items-cant-move.stderr b/src/test/ui/static/static-items-cant-move.stderr
new file mode 100644
index 0000000..254710b
--- /dev/null
+++ b/src/test/ui/static/static-items-cant-move.stderr
@@ -0,0 +1,9 @@
+error[E0507]: cannot move out of static item
+ --> $DIR/static-items-cant-move.rs:28:10
+ |
+LL | test(BAR); //~ ERROR cannot move out of static item
+ | ^^^ cannot move out of static item
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/static/static-lifetime-bound.nll.stderr b/src/test/ui/static/static-lifetime-bound.nll.stderr
new file mode 100644
index 0000000..ad4d043
--- /dev/null
+++ b/src/test/ui/static/static-lifetime-bound.nll.stderr
@@ -0,0 +1,21 @@
+warning: unnecessary lifetime parameter `'a`
+ --> $DIR/static-lifetime-bound.rs:11:6
+ |
+LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a`
+ | ^^^^^^^^^^^
+ |
+ = help: you can use the `'static` lifetime directly, in place of `'a`
+
+error[E0597]: `x` does not live long enough
+ --> $DIR/static-lifetime-bound.rs:15:7
+ |
+LL | f(&x); //~ERROR does not live long enough
+ | ^^ borrowed value does not live long enough
+LL | }
+ | - `x` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/static-lifetime-bound.rs b/src/test/ui/static/static-lifetime-bound.rs
similarity index 100%
rename from src/test/compile-fail/static-lifetime-bound.rs
rename to src/test/ui/static/static-lifetime-bound.rs
diff --git a/src/test/ui/static/static-lifetime-bound.stderr b/src/test/ui/static/static-lifetime-bound.stderr
new file mode 100644
index 0000000..0ee2b66
--- /dev/null
+++ b/src/test/ui/static/static-lifetime-bound.stderr
@@ -0,0 +1,21 @@
+warning: unnecessary lifetime parameter `'a`
+ --> $DIR/static-lifetime-bound.rs:11:6
+ |
+LL | fn f<'a: 'static>(_: &'a i32) {} //~WARN unnecessary lifetime parameter `'a`
+ | ^^^^^^^^^^^
+ |
+ = help: you can use the `'static` lifetime directly, in place of `'a`
+
+error[E0597]: `x` does not live long enough
+ --> $DIR/static-lifetime-bound.rs:15:8
+ |
+LL | f(&x); //~ERROR does not live long enough
+ | ^ borrowed value does not live long enough
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/static-lifetime.rs b/src/test/ui/static/static-lifetime.rs
similarity index 100%
rename from src/test/ui/static-lifetime.rs
rename to src/test/ui/static/static-lifetime.rs
diff --git a/src/test/ui/static-lifetime.stderr b/src/test/ui/static/static-lifetime.stderr
similarity index 100%
rename from src/test/ui/static-lifetime.stderr
rename to src/test/ui/static/static-lifetime.stderr
diff --git a/src/test/compile-fail/static-method-privacy.rs b/src/test/ui/static/static-method-privacy.rs
similarity index 100%
rename from src/test/compile-fail/static-method-privacy.rs
rename to src/test/ui/static/static-method-privacy.rs
diff --git a/src/test/ui/static/static-method-privacy.stderr b/src/test/ui/static/static-method-privacy.stderr
new file mode 100644
index 0000000..783b72c
--- /dev/null
+++ b/src/test/ui/static/static-method-privacy.stderr
@@ -0,0 +1,9 @@
+error[E0624]: method `new` is private
+ --> $DIR/static-method-privacy.rs:19:13
+ |
+LL | let _ = a::S::new(); //~ ERROR method `new` is private
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/static-mut-bad-types.rs b/src/test/ui/static/static-mut-bad-types.rs
similarity index 100%
rename from src/test/compile-fail/static-mut-bad-types.rs
rename to src/test/ui/static/static-mut-bad-types.rs
diff --git a/src/test/ui/static/static-mut-bad-types.stderr b/src/test/ui/static/static-mut-bad-types.stderr
new file mode 100644
index 0000000..f8bee22
--- /dev/null
+++ b/src/test/ui/static/static-mut-bad-types.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/static-mut-bad-types.rs:15:13
+ |
+LL | a = true; //~ ERROR: mismatched types
+ | ^^^^ expected isize, found bool
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/static-mut-foreign-requires-unsafe.rs b/src/test/ui/static/static-mut-foreign-requires-unsafe.rs
similarity index 100%
rename from src/test/compile-fail/static-mut-foreign-requires-unsafe.rs
rename to src/test/ui/static/static-mut-foreign-requires-unsafe.rs
diff --git a/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr
new file mode 100644
index 0000000..01cbe78
--- /dev/null
+++ b/src/test/ui/static/static-mut-foreign-requires-unsafe.stderr
@@ -0,0 +1,27 @@
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/static-mut-foreign-requires-unsafe.rs:16:5
+ |
+LL | a += 3; //~ ERROR: requires unsafe
+ | ^^^^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/static-mut-foreign-requires-unsafe.rs:17:5
+ |
+LL | a = 4; //~ ERROR: requires unsafe
+ | ^^^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/static-mut-foreign-requires-unsafe.rs:18:14
+ |
+LL | let _b = a; //~ ERROR: requires unsafe
+ | ^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/static-mut-not-constant.rs b/src/test/ui/static/static-mut-not-constant.rs
similarity index 100%
rename from src/test/compile-fail/static-mut-not-constant.rs
rename to src/test/ui/static/static-mut-not-constant.rs
diff --git a/src/test/ui/static/static-mut-not-constant.stderr b/src/test/ui/static/static-mut-not-constant.stderr
new file mode 100644
index 0000000..ad44121
--- /dev/null
+++ b/src/test/ui/static/static-mut-not-constant.stderr
@@ -0,0 +1,9 @@
+error[E0010]: allocations are not allowed in statics
+ --> $DIR/static-mut-not-constant.rs:13:28
+ |
+LL | static mut a: Box<isize> = box 3;
+ | ^^^^^ allocation not allowed in statics
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0010`.
diff --git a/src/test/compile-fail/static-mut-not-pat.rs b/src/test/ui/static/static-mut-not-pat.rs
similarity index 100%
rename from src/test/compile-fail/static-mut-not-pat.rs
rename to src/test/ui/static/static-mut-not-pat.rs
diff --git a/src/test/ui/static/static-mut-not-pat.stderr b/src/test/ui/static/static-mut-not-pat.stderr
new file mode 100644
index 0000000..123cf7b
--- /dev/null
+++ b/src/test/ui/static/static-mut-not-pat.stderr
@@ -0,0 +1,21 @@
+error[E0530]: match bindings cannot shadow statics
+ --> $DIR/static-mut-not-pat.rs:23:9
+ |
+LL | static mut a: isize = 3;
+ | ------------------------ a static `a` is defined here
+...
+LL | a => {} //~ ERROR match bindings cannot shadow statics
+ | ^ cannot be named the same as a static
+
+error[E0530]: match bindings cannot shadow statics
+ --> $DIR/static-mut-not-pat.rs:46:9
+ |
+LL | static mut STATIC_MUT_FOO: Foo = Foo { bar: Some(Direction::West), baz: NEW_FALSE };
+ | ------------------------------------------------------------------------------------ a static `STATIC_MUT_FOO` is defined here
+...
+LL | STATIC_MUT_FOO => (),
+ | ^^^^^^^^^^^^^^ cannot be named the same as a static
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0530`.
diff --git a/src/test/compile-fail/static-mut-requires-unsafe.rs b/src/test/ui/static/static-mut-requires-unsafe.rs
similarity index 100%
rename from src/test/compile-fail/static-mut-requires-unsafe.rs
rename to src/test/ui/static/static-mut-requires-unsafe.rs
diff --git a/src/test/ui/static/static-mut-requires-unsafe.stderr b/src/test/ui/static/static-mut-requires-unsafe.stderr
new file mode 100644
index 0000000..310da8f
--- /dev/null
+++ b/src/test/ui/static/static-mut-requires-unsafe.stderr
@@ -0,0 +1,27 @@
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/static-mut-requires-unsafe.rs:14:5
+ |
+LL | a += 3; //~ ERROR: requires unsafe
+ | ^^^^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/static-mut-requires-unsafe.rs:15:5
+ |
+LL | a = 4; //~ ERROR: requires unsafe
+ | ^^^^^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+ --> $DIR/static-mut-requires-unsafe.rs:16:14
+ |
+LL | let _b = a; //~ ERROR: requires unsafe
+ | ^ use of mutable static
+ |
+ = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/static-priv-by-default2.rs b/src/test/ui/static/static-priv-by-default2.rs
similarity index 100%
rename from src/test/compile-fail/static-priv-by-default2.rs
rename to src/test/ui/static/static-priv-by-default2.rs
diff --git a/src/test/ui/static/static-priv-by-default2.stderr b/src/test/ui/static/static-priv-by-default2.stderr
new file mode 100644
index 0000000..0f749b0
--- /dev/null
+++ b/src/test/ui/static/static-priv-by-default2.stderr
@@ -0,0 +1,15 @@
+error[E0603]: static `private` is private
+ --> $DIR/static-priv-by-default2.rs:25:9
+ |
+LL | use child::childs_child::private;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: static `private` is private
+ --> $DIR/static-priv-by-default2.rs:33:9
+ |
+LL | use static_priv_by_default::private;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/static-reference-to-fn-1.rs b/src/test/ui/static/static-reference-to-fn-1.rs
similarity index 100%
rename from src/test/compile-fail/static-reference-to-fn-1.rs
rename to src/test/ui/static/static-reference-to-fn-1.rs
diff --git a/src/test/ui/static/static-reference-to-fn-1.stderr b/src/test/ui/static/static-reference-to-fn-1.stderr
new file mode 100644
index 0000000..609319f
--- /dev/null
+++ b/src/test/ui/static/static-reference-to-fn-1.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/static-reference-to-fn-1.rs:27:15
+ |
+LL | func: &foo, //~ ERROR mismatched types
+ | ^^^^ expected fn pointer, found fn item
+ |
+ = note: expected type `&fn() -> std::option::Option<isize>`
+ found type `&fn() -> std::option::Option<isize> {foo}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/static/static-reference-to-fn-2.nll.stderr b/src/test/ui/static/static-reference-to-fn-2.nll.stderr
new file mode 100644
index 0000000..9ef9418
--- /dev/null
+++ b/src/test/ui/static/static-reference-to-fn-2.nll.stderr
@@ -0,0 +1,68 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:28:22
+ |
+LL | self_.statefn = &id(state2 as StateMachineFunc);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 27:1...
+ --> $DIR/static-reference-to-fn-2.rs:27:1
+ |
+LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
+LL | | self_.statefn = &id(state2 as StateMachineFunc);
+LL | | //~^ ERROR borrowed value does not live long enough
+LL | | return Some("state1");
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:34:22
+ |
+LL | self_.statefn = &id(state3 as StateMachineFunc);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 33:1...
+ --> $DIR/static-reference-to-fn-2.rs:33:1
+ |
+LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+LL | | self_.statefn = &id(state3 as StateMachineFunc);
+LL | | //~^ ERROR borrowed value does not live long enough
+LL | | return Some("state2");
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:40:22
+ |
+LL | self_.statefn = &id(finished as StateMachineFunc);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 39:1...
+ --> $DIR/static-reference-to-fn-2.rs:39:1
+ |
+LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+LL | | self_.statefn = &id(finished as StateMachineFunc);
+LL | | //~^ ERROR borrowed value does not live long enough
+LL | | return Some("state3");
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:51:19
+ |
+LL | statefn: &id(state1 as StateMachineFunc)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/static-reference-to-fn-2.rs b/src/test/ui/static/static-reference-to-fn-2.rs
similarity index 100%
rename from src/test/compile-fail/static-reference-to-fn-2.rs
rename to src/test/ui/static/static-reference-to-fn-2.rs
diff --git a/src/test/ui/static/static-reference-to-fn-2.stderr b/src/test/ui/static/static-reference-to-fn-2.stderr
new file mode 100644
index 0000000..a01ab4c
--- /dev/null
+++ b/src/test/ui/static/static-reference-to-fn-2.stderr
@@ -0,0 +1,71 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:28:22
+ |
+LL | self_.statefn = &id(state2 as StateMachineFunc);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 27:1...
+ --> $DIR/static-reference-to-fn-2.rs:27:1
+ |
+LL | / fn state1(self_: &mut StateMachineIter) -> Option<&'static str> {
+LL | | self_.statefn = &id(state2 as StateMachineFunc);
+LL | | //~^ ERROR borrowed value does not live long enough
+LL | | return Some("state1");
+LL | | }
+ | |_^
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:34:22
+ |
+LL | self_.statefn = &id(state3 as StateMachineFunc);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 33:1...
+ --> $DIR/static-reference-to-fn-2.rs:33:1
+ |
+LL | / fn state2(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+LL | | self_.statefn = &id(state3 as StateMachineFunc);
+LL | | //~^ ERROR borrowed value does not live long enough
+LL | | return Some("state2");
+LL | | }
+ | |_^
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:40:22
+ |
+LL | self_.statefn = &id(finished as StateMachineFunc);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- temporary value only lives until here
+ | |
+ | temporary value does not live long enough
+ |
+note: borrowed value must be valid for the anonymous lifetime #2 defined on the function body at 39:1...
+ --> $DIR/static-reference-to-fn-2.rs:39:1
+ |
+LL | / fn state3(self_: &mut StateMachineIter) -> Option<(&'static str)> {
+LL | | self_.statefn = &id(finished as StateMachineFunc);
+LL | | //~^ ERROR borrowed value does not live long enough
+LL | | return Some("state3");
+LL | | }
+ | |_^
+ = note: consider using a `let` binding to increase its lifetime
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-reference-to-fn-2.rs:51:19
+ |
+LL | statefn: &id(state1 as StateMachineFunc)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough
+...
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/ui/static/static-region-bound.rs
similarity index 100%
rename from src/test/compile-fail/static-region-bound.rs
rename to src/test/ui/static/static-region-bound.rs
diff --git a/src/test/ui/static/static-region-bound.stderr b/src/test/ui/static/static-region-bound.stderr
new file mode 100644
index 0000000..ee3398b
--- /dev/null
+++ b/src/test/ui/static/static-region-bound.stderr
@@ -0,0 +1,14 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/static-region-bound.rs:20:14
+ |
+LL | let x = &id(3); //~ ERROR borrowed value does not live long enough
+ | ^^^^^ temporary value does not live long enough
+LL | f(x);
+LL | }
+ | - temporary value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/static-vec-repeat-not-constant.rs b/src/test/ui/static/static-vec-repeat-not-constant.rs
similarity index 100%
rename from src/test/compile-fail/static-vec-repeat-not-constant.rs
rename to src/test/ui/static/static-vec-repeat-not-constant.rs
diff --git a/src/test/ui/static/static-vec-repeat-not-constant.stderr b/src/test/ui/static/static-vec-repeat-not-constant.stderr
new file mode 100644
index 0000000..27d1b41
--- /dev/null
+++ b/src/test/ui/static/static-vec-repeat-not-constant.stderr
@@ -0,0 +1,9 @@
+error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
+ --> $DIR/static-vec-repeat-not-constant.rs:13:25
+ |
+LL | static a: [isize; 2] = [foo(); 2];
+ | ^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0015`.
diff --git a/src/test/compile-fail/staticness-mismatch.rs b/src/test/ui/staticness-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/staticness-mismatch.rs
rename to src/test/ui/staticness-mismatch.rs
diff --git a/src/test/ui/staticness-mismatch.stderr b/src/test/ui/staticness-mismatch.stderr
new file mode 100644
index 0000000..31c06ae
--- /dev/null
+++ b/src/test/ui/staticness-mismatch.stderr
@@ -0,0 +1,12 @@
+error[E0185]: method `bar` has a `&self` declaration in the impl, but not in the trait
+ --> $DIR/staticness-mismatch.rs:17:5
+ |
+LL | fn bar();
+ | --------- trait method declared without `&self`
+...
+LL | fn bar(&self) {}
+ | ^^^^^^^^^^^^^ `&self` used in impl
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0185`.
diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr
new file mode 100644
index 0000000..e6b612f
--- /dev/null
+++ b/src/test/ui/std-uncopyable-atomics.nll.stderr
@@ -0,0 +1,39 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:19:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `&x`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:21:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `&x`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:23:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `&x`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:25:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `&x`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/std-uncopyable-atomics.rs b/src/test/ui/std-uncopyable-atomics.rs
similarity index 100%
rename from src/test/compile-fail/std-uncopyable-atomics.rs
rename to src/test/ui/std-uncopyable-atomics.rs
diff --git a/src/test/ui/std-uncopyable-atomics.stderr b/src/test/ui/std-uncopyable-atomics.stderr
new file mode 100644
index 0000000..4452bfa
--- /dev/null
+++ b/src/test/ui/std-uncopyable-atomics.stderr
@@ -0,0 +1,39 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:19:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider using a reference instead: `&*&x`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:21:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider using a reference instead: `&*&x`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:23:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider using a reference instead: `&*&x`
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/std-uncopyable-atomics.rs:25:13
+ |
+LL | let x = *&x; //~ ERROR: cannot move out of borrowed content
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider using a reference instead: `&*&x`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/stmt_expr_attrs_no_feature.rs b/src/test/ui/stmt_expr_attrs_no_feature.rs
similarity index 100%
rename from src/test/compile-fail/stmt_expr_attrs_no_feature.rs
rename to src/test/ui/stmt_expr_attrs_no_feature.rs
diff --git a/src/test/ui/stmt_expr_attrs_no_feature.stderr b/src/test/ui/stmt_expr_attrs_no_feature.stderr
new file mode 100644
index 0000000..dc114ce
--- /dev/null
+++ b/src/test/ui/stmt_expr_attrs_no_feature.stderr
@@ -0,0 +1,75 @@
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:23:5
+ |
+LL | #[attr] //~ ERROR attributes on expressions are experimental
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:104:18
+ |
+LL | fn y(a: [u8; #[attr] 5]); //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:111:19
+ |
+LL | const Y: u8 = #[attr] 5; //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:117:19
+ |
+LL | const Y: [u8; #[attr] 5]; //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:123:18
+ |
+LL | field2: [u8; #[attr] 5] //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:128:10
+ |
+LL | [u8; #[attr] 5] //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:134:14
+ |
+LL | [u8; #[attr] 5] //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:139:22
+ |
+LL | field2: [u8; #[attr] 5] //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error[E0658]: attributes on expressions are experimental. (see issue #15701)
+ --> $DIR/stmt_expr_attrs_no_feature.rs:147:14
+ |
+LL | 6 => #[attr] (), //~ ERROR 15701
+ | ^^^^^^^
+ |
+ = help: add #![feature(stmt_expr_attributes)] to the crate attributes to enable
+
+error: aborting due to 9 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/str-array-assignment.stderr b/src/test/ui/str-array-assignment.stderr
deleted file mode 100644
index 7a774ca..0000000
--- a/src/test/ui/str-array-assignment.stderr
+++ /dev/null
@@ -1,49 +0,0 @@
-error[E0308]: if and else have incompatible types
- --> $DIR/str-array-assignment.rs:13:11
- |
-LL | let t = if true { s[..2] } else { s };
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str
- |
- = note: expected type `str`
- found type `&str`
-
-error[E0308]: mismatched types
- --> $DIR/str-array-assignment.rs:15:27
- |
-LL | let u: &str = if true { s[..2] } else { s };
- | ^^^^^^
- | |
- | expected &str, found str
- | help: consider borrowing here: `&s[..2]`
- |
- = note: expected type `&str`
- found type `str`
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/str-array-assignment.rs:17:7
- |
-LL | let v = s[..2];
- | ^ ------ help: consider borrowing here: `&s[..2]`
- | |
- | doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: all local variables must have a statically known size
-
-error[E0308]: mismatched types
- --> $DIR/str-array-assignment.rs:19:17
- |
-LL | let w: &str = s[..2];
- | ^^^^^^
- | |
- | expected &str, found str
- | help: consider borrowing here: `&s[..2]`
- |
- = note: expected type `&str`
- found type `str`
-
-error: aborting due to 4 previous errors
-
-Some errors occurred: E0277, E0308.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/str-array-assignment.rs b/src/test/ui/str/str-array-assignment.rs
similarity index 100%
rename from src/test/ui/str-array-assignment.rs
rename to src/test/ui/str/str-array-assignment.rs
diff --git a/src/test/ui/str/str-array-assignment.stderr b/src/test/ui/str/str-array-assignment.stderr
new file mode 100644
index 0000000..57eff3f
--- /dev/null
+++ b/src/test/ui/str/str-array-assignment.stderr
@@ -0,0 +1,50 @@
+error[E0308]: if and else have incompatible types
+ --> $DIR/str-array-assignment.rs:13:11
+ |
+LL | let t = if true { s[..2] } else { s };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected str, found &str
+ |
+ = note: expected type `str`
+ found type `&str`
+
+error[E0308]: mismatched types
+ --> $DIR/str-array-assignment.rs:15:27
+ |
+LL | let u: &str = if true { s[..2] } else { s };
+ | ^^^^^^
+ | |
+ | expected &str, found str
+ | help: consider borrowing here: `&s[..2]`
+ |
+ = note: expected type `&str`
+ found type `str`
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/str-array-assignment.rs:17:7
+ |
+LL | let v = s[..2];
+ | ^ ------ help: consider borrowing here: `&s[..2]`
+ | |
+ | doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0308]: mismatched types
+ --> $DIR/str-array-assignment.rs:19:17
+ |
+LL | let w: &str = s[..2];
+ | ^^^^^^
+ | |
+ | expected &str, found str
+ | help: consider borrowing here: `&s[..2]`
+ |
+ = note: expected type `&str`
+ found type `str`
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/str-as-char.fixed b/src/test/ui/str/str-as-char.fixed
similarity index 100%
rename from src/test/ui/str-as-char.fixed
rename to src/test/ui/str/str-as-char.fixed
diff --git a/src/test/ui/str-as-char.rs b/src/test/ui/str/str-as-char.rs
similarity index 100%
rename from src/test/ui/str-as-char.rs
rename to src/test/ui/str/str-as-char.rs
diff --git a/src/test/ui/str-as-char.stderr b/src/test/ui/str/str-as-char.stderr
similarity index 100%
rename from src/test/ui/str-as-char.stderr
rename to src/test/ui/str/str-as-char.stderr
diff --git a/src/test/ui/str-concat-on-double-ref.rs b/src/test/ui/str/str-concat-on-double-ref.rs
similarity index 100%
rename from src/test/ui/str-concat-on-double-ref.rs
rename to src/test/ui/str/str-concat-on-double-ref.rs
diff --git a/src/test/ui/str-concat-on-double-ref.stderr b/src/test/ui/str/str-concat-on-double-ref.stderr
similarity index 100%
rename from src/test/ui/str-concat-on-double-ref.stderr
rename to src/test/ui/str/str-concat-on-double-ref.stderr
diff --git a/src/test/compile-fail/str-idx.rs b/src/test/ui/str/str-idx.rs
similarity index 100%
rename from src/test/compile-fail/str-idx.rs
rename to src/test/ui/str/str-idx.rs
diff --git a/src/test/ui/str/str-idx.stderr b/src/test/ui/str/str-idx.stderr
new file mode 100644
index 0000000..496187c
--- /dev/null
+++ b/src/test/ui/str/str-idx.stderr
@@ -0,0 +1,11 @@
+error[E0277]: the type `str` cannot be indexed by `{integer}`
+ --> $DIR/str-idx.rs:13:17
+ |
+LL | let c: u8 = s[4]; //~ ERROR the type `str` cannot be indexed by `{integer}`
+ | ^^^^ `str` cannot be indexed by `{integer}`
+ |
+ = help: the trait `std::ops::Index<{integer}>` is not implemented for `str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/str-lit-type-mismatch.rs b/src/test/ui/str/str-lit-type-mismatch.rs
similarity index 100%
rename from src/test/ui/str-lit-type-mismatch.rs
rename to src/test/ui/str/str-lit-type-mismatch.rs
diff --git a/src/test/ui/str-lit-type-mismatch.stderr b/src/test/ui/str/str-lit-type-mismatch.stderr
similarity index 100%
rename from src/test/ui/str-lit-type-mismatch.stderr
rename to src/test/ui/str/str-lit-type-mismatch.stderr
diff --git a/src/test/compile-fail/str-mut-idx.rs b/src/test/ui/str/str-mut-idx.rs
similarity index 100%
rename from src/test/compile-fail/str-mut-idx.rs
rename to src/test/ui/str/str-mut-idx.rs
diff --git a/src/test/ui/str/str-mut-idx.stderr b/src/test/ui/str/str-mut-idx.stderr
new file mode 100644
index 0000000..df21ea2
--- /dev/null
+++ b/src/test/ui/str/str-mut-idx.stderr
@@ -0,0 +1,35 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/str-mut-idx.rs:14:15
+ |
+LL | s[1..2] = bot();
+ | ^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+note: required by `bot`
+ --> $DIR/str-mut-idx.rs:11:1
+ |
+LL | fn bot<T>() -> T { loop {} }
+ | ^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/str-mut-idx.rs:14:5
+ |
+LL | s[1..2] = bot();
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: the left-hand-side of an assignment must have a statically known size
+
+error[E0277]: the type `str` cannot be mutably indexed by `usize`
+ --> $DIR/str-mut-idx.rs:17:5
+ |
+LL | s[1usize] = bot();
+ | ^^^^^^^^^ `str` cannot be mutably indexed by `usize`
+ |
+ = help: the trait `std::ops::IndexMut<usize>` is not implemented for `str`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/auxiliary/struct_field_privacy.rs b/src/test/ui/structs/auxiliary/struct_field_privacy.rs
similarity index 100%
rename from src/test/ui/auxiliary/struct_field_privacy.rs
rename to src/test/ui/structs/auxiliary/struct_field_privacy.rs
diff --git a/src/test/compile-fail/auxiliary/struct_variant_privacy.rs b/src/test/ui/structs/auxiliary/struct_variant_privacy.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/struct_variant_privacy.rs
rename to src/test/ui/structs/auxiliary/struct_variant_privacy.rs
diff --git a/src/test/compile-fail/struct-base-wrong-type-2.rs b/src/test/ui/structs/struct-base-wrong-type-2.rs
similarity index 100%
rename from src/test/compile-fail/struct-base-wrong-type-2.rs
rename to src/test/ui/structs/struct-base-wrong-type-2.rs
diff --git a/src/test/ui/structs/struct-base-wrong-type-2.stderr b/src/test/ui/structs/struct-base-wrong-type-2.stderr
new file mode 100644
index 0000000..aab5ed0
--- /dev/null
+++ b/src/test/ui/structs/struct-base-wrong-type-2.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/struct-base-wrong-type-2.rs:21:27
+ |
+LL | let f = Foo { a: 2, ..b }; //~ ERROR mismatched types
+ | ^ expected struct `Foo`, found struct `Bar`
+ |
+ = note: expected type `Foo`
+ found type `Bar`
+
+error[E0308]: mismatched types
+ --> $DIR/struct-base-wrong-type-2.rs:25:34
+ |
+LL | let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types
+ | ^ expected struct `Foo`, found integral variable
+ |
+ = note: expected type `Foo`
+ found type `{integer}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/struct-base-wrong-type.rs b/src/test/ui/structs/struct-base-wrong-type.rs
similarity index 100%
rename from src/test/compile-fail/struct-base-wrong-type.rs
rename to src/test/ui/structs/struct-base-wrong-type.rs
diff --git a/src/test/ui/structs/struct-base-wrong-type.stderr b/src/test/ui/structs/struct-base-wrong-type.stderr
new file mode 100644
index 0000000..2c87f52
--- /dev/null
+++ b/src/test/ui/structs/struct-base-wrong-type.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/struct-base-wrong-type.rs:20:33
+ |
+LL | static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types
+ | ^^^ expected struct `Foo`, found struct `Bar`
+ |
+ = note: expected type `Foo`
+ found type `Bar`
+
+error[E0308]: mismatched types
+ --> $DIR/struct-base-wrong-type.rs:24:35
+ |
+LL | static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types
+ | ^ expected struct `Foo`, found integral variable
+ |
+ = note: expected type `Foo`
+ found type `{integer}`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/struct-duplicate-comma.rs b/src/test/ui/structs/struct-duplicate-comma.rs
similarity index 100%
rename from src/test/ui/struct-duplicate-comma.rs
rename to src/test/ui/structs/struct-duplicate-comma.rs
diff --git a/src/test/ui/struct-duplicate-comma.stderr b/src/test/ui/structs/struct-duplicate-comma.stderr
similarity index 100%
rename from src/test/ui/struct-duplicate-comma.stderr
rename to src/test/ui/structs/struct-duplicate-comma.stderr
diff --git a/src/test/compile-fail/struct-field-cfg.rs b/src/test/ui/structs/struct-field-cfg.rs
similarity index 100%
rename from src/test/compile-fail/struct-field-cfg.rs
rename to src/test/ui/structs/struct-field-cfg.rs
diff --git a/src/test/ui/structs/struct-field-cfg.stderr b/src/test/ui/structs/struct-field-cfg.stderr
new file mode 100644
index 0000000..db47906
--- /dev/null
+++ b/src/test/ui/structs/struct-field-cfg.stderr
@@ -0,0 +1,30 @@
+error[E0063]: missing field `present` in initializer of `Foo`
+ --> $DIR/struct-field-cfg.rs:17:13
+ |
+LL | let _ = Foo { #[cfg(any())] present: () };
+ | ^^^ missing `present`
+
+error[E0560]: struct `Foo` has no field named `absent`
+ --> $DIR/struct-field-cfg.rs:20:46
+ |
+LL | let _ = Foo { present: (), #[cfg(all())] absent: () };
+ | ^^^^^^ `Foo` does not have this field
+ |
+ = note: available fields are: `present`
+
+error[E0027]: pattern does not mention field `present`
+ --> $DIR/struct-field-cfg.rs:23:9
+ |
+LL | let Foo { #[cfg(any())] present: () } = foo;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing field `present`
+
+error[E0026]: struct `Foo` does not have a field named `absent`
+ --> $DIR/struct-field-cfg.rs:26:42
+ |
+LL | let Foo { present: (), #[cfg(all())] absent: () } = foo;
+ | ^^^^^^^^^^ struct `Foo` does not have this field
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0026, E0027, E0063, E0560.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/src/test/ui/struct-field-init-syntax.rs b/src/test/ui/structs/struct-field-init-syntax.rs
similarity index 100%
rename from src/test/ui/struct-field-init-syntax.rs
rename to src/test/ui/structs/struct-field-init-syntax.rs
diff --git a/src/test/ui/struct-field-init-syntax.stderr b/src/test/ui/structs/struct-field-init-syntax.stderr
similarity index 100%
rename from src/test/ui/struct-field-init-syntax.stderr
rename to src/test/ui/structs/struct-field-init-syntax.stderr
diff --git a/src/test/compile-fail/struct-field-privacy.rs b/src/test/ui/structs/struct-field-privacy.rs
similarity index 100%
rename from src/test/compile-fail/struct-field-privacy.rs
rename to src/test/ui/structs/struct-field-privacy.rs
diff --git a/src/test/ui/structs/struct-field-privacy.stderr b/src/test/ui/structs/struct-field-privacy.stderr
new file mode 100644
index 0000000..ad3ee12
--- /dev/null
+++ b/src/test/ui/structs/struct-field-privacy.stderr
@@ -0,0 +1,33 @@
+error[E0616]: field `a` of struct `inner::A` is private
+ --> $DIR/struct-field-privacy.rs:33:5
+ |
+LL | b.a; //~ ERROR: field `a` of struct `inner::A` is private
+ | ^^^
+
+error[E0616]: field `b` of struct `inner::B` is private
+ --> $DIR/struct-field-privacy.rs:36:5
+ |
+LL | c.b; //~ ERROR: field `b` of struct `inner::B` is private
+ | ^^^
+
+error[E0616]: field `a` of struct `xc::A` is private
+ --> $DIR/struct-field-privacy.rs:38:5
+ |
+LL | d.a; //~ ERROR: field `a` of struct `xc::A` is private
+ | ^^^
+
+error[E0616]: field `b` of struct `xc::B` is private
+ --> $DIR/struct-field-privacy.rs:42:5
+ |
+LL | e.b; //~ ERROR: field `b` of struct `xc::B` is private
+ | ^^^
+
+error[E0616]: field `1` of struct `inner::Z` is private
+ --> $DIR/struct-field-privacy.rs:45:5
+ |
+LL | z.1; //~ ERROR: field `1` of struct `inner::Z` is private
+ | ^^^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0616`.
diff --git a/src/test/ui/struct-fields-decl-dupe.rs b/src/test/ui/structs/struct-fields-decl-dupe.rs
similarity index 100%
rename from src/test/ui/struct-fields-decl-dupe.rs
rename to src/test/ui/structs/struct-fields-decl-dupe.rs
diff --git a/src/test/ui/struct-fields-decl-dupe.stderr b/src/test/ui/structs/struct-fields-decl-dupe.stderr
similarity index 100%
rename from src/test/ui/struct-fields-decl-dupe.stderr
rename to src/test/ui/structs/struct-fields-decl-dupe.stderr
diff --git a/src/test/compile-fail/struct-fields-dupe.rs b/src/test/ui/structs/struct-fields-dupe.rs
similarity index 100%
rename from src/test/compile-fail/struct-fields-dupe.rs
rename to src/test/ui/structs/struct-fields-dupe.rs
diff --git a/src/test/ui/structs/struct-fields-dupe.stderr b/src/test/ui/structs/struct-fields-dupe.stderr
new file mode 100644
index 0000000..fa20793
--- /dev/null
+++ b/src/test/ui/structs/struct-fields-dupe.stderr
@@ -0,0 +1,11 @@
+error[E0062]: field `foo` specified more than once
+ --> $DIR/struct-fields-dupe.rs:18:9
+ |
+LL | foo: 0,
+ | ------ first use of `foo`
+LL | foo: 0 //~ ERROR field `foo` specified more than once
+ | ^^^ used more than once
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0062`.
diff --git a/src/test/ui/struct-fields-hints-no-dupe.rs b/src/test/ui/structs/struct-fields-hints-no-dupe.rs
similarity index 100%
rename from src/test/ui/struct-fields-hints-no-dupe.rs
rename to src/test/ui/structs/struct-fields-hints-no-dupe.rs
diff --git a/src/test/ui/struct-fields-hints-no-dupe.stderr b/src/test/ui/structs/struct-fields-hints-no-dupe.stderr
similarity index 100%
rename from src/test/ui/struct-fields-hints-no-dupe.stderr
rename to src/test/ui/structs/struct-fields-hints-no-dupe.stderr
diff --git a/src/test/ui/struct-fields-hints.rs b/src/test/ui/structs/struct-fields-hints.rs
similarity index 100%
rename from src/test/ui/struct-fields-hints.rs
rename to src/test/ui/structs/struct-fields-hints.rs
diff --git a/src/test/ui/struct-fields-hints.stderr b/src/test/ui/structs/struct-fields-hints.stderr
similarity index 100%
rename from src/test/ui/struct-fields-hints.stderr
rename to src/test/ui/structs/struct-fields-hints.stderr
diff --git a/src/test/compile-fail/struct-fields-missing.rs b/src/test/ui/structs/struct-fields-missing.rs
similarity index 100%
rename from src/test/compile-fail/struct-fields-missing.rs
rename to src/test/ui/structs/struct-fields-missing.rs
diff --git a/src/test/ui/structs/struct-fields-missing.stderr b/src/test/ui/structs/struct-fields-missing.stderr
new file mode 100644
index 0000000..606288e
--- /dev/null
+++ b/src/test/ui/structs/struct-fields-missing.stderr
@@ -0,0 +1,9 @@
+error[E0063]: missing field `bar` in initializer of `BuildData`
+ --> $DIR/struct-fields-missing.rs:18:15
+ |
+LL | let foo = BuildData { //~ ERROR missing field `bar` in initializer of `BuildData`
+ | ^^^^^^^^^ missing `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0063`.
diff --git a/src/test/compile-fail/struct-fields-shorthand-unresolved.rs b/src/test/ui/structs/struct-fields-shorthand-unresolved.rs
similarity index 100%
rename from src/test/compile-fail/struct-fields-shorthand-unresolved.rs
rename to src/test/ui/structs/struct-fields-shorthand-unresolved.rs
diff --git a/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr
new file mode 100644
index 0000000..f66ac96
--- /dev/null
+++ b/src/test/ui/structs/struct-fields-shorthand-unresolved.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `y` in this scope
+ --> $DIR/struct-fields-shorthand-unresolved.rs:20:9
+ |
+LL | y //~ ERROR cannot find value `y` in this scope
+ | ^ did you mean `x`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/struct-fields-shorthand.rs b/src/test/ui/structs/struct-fields-shorthand.rs
similarity index 100%
rename from src/test/compile-fail/struct-fields-shorthand.rs
rename to src/test/ui/structs/struct-fields-shorthand.rs
diff --git a/src/test/ui/structs/struct-fields-shorthand.stderr b/src/test/ui/structs/struct-fields-shorthand.stderr
new file mode 100644
index 0000000..a65a9c8
--- /dev/null
+++ b/src/test/ui/structs/struct-fields-shorthand.stderr
@@ -0,0 +1,11 @@
+error[E0560]: struct `Foo` has no field named `z`
+ --> $DIR/struct-fields-shorthand.rs:19:15
+ |
+LL | x, y, z //~ ERROR struct `Foo` has no field named `z`
+ | ^ `Foo` does not have this field
+ |
+ = note: available fields are: `x`, `y`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0560`.
diff --git a/src/test/ui/struct-fields-too-many.rs b/src/test/ui/structs/struct-fields-too-many.rs
similarity index 100%
rename from src/test/ui/struct-fields-too-many.rs
rename to src/test/ui/structs/struct-fields-too-many.rs
diff --git a/src/test/ui/struct-fields-too-many.stderr b/src/test/ui/structs/struct-fields-too-many.stderr
similarity index 100%
rename from src/test/ui/struct-fields-too-many.stderr
rename to src/test/ui/structs/struct-fields-too-many.stderr
diff --git a/src/test/compile-fail/struct-fields-typo.rs b/src/test/ui/structs/struct-fields-typo.rs
similarity index 100%
rename from src/test/compile-fail/struct-fields-typo.rs
rename to src/test/ui/structs/struct-fields-typo.rs
diff --git a/src/test/ui/structs/struct-fields-typo.stderr b/src/test/ui/structs/struct-fields-typo.stderr
new file mode 100644
index 0000000..9f2f97a
--- /dev/null
+++ b/src/test/ui/structs/struct-fields-typo.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `baa` on type `BuildData`
+ --> $DIR/struct-fields-typo.rs:21:17
+ |
+LL | let x = foo.baa;//~ no field `baa` on type `BuildData`
+ | ^^^ did you mean `bar`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/compile-fail/struct-like-enum-nonexhaustive.rs b/src/test/ui/structs/struct-like-enum-nonexhaustive.rs
similarity index 100%
rename from src/test/compile-fail/struct-like-enum-nonexhaustive.rs
rename to src/test/ui/structs/struct-like-enum-nonexhaustive.rs
diff --git a/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr
new file mode 100644
index 0000000..56dbf0c
--- /dev/null
+++ b/src/test/ui/structs/struct-like-enum-nonexhaustive.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `B { x: Some(_) }` not covered
+ --> $DIR/struct-like-enum-nonexhaustive.rs:18:11
+ |
+LL | match x { //~ ERROR non-exhaustive patterns
+ | ^ pattern `B { x: Some(_) }` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/ui/struct-missing-comma.rs b/src/test/ui/structs/struct-missing-comma.rs
similarity index 100%
rename from src/test/ui/struct-missing-comma.rs
rename to src/test/ui/structs/struct-missing-comma.rs
diff --git a/src/test/ui/struct-missing-comma.stderr b/src/test/ui/structs/struct-missing-comma.stderr
similarity index 100%
rename from src/test/ui/struct-missing-comma.stderr
rename to src/test/ui/structs/struct-missing-comma.stderr
diff --git a/src/test/compile-fail/struct-pat-derived-error.rs b/src/test/ui/structs/struct-pat-derived-error.rs
similarity index 100%
rename from src/test/compile-fail/struct-pat-derived-error.rs
rename to src/test/ui/structs/struct-pat-derived-error.rs
diff --git a/src/test/ui/structs/struct-pat-derived-error.stderr b/src/test/ui/structs/struct-pat-derived-error.stderr
new file mode 100644
index 0000000..68b71ef
--- /dev/null
+++ b/src/test/ui/structs/struct-pat-derived-error.stderr
@@ -0,0 +1,22 @@
+error[E0609]: no field `d` on type `&a`
+ --> $DIR/struct-pat-derived-error.rs:18:31
+ |
+LL | let a { x, y } = self.d; //~ ERROR no field `d` on type `&a`
+ | ^
+
+error[E0026]: struct `a` does not have fields named `x`, `y`
+ --> $DIR/struct-pat-derived-error.rs:18:17
+ |
+LL | let a { x, y } = self.d; //~ ERROR no field `d` on type `&a`
+ | ^ ^ struct `a` does not have these fields
+
+error[E0027]: pattern does not mention fields `b`, `c`
+ --> $DIR/struct-pat-derived-error.rs:18:13
+ |
+LL | let a { x, y } = self.d; //~ ERROR no field `d` on type `&a`
+ | ^^^^^^^^^^ missing fields `b`, `c`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0026, E0027, E0609.
+For more information about an error, try `rustc --explain E0026`.
diff --git a/src/test/compile-fail/struct-path-alias-bounds.rs b/src/test/ui/structs/struct-path-alias-bounds.rs
similarity index 100%
rename from src/test/compile-fail/struct-path-alias-bounds.rs
rename to src/test/ui/structs/struct-path-alias-bounds.rs
diff --git a/src/test/ui/structs/struct-path-alias-bounds.stderr b/src/test/ui/structs/struct-path-alias-bounds.stderr
new file mode 100644
index 0000000..f8e2fe1
--- /dev/null
+++ b/src/test/ui/structs/struct-path-alias-bounds.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `NoClone: std::clone::Clone` is not satisfied
+ --> $DIR/struct-path-alias-bounds.rs:19:13
+ |
+LL | let s = A { a: NoClone };
+ | ^ the trait `std::clone::Clone` is not implemented for `NoClone`
+ |
+note: required by `S`
+ --> $DIR/struct-path-alias-bounds.rs:13:1
+ |
+LL | struct S<T: Clone> { a: T }
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/struct-path-associated-type.rs b/src/test/ui/structs/struct-path-associated-type.rs
similarity index 100%
rename from src/test/compile-fail/struct-path-associated-type.rs
rename to src/test/ui/structs/struct-path-associated-type.rs
diff --git a/src/test/ui/structs/struct-path-associated-type.stderr b/src/test/ui/structs/struct-path-associated-type.stderr
new file mode 100644
index 0000000..1364b2a
--- /dev/null
+++ b/src/test/ui/structs/struct-path-associated-type.stderr
@@ -0,0 +1,64 @@
+error[E0071]: expected struct, variant or union type, found associated type
+ --> $DIR/struct-path-associated-type.rs:22:13
+ |
+LL | let s = T::A {};
+ | ^^^^ not a struct
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/struct-path-associated-type.rs:24:20
+ |
+LL | let z = T::A::<u8> {};
+ | ^^ type parameter not allowed
+
+error[E0071]: expected struct, variant or union type, found associated type
+ --> $DIR/struct-path-associated-type.rs:24:13
+ |
+LL | let z = T::A::<u8> {};
+ | ^^^^^^^^^^ not a struct
+
+error[E0071]: expected struct, variant or union type, found associated type
+ --> $DIR/struct-path-associated-type.rs:28:9
+ |
+LL | T::A {} => {}
+ | ^^^^ not a struct
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/struct-path-associated-type.rs:35:20
+ |
+LL | let z = T::A::<u8> {}; //~ ERROR type parameters are not allowed on this type
+ | ^^ type parameter not allowed
+
+error[E0223]: ambiguous associated type
+ --> $DIR/struct-path-associated-type.rs:42:13
+ |
+LL | let s = S::A {}; //~ ERROR ambiguous associated type
+ | ^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<S as Trait>::A`
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/struct-path-associated-type.rs:43:20
+ |
+LL | let z = S::A::<u8> {}; //~ ERROR ambiguous associated type
+ | ^^ type parameter not allowed
+
+error[E0223]: ambiguous associated type
+ --> $DIR/struct-path-associated-type.rs:43:13
+ |
+LL | let z = S::A::<u8> {}; //~ ERROR ambiguous associated type
+ | ^^^^^^^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<S as Trait>::A`
+
+error[E0223]: ambiguous associated type
+ --> $DIR/struct-path-associated-type.rs:46:9
+ |
+LL | S::A {} => {} //~ ERROR ambiguous associated type
+ | ^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<S as Trait>::A`
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0071, E0109, E0223.
+For more information about an error, try `rustc --explain E0071`.
diff --git a/src/test/ui/struct-path-self-type-mismatch.rs b/src/test/ui/structs/struct-path-self-type-mismatch.rs
similarity index 100%
rename from src/test/ui/struct-path-self-type-mismatch.rs
rename to src/test/ui/structs/struct-path-self-type-mismatch.rs
diff --git a/src/test/ui/struct-path-self-type-mismatch.stderr b/src/test/ui/structs/struct-path-self-type-mismatch.stderr
similarity index 100%
rename from src/test/ui/struct-path-self-type-mismatch.stderr
rename to src/test/ui/structs/struct-path-self-type-mismatch.stderr
diff --git a/src/test/compile-fail/struct-path-self.rs b/src/test/ui/structs/struct-path-self.rs
similarity index 100%
rename from src/test/compile-fail/struct-path-self.rs
rename to src/test/ui/structs/struct-path-self.rs
diff --git a/src/test/ui/structs/struct-path-self.stderr b/src/test/ui/structs/struct-path-self.stderr
new file mode 100644
index 0000000..1b55060
--- /dev/null
+++ b/src/test/ui/structs/struct-path-self.stderr
@@ -0,0 +1,40 @@
+error[E0071]: expected struct, variant or union type, found Self
+ --> $DIR/struct-path-self.rs:15:17
+ |
+LL | let s = Self {};
+ | ^^^^ not a struct
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/struct-path-self.rs:17:24
+ |
+LL | let z = Self::<u8> {};
+ | ^^ type parameter not allowed
+
+error[E0071]: expected struct, variant or union type, found Self
+ --> $DIR/struct-path-self.rs:17:17
+ |
+LL | let z = Self::<u8> {};
+ | ^^^^^^^^^^ not a struct
+
+error[E0071]: expected struct, variant or union type, found Self
+ --> $DIR/struct-path-self.rs:21:13
+ |
+LL | Self { .. } => {}
+ | ^^^^ not a struct
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/struct-path-self.rs:30:24
+ |
+LL | let z = Self::<u8> {}; //~ ERROR type parameters are not allowed on this type
+ | ^^ type parameter not allowed
+
+error[E0109]: type parameters are not allowed on this type
+ --> $DIR/struct-path-self.rs:40:24
+ |
+LL | let z = Self::<u8> {}; //~ ERROR type parameters are not allowed on this type
+ | ^^ type parameter not allowed
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0071, E0109.
+For more information about an error, try `rustc --explain E0071`.
diff --git a/src/test/compile-fail/struct-pattern-match-useless.rs b/src/test/ui/structs/struct-pattern-match-useless.rs
similarity index 100%
rename from src/test/compile-fail/struct-pattern-match-useless.rs
rename to src/test/ui/structs/struct-pattern-match-useless.rs
diff --git a/src/test/ui/structs/struct-pattern-match-useless.stderr b/src/test/ui/structs/struct-pattern-match-useless.stderr
new file mode 100644
index 0000000..60f17d1
--- /dev/null
+++ b/src/test/ui/structs/struct-pattern-match-useless.stderr
@@ -0,0 +1,14 @@
+error: unreachable pattern
+ --> $DIR/struct-pattern-match-useless.rs:22:9
+ |
+LL | Foo { .. } => () //~ ERROR unreachable pattern
+ | ^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/struct-pattern-match-useless.rs:11:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/struct-variant-privacy-xc.rs b/src/test/ui/structs/struct-variant-privacy-xc.rs
similarity index 100%
rename from src/test/compile-fail/struct-variant-privacy-xc.rs
rename to src/test/ui/structs/struct-variant-privacy-xc.rs
diff --git a/src/test/ui/structs/struct-variant-privacy-xc.stderr b/src/test/ui/structs/struct-variant-privacy-xc.stderr
new file mode 100644
index 0000000..731d23e
--- /dev/null
+++ b/src/test/ui/structs/struct-variant-privacy-xc.stderr
@@ -0,0 +1,15 @@
+error[E0603]: enum `Bar` is private
+ --> $DIR/struct-variant-privacy-xc.rs:14:9
+ |
+LL | fn f(b: struct_variant_privacy::Bar) { //~ ERROR enum `Bar` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: enum `Bar` is private
+ --> $DIR/struct-variant-privacy-xc.rs:16:9
+ |
+LL | struct_variant_privacy::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/struct-variant-privacy.rs b/src/test/ui/structs/struct-variant-privacy.rs
similarity index 100%
rename from src/test/compile-fail/struct-variant-privacy.rs
rename to src/test/ui/structs/struct-variant-privacy.rs
diff --git a/src/test/ui/structs/struct-variant-privacy.stderr b/src/test/ui/structs/struct-variant-privacy.stderr
new file mode 100644
index 0000000..a82ac8a
--- /dev/null
+++ b/src/test/ui/structs/struct-variant-privacy.stderr
@@ -0,0 +1,15 @@
+error[E0603]: enum `Bar` is private
+ --> $DIR/struct-variant-privacy.rs:16:9
+ |
+LL | fn f(b: foo::Bar) { //~ ERROR enum `Bar` is private
+ | ^^^^^^^^
+
+error[E0603]: enum `Bar` is private
+ --> $DIR/struct-variant-privacy.rs:18:9
+ |
+LL | foo::Bar::Baz { a: _a } => {} //~ ERROR enum `Bar` is private
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/structure-constructor-type-mismatch.rs b/src/test/ui/structs/structure-constructor-type-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/structure-constructor-type-mismatch.rs
rename to src/test/ui/structs/structure-constructor-type-mismatch.rs
diff --git a/src/test/ui/structs/structure-constructor-type-mismatch.stderr b/src/test/ui/structs/structure-constructor-type-mismatch.stderr
new file mode 100644
index 0000000..1a88bc0
--- /dev/null
+++ b/src/test/ui/structs/structure-constructor-type-mismatch.stderr
@@ -0,0 +1,139 @@
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:27:12
+ |
+LL | x: 1,
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `1.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:30:12
+ |
+LL | y: 2,
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `2.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:36:12
+ |
+LL | x: 3,
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `3.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:39:12
+ |
+LL | y: 4,
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `4.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:45:12
+ |
+LL | x: 5,
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `5.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:52:12
+ |
+LL | x: 7,
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `7.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0244]: wrong number of type arguments: expected 0, found 1
+ --> $DIR/structure-constructor-type-mismatch.rs:58:15
+ |
+LL | let pt3 = PointF::<i32> { //~ ERROR wrong number of type arguments
+ | ^^^^^^^^^^^^^ expected no type arguments
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:59:12
+ |
+LL | x: 9, //~ ERROR mismatched types
+ | ^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `9.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:60:12
+ |
+LL | y: 10, //~ ERROR mismatched types
+ | ^^
+ | |
+ | expected f32, found integral variable
+ | help: use a float literal: `10.0`
+ |
+ = note: expected type `f32`
+ found type `{integer}`
+
+error[E0244]: wrong number of type arguments: expected 0, found 1
+ --> $DIR/structure-constructor-type-mismatch.rs:64:9
+ |
+LL | PointF::<u32> { .. } => {} //~ ERROR wrong number of type arguments
+ | ^^^^^^^^^^^^^ expected no type arguments
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:64:9
+ |
+LL | PointF::<u32> { .. } => {} //~ ERROR wrong number of type arguments
+ | ^^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32
+ |
+ = note: expected type `Point<{integer}>`
+ found type `Point<f32>`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:69:9
+ |
+LL | PointF { .. } => {} //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^ expected integral variable, found f32
+ |
+ = note: expected type `Point<{integer}>`
+ found type `Point<f32>`
+
+error[E0308]: mismatched types
+ --> $DIR/structure-constructor-type-mismatch.rs:77:9
+ |
+LL | PairF::<u32> { .. } => {} //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^ expected integral variable, found f32
+ |
+ = note: expected type `Pair<{integer}, {integer}>`
+ found type `Pair<f32, u32>`
+
+error: aborting due to 13 previous errors
+
+Some errors occurred: E0244, E0308.
+For more information about an error, try `rustc --explain E0244`.
diff --git a/src/test/ui/substs-ppaux.normal.stderr b/src/test/ui/substs-ppaux.normal.stderr
new file mode 100644
index 0000000..9f87329
--- /dev/null
+++ b/src/test/ui/substs-ppaux.normal.stderr
@@ -0,0 +1,55 @@
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:25:17
+ |
+LL | let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {<i8 as Foo<'static, 'static, u8>>::bar::<'static, char>}`
+
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:34:17
+ |
+LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {<i8 as Foo<'static, 'static>>::bar::<'static, char>}`
+
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:42:17
+ |
+LL | let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {<i8 as Foo<'static, 'static, u8>>::baz}`
+
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:50:17
+ |
+LL | let x: () = foo::<'static>;
+ | ^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {foo::<'static>}`
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/substs-ppaux.rs:58:5
+ |
+LL | <str as Foo<u8>>::bar;
+ | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because of the requirements on the impl of `Foo<'_, '_, u8>` for `str`
+note: required by `Foo::bar`
+ --> $DIR/substs-ppaux.rs:16:5
+ |
+LL | fn bar<'a, T>() where T: 'a {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/substs-ppaux.rs b/src/test/ui/substs-ppaux.rs
similarity index 100%
rename from src/test/compile-fail/substs-ppaux.rs
rename to src/test/ui/substs-ppaux.rs
diff --git a/src/test/ui/substs-ppaux.verbose.stderr b/src/test/ui/substs-ppaux.verbose.stderr
new file mode 100644
index 0000000..2daa960
--- /dev/null
+++ b/src/test/ui/substs-ppaux.verbose.stderr
@@ -0,0 +1,55 @@
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:25:17
+ |
+LL | let x: () = <i8 as Foo<'static, 'static, u8>>::bar::<'static, char>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::bar::<ReStatic, char>}`
+
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:34:17
+ |
+LL | let x: () = <i8 as Foo<'static, 'static, u32>>::bar::<'static, char>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {<i8 as Foo<ReStatic, ReStatic, u32>>::bar::<ReStatic, char>}`
+
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:42:17
+ |
+LL | let x: () = <i8 as Foo<'static, 'static, u8>>::baz;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {<i8 as Foo<ReStatic, ReStatic, u8>>::baz}`
+
+error[E0308]: mismatched types
+ --> $DIR/substs-ppaux.rs:50:17
+ |
+LL | let x: () = foo::<'static>;
+ | ^^^^^^^^^^^^^^ expected (), found fn item
+ |
+ = note: expected type `()`
+ found type `fn() {foo::<ReStatic>}`
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/substs-ppaux.rs:58:5
+ |
+LL | <str as Foo<u8>>::bar;
+ | ^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because of the requirements on the impl of `Foo<'_#0r, '_#1r, u8>` for `str`
+note: required by `Foo::bar`
+ --> $DIR/substs-ppaux.rs:16:5
+ |
+LL | fn bar<'a, T>() where T: 'a {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/suffixed-literal-meta.rs b/src/test/ui/suffixed-literal-meta.rs
similarity index 100%
rename from src/test/compile-fail/suffixed-literal-meta.rs
rename to src/test/ui/suffixed-literal-meta.rs
diff --git a/src/test/ui/suffixed-literal-meta.stderr b/src/test/ui/suffixed-literal-meta.stderr
new file mode 100644
index 0000000..6d88ab1
--- /dev/null
+++ b/src/test/ui/suffixed-literal-meta.stderr
@@ -0,0 +1,98 @@
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:13:10
+ |
+LL | #[path = 1usize] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:14:10
+ |
+LL | #[path = 1u8] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:15:10
+ |
+LL | #[path = 1u16] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:16:10
+ |
+LL | #[path = 1u32] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:17:10
+ |
+LL | #[path = 1u64] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:18:10
+ |
+LL | #[path = 1isize] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:19:10
+ |
+LL | #[path = 1i8] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:20:10
+ |
+LL | #[path = 1i16] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:21:10
+ |
+LL | #[path = 1i32] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:22:10
+ |
+LL | #[path = 1i64] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:23:10
+ |
+LL | #[path = 1.0f32] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: suffixed literals are not allowed in attributes
+ --> $DIR/suffixed-literal-meta.rs:24:10
+ |
+LL | #[path = 1.0f64] //~ ERROR: suffixed literals are not allowed in attributes
+ | ^^^^^^
+ |
+ = help: instead of using a suffixed literal (1u8, 1.0f32, etc.), use an unsuffixed version (1, 1.0, etc.).
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/ui/auxiliary/struct_field_privacy.rs b/src/test/ui/suggestions/auxiliary/struct_field_privacy.rs
similarity index 100%
copy from src/test/ui/auxiliary/struct_field_privacy.rs
copy to src/test/ui/suggestions/auxiliary/struct_field_privacy.rs
diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs
new file mode 100644
index 0000000..dc0186e
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.rs
@@ -0,0 +1,162 @@
+// 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.
+
+#![feature(nll)]
+
+#[derive(Clone)]
+enum Either {
+ One(X),
+ Two(X),
+}
+
+#[derive(Clone)]
+struct X(Y);
+
+#[derive(Clone)]
+struct Y;
+
+
+pub fn main() {
+ let e = Either::One(X(Y));
+ let mut em = Either::One(X(Y));
+
+ let r = &e;
+ let rm = &mut Either::One(X(Y));
+
+ let x = X(Y);
+ let mut xm = X(Y);
+
+ let s = &x;
+ let sm = &mut X(Y);
+
+ let ve = vec![Either::One(X(Y))];
+
+ let vr = &ve;
+ let vrm = &mut vec![Either::One(X(Y))];
+
+ let vx = vec![X(Y)];
+
+ let vs = &vx;
+ let vsm = &mut vec![X(Y)];
+
+ // -------- test for duplicate suggestions --------
+
+ let &(X(_t), X(_u)) = &(x.clone(), x.clone());
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION (X(_t), X(_u))
+ if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ match &(e.clone(), e.clone()) {
+ //~^ ERROR cannot move
+ &(Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ &(Either::Two(_t), Either::One(_u)) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION (Either::Two(_t), Either::One(_u))
+ _ => (),
+ }
+ match &(e.clone(), e.clone()) {
+ //~^ ERROR cannot move
+ &(Either::One(_t), Either::Two(_u))
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ | &(Either::Two(_t), Either::One(_u)) => (),
+ // FIXME: would really like a suggestion here too
+ _ => (),
+ }
+ match &(e.clone(), e.clone()) {
+ //~^ ERROR cannot move
+ &(Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ &(Either::Two(ref _t), Either::One(ref _u)) => (),
+ _ => (),
+ }
+ match &(e.clone(), e.clone()) {
+ //~^ ERROR cannot move
+ &(Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ (Either::Two(_t), Either::One(_u)) => (),
+ _ => (),
+ }
+ fn f5(&(X(_t), X(_u)): &(X, X)) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION (X(_t), X(_u))
+
+ let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION (X(_t), X(_u))
+ if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ match &mut (em.clone(), em.clone()) {
+ //~^ ERROR cannot move
+ &mut (Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ &mut (Either::Two(_t), Either::One(_u)) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::Two(_t), Either::One(_u))
+ _ => (),
+ }
+ match &mut (em.clone(), em.clone()) {
+ //~^ ERROR cannot move
+ &mut (Either::One(_t), Either::Two(_u))
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ | &mut (Either::Two(_t), Either::One(_u)) => (),
+ // FIXME: would really like a suggestion here too
+ _ => (),
+ }
+ match &mut (em.clone(), em.clone()) {
+ //~^ ERROR cannot move
+ &mut (Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ &mut (Either::Two(ref _t), Either::One(ref _u)) => (),
+ _ => (),
+ }
+ match &mut (em.clone(), em.clone()) {
+ //~^ ERROR cannot move
+ &mut (Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ &mut (Either::Two(ref mut _t), Either::One(ref mut _u)) => (),
+ _ => (),
+ }
+ match &mut (em.clone(), em.clone()) {
+ //~^ ERROR cannot move
+ &mut (Either::One(_t), Either::Two(_u)) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION (Either::One(_t), Either::Two(_u))
+ (Either::Two(_t), Either::One(_u)) => (),
+ _ => (),
+ }
+ fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION (X(_t), X(_u))
+}
diff --git a/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr
new file mode 100644
index 0000000..bb36884
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-ref/duplicate-suggestions.stderr
@@ -0,0 +1,328 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:51:27
+ |
+LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone());
+ | --------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&`: `(X(_t), X(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:51:13
+ |
+LL | let &(X(_t), X(_u)) = &(x.clone(), x.clone());
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:55:50
+ |
+LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
+ | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:55:26
+ |
+LL | if let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:59:53
+ |
+LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
+ | ----------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:59:29
+ |
+LL | while let &(Either::One(_t), Either::Two(_u)) = &(e.clone(), e.clone()) { }
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:63:11
+ |
+LL | match &(e.clone(), e.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &(Either::One(_t), Either::Two(_u)) => (),
+ | -- -- ...and here
+ | |
+ | data moved here
+...
+LL | &(Either::Two(_t), Either::One(_u)) => (),
+ | -- ...and here -- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:65:23
+ |
+LL | &(Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+...
+LL | &(Either::Two(_t), Either::One(_u)) => (),
+ | ^^ ^^
+help: consider removing the `&`
+ |
+LL | (Either::One(_t), Either::Two(_u)) => (),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: consider removing the `&`
+ |
+LL | (Either::Two(_t), Either::One(_u)) => (),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:73:11
+ |
+LL | match &(e.clone(), e.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &(Either::One(_t), Either::Two(_u))
+ | -----------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:75:23
+ |
+LL | &(Either::One(_t), Either::Two(_u))
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:82:11
+ |
+LL | match &(e.clone(), e.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &(Either::One(_t), Either::Two(_u)) => (),
+ | -----------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:84:23
+ |
+LL | &(Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:90:11
+ |
+LL | match &(e.clone(), e.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &(Either::One(_t), Either::Two(_u)) => (),
+ | -----------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:92:23
+ |
+LL | &(Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:103:31
+ |
+LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
+ | ------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(X(_t), X(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:103:17
+ |
+LL | let &mut (X(_t), X(_u)) = &mut (xm.clone(), xm.clone());
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:107:54
+ |
+LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
+ | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:107:30
+ |
+LL | if let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:111:57
+ |
+LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
+ | --------------------------------------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:111:33
+ |
+LL | while let &mut (Either::One(_t), Either::Two(_u)) = &mut (em.clone(), em.clone()) { }
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:115:11
+ |
+LL | match &mut (em.clone(), em.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | -- -- ...and here
+ | |
+ | data moved here
+...
+LL | &mut (Either::Two(_t), Either::One(_u)) => (),
+ | -- ...and here -- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:117:27
+ |
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+...
+LL | &mut (Either::Two(_t), Either::One(_u)) => (),
+ | ^^ ^^
+help: consider removing the `&mut`
+ |
+LL | (Either::One(_t), Either::Two(_u)) => (),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+help: consider removing the `&mut`
+ |
+LL | (Either::Two(_t), Either::One(_u)) => (),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:125:11
+ |
+LL | match &mut (em.clone(), em.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut (Either::One(_t), Either::Two(_u))
+ | ---------------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:127:27
+ |
+LL | &mut (Either::One(_t), Either::Two(_u))
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:134:11
+ |
+LL | match &mut (em.clone(), em.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ---------------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:136:27
+ |
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:142:11
+ |
+LL | match &mut (em.clone(), em.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ---------------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:144:27
+ |
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:150:11
+ |
+LL | match &mut (em.clone(), em.clone()) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ---------------------------------------
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | help: consider removing the `&mut`: `(Either::One(_t), Either::Two(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:152:27
+ |
+LL | &mut (Either::One(_t), Either::Two(_u)) => (),
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:98:11
+ |
+LL | fn f5(&(X(_t), X(_u)): &(X, X)) { }
+ | ^^^^--^^^^^--^^
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `(X(_t), X(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:98:15
+ |
+LL | fn f5(&(X(_t), X(_u)): &(X, X)) { }
+ | ^^ ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/duplicate-suggestions.rs:158:11
+ |
+LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
+ | ^^^^^^^^--^^^^^--^^
+ | | | |
+ | | | ...and here
+ | | data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&mut`: `(X(_t), X(_u))`
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/duplicate-suggestions.rs:158:19
+ |
+LL | fn f6(&mut (X(_t), X(_u)): &mut (X, X)) { }
+ | ^^ ^^
+
+error: aborting due to 17 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs
new file mode 100644
index 0000000..8cc847e
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.rs
@@ -0,0 +1,171 @@
+// 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.
+
+#![feature(nll)]
+
+#[derive(Clone)]
+enum Either {
+ One(X),
+ Two(X),
+}
+
+#[derive(Clone)]
+struct X(Y);
+
+#[derive(Clone)]
+struct Y;
+
+fn consume_fn<F: Fn()>(_f: F) { }
+
+fn consume_fnmut<F: FnMut()>(_f: F) { }
+
+pub fn main() { }
+
+fn move_into_fn() {
+ let e = Either::One(X(Y));
+ let mut em = Either::One(X(Y));
+
+ let x = X(Y);
+
+ // -------- move into Fn --------
+
+ consume_fn(|| {
+ let X(_t) = x;
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &x
+ if let Either::One(_t) = e { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ while let Either::One(_t) = e { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ match e {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ Either::One(_t)
+ | Either::Two(_t) => (),
+ }
+ match e {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ Either::One(_t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+
+ let X(mut _t) = x;
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &x
+ if let Either::One(mut _t) = em { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ while let Either::One(mut _t) = em { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ match em {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ Either::One(mut _t)
+ | Either::Two(mut _t) => (),
+ }
+ match em {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ Either::One(mut _t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+ });
+}
+
+fn move_into_fnmut() {
+ let e = Either::One(X(Y));
+ let mut em = Either::One(X(Y));
+
+ let x = X(Y);
+
+ // -------- move into FnMut --------
+
+ consume_fnmut(|| {
+ let X(_t) = x;
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &x
+ if let Either::One(_t) = e { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ while let Either::One(_t) = e { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ match e {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ Either::One(_t)
+ | Either::Two(_t) => (),
+ }
+ match e {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &e
+ Either::One(_t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+
+ let X(mut _t) = x;
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &x
+ if let Either::One(mut _t) = em { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ while let Either::One(mut _t) = em { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ match em {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ Either::One(mut _t)
+ | Either::Two(mut _t) => (),
+ }
+ match em {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ Either::One(mut _t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+ match em {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &em
+ Either::One(mut _t) => (),
+ Either::Two(ref mut _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+ });
+}
diff --git a/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr
new file mode 100644
index 0000000..228ec5a
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-ref/move-into-closure.stderr
@@ -0,0 +1,420 @@
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:40:21
+ |
+LL | let x = X(Y);
+ | - captured outer variable
+...
+LL | let X(_t) = x;
+ | -- ^
+ | | |
+ | | cannot move out of captured variable in an `Fn` closure
+ | | help: consider borrowing here: `&x`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:40:15
+ |
+LL | let X(_t) = x;
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:44:34
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | if let Either::One(_t) = e { }
+ | -- ^
+ | | |
+ | | cannot move out of captured variable in an `Fn` closure
+ | | help: consider borrowing here: `&e`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:44:28
+ |
+LL | if let Either::One(_t) = e { }
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:48:37
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | while let Either::One(_t) = e { }
+ | -- ^
+ | | |
+ | | cannot move out of captured variable in an `Fn` closure
+ | | help: consider borrowing here: `&e`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:48:31
+ |
+LL | while let Either::One(_t) = e { }
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:52:15
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | match e {
+ | ^
+ | |
+ | cannot move out of captured variable in an `Fn` closure
+ | help: consider borrowing here: `&e`
+...
+LL | Either::One(_t)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:56:25
+ |
+LL | Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:59:15
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | match e {
+ | ^
+ | |
+ | cannot move out of captured variable in an `Fn` closure
+ | help: consider borrowing here: `&e`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:63:25
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:68:25
+ |
+LL | let x = X(Y);
+ | - captured outer variable
+...
+LL | let X(mut _t) = x;
+ | ------ ^
+ | | |
+ | | cannot move out of captured variable in an `Fn` closure
+ | | help: consider borrowing here: `&x`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:68:15
+ |
+LL | let X(mut _t) = x;
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:72:38
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | if let Either::One(mut _t) = em { }
+ | ------ ^^
+ | | |
+ | | cannot move out of captured variable in an `Fn` closure
+ | | help: consider borrowing here: `&em`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:72:28
+ |
+LL | if let Either::One(mut _t) = em { }
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:76:41
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | while let Either::One(mut _t) = em { }
+ | ------ ^^
+ | | |
+ | | cannot move out of captured variable in an `Fn` closure
+ | | help: consider borrowing here: `&em`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:76:31
+ |
+LL | while let Either::One(mut _t) = em { }
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:80:15
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | match em {
+ | ^^
+ | |
+ | cannot move out of captured variable in an `Fn` closure
+ | help: consider borrowing here: `&em`
+...
+LL | Either::One(mut _t)
+ | ------ data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:84:25
+ |
+LL | Either::One(mut _t)
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/move-into-closure.rs:87:15
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | match em {
+ | ^^
+ | |
+ | cannot move out of captured variable in an `Fn` closure
+ | help: consider borrowing here: `&em`
+...
+LL | Either::One(mut _t) => (),
+ | ------ data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:91:25
+ |
+LL | Either::One(mut _t) => (),
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:107:21
+ |
+LL | let x = X(Y);
+ | - captured outer variable
+...
+LL | let X(_t) = x;
+ | -- ^
+ | | |
+ | | cannot move out of captured variable in an `FnMut` closure
+ | | help: consider borrowing here: `&x`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:107:15
+ |
+LL | let X(_t) = x;
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:111:34
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | if let Either::One(_t) = e { }
+ | -- ^
+ | | |
+ | | cannot move out of captured variable in an `FnMut` closure
+ | | help: consider borrowing here: `&e`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:111:28
+ |
+LL | if let Either::One(_t) = e { }
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:115:37
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | while let Either::One(_t) = e { }
+ | -- ^
+ | | |
+ | | cannot move out of captured variable in an `FnMut` closure
+ | | help: consider borrowing here: `&e`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:115:31
+ |
+LL | while let Either::One(_t) = e { }
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:119:15
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | match e {
+ | ^
+ | |
+ | cannot move out of captured variable in an `FnMut` closure
+ | help: consider borrowing here: `&e`
+...
+LL | Either::One(_t)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:123:25
+ |
+LL | Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:126:15
+ |
+LL | let e = Either::One(X(Y));
+ | - captured outer variable
+...
+LL | match e {
+ | ^
+ | |
+ | cannot move out of captured variable in an `FnMut` closure
+ | help: consider borrowing here: `&e`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:130:25
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:135:25
+ |
+LL | let x = X(Y);
+ | - captured outer variable
+...
+LL | let X(mut _t) = x;
+ | ------ ^
+ | | |
+ | | cannot move out of captured variable in an `FnMut` closure
+ | | help: consider borrowing here: `&x`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:135:15
+ |
+LL | let X(mut _t) = x;
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:139:38
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | if let Either::One(mut _t) = em { }
+ | ------ ^^
+ | | |
+ | | cannot move out of captured variable in an `FnMut` closure
+ | | help: consider borrowing here: `&em`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:139:28
+ |
+LL | if let Either::One(mut _t) = em { }
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:143:41
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | while let Either::One(mut _t) = em { }
+ | ------ ^^
+ | | |
+ | | cannot move out of captured variable in an `FnMut` closure
+ | | help: consider borrowing here: `&em`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:143:31
+ |
+LL | while let Either::One(mut _t) = em { }
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:147:15
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | match em {
+ | ^^
+ | |
+ | cannot move out of captured variable in an `FnMut` closure
+ | help: consider borrowing here: `&em`
+...
+LL | Either::One(mut _t)
+ | ------ data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:151:25
+ |
+LL | Either::One(mut _t)
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:154:15
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | match em {
+ | ^^
+ | |
+ | cannot move out of captured variable in an `FnMut` closure
+ | help: consider borrowing here: `&em`
+...
+LL | Either::One(mut _t) => (),
+ | ------ data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:158:25
+ |
+LL | Either::One(mut _t) => (),
+ | ^^^^^^
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/move-into-closure.rs:162:15
+ |
+LL | let mut em = Either::One(X(Y));
+ | ------ captured outer variable
+...
+LL | match em {
+ | ^^
+ | |
+ | cannot move out of captured variable in an `FnMut` closure
+ | help: consider borrowing here: `&em`
+...
+LL | Either::One(mut _t) => (),
+ | ------ data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/move-into-closure.rs:166:25
+ |
+LL | Either::One(mut _t) => (),
+ | ^^^^^^
+
+error: aborting due to 21 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.rs b/src/test/ui/suggestions/dont-suggest-ref/simple.rs
new file mode 100644
index 0000000..474e88c
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-ref/simple.rs
@@ -0,0 +1,376 @@
+// 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.
+
+#![feature(nll)]
+
+#[derive(Clone)]
+enum Either {
+ One(X),
+ Two(X),
+}
+
+#[derive(Clone)]
+struct X(Y);
+
+#[derive(Clone)]
+struct Y;
+
+pub fn main() {
+ let e = Either::One(X(Y));
+ let mut em = Either::One(X(Y));
+
+ let r = &e;
+ let rm = &mut Either::One(X(Y));
+
+ let x = X(Y);
+ let mut xm = X(Y);
+
+ let s = &x;
+ let sm = &mut X(Y);
+
+ let ve = vec![Either::One(X(Y))];
+
+ let vr = &ve;
+ let vrm = &mut vec![Either::One(X(Y))];
+
+ let vx = vec![X(Y)];
+
+ let vs = &vx;
+ let vsm = &mut vec![X(Y)];
+
+ // -------- move from Either/X place --------
+
+ let X(_t) = *s;
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION s
+ if let Either::One(_t) = *r { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION r
+ while let Either::One(_t) = *r { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION r
+ match *r {
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION r
+ Either::One(_t)
+ | Either::Two(_t) => (),
+ }
+ match *r {
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION r
+ Either::One(_t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+
+ let X(_t) = *sm;
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION sm
+ if let Either::One(_t) = *rm { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION rm
+ while let Either::One(_t) = *rm { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION rm
+ match *rm {
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION rm
+ Either::One(_t)
+ | Either::Two(_t) => (),
+ }
+ match *rm {
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION rm
+ Either::One(_t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+ match *rm {
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `*`
+ //~| SUGGESTION rm
+ Either::One(_t) => (),
+ Either::Two(ref mut _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+
+ let X(_t) = vs[0];
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vs[0]
+ if let Either::One(_t) = vr[0] { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vr[0]
+ while let Either::One(_t) = vr[0] { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vr[0]
+ match vr[0] {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vr[0]
+ Either::One(_t)
+ | Either::Two(_t) => (),
+ }
+ match vr[0] {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vr[0]
+ Either::One(_t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+
+ let X(_t) = vsm[0];
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vsm[0]
+ if let Either::One(_t) = vrm[0] { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vrm[0]
+ while let Either::One(_t) = vrm[0] { }
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vrm[0]
+ match vrm[0] {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vrm[0]
+ Either::One(_t)
+ | Either::Two(_t) => (),
+ }
+ match vrm[0] {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vrm[0]
+ Either::One(_t) => (),
+ Either::Two(ref _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+ match vrm[0] {
+ //~^ ERROR cannot move
+ //~| HELP consider borrowing here
+ //~| SUGGESTION &vrm[0]
+ Either::One(_t) => (),
+ Either::Two(ref mut _t) => (),
+ // FIXME: should suggest removing `ref` too
+ }
+
+ // -------- move from &Either/&X place --------
+
+ let &X(_t) = s;
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION X(_t)
+ if let &Either::One(_t) = r { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ while let &Either::One(_t) = r { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ match r {
+ //~^ ERROR cannot move
+ &Either::One(_t)
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ | &Either::Two(_t) => (),
+ // FIXME: would really like a suggestion here too
+ }
+ match r {
+ //~^ ERROR cannot move
+ &Either::One(_t) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ &Either::Two(ref _t) => (),
+ }
+ match r {
+ //~^ ERROR cannot move
+ &Either::One(_t) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ Either::Two(_t) => (),
+ }
+ fn f1(&X(_t): &X) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION X(_t)
+
+ let &mut X(_t) = sm;
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION X(_t)
+ if let &mut Either::One(_t) = rm { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ while let &mut Either::One(_t) = rm { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ match rm {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ &mut Either::Two(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::Two(_t)
+ }
+ match rm {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ &mut Either::Two(ref _t) => (),
+ }
+ match rm {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ &mut Either::Two(ref mut _t) => (),
+ }
+ match rm {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ Either::Two(_t) => (),
+ }
+ fn f2(&mut X(_t): &mut X) { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION X(_t)
+
+ // -------- move from tuple of &Either/&X --------
+
+ // FIXME: These should have suggestions.
+
+ let (&X(_t),) = (&x.clone(),);
+ //~^ ERROR cannot move
+ if let (&Either::One(_t),) = (&e.clone(),) { }
+ //~^ ERROR cannot move
+ while let (&Either::One(_t),) = (&e.clone(),) { }
+ //~^ ERROR cannot move
+ match (&e.clone(),) {
+ //~^ ERROR cannot move
+ (&Either::One(_t),)
+ | (&Either::Two(_t),) => (),
+ }
+ fn f3((&X(_t),): (&X,)) { }
+ //~^ ERROR cannot move
+
+ let (&mut X(_t),) = (&mut xm.clone(),);
+ //~^ ERROR cannot move
+ if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
+ //~^ ERROR cannot move
+ while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
+ //~^ ERROR cannot move
+ match (&mut em.clone(),) {
+ //~^ ERROR cannot move
+ (&mut Either::One(_t),) => (),
+ (&mut Either::Two(_t),) => (),
+ }
+ fn f4((&mut X(_t),): (&mut X,)) { }
+ //~^ ERROR cannot move
+
+ // -------- move from &Either/&X value --------
+
+ let &X(_t) = &x;
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION X(_t)
+ if let &Either::One(_t) = &e { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ while let &Either::One(_t) = &e { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ match &e {
+ //~^ ERROR cannot move
+ &Either::One(_t)
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ | &Either::Two(_t) => (),
+ // FIXME: would really like a suggestion here too
+ }
+ match &e {
+ //~^ ERROR cannot move
+ &Either::One(_t) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ &Either::Two(ref _t) => (),
+ }
+ match &e {
+ //~^ ERROR cannot move
+ &Either::One(_t) => (),
+ //~^ HELP consider removing the `&`
+ //~| SUGGESTION Either::One(_t)
+ Either::Two(_t) => (),
+ }
+
+ let &mut X(_t) = &mut xm;
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION X(_t)
+ if let &mut Either::One(_t) = &mut em { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ while let &mut Either::One(_t) = &mut em { }
+ //~^ ERROR cannot move
+ //~| HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ match &mut em {
+ //~^ ERROR cannot move
+ &mut Either::One(_t)
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ | &mut Either::Two(_t) => (),
+ // FIXME: would really like a suggestion here too
+ }
+ match &mut em {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ &mut Either::Two(ref _t) => (),
+ }
+ match &mut em {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ &mut Either::Two(ref mut _t) => (),
+ }
+ match &mut em {
+ //~^ ERROR cannot move
+ &mut Either::One(_t) => (),
+ //~^ HELP consider removing the `&mut`
+ //~| SUGGESTION Either::One(_t)
+ Either::Two(_t) => (),
+ }
+}
diff --git a/src/test/ui/suggestions/dont-suggest-ref/simple.stderr b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr
new file mode 100644
index 0000000..d7a32db
--- /dev/null
+++ b/src/test/ui/suggestions/dont-suggest-ref/simple.stderr
@@ -0,0 +1,998 @@
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:50:17
+ |
+LL | let X(_t) = *s;
+ | -- ^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider removing the `*`: `s`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:50:11
+ |
+LL | let X(_t) = *s;
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:54:30
+ |
+LL | if let Either::One(_t) = *r { }
+ | -- ^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider removing the `*`: `r`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:54:24
+ |
+LL | if let Either::One(_t) = *r { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:58:33
+ |
+LL | while let Either::One(_t) = *r { }
+ | -- ^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider removing the `*`: `r`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:58:27
+ |
+LL | while let Either::One(_t) = *r { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:62:11
+ |
+LL | match *r {
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
+...
+LL | Either::One(_t)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:66:21
+ |
+LL | Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:69:11
+ |
+LL | match *r {
+ | ^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `r`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:73:21
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:78:17
+ |
+LL | let X(_t) = *sm;
+ | -- ^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider removing the `*`: `sm`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:78:11
+ |
+LL | let X(_t) = *sm;
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:82:30
+ |
+LL | if let Either::One(_t) = *rm { }
+ | -- ^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider removing the `*`: `rm`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:82:24
+ |
+LL | if let Either::One(_t) = *rm { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:86:33
+ |
+LL | while let Either::One(_t) = *rm { }
+ | -- ^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider removing the `*`: `rm`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:86:27
+ |
+LL | while let Either::One(_t) = *rm { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:90:11
+ |
+LL | match *rm {
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `rm`
+...
+LL | Either::One(_t)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:94:21
+ |
+LL | Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:97:11
+ |
+LL | match *rm {
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `rm`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:101:21
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:105:11
+ |
+LL | match *rm {
+ | ^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider removing the `*`: `rm`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:109:21
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:114:17
+ |
+LL | let X(_t) = vs[0];
+ | -- ^^^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider borrowing here: `&vs[0]`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:114:11
+ |
+LL | let X(_t) = vs[0];
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:118:30
+ |
+LL | if let Either::One(_t) = vr[0] { }
+ | -- ^^^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider borrowing here: `&vr[0]`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:118:24
+ |
+LL | if let Either::One(_t) = vr[0] { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:122:33
+ |
+LL | while let Either::One(_t) = vr[0] { }
+ | -- ^^^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider borrowing here: `&vr[0]`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:122:27
+ |
+LL | while let Either::One(_t) = vr[0] { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:126:11
+ |
+LL | match vr[0] {
+ | ^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&vr[0]`
+...
+LL | Either::One(_t)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:130:21
+ |
+LL | Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:133:11
+ |
+LL | match vr[0] {
+ | ^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&vr[0]`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:137:21
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:142:17
+ |
+LL | let X(_t) = vsm[0];
+ | -- ^^^^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider borrowing here: `&vsm[0]`
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:142:11
+ |
+LL | let X(_t) = vsm[0];
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:146:30
+ |
+LL | if let Either::One(_t) = vrm[0] { }
+ | -- ^^^^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider borrowing here: `&vrm[0]`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:146:24
+ |
+LL | if let Either::One(_t) = vrm[0] { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:150:33
+ |
+LL | while let Either::One(_t) = vrm[0] { }
+ | -- ^^^^^^
+ | | |
+ | | cannot move out of borrowed content
+ | | help: consider borrowing here: `&vrm[0]`
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:150:27
+ |
+LL | while let Either::One(_t) = vrm[0] { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:154:11
+ |
+LL | match vrm[0] {
+ | ^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&vrm[0]`
+...
+LL | Either::One(_t)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:158:21
+ |
+LL | Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:161:11
+ |
+LL | match vrm[0] {
+ | ^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&vrm[0]`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:165:21
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:169:11
+ |
+LL | match vrm[0] {
+ | ^^^^^^
+ | |
+ | cannot move out of borrowed content
+ | help: consider borrowing here: `&vrm[0]`
+...
+LL | Either::One(_t) => (),
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:173:21
+ |
+LL | Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:180:18
+ |
+LL | let &X(_t) = s;
+ | ------ ^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `X(_t)`
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:180:12
+ |
+LL | let &X(_t) = s;
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:184:31
+ |
+LL | if let &Either::One(_t) = r { }
+ | ---------------- ^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:184:25
+ |
+LL | if let &Either::One(_t) = r { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:188:34
+ |
+LL | while let &Either::One(_t) = r { }
+ | ---------------- ^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:188:28
+ |
+LL | while let &Either::One(_t) = r { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:192:11
+ |
+LL | match r {
+ | ^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &Either::One(_t)
+ | ----------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:194:22
+ |
+LL | &Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:200:11
+ |
+LL | match r {
+ | ^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &Either::One(_t) => (),
+ | ----------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:202:22
+ |
+LL | &Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:207:11
+ |
+LL | match r {
+ | ^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &Either::One(_t) => (),
+ | ----------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:209:22
+ |
+LL | &Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:219:22
+ |
+LL | let &mut X(_t) = sm;
+ | ---------- ^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `X(_t)`
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:219:16
+ |
+LL | let &mut X(_t) = sm;
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:223:35
+ |
+LL | if let &mut Either::One(_t) = rm { }
+ | -------------------- ^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:223:29
+ |
+LL | if let &mut Either::One(_t) = rm { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:227:38
+ |
+LL | while let &mut Either::One(_t) = rm { }
+ | -------------------- ^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:227:32
+ |
+LL | while let &mut Either::One(_t) = rm { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:231:11
+ |
+LL | match rm {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | -- data moved here
+...
+LL | &mut Either::Two(_t) => (),
+ | -- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/simple.rs:233:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+...
+LL | &mut Either::Two(_t) => (),
+ | ^^
+help: consider removing the `&mut`
+ |
+LL | Either::One(_t) => (),
+ | ^^^^^^^^^^^^^^^
+help: consider removing the `&mut`
+ |
+LL | Either::Two(_t) => (),
+ | ^^^^^^^^^^^^^^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:240:11
+ |
+LL | match rm {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:242:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:247:11
+ |
+LL | match rm {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:249:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:254:11
+ |
+LL | match rm {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:256:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:270:21
+ |
+LL | let (&X(_t),) = (&x.clone(),);
+ | -- ^^^^^^^^^^^^^ cannot move out of borrowed content
+ | |
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:270:13
+ |
+LL | let (&X(_t),) = (&x.clone(),);
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:272:34
+ |
+LL | if let (&Either::One(_t),) = (&e.clone(),) { }
+ | -- ^^^^^^^^^^^^^ cannot move out of borrowed content
+ | |
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:272:26
+ |
+LL | if let (&Either::One(_t),) = (&e.clone(),) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:274:37
+ |
+LL | while let (&Either::One(_t),) = (&e.clone(),) { }
+ | -- ^^^^^^^^^^^^^ cannot move out of borrowed content
+ | |
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:274:29
+ |
+LL | while let (&Either::One(_t),) = (&e.clone(),) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:276:11
+ |
+LL | match (&e.clone(),) {
+ | ^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | (&Either::One(_t),)
+ | -- data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:278:23
+ |
+LL | (&Either::One(_t),)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:284:25
+ |
+LL | let (&mut X(_t),) = (&mut xm.clone(),);
+ | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | |
+ | data moved here
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:284:17
+ |
+LL | let (&mut X(_t),) = (&mut xm.clone(),);
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:286:38
+ |
+LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
+ | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | |
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:286:30
+ |
+LL | if let (&mut Either::One(_t),) = (&mut em.clone(),) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:288:41
+ |
+LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
+ | -- ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+ | |
+ | data moved here
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:288:33
+ |
+LL | while let (&mut Either::One(_t),) = (&mut em.clone(),) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:290:11
+ |
+LL | match (&mut em.clone(),) {
+ | ^^^^^^^^^^^^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | (&mut Either::One(_t),) => (),
+ | -- data moved here
+LL | (&mut Either::Two(_t),) => (),
+ | -- ...and here
+ |
+note: move occurs because these variables have types that don't implement the `Copy` trait
+ --> $DIR/simple.rs:292:27
+ |
+LL | (&mut Either::One(_t),) => (),
+ | ^^
+LL | (&mut Either::Two(_t),) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:300:18
+ |
+LL | let &X(_t) = &x;
+ | ------ ^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `X(_t)`
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:300:12
+ |
+LL | let &X(_t) = &x;
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:304:31
+ |
+LL | if let &Either::One(_t) = &e { }
+ | ---------------- ^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:304:25
+ |
+LL | if let &Either::One(_t) = &e { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:308:34
+ |
+LL | while let &Either::One(_t) = &e { }
+ | ---------------- ^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:308:28
+ |
+LL | while let &Either::One(_t) = &e { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:312:11
+ |
+LL | match &e {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &Either::One(_t)
+ | ----------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:314:22
+ |
+LL | &Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:320:11
+ |
+LL | match &e {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &Either::One(_t) => (),
+ | ----------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:322:22
+ |
+LL | &Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:327:11
+ |
+LL | match &e {
+ | ^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &Either::One(_t) => (),
+ | ----------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:329:22
+ |
+LL | &Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:335:22
+ |
+LL | let &mut X(_t) = &mut xm;
+ | ---------- ^^^^^^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `X(_t)`
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:335:16
+ |
+LL | let &mut X(_t) = &mut xm;
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:339:35
+ |
+LL | if let &mut Either::One(_t) = &mut em { }
+ | -------------------- ^^^^^^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:339:29
+ |
+LL | if let &mut Either::One(_t) = &mut em { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:343:38
+ |
+LL | while let &mut Either::One(_t) = &mut em { }
+ | -------------------- ^^^^^^^ cannot move out of borrowed content
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:343:32
+ |
+LL | while let &mut Either::One(_t) = &mut em { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:347:11
+ |
+LL | match &mut em {
+ | ^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t)
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:349:26
+ |
+LL | &mut Either::One(_t)
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:355:11
+ |
+LL | match &mut em {
+ | ^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:357:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:362:11
+ |
+LL | match &mut em {
+ | ^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:364:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:369:11
+ |
+LL | match &mut em {
+ | ^^^^^^^ cannot move out of borrowed content
+LL | //~^ ERROR cannot move
+LL | &mut Either::One(_t) => (),
+ | --------------------
+ | | |
+ | | data moved here
+ | help: consider removing the `&mut`: `Either::One(_t)`
+ |
+note: move occurs because `_t` has type `X`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:371:26
+ |
+LL | &mut Either::One(_t) => (),
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:214:11
+ |
+LL | fn f1(&X(_t): &X) { }
+ | ^^^--^
+ | | |
+ | | data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&`: `X(_t)`
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:214:14
+ |
+LL | fn f1(&X(_t): &X) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:261:11
+ |
+LL | fn f2(&mut X(_t): &mut X) { }
+ | ^^^^^^^--^
+ | | |
+ | | data moved here
+ | cannot move out of borrowed content
+ | help: consider removing the `&mut`: `X(_t)`
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:261:18
+ |
+LL | fn f2(&mut X(_t): &mut X) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:281:11
+ |
+LL | fn f3((&X(_t),): (&X,)) { }
+ | ^^^^--^^^
+ | | |
+ | | data moved here
+ | cannot move out of borrowed content
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:281:15
+ |
+LL | fn f3((&X(_t),): (&X,)) { }
+ | ^^
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/simple.rs:295:11
+ |
+LL | fn f4((&mut X(_t),): (&mut X,)) { }
+ | ^^^^^^^^--^^^
+ | | |
+ | | data moved here
+ | cannot move out of borrowed content
+ |
+note: move occurs because `_t` has type `Y`, which does not implement the `Copy` trait
+ --> $DIR/simple.rs:295:19
+ |
+LL | fn f4((&mut X(_t),): (&mut X,)) { }
+ | ^^
+
+error: aborting due to 60 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/suggest-labels.rs b/src/test/ui/suggestions/suggest-labels.rs
similarity index 100%
rename from src/test/ui/suggest-labels.rs
rename to src/test/ui/suggestions/suggest-labels.rs
diff --git a/src/test/ui/suggest-labels.stderr b/src/test/ui/suggestions/suggest-labels.stderr
similarity index 100%
rename from src/test/ui/suggest-labels.stderr
rename to src/test/ui/suggestions/suggest-labels.stderr
diff --git a/src/test/ui/suggest-methods.rs b/src/test/ui/suggestions/suggest-methods.rs
similarity index 100%
rename from src/test/ui/suggest-methods.rs
rename to src/test/ui/suggestions/suggest-methods.rs
diff --git a/src/test/ui/suggest-methods.stderr b/src/test/ui/suggestions/suggest-methods.stderr
similarity index 100%
rename from src/test/ui/suggest-methods.stderr
rename to src/test/ui/suggestions/suggest-methods.stderr
diff --git a/src/test/ui/suggest-private-fields.rs b/src/test/ui/suggestions/suggest-private-fields.rs
similarity index 100%
rename from src/test/ui/suggest-private-fields.rs
rename to src/test/ui/suggestions/suggest-private-fields.rs
diff --git a/src/test/ui/suggest-private-fields.stderr b/src/test/ui/suggestions/suggest-private-fields.stderr
similarity index 100%
rename from src/test/ui/suggest-private-fields.stderr
rename to src/test/ui/suggestions/suggest-private-fields.stderr
diff --git a/src/test/ui/suggest-ref-mut.rs b/src/test/ui/suggestions/suggest-ref-mut.rs
similarity index 100%
rename from src/test/ui/suggest-ref-mut.rs
rename to src/test/ui/suggestions/suggest-ref-mut.rs
diff --git a/src/test/ui/suggest-ref-mut.stderr b/src/test/ui/suggestions/suggest-ref-mut.stderr
similarity index 100%
rename from src/test/ui/suggest-ref-mut.stderr
rename to src/test/ui/suggestions/suggest-ref-mut.stderr
diff --git a/src/test/ui/suggest-remove-refs-1.rs b/src/test/ui/suggestions/suggest-remove-refs-1.rs
similarity index 100%
rename from src/test/ui/suggest-remove-refs-1.rs
rename to src/test/ui/suggestions/suggest-remove-refs-1.rs
diff --git a/src/test/ui/suggest-remove-refs-1.stderr b/src/test/ui/suggestions/suggest-remove-refs-1.stderr
similarity index 100%
rename from src/test/ui/suggest-remove-refs-1.stderr
rename to src/test/ui/suggestions/suggest-remove-refs-1.stderr
diff --git a/src/test/ui/suggest-remove-refs-2.rs b/src/test/ui/suggestions/suggest-remove-refs-2.rs
similarity index 100%
rename from src/test/ui/suggest-remove-refs-2.rs
rename to src/test/ui/suggestions/suggest-remove-refs-2.rs
diff --git a/src/test/ui/suggest-remove-refs-2.stderr b/src/test/ui/suggestions/suggest-remove-refs-2.stderr
similarity index 100%
rename from src/test/ui/suggest-remove-refs-2.stderr
rename to src/test/ui/suggestions/suggest-remove-refs-2.stderr
diff --git a/src/test/ui/suggest-remove-refs-3.rs b/src/test/ui/suggestions/suggest-remove-refs-3.rs
similarity index 100%
rename from src/test/ui/suggest-remove-refs-3.rs
rename to src/test/ui/suggestions/suggest-remove-refs-3.rs
diff --git a/src/test/ui/suggest-remove-refs-3.stderr b/src/test/ui/suggestions/suggest-remove-refs-3.stderr
similarity index 100%
rename from src/test/ui/suggest-remove-refs-3.stderr
rename to src/test/ui/suggestions/suggest-remove-refs-3.stderr
diff --git a/src/test/compile-fail/super-at-top-level.rs b/src/test/ui/super-at-top-level.rs
similarity index 100%
rename from src/test/compile-fail/super-at-top-level.rs
rename to src/test/ui/super-at-top-level.rs
diff --git a/src/test/ui/super-at-top-level.stderr b/src/test/ui/super-at-top-level.stderr
new file mode 100644
index 0000000..b4af730
--- /dev/null
+++ b/src/test/ui/super-at-top-level.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. There are too many initial `super`s.
+ --> $DIR/super-at-top-level.rs:11:5
+ |
+LL | use super::f; //~ ERROR There are too many initial `super`s
+ | ^^^^^ There are too many initial `super`s.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/compile-fail/suppressed-error.rs b/src/test/ui/suppressed-error.rs
similarity index 100%
rename from src/test/compile-fail/suppressed-error.rs
rename to src/test/ui/suppressed-error.rs
diff --git a/src/test/ui/suppressed-error.stderr b/src/test/ui/suppressed-error.stderr
new file mode 100644
index 0000000..d17e7cb
--- /dev/null
+++ b/src/test/ui/suppressed-error.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/suppressed-error.rs:12:9
+ |
+LL | let (x, y) = ();
+ | ^^^^^^ expected (), found tuple
+ |
+ = note: expected type `()`
+ found type `(_, _)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/auxiliary/svh-a-base.rs b/src/test/ui/svh/auxiliary/svh-a-base.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-base.rs
rename to src/test/ui/svh/auxiliary/svh-a-base.rs
diff --git a/src/test/ui/auxiliary/svh-a-change-lit.rs b/src/test/ui/svh/auxiliary/svh-a-change-lit.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-change-lit.rs
rename to src/test/ui/svh/auxiliary/svh-a-change-lit.rs
diff --git a/src/test/ui/auxiliary/svh-a-change-significant-cfg.rs b/src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-change-significant-cfg.rs
rename to src/test/ui/svh/auxiliary/svh-a-change-significant-cfg.rs
diff --git a/src/test/ui/auxiliary/svh-a-change-trait-bound.rs b/src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-change-trait-bound.rs
rename to src/test/ui/svh/auxiliary/svh-a-change-trait-bound.rs
diff --git a/src/test/ui/auxiliary/svh-a-change-type-arg.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-change-type-arg.rs
rename to src/test/ui/svh/auxiliary/svh-a-change-type-arg.rs
diff --git a/src/test/ui/auxiliary/svh-a-change-type-ret.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-change-type-ret.rs
rename to src/test/ui/svh/auxiliary/svh-a-change-type-ret.rs
diff --git a/src/test/ui/auxiliary/svh-a-change-type-static.rs b/src/test/ui/svh/auxiliary/svh-a-change-type-static.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-a-change-type-static.rs
rename to src/test/ui/svh/auxiliary/svh-a-change-type-static.rs
diff --git a/src/test/ui/auxiliary/svh-b.rs b/src/test/ui/svh/auxiliary/svh-b.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-b.rs
rename to src/test/ui/svh/auxiliary/svh-b.rs
diff --git a/src/test/ui/auxiliary/svh-uta-base.rs b/src/test/ui/svh/auxiliary/svh-uta-base.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-uta-base.rs
rename to src/test/ui/svh/auxiliary/svh-uta-base.rs
diff --git a/src/test/ui/auxiliary/svh-uta-change-use-trait.rs b/src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-uta-change-use-trait.rs
rename to src/test/ui/svh/auxiliary/svh-uta-change-use-trait.rs
diff --git a/src/test/ui/auxiliary/svh-utb.rs b/src/test/ui/svh/auxiliary/svh-utb.rs
similarity index 100%
rename from src/test/ui/auxiliary/svh-utb.rs
rename to src/test/ui/svh/auxiliary/svh-utb.rs
diff --git a/src/test/ui/svh-change-lit.rs b/src/test/ui/svh/svh-change-lit.rs
similarity index 100%
rename from src/test/ui/svh-change-lit.rs
rename to src/test/ui/svh/svh-change-lit.rs
diff --git a/src/test/ui/svh-change-lit.stderr b/src/test/ui/svh/svh-change-lit.stderr
similarity index 100%
rename from src/test/ui/svh-change-lit.stderr
rename to src/test/ui/svh/svh-change-lit.stderr
diff --git a/src/test/ui/svh-change-significant-cfg.rs b/src/test/ui/svh/svh-change-significant-cfg.rs
similarity index 100%
rename from src/test/ui/svh-change-significant-cfg.rs
rename to src/test/ui/svh/svh-change-significant-cfg.rs
diff --git a/src/test/ui/svh-change-significant-cfg.stderr b/src/test/ui/svh/svh-change-significant-cfg.stderr
similarity index 100%
rename from src/test/ui/svh-change-significant-cfg.stderr
rename to src/test/ui/svh/svh-change-significant-cfg.stderr
diff --git a/src/test/ui/svh-change-trait-bound.rs b/src/test/ui/svh/svh-change-trait-bound.rs
similarity index 100%
rename from src/test/ui/svh-change-trait-bound.rs
rename to src/test/ui/svh/svh-change-trait-bound.rs
diff --git a/src/test/ui/svh-change-trait-bound.stderr b/src/test/ui/svh/svh-change-trait-bound.stderr
similarity index 100%
rename from src/test/ui/svh-change-trait-bound.stderr
rename to src/test/ui/svh/svh-change-trait-bound.stderr
diff --git a/src/test/ui/svh-change-type-arg.rs b/src/test/ui/svh/svh-change-type-arg.rs
similarity index 100%
rename from src/test/ui/svh-change-type-arg.rs
rename to src/test/ui/svh/svh-change-type-arg.rs
diff --git a/src/test/ui/svh-change-type-arg.stderr b/src/test/ui/svh/svh-change-type-arg.stderr
similarity index 100%
rename from src/test/ui/svh-change-type-arg.stderr
rename to src/test/ui/svh/svh-change-type-arg.stderr
diff --git a/src/test/ui/svh-change-type-ret.rs b/src/test/ui/svh/svh-change-type-ret.rs
similarity index 100%
rename from src/test/ui/svh-change-type-ret.rs
rename to src/test/ui/svh/svh-change-type-ret.rs
diff --git a/src/test/ui/svh-change-type-ret.stderr b/src/test/ui/svh/svh-change-type-ret.stderr
similarity index 100%
rename from src/test/ui/svh-change-type-ret.stderr
rename to src/test/ui/svh/svh-change-type-ret.stderr
diff --git a/src/test/ui/svh-change-type-static.rs b/src/test/ui/svh/svh-change-type-static.rs
similarity index 100%
rename from src/test/ui/svh-change-type-static.rs
rename to src/test/ui/svh/svh-change-type-static.rs
diff --git a/src/test/ui/svh-change-type-static.stderr b/src/test/ui/svh/svh-change-type-static.stderr
similarity index 100%
rename from src/test/ui/svh-change-type-static.stderr
rename to src/test/ui/svh/svh-change-type-static.stderr
diff --git a/src/test/ui/svh-use-trait.rs b/src/test/ui/svh/svh-use-trait.rs
similarity index 100%
rename from src/test/ui/svh-use-trait.rs
rename to src/test/ui/svh/svh-use-trait.rs
diff --git a/src/test/ui/svh-use-trait.stderr b/src/test/ui/svh/svh-use-trait.stderr
similarity index 100%
rename from src/test/ui/svh-use-trait.stderr
rename to src/test/ui/svh/svh-use-trait.stderr
diff --git a/src/test/compile-fail/symbol-names/basic.rs b/src/test/ui/symbol-names/basic.rs
similarity index 100%
rename from src/test/compile-fail/symbol-names/basic.rs
rename to src/test/ui/symbol-names/basic.rs
diff --git a/src/test/ui/symbol-names/basic.stderr b/src/test/ui/symbol-names/basic.stderr
new file mode 100644
index 0000000..eeeb1b5
--- /dev/null
+++ b/src/test/ui/symbol-names/basic.stderr
@@ -0,0 +1,14 @@
+error: symbol-name(_ZN5basic4main17h2138d548fb9814b6E)
+ --> $DIR/basic.rs:13:1
+ |
+LL | #[rustc_symbol_name] //~ ERROR _ZN5basic4main
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: item-path(main)
+ --> $DIR/basic.rs:14:1
+ |
+LL | #[rustc_item_path] //~ ERROR item-path(main)
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/symbol-names/impl1.rs b/src/test/ui/symbol-names/impl1.rs
similarity index 100%
rename from src/test/compile-fail/symbol-names/impl1.rs
rename to src/test/ui/symbol-names/impl1.rs
diff --git a/src/test/ui/symbol-names/impl1.stderr b/src/test/ui/symbol-names/impl1.stderr
new file mode 100644
index 0000000..edce692
--- /dev/null
+++ b/src/test/ui/symbol-names/impl1.stderr
@@ -0,0 +1,26 @@
+error: symbol-name(_ZN5impl13foo3Foo3bar17h8da62e6147ff602fE)
+ --> $DIR/impl1.rs:18:9
+ |
+LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13foo3Foo3bar
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: item-path(foo::Foo::bar)
+ --> $DIR/impl1.rs:19:9
+ |
+LL | #[rustc_item_path] //~ ERROR item-path(foo::Foo::bar)
+ | ^^^^^^^^^^^^^^^^^^
+
+error: symbol-name(_ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz17h374cb8f6185db9b4E)
+ --> $DIR/impl1.rs:28:9
+ |
+LL | #[rustc_symbol_name] //~ ERROR _ZN5impl13bar33_$LT$impl$u20$impl1..foo..Foo$GT$3baz
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: item-path(bar::<impl foo::Foo>::baz)
+ --> $DIR/impl1.rs:29:9
+ |
+LL | #[rustc_item_path] //~ ERROR item-path(bar::<impl foo::Foo>::baz)
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/syntax-extension-minor.rs b/src/test/ui/syntax-extension-minor.rs
similarity index 100%
rename from src/test/compile-fail/syntax-extension-minor.rs
rename to src/test/ui/syntax-extension-minor.rs
diff --git a/src/test/ui/syntax-extension-minor.stderr b/src/test/ui/syntax-extension-minor.stderr
new file mode 100644
index 0000000..7df1f30
--- /dev/null
+++ b/src/test/ui/syntax-extension-minor.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find value `asdf_fdsa` in this scope
+ --> $DIR/syntax-extension-minor.rs:20:13
+ |
+LL | assert!(concat_idents!(asd, f_f, dsa) == "<.<".to_string());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/syntax-trait-polarity-feature-gate.rs b/src/test/ui/syntax-trait-polarity-feature-gate.rs
similarity index 100%
rename from src/test/compile-fail/syntax-trait-polarity-feature-gate.rs
rename to src/test/ui/syntax-trait-polarity-feature-gate.rs
diff --git a/src/test/ui/syntax-trait-polarity-feature-gate.stderr b/src/test/ui/syntax-trait-polarity-feature-gate.stderr
new file mode 100644
index 0000000..eebd018
--- /dev/null
+++ b/src/test/ui/syntax-trait-polarity-feature-gate.stderr
@@ -0,0 +1,11 @@
+error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now (see issue #13231)
+ --> $DIR/syntax-trait-polarity-feature-gate.rs:17:1
+ |
+LL | impl !Send for TestType {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(optin_builtin_traits)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/syntax-trait-polarity.rs b/src/test/ui/syntax-trait-polarity.rs
similarity index 100%
rename from src/test/compile-fail/syntax-trait-polarity.rs
rename to src/test/ui/syntax-trait-polarity.rs
diff --git a/src/test/ui/syntax-trait-polarity.stderr b/src/test/ui/syntax-trait-polarity.stderr
new file mode 100644
index 0000000..724ac60
--- /dev/null
+++ b/src/test/ui/syntax-trait-polarity.stderr
@@ -0,0 +1,40 @@
+error: inherent impls cannot be negative
+ --> $DIR/syntax-trait-polarity.rs:17:1
+ |
+LL | impl !TestType {}
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0198]: negative impls cannot be unsafe
+ --> $DIR/syntax-trait-polarity.rs:22:1
+ |
+LL | unsafe impl !Send for TestType {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: inherent impls cannot be negative
+ --> $DIR/syntax-trait-polarity.rs:29:1
+ |
+LL | impl<T> !TestType2<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0198]: negative impls cannot be unsafe
+ --> $DIR/syntax-trait-polarity.rs:32:1
+ |
+LL | unsafe impl<T> !Send for TestType2<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`)
+ --> $DIR/syntax-trait-polarity.rs:24:1
+ |
+LL | impl !TestTrait for TestType {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`)
+ --> $DIR/syntax-trait-polarity.rs:34:1
+ |
+LL | impl<T> !TestTrait for TestType2<T> {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0192, E0198.
+For more information about an error, try `rustc --explain E0192`.
diff --git a/src/test/compile-fail/synthetic-param.rs b/src/test/ui/synthetic-param.rs
similarity index 100%
rename from src/test/compile-fail/synthetic-param.rs
rename to src/test/ui/synthetic-param.rs
diff --git a/src/test/ui/synthetic-param.stderr b/src/test/ui/synthetic-param.stderr
new file mode 100644
index 0000000..2711f6f
--- /dev/null
+++ b/src/test/ui/synthetic-param.stderr
@@ -0,0 +1,21 @@
+error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
+ --> $DIR/synthetic-param.rs:30:5
+ |
+LL | func::<u8>(42); //~ ERROR cannot provide explicit type parameters
+ | ^^^^^^^^^^
+
+error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
+ --> $DIR/synthetic-param.rs:33:5
+ |
+LL | Foo::func::<u8>(42); //~ ERROR cannot provide explicit type parameters
+ | ^^^^^^^^^^^^^^^
+
+error[E0632]: cannot provide explicit type parameters when `impl Trait` is used in argument position.
+ --> $DIR/synthetic-param.rs:36:5
+ |
+LL | Bar::<i8>::func::<u8>(42); //~ ERROR cannot provide explicit type parameters
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0632`.
diff --git a/src/test/compile-fail/tag-that-dare-not-speak-its-name.rs b/src/test/ui/tag-that-dare-not-speak-its-name.rs
similarity index 100%
rename from src/test/compile-fail/tag-that-dare-not-speak-its-name.rs
rename to src/test/ui/tag-that-dare-not-speak-its-name.rs
diff --git a/src/test/ui/tag-that-dare-not-speak-its-name.stderr b/src/test/ui/tag-that-dare-not-speak-its-name.stderr
new file mode 100644
index 0000000..b9580ea
--- /dev/null
+++ b/src/test/ui/tag-that-dare-not-speak-its-name.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/tag-that-dare-not-speak-its-name.rs:22:20
+ |
+LL | let x : char = last(y);
+ | ^^^^^^^ expected char, found enum `std::option::Option`
+ |
+ = note: expected type `char`
+ found type `std::option::Option<_>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/tag-type-args.rs b/src/test/ui/tag-type-args.rs
similarity index 100%
rename from src/test/compile-fail/tag-type-args.rs
rename to src/test/ui/tag-type-args.rs
diff --git a/src/test/ui/tag-type-args.stderr b/src/test/ui/tag-type-args.stderr
new file mode 100644
index 0000000..1431ee9
--- /dev/null
+++ b/src/test/ui/tag-type-args.stderr
@@ -0,0 +1,9 @@
+error[E0243]: wrong number of type arguments: expected 1, found 0
+ --> $DIR/tag-type-args.rs:15:11
+ |
+LL | fn foo(c: quux) { assert!((false)); }
+ | ^^^^ expected 1 type argument
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0243`.
diff --git a/src/test/compile-fail/tag-variant-cast-non-nullary.rs b/src/test/ui/tag-variant-cast-non-nullary.rs
similarity index 100%
rename from src/test/compile-fail/tag-variant-cast-non-nullary.rs
rename to src/test/ui/tag-variant-cast-non-nullary.rs
diff --git a/src/test/ui/tag-variant-cast-non-nullary.stderr b/src/test/ui/tag-variant-cast-non-nullary.stderr
new file mode 100644
index 0000000..1e64c74
--- /dev/null
+++ b/src/test/ui/tag-variant-cast-non-nullary.stderr
@@ -0,0 +1,11 @@
+error[E0605]: non-primitive cast: `non_nullary` as `isize`
+ --> $DIR/tag-variant-cast-non-nullary.rs:18:15
+ |
+LL | let val = v as isize; //~ ERROR non-primitive cast: `non_nullary` as `isize` [E0605]
+ | ^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/tag-variant-disr-dup.rs b/src/test/ui/tag-variant-disr-dup.rs
similarity index 100%
rename from src/test/compile-fail/tag-variant-disr-dup.rs
rename to src/test/ui/tag-variant-disr-dup.rs
diff --git a/src/test/ui/tag-variant-disr-dup.stderr b/src/test/ui/tag-variant-disr-dup.stderr
new file mode 100644
index 0000000..de5a0fa
--- /dev/null
+++ b/src/test/ui/tag-variant-disr-dup.stderr
@@ -0,0 +1,11 @@
+error[E0081]: discriminant value `0` already exists
+ --> $DIR/tag-variant-disr-dup.rs:20:13
+ |
+LL | black = 0x000000,
+ | -------- first use of `0`
+LL | white = 0x000000,
+ | ^^^^^^^^ enum already has `0`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0081`.
diff --git a/src/test/compile-fail/tail-typeck.rs b/src/test/ui/tail-typeck.rs
similarity index 100%
rename from src/test/compile-fail/tail-typeck.rs
rename to src/test/ui/tail-typeck.rs
diff --git a/src/test/ui/tail-typeck.stderr b/src/test/ui/tail-typeck.stderr
new file mode 100644
index 0000000..302bd6a
--- /dev/null
+++ b/src/test/ui/tail-typeck.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/tail-typeck.rs:13:26
+ |
+LL | fn f() -> isize { return g(); }
+ | ^^^ expected isize, found usize
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/target-feature-gate.rs b/src/test/ui/target-feature-gate.rs
index c2dc927..8a04588 100644
--- a/src/test/ui/target-feature-gate.rs
+++ b/src/test/ui/target-feature-gate.rs
@@ -23,6 +23,7 @@
// gate-test-hexagon_target_feature
// gate-test-mips_target_feature
// gate-test-mmx_target_feature
+// gate-test-wasm_target_feature
// min-llvm-version 6.0
#[target_feature(enable = "avx512bw")]
diff --git a/src/test/ui/target-feature-gate.stderr b/src/test/ui/target-feature-gate.stderr
index 24141d0..f18bebc 100644
--- a/src/test/ui/target-feature-gate.stderr
+++ b/src/test/ui/target-feature-gate.stderr
@@ -1,5 +1,5 @@
error[E0658]: the target feature `avx512bw` is currently unstable (see issue #44839)
- --> $DIR/target-feature-gate.rs:28:18
+ --> $DIR/target-feature-gate.rs:29:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/compile-fail/terr-in-field.rs b/src/test/ui/terr-in-field.rs
similarity index 100%
rename from src/test/compile-fail/terr-in-field.rs
rename to src/test/ui/terr-in-field.rs
diff --git a/src/test/ui/terr-in-field.stderr b/src/test/ui/terr-in-field.stderr
new file mode 100644
index 0000000..5d06eef
--- /dev/null
+++ b/src/test/ui/terr-in-field.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/terr-in-field.rs:23:14
+ |
+LL | want_foo(b); //~ ERROR mismatched types
+ | ^ expected struct `foo`, found struct `bar`
+ |
+ = note: expected type `foo`
+ found type `bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/terr-sorts.rs b/src/test/ui/terr-sorts.rs
similarity index 100%
rename from src/test/compile-fail/terr-sorts.rs
rename to src/test/ui/terr-sorts.rs
diff --git a/src/test/ui/terr-sorts.stderr b/src/test/ui/terr-sorts.stderr
new file mode 100644
index 0000000..a16216c
--- /dev/null
+++ b/src/test/ui/terr-sorts.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/terr-sorts.rs:21:14
+ |
+LL | want_foo(b); //~ ERROR mismatched types
+ | ^ expected struct `foo`, found struct `std::boxed::Box`
+ |
+ = note: expected type `foo`
+ found type `std::boxed::Box<foo>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/test-cfg.rs b/src/test/ui/test-cfg.rs
similarity index 100%
rename from src/test/compile-fail/test-cfg.rs
rename to src/test/ui/test-cfg.rs
diff --git a/src/test/ui/test-cfg.stderr b/src/test/ui/test-cfg.stderr
new file mode 100644
index 0000000..1db6d5e
--- /dev/null
+++ b/src/test/ui/test-cfg.stderr
@@ -0,0 +1,9 @@
+error[E0425]: cannot find function `foo` in this scope
+ --> $DIR/test-cfg.rs:17:5
+ |
+LL | foo(); //~ ERROR cannot find function `foo` in this scope
+ | ^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/test-warns-dead-code.rs b/src/test/ui/test-warns-dead-code.rs
similarity index 100%
rename from src/test/compile-fail/test-warns-dead-code.rs
rename to src/test/ui/test-warns-dead-code.rs
diff --git a/src/test/ui/test-warns-dead-code.stderr b/src/test/ui/test-warns-dead-code.stderr
new file mode 100644
index 0000000..46ff31c
--- /dev/null
+++ b/src/test/ui/test-warns-dead-code.stderr
@@ -0,0 +1,14 @@
+error: function is never used: `dead`
+ --> $DIR/test-warns-dead-code.rs:15:1
+ |
+LL | fn dead() {} //~ error: function is never used: `dead`
+ | ^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/test-warns-dead-code.rs:13:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/thread-local-in-ctfe.nll.stderr b/src/test/ui/thread-local-in-ctfe.nll.stderr
new file mode 100644
index 0000000..c9c0ac2
--- /dev/null
+++ b/src/test/ui/thread-local-in-ctfe.nll.stderr
@@ -0,0 +1,50 @@
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:16:17
+ |
+LL | static B: u32 = A;
+ | ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:19:18
+ |
+LL | static C: &u32 = &A;
+ | ^^
+
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/thread-local-in-ctfe.rs:19:18
+ |
+LL | static C: &u32 = &A;
+ | ^^- end of enclosing function is here
+ | |
+ | thread-local variables cannot be borrowed beyond the end of the function
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:22:16
+ |
+LL | const D: u32 = A;
+ | ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:25:17
+ |
+LL | const E: &u32 = &A;
+ | ^^
+
+error[E0712]: thread-local variable borrowed past end of function
+ --> $DIR/thread-local-in-ctfe.rs:25:17
+ |
+LL | const E: &u32 = &A;
+ | ^^- end of enclosing function is here
+ | |
+ | thread-local variables cannot be borrowed beyond the end of the function
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:29:5
+ |
+LL | A
+ | ^
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0625, E0712.
+For more information about an error, try `rustc --explain E0625`.
diff --git a/src/test/compile-fail/thread-local-in-ctfe.rs b/src/test/ui/thread-local-in-ctfe.rs
similarity index 100%
rename from src/test/compile-fail/thread-local-in-ctfe.rs
rename to src/test/ui/thread-local-in-ctfe.rs
diff --git a/src/test/ui/thread-local-in-ctfe.stderr b/src/test/ui/thread-local-in-ctfe.stderr
new file mode 100644
index 0000000..76079d9
--- /dev/null
+++ b/src/test/ui/thread-local-in-ctfe.stderr
@@ -0,0 +1,33 @@
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:16:17
+ |
+LL | static B: u32 = A;
+ | ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:19:18
+ |
+LL | static C: &u32 = &A;
+ | ^^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:22:16
+ |
+LL | const D: u32 = A;
+ | ^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:25:17
+ |
+LL | const E: &u32 = &A;
+ | ^^
+
+error[E0625]: thread-local statics cannot be accessed at compile-time
+ --> $DIR/thread-local-in-ctfe.rs:29:5
+ |
+LL | A
+ | ^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0625`.
diff --git a/src/test/ui/token/issue-10636-2.stderr b/src/test/ui/token/issue-10636-2.stderr
index 6c0053f..634191b 100644
--- a/src/test/ui/token/issue-10636-2.stderr
+++ b/src/test/ui/token/issue-10636-2.stderr
@@ -1,14 +1,11 @@
error: incorrect close delimiter: `}`
--> $DIR/issue-10636-2.rs:18:1
|
-LL | } //~ ERROR: incorrect close delimiter
- | ^
- |
-note: unclosed delimiter
- --> $DIR/issue-10636-2.rs:15:15
- |
LL | option.map(|some| 42;
- | ^
+ | - unclosed delimiter
+...
+LL | } //~ ERROR: incorrect close delimiter
+ | ^ incorrect close delimiter
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `;`
--> $DIR/issue-10636-2.rs:15:25
diff --git a/src/test/ui/tool-attributes-disabled-1.rs b/src/test/ui/tool-attributes-disabled-1.rs
deleted file mode 100644
index 87d47b7..0000000
--- a/src/test/ui/tool-attributes-disabled-1.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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.
-
-// If macro modularization (`use_extern_macros`) is not enabled,
-// then tool attributes are treated as custom attributes.
-
-#[rustfmt::bar] //~ ERROR The attribute `rustfmt::bar` is currently unknown to the compiler
-fn main() {}
diff --git a/src/test/ui/tool-attributes-disabled-1.stderr b/src/test/ui/tool-attributes-disabled-1.stderr
deleted file mode 100644
index 6302c06..0000000
--- a/src/test/ui/tool-attributes-disabled-1.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: The attribute `rustfmt::bar` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
- --> $DIR/tool-attributes-disabled-1.rs:14:1
- |
-LL | #[rustfmt::bar] //~ ERROR The attribute `rustfmt::bar` is currently unknown to the compiler
- | ^^^^^^^^^^^^^^^
- |
- = help: add #![feature(custom_attribute)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/tool-attributes-disabled-2.rs b/src/test/ui/tool-attributes-disabled-2.rs
deleted file mode 100644
index 2d97e16..0000000
--- a/src/test/ui/tool-attributes-disabled-2.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-// 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.
-
-// If macro modularization (`use_extern_macros`) is not enabled,
-// then tool attributes are treated as custom attributes.
-
-#[rustfmt::bar] //~ ERROR attribute `rustfmt::bar` is currently unknown to the compiler
-fn main() {}
diff --git a/src/test/ui/tool-attributes-disabled-2.stderr b/src/test/ui/tool-attributes-disabled-2.stderr
deleted file mode 100644
index b327773..0000000
--- a/src/test/ui/tool-attributes-disabled-2.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-error[E0658]: The attribute `rustfmt::bar` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
- --> $DIR/tool-attributes-disabled-2.rs:14:1
- |
-LL | #[rustfmt::bar] //~ ERROR attribute `rustfmt::bar` is currently unknown to the compiler
- | ^^^^^^^^^^^^^^^
- |
- = help: add #![feature(custom_attribute)] to the crate attributes to enable
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/tool-attributes-misplaced-1.rs b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs
similarity index 100%
rename from src/test/ui/tool-attributes-misplaced-1.rs
rename to src/test/ui/tool-attributes/tool-attributes-misplaced-1.rs
diff --git a/src/test/ui/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr
similarity index 100%
rename from src/test/ui/tool-attributes-misplaced-1.stderr
rename to src/test/ui/tool-attributes/tool-attributes-misplaced-1.stderr
diff --git a/src/test/ui/tool-attributes-misplaced-2.rs b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.rs
similarity index 100%
rename from src/test/ui/tool-attributes-misplaced-2.rs
rename to src/test/ui/tool-attributes/tool-attributes-misplaced-2.rs
diff --git a/src/test/ui/tool-attributes-misplaced-2.stderr b/src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr
similarity index 100%
rename from src/test/ui/tool-attributes-misplaced-2.stderr
rename to src/test/ui/tool-attributes/tool-attributes-misplaced-2.stderr
diff --git a/src/test/ui/tool-attributes-shadowing.rs b/src/test/ui/tool-attributes/tool-attributes-shadowing.rs
similarity index 100%
rename from src/test/ui/tool-attributes-shadowing.rs
rename to src/test/ui/tool-attributes/tool-attributes-shadowing.rs
diff --git a/src/test/ui/tool-attributes-shadowing.stderr b/src/test/ui/tool-attributes/tool-attributes-shadowing.stderr
similarity index 100%
rename from src/test/ui/tool-attributes-shadowing.stderr
rename to src/test/ui/tool-attributes/tool-attributes-shadowing.stderr
diff --git a/src/test/compile-fail/tool_lints.rs b/src/test/ui/tool_lints-fail.rs
similarity index 100%
rename from src/test/compile-fail/tool_lints.rs
rename to src/test/ui/tool_lints-fail.rs
diff --git a/src/test/ui/tool_lints-fail.stderr b/src/test/ui/tool_lints-fail.stderr
new file mode 100644
index 0000000..735673b
--- /dev/null
+++ b/src/test/ui/tool_lints-fail.stderr
@@ -0,0 +1,14 @@
+error: unknown lint: `clippy`
+ --> $DIR/tool_lints-fail.rs:16:9
+ |
+LL | #![deny(clippy)] //~ ERROR: unknown lint: `clippy`
+ | ^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/tool_lints-fail.rs:14:9
+ |
+LL | #![deny(unknown_lints)]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/trace_macros-format.rs b/src/test/ui/trace_macros-format.rs
similarity index 100%
rename from src/test/compile-fail/trace_macros-format.rs
rename to src/test/ui/trace_macros-format.rs
diff --git a/src/test/ui/trace_macros-format.stderr b/src/test/ui/trace_macros-format.stderr
new file mode 100644
index 0000000..8dad041
--- /dev/null
+++ b/src/test/ui/trace_macros-format.stderr
@@ -0,0 +1,38 @@
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/trace_macros-format.rs:14:5
+ |
+LL | trace_macros!(); //~ ERROR trace_macros! accepts only `true` or `false`
+ | ^^^^^^^^^^^^^^^^
+
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/trace_macros-format.rs:15:5
+ |
+LL | trace_macros!(1); //~ ERROR trace_macros! accepts only `true` or `false`
+ | ^^^^^^^^^^^^^^^^^
+
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/trace_macros-format.rs:16:5
+ |
+LL | trace_macros!(ident); //~ ERROR trace_macros! accepts only `true` or `false`
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/trace_macros-format.rs:17:5
+ |
+LL | trace_macros!(for); //~ ERROR trace_macros! accepts only `true` or `false`
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/trace_macros-format.rs:18:5
+ |
+LL | trace_macros!(true,); //~ ERROR trace_macros! accepts only `true` or `false`
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: trace_macros! accepts only `true` or `false`
+ --> $DIR/trace_macros-format.rs:19:5
+ |
+LL | trace_macros!(false 1); //~ ERROR trace_macros! accepts only `true` or `false`
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/compile-fail/trace_macros-gate.rs b/src/test/ui/trace_macros-gate.rs
similarity index 100%
rename from src/test/compile-fail/trace_macros-gate.rs
rename to src/test/ui/trace_macros-gate.rs
diff --git a/src/test/ui/trace_macros-gate.stderr b/src/test/ui/trace_macros-gate.stderr
new file mode 100644
index 0000000..ed92e12
--- /dev/null
+++ b/src/test/ui/trace_macros-gate.stderr
@@ -0,0 +1,62 @@
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:14:5
+ |
+LL | trace_macros!(); //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:15:5
+ |
+LL | trace_macros!(1); //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:16:5
+ |
+LL | trace_macros!(ident); //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:17:5
+ |
+LL | trace_macros!(for); //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:18:5
+ |
+LL | trace_macros!(true,); //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:19:5
+ |
+LL | trace_macros!(false 1); //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error[E0658]: `trace_macros` is not stable enough for use and is subject to change (see issue #29598)
+ --> $DIR/trace_macros-gate.rs:26:26
+ |
+LL | ($x: ident) => { trace_macros!($x) } //~ ERROR `trace_macros` is not stable
+ | ^^^^^^^^^^^^^^^^^
+...
+LL | expando!(true);
+ | --------------- in this macro invocation
+ |
+ = help: add #![feature(trace_macros)] to the crate attributes to enable
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/trait-alias.rs b/src/test/ui/trait-alias-fail.rs
similarity index 100%
rename from src/test/compile-fail/trait-alias.rs
rename to src/test/ui/trait-alias-fail.rs
diff --git a/src/test/ui/trait-alias-fail.stderr b/src/test/ui/trait-alias-fail.stderr
new file mode 100644
index 0000000..f7b144c
--- /dev/null
+++ b/src/test/ui/trait-alias-fail.stderr
@@ -0,0 +1,44 @@
+error: type parameters on the left side of a trait alias cannot be bounded
+ --> $DIR/trait-alias-fail.rs:15:14
+ |
+LL | trait Alias2<T: Clone = ()> = Default;
+ | ^
+
+error: type parameters on the left side of a trait alias cannot have defaults
+ --> $DIR/trait-alias-fail.rs:15:14
+ |
+LL | trait Alias2<T: Clone = ()> = Default;
+ | ^
+
+error[E0573]: expected type, found trait alias `Alias1`
+ --> $DIR/trait-alias-fail.rs:20:6
+ |
+LL | impl Alias1 { //~ERROR expected type, found trait alias
+ | ^^^^^^ not a type
+
+error[E0404]: expected trait, found trait alias `Alias1`
+ --> $DIR/trait-alias-fail.rs:23:6
+ |
+LL | impl Alias1 for () { //~ERROR expected trait, found trait alias
+ | ^^^^^^ not a trait
+
+error[E0658]: trait aliases are not yet fully implemented (see issue #41517)
+ --> $DIR/trait-alias-fail.rs:13:1
+ |
+LL | trait Alias1<T> = Default where T: Clone; // ok
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trait_alias)] to the crate attributes to enable
+
+error[E0658]: trait aliases are not yet fully implemented (see issue #41517)
+ --> $DIR/trait-alias-fail.rs:15:1
+ |
+LL | trait Alias2<T: Clone = ()> = Default;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(trait_alias)] to the crate attributes to enable
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0404, E0573, E0658.
+For more information about an error, try `rustc --explain E0404`.
diff --git a/src/test/ui/trait-suggest-where-clause.stderr b/src/test/ui/trait-suggest-where-clause.stderr
deleted file mode 100644
index f506440..0000000
--- a/src/test/ui/trait-suggest-where-clause.stderr
+++ /dev/null
@@ -1,72 +0,0 @@
-error[E0277]: the size for values of type `U` cannot be known at compilation time
- --> $DIR/trait-suggest-where-clause.rs:17:5
- |
-LL | mem::size_of::<U>();
- | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `U`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where U: std::marker::Sized` bound
- = note: required by `std::mem::size_of`
-
-error[E0277]: the size for values of type `U` cannot be known at compilation time
- --> $DIR/trait-suggest-where-clause.rs:20:5
- |
-LL | mem::size_of::<Misc<U>>();
- | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where U: std::marker::Sized` bound
- = note: required because it appears within the type `Misc<U>`
- = note: required by `std::mem::size_of`
-
-error[E0277]: the trait bound `u64: std::convert::From<T>` is not satisfied
- --> $DIR/trait-suggest-where-clause.rs:25:5
- |
-LL | <u64 as From<T>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `u64`
- |
- = help: consider adding a `where u64: std::convert::From<T>` bound
- = note: required by `std::convert::From::from`
-
-error[E0277]: the trait bound `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
- --> $DIR/trait-suggest-where-clause.rs:28:5
- |
-LL | <u64 as From<<T as Iterator>::Item>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<T as std::iter::Iterator>::Item>` is not implemented for `u64`
- |
- = help: consider adding a `where u64: std::convert::From<<T as std::iter::Iterator>::Item>` bound
- = note: required by `std::convert::From::from`
-
-error[E0277]: the trait bound `Misc<_>: std::convert::From<T>` is not satisfied
- --> $DIR/trait-suggest-where-clause.rs:33:5
- |
-LL | <Misc<_> as From<T>>::from;
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `Misc<_>`
- |
- = note: required by `std::convert::From::from`
-
-error[E0277]: the size for values of type `[T]` cannot be known at compilation time
- --> $DIR/trait-suggest-where-clause.rs:38:5
- |
-LL | mem::size_of::<[T]>();
- | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[T]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `std::mem::size_of`
-
-error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
- --> $DIR/trait-suggest-where-clause.rs:41:5
- |
-LL | mem::size_of::<[&U]>();
- | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[&U]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required by `std::mem::size_of`
-
-error: aborting due to 7 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/auxiliary/crate_a1.rs b/src/test/ui/traits/auxiliary/crate_a1.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/crate_a1.rs
rename to src/test/ui/traits/auxiliary/crate_a1.rs
diff --git a/src/test/compile-fail/auxiliary/trait_bounds_on_structs_and_enums_xc.rs b/src/test/ui/traits/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
rename to src/test/ui/traits/auxiliary/trait_bounds_on_structs_and_enums_xc.rs
diff --git a/src/test/compile-fail/auxiliary/trait_safety_lib.rs b/src/test/ui/traits/auxiliary/trait_safety_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/trait_safety_lib.rs
rename to src/test/ui/traits/auxiliary/trait_safety_lib.rs
diff --git a/src/test/ui/trait-alias.rs b/src/test/ui/traits/trait-alias.rs
similarity index 100%
rename from src/test/ui/trait-alias.rs
rename to src/test/ui/traits/trait-alias.rs
diff --git a/src/test/ui/trait-alias.stderr b/src/test/ui/traits/trait-alias.stderr
similarity index 100%
rename from src/test/ui/trait-alias.stderr
rename to src/test/ui/traits/trait-alias.stderr
diff --git a/src/test/compile-fail/trait-as-struct-constructor.rs b/src/test/ui/traits/trait-as-struct-constructor.rs
similarity index 100%
rename from src/test/compile-fail/trait-as-struct-constructor.rs
rename to src/test/ui/traits/trait-as-struct-constructor.rs
diff --git a/src/test/ui/traits/trait-as-struct-constructor.stderr b/src/test/ui/traits/trait-as-struct-constructor.stderr
new file mode 100644
index 0000000..ecb4e5d
--- /dev/null
+++ b/src/test/ui/traits/trait-as-struct-constructor.stderr
@@ -0,0 +1,9 @@
+error[E0574]: expected struct, variant or union type, found trait `TraitNotAStruct`
+ --> $DIR/trait-as-struct-constructor.rs:14:5
+ |
+LL | TraitNotAStruct{ value: 0 };
+ | ^^^^^^^^^^^^^^^ not a struct, variant or union type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0574`.
diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/ui/traits/trait-bounds-not-on-bare-trait.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-not-on-bare-trait.rs
rename to src/test/ui/traits/trait-bounds-not-on-bare-trait.rs
diff --git a/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr
new file mode 100644
index 0000000..ecabf9a
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-not-on-bare-trait.stderr
@@ -0,0 +1,14 @@
+error[E0277]: the size for values of type `(dyn Foo + std::marker::Send + 'static)` cannot be known at compilation time
+ --> $DIR/trait-bounds-not-on-bare-trait.rs:17:8
+ |
+LL | fn foo(_x: Foo + Send) {
+ | ^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + std::marker::Send + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-not-on-struct.rs b/src/test/ui/traits/trait-bounds-not-on-struct.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-not-on-struct.rs
rename to src/test/ui/traits/trait-bounds-not-on-struct.rs
diff --git a/src/test/ui/traits/trait-bounds-not-on-struct.stderr b/src/test/ui/traits/trait-bounds-not-on-struct.stderr
new file mode 100644
index 0000000..929a1bf
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-not-on-struct.stderr
@@ -0,0 +1,15 @@
+error[E0404]: expected trait, found struct `Foo`
+ --> $DIR/trait-bounds-not-on-struct.rs:15:16
+ |
+LL | fn foo(_x: Box<Foo + Send>) { } //~ ERROR expected trait, found struct `Foo`
+ | ^^^ not a trait
+
+error[E0404]: expected trait, found struct `Vec`
+ --> $DIR/trait-bounds-not-on-struct.rs:17:21
+ |
+LL | type A<T> = Box<dyn Vec<T>>; //~ ERROR expected trait, found struct `Vec`
+ | ^^^^^^ not a trait
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0404`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-fns.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums-in-fns.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr
new file mode 100644
index 0000000..6dd4d1f
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-fns.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `u32: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:23:1
+ |
+LL | fn explode(x: Foo<u32>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u32`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:13:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `f32: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:26:1
+ |
+LL | fn kaboom(y: Bar<f32>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `f32`
+ |
+note: required by `Bar`
+ --> $DIR/trait-bounds-on-structs-and-enums-in-fns.rs:17:1
+ |
+LL | enum Bar<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-in-impls.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums-in-impls.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr
new file mode 100644
index 0000000..6f91770
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-in-impls.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `u16: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:30:6
+ |
+LL | impl PolyTrait<Foo<u16>> for Struct {
+ | ^^^^^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u16`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums-in-impls.rs:13:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr
new file mode 100644
index 0000000..cdaa124
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-locals.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `usize: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:25:14
+ |
+LL | let baz: Foo<usize> = loop { };
+ | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `{integer}: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:20:15
+ |
+LL | let foo = Foo {
+ | ^^^ the trait `Trait` is not implemented for `{integer}`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums-locals.rs:15:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums-static.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr
new file mode 100644
index 0000000..28d4257
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-static.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `usize: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-static.rs:19:1
+ |
+LL | / static X: Foo<usize> = Foo {
+LL | | //~^ ERROR E0277
+LL | | x: 1,
+LL | | };
+ | |__^ the trait `Trait` is not implemented for `usize`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums-static.rs:15:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr
new file mode 100644
index 0000000..b798ccf
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `usize: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-xc.rs:17:1
+ |
+LL | fn explode(x: Foo<usize>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `usize`
+ |
+ = note: required by `trait_bounds_on_structs_and_enums_xc::Foo`
+
+error[E0277]: the trait bound `f32: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-xc.rs:20:1
+ |
+LL | fn kaboom(y: Bar<f32>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f32`
+ |
+ = note: required by `trait_bounds_on_structs_and_enums_xc::Bar`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr
new file mode 100644
index 0000000..0b0bd4f
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums-xc1.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `f64: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:22:14
+ |
+LL | let bar: Bar<f64> = return;
+ | ^^^^^^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `f64`
+ |
+ = note: required by `trait_bounds_on_structs_and_enums_xc::Bar`
+
+error[E0277]: the trait bound `{integer}: trait_bounds_on_structs_and_enums_xc::Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums-xc1.rs:18:15
+ |
+LL | let foo = Foo {
+ | ^^^ the trait `trait_bounds_on_structs_and_enums_xc::Trait` is not implemented for `{integer}`
+ |
+ = note: required by `trait_bounds_on_structs_and_enums_xc::Foo`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/ui/traits/trait-bounds-on-structs-and-enums.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-on-structs-and-enums.rs
rename to src/test/ui/traits/trait-bounds-on-structs-and-enums.rs
diff --git a/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr
new file mode 100644
index 0000000..5686e62
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-on-structs-and-enums.stderr
@@ -0,0 +1,90 @@
+error[E0277]: the trait bound `T: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:23:9
+ |
+LL | impl<T> Foo<T> {
+ | ^^^^^^ the trait `Trait` is not implemented for `T`
+ |
+ = help: consider adding a `where T: Trait` bound
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `isize: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:29:5
+ |
+LL | a: Foo<isize>, //~ ERROR E0277
+ | ^^^^^^^^^^^^^ the trait `Trait` is not implemented for `isize`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `usize: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:33:10
+ |
+LL | Quux(Bar<usize>), //~ ERROR E0277
+ | ^^^^^^^^^^ the trait `Trait` is not implemented for `usize`
+ |
+note: required by `Bar`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:17:1
+ |
+LL | enum Bar<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `U: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:37:5
+ |
+LL | b: Foo<U>, //~ ERROR E0277
+ | ^^^^^^^^^ the trait `Trait` is not implemented for `U`
+ |
+ = help: consider adding a `where U: Trait` bound
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `V: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:41:21
+ |
+LL | EvenMoreBadness(Bar<V>), //~ ERROR E0277
+ | ^^^^^^ the trait `Trait` is not implemented for `V`
+ |
+ = help: consider adding a `where V: Trait` bound
+note: required by `Bar`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:17:1
+ |
+LL | enum Bar<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `i32: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:45:5
+ |
+LL | Foo<i32>, //~ ERROR E0277
+ | ^^^^^^^^ the trait `Trait` is not implemented for `i32`
+ |
+note: required by `Foo`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:13:1
+ |
+LL | struct Foo<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `u8: Trait` is not satisfied
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:49:22
+ |
+LL | DictionaryLike { field: Bar<u8> }, //~ ERROR E0277
+ | ^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `u8`
+ |
+note: required by `Bar`
+ --> $DIR/trait-bounds-on-structs-and-enums.rs:17:1
+ |
+LL | enum Bar<T:Trait> {
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-bounds-sugar.rs b/src/test/ui/traits/trait-bounds-sugar.rs
similarity index 100%
rename from src/test/compile-fail/trait-bounds-sugar.rs
rename to src/test/ui/traits/trait-bounds-sugar.rs
diff --git a/src/test/ui/traits/trait-bounds-sugar.stderr b/src/test/ui/traits/trait-bounds-sugar.stderr
new file mode 100644
index 0000000..bd899e0
--- /dev/null
+++ b/src/test/ui/traits/trait-bounds-sugar.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/trait-bounds-sugar.rs:22:7
+ |
+LL | a(x); //~ ERROR mismatched types
+ | ^ expected trait `Foo + std::marker::Send`, found trait `Foo + std::marker::Sync`
+ |
+ = note: expected type `std::boxed::Box<(dyn Foo + std::marker::Send + 'static)>`
+ found type `std::boxed::Box<(dyn Foo + std::marker::Sync + 'static)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/trait-coercion-generic-bad.rs b/src/test/ui/traits/trait-coercion-generic-bad.rs
similarity index 100%
rename from src/test/compile-fail/trait-coercion-generic-bad.rs
rename to src/test/ui/traits/trait-coercion-generic-bad.rs
diff --git a/src/test/ui/traits/trait-coercion-generic-bad.stderr b/src/test/ui/traits/trait-coercion-generic-bad.stderr
new file mode 100644
index 0000000..a186877
--- /dev/null
+++ b/src/test/ui/traits/trait-coercion-generic-bad.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the trait bound `Struct: Trait<isize>` is not satisfied
+ --> $DIR/trait-coercion-generic-bad.rs:26:32
+ |
+LL | let s: Box<Trait<isize>> = Box::new(Struct { person: "Fred" });
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<isize>` is not implemented for `Struct`
+ |
+ = help: the following implementations were found:
+ <Struct as Trait<&'static str>>
+ = note: required for the cast to the object type `dyn Trait<isize>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr
new file mode 100644
index 0000000..c6a7482
--- /dev/null
+++ b/src/test/ui/traits/trait-coercion-generic-regions.nll.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `person` does not live long enough
+ --> $DIR/trait-coercion-generic-regions.rs:27:24
+ |
+LL | let person: &str = &person; //~ ERROR `person` does not live long enough
+ | ^^^^^^^ borrowed value does not live long enough
+LL | let s: Box<Trait<&'static str>> = Box::new(Struct { person: person });
+LL | }
+ | - `person` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/trait-coercion-generic-regions.rs b/src/test/ui/traits/trait-coercion-generic-regions.rs
similarity index 100%
rename from src/test/compile-fail/trait-coercion-generic-regions.rs
rename to src/test/ui/traits/trait-coercion-generic-regions.rs
diff --git a/src/test/ui/traits/trait-coercion-generic-regions.stderr b/src/test/ui/traits/trait-coercion-generic-regions.stderr
new file mode 100644
index 0000000..8eaf7e9
--- /dev/null
+++ b/src/test/ui/traits/trait-coercion-generic-regions.stderr
@@ -0,0 +1,14 @@
+error[E0597]: `person` does not live long enough
+ --> $DIR/trait-coercion-generic-regions.rs:27:25
+ |
+LL | let person: &str = &person; //~ ERROR `person` does not live long enough
+ | ^^^^^^ borrowed value does not live long enough
+LL | let s: Box<Trait<&'static str>> = Box::new(Struct { person: person });
+LL | }
+ | - borrowed value only lives until here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/trait-duplicate-methods.rs b/src/test/ui/traits/trait-duplicate-methods.rs
similarity index 100%
rename from src/test/ui/trait-duplicate-methods.rs
rename to src/test/ui/traits/trait-duplicate-methods.rs
diff --git a/src/test/ui/trait-duplicate-methods.stderr b/src/test/ui/traits/trait-duplicate-methods.stderr
similarity index 100%
rename from src/test/ui/trait-duplicate-methods.stderr
rename to src/test/ui/traits/trait-duplicate-methods.stderr
diff --git a/src/test/compile-fail/trait-impl-1.rs b/src/test/ui/traits/trait-impl-1.rs
similarity index 100%
rename from src/test/compile-fail/trait-impl-1.rs
rename to src/test/ui/traits/trait-impl-1.rs
diff --git a/src/test/ui/traits/trait-impl-1.stderr b/src/test/ui/traits/trait-impl-1.stderr
new file mode 100644
index 0000000..b803390
--- /dev/null
+++ b/src/test/ui/traits/trait-impl-1.stderr
@@ -0,0 +1,9 @@
+error[E0599]: no method named `foo` found for type `&i32` in the current scope
+ --> $DIR/trait-impl-1.rs:25:7
+ |
+LL | x.foo(); //~ERROR: no method named `foo` found for type `&i32` in the current scope
+ | ^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/trait-impl-can-not-have-untraitful-items.rs b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.rs
similarity index 100%
rename from src/test/compile-fail/trait-impl-can-not-have-untraitful-items.rs
rename to src/test/ui/traits/trait-impl-can-not-have-untraitful-items.rs
diff --git a/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr
new file mode 100644
index 0000000..e23225b
--- /dev/null
+++ b/src/test/ui/traits/trait-impl-can-not-have-untraitful-items.stderr
@@ -0,0 +1,22 @@
+error[E0438]: const `BAR` is not a member of trait `A`
+ --> $DIR/trait-impl-can-not-have-untraitful-items.rs:15:5
+ |
+LL | const BAR: () = (); //~ ERROR const `BAR` is not a member of trait `A`
+ | ^^^^^^^^^^^^^^^^^^^ not a member of trait `A`
+
+error[E0437]: type `Baz` is not a member of trait `A`
+ --> $DIR/trait-impl-can-not-have-untraitful-items.rs:16:5
+ |
+LL | type Baz = (); //~ ERROR type `Baz` is not a member of trait `A`
+ | ^^^^^^^^^^^^^^ not a member of trait `A`
+
+error[E0407]: method `foo` is not a member of trait `A`
+ --> $DIR/trait-impl-can-not-have-untraitful-items.rs:17:5
+ |
+LL | fn foo(&self) { } //~ ERROR method `foo` is not a member of trait `A`
+ | ^^^^^^^^^^^^^^^^^ not a member of trait `A`
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0407, E0437, E0438.
+For more information about an error, try `rustc --explain E0407`.
diff --git a/src/test/compile-fail/trait-impl-different-num-params.rs b/src/test/ui/traits/trait-impl-different-num-params.rs
similarity index 100%
rename from src/test/compile-fail/trait-impl-different-num-params.rs
rename to src/test/ui/traits/trait-impl-different-num-params.rs
diff --git a/src/test/ui/traits/trait-impl-different-num-params.stderr b/src/test/ui/traits/trait-impl-different-num-params.stderr
new file mode 100644
index 0000000..c3bbf99
--- /dev/null
+++ b/src/test/ui/traits/trait-impl-different-num-params.stderr
@@ -0,0 +1,12 @@
+error[E0050]: method `bar` has 1 parameter but the declaration in trait `foo::bar` has 2
+ --> $DIR/trait-impl-different-num-params.rs:15:12
+ |
+LL | fn bar(&self, x: usize) -> Self;
+ | ----- trait requires 2 parameters
+...
+LL | fn bar(&self) -> isize {
+ | ^^^^^ expected 2 parameters, found 1
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0050`.
diff --git a/src/test/compile-fail/trait-impl-for-module.rs b/src/test/ui/traits/trait-impl-for-module.rs
similarity index 100%
rename from src/test/compile-fail/trait-impl-for-module.rs
rename to src/test/ui/traits/trait-impl-for-module.rs
diff --git a/src/test/ui/traits/trait-impl-for-module.stderr b/src/test/ui/traits/trait-impl-for-module.stderr
new file mode 100644
index 0000000..62ae84d
--- /dev/null
+++ b/src/test/ui/traits/trait-impl-for-module.stderr
@@ -0,0 +1,9 @@
+error[E0573]: expected type, found module `a`
+ --> $DIR/trait-impl-for-module.rs:17:12
+ |
+LL | impl A for a { //~ ERROR expected type, found module
+ | ^ did you mean `A`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0573`.
diff --git a/src/test/compile-fail/trait-impl-method-mismatch.rs b/src/test/ui/traits/trait-impl-method-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/trait-impl-method-mismatch.rs
rename to src/test/ui/traits/trait-impl-method-mismatch.rs
diff --git a/src/test/ui/traits/trait-impl-method-mismatch.stderr b/src/test/ui/traits/trait-impl-method-mismatch.stderr
new file mode 100644
index 0000000..526a37f
--- /dev/null
+++ b/src/test/ui/traits/trait-impl-method-mismatch.stderr
@@ -0,0 +1,15 @@
+error[E0053]: method `jumbo` has an incompatible type for trait
+ --> $DIR/trait-impl-method-mismatch.rs:18:5
+ |
+LL | fn jumbo(&self, x: &usize) -> usize;
+ | ------------------------------------ type in trait
+...
+LL | unsafe fn jumbo(&self, x: &usize) { *self + *x; }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected normal fn, found unsafe fn
+ |
+ = note: expected type `fn(&usize, &usize) -> usize`
+ found type `unsafe fn(&usize, &usize)`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/compile-fail/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs
similarity index 100%
rename from src/test/compile-fail/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs
rename to src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs
diff --git a/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr
new file mode 100644
index 0000000..6a97a4e
--- /dev/null
+++ b/src/test/ui/traits/trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr
@@ -0,0 +1,23 @@
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
+ --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:34:13
+ |
+LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 34:6...
+ --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:34:6
+ |
+LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime
+ | ^^
+note: ...but the lifetime must also be valid for the lifetime 'b as defined on the impl at 34:9...
+ --> $DIR/trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs:34:9
+ |
+LL | impl<'a,'b> T2<'a, 'b> for S<'a, 'b> { //~ ERROR cannot infer an appropriate lifetime
+ | ^^
+ = note: ...so that the types are compatible:
+ expected T1<'a>
+ found T1<'_>
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0495`.
diff --git a/src/test/compile-fail/trait-item-privacy.rs b/src/test/ui/traits/trait-item-privacy.rs
similarity index 100%
rename from src/test/compile-fail/trait-item-privacy.rs
rename to src/test/ui/traits/trait-item-privacy.rs
diff --git a/src/test/ui/traits/trait-item-privacy.stderr b/src/test/ui/traits/trait-item-privacy.stderr
new file mode 100644
index 0000000..a3747bc
--- /dev/null
+++ b/src/test/ui/traits/trait-item-privacy.stderr
@@ -0,0 +1,176 @@
+error[E0599]: no method named `a` found for type `S` in the current scope
+ --> $DIR/trait-item-privacy.rs:77:7
+ |
+LL | struct S;
+ | --------- method `a` not found for this
+...
+LL | S.a(); //~ ERROR no method named `a` found for type `S` in the current scope
+ | ^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `a`, perhaps you need to implement it:
+ candidate #1: `method::A`
+
+error[E0599]: no method named `b` found for type `S` in the current scope
+ --> $DIR/trait-item-privacy.rs:78:7
+ |
+LL | struct S;
+ | --------- method `b` not found for this
+...
+LL | S.b(); //~ ERROR no method named `b` found for type `S` in the current scope
+ | ^
+ |
+ = help: items from traits can only be used if the trait is in scope
+help: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ |
+LL | use method::B;
+ |
+
+error[E0624]: method `a` is private
+ --> $DIR/trait-item-privacy.rs:82:7
+ |
+LL | c.a(); //~ ERROR method `a` is private
+ | ^
+
+error[E0599]: no function or associated item named `a` found for type `S` in the current scope
+ --> $DIR/trait-item-privacy.rs:88:5
+ |
+LL | struct S;
+ | --------- function or associated item `a` not found for this
+...
+LL | S::a(&S);
+ | ^^^^ function or associated item not found in `S`
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `a`, perhaps you need to implement it:
+ candidate #1: `method::A`
+
+error[E0599]: no function or associated item named `b` found for type `S` in the current scope
+ --> $DIR/trait-item-privacy.rs:90:5
+ |
+LL | struct S;
+ | --------- function or associated item `b` not found for this
+...
+LL | S::b(&S);
+ | ^^^^ function or associated item not found in `S`
+ |
+ = help: items from traits can only be used if the trait is in scope
+help: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ |
+LL | use method::B;
+ |
+
+error[E0624]: method `a` is private
+ --> $DIR/trait-item-privacy.rs:94:5
+ |
+LL | C::a(&S); //~ ERROR method `a` is private
+ | ^^^^
+
+error[E0599]: no associated item named `A` found for type `S` in the current scope
+ --> $DIR/trait-item-privacy.rs:107:5
+ |
+LL | struct S;
+ | --------- associated item `A` not found for this
+...
+LL | S::A; //~ ERROR no associated item named `A` found for type `S` in the current scope
+ | ^^^^ associated item not found in `S`
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `A`, perhaps you need to implement it:
+ candidate #1: `assoc_const::A`
+
+error[E0599]: no associated item named `B` found for type `S` in the current scope
+ --> $DIR/trait-item-privacy.rs:108:5
+ |
+LL | struct S;
+ | --------- associated item `B` not found for this
+...
+LL | S::B; //~ ERROR no associated item named `B` found for type `S` in the current scope
+ | ^^^^ associated item not found in `S`
+ |
+ = help: items from traits can only be used if the trait is in scope
+help: the following trait is implemented but not in scope, perhaps add a `use` for it:
+ |
+LL | use assoc_const::B;
+ |
+
+error[E0624]: associated constant `A` is private
+ --> $DIR/trait-item-privacy.rs:111:5
+ |
+LL | C::A; //~ ERROR associated constant `A` is private
+ | ^^^^
+
+error[E0277]: the trait bound `dyn assoc_const::C: assoc_const::A` is not satisfied
+ --> $DIR/trait-item-privacy.rs:111:5
+ |
+LL | C::A; //~ ERROR associated constant `A` is private
+ | ^^^^ the trait `assoc_const::A` is not implemented for `dyn assoc_const::C`
+ |
+note: required by `assoc_const::A::A`
+ --> $DIR/trait-item-privacy.rs:35:9
+ |
+LL | const A: u8 = 0;
+ | ^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `dyn assoc_const::C: assoc_const::B` is not satisfied
+ --> $DIR/trait-item-privacy.rs:114:5
+ |
+LL | C::B; // ERROR the trait `assoc_const::C` cannot be made into an object
+ | ^^^^ the trait `assoc_const::B` is not implemented for `dyn assoc_const::C`
+ |
+note: required by `assoc_const::B::B`
+ --> $DIR/trait-item-privacy.rs:39:9
+ |
+LL | const B: u8 = 0;
+ | ^^^^^^^^^^^^^^^^
+
+error[E0038]: the trait `assoc_const::C` cannot be made into an object
+ --> $DIR/trait-item-privacy.rs:111:5
+ |
+LL | C::A; //~ ERROR associated constant `A` is private
+ | ^^^^ the trait `assoc_const::C` cannot be made into an object
+ |
+ = note: the trait cannot contain associated consts like `C`
+ = note: the trait cannot contain associated consts like `B`
+ = note: the trait cannot contain associated consts like `A`
+
+error[E0223]: ambiguous associated type
+ --> $DIR/trait-item-privacy.rs:127:12
+ |
+LL | let _: S::A; //~ ERROR ambiguous associated type
+ | ^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<S as Trait>::A`
+
+error[E0223]: ambiguous associated type
+ --> $DIR/trait-item-privacy.rs:128:12
+ |
+LL | let _: S::B; //~ ERROR ambiguous associated type
+ | ^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<S as Trait>::B`
+
+error[E0223]: ambiguous associated type
+ --> $DIR/trait-item-privacy.rs:129:12
+ |
+LL | let _: S::C; //~ ERROR ambiguous associated type
+ | ^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<S as Trait>::C`
+
+error: associated type `A` is private
+ --> $DIR/trait-item-privacy.rs:131:12
+ |
+LL | let _: T::A; //~ ERROR associated type `A` is private
+ | ^^^^
+
+error: associated type `A` is private
+ --> $DIR/trait-item-privacy.rs:140:9
+ |
+LL | A = u8, //~ ERROR associated type `A` is private
+ | ^^^^^^
+
+error: aborting due to 17 previous errors
+
+Some errors occurred: E0038, E0223, E0277, E0599, E0624.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/trait-matching-lifetimes.rs b/src/test/ui/traits/trait-matching-lifetimes.rs
similarity index 100%
rename from src/test/compile-fail/trait-matching-lifetimes.rs
rename to src/test/ui/traits/trait-matching-lifetimes.rs
diff --git a/src/test/ui/traits/trait-matching-lifetimes.stderr b/src/test/ui/traits/trait-matching-lifetimes.stderr
new file mode 100644
index 0000000..8f27947
--- /dev/null
+++ b/src/test/ui/traits/trait-matching-lifetimes.stderr
@@ -0,0 +1,41 @@
+error[E0308]: method not compatible with trait
+ --> $DIR/trait-matching-lifetimes.rs:24:5
+ |
+LL | fn foo(x: Foo<'b,'a>) {
+ | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `fn(Foo<'a, 'b>)`
+ found type `fn(Foo<'b, 'a>)`
+note: the lifetime 'b as defined on the impl at 23:9...
+ --> $DIR/trait-matching-lifetimes.rs:23:9
+ |
+LL | impl<'a,'b> Tr for Foo<'a,'b> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 23:6
+ --> $DIR/trait-matching-lifetimes.rs:23:6
+ |
+LL | impl<'a,'b> Tr for Foo<'a,'b> {
+ | ^^
+
+error[E0308]: method not compatible with trait
+ --> $DIR/trait-matching-lifetimes.rs:24:5
+ |
+LL | fn foo(x: Foo<'b,'a>) {
+ | ^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `fn(Foo<'a, 'b>)`
+ found type `fn(Foo<'b, 'a>)`
+note: the lifetime 'a as defined on the impl at 23:6...
+ --> $DIR/trait-matching-lifetimes.rs:23:6
+ |
+LL | impl<'a,'b> Tr for Foo<'a,'b> {
+ | ^^
+note: ...does not necessarily outlive the lifetime 'b as defined on the impl at 23:9
+ --> $DIR/trait-matching-lifetimes.rs:23:9
+ |
+LL | impl<'a,'b> Tr for Foo<'a,'b> {
+ | ^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/trait-method-private.rs b/src/test/ui/traits/trait-method-private.rs
similarity index 100%
rename from src/test/ui/trait-method-private.rs
rename to src/test/ui/traits/trait-method-private.rs
diff --git a/src/test/ui/trait-method-private.stderr b/src/test/ui/traits/trait-method-private.stderr
similarity index 100%
rename from src/test/ui/trait-method-private.stderr
rename to src/test/ui/traits/trait-method-private.stderr
diff --git a/src/test/ui/trait-object-auto-dedup-in-impl.rs b/src/test/ui/traits/trait-object-auto-dedup-in-impl.rs
similarity index 100%
rename from src/test/ui/trait-object-auto-dedup-in-impl.rs
rename to src/test/ui/traits/trait-object-auto-dedup-in-impl.rs
diff --git a/src/test/ui/trait-object-auto-dedup-in-impl.stderr b/src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr
similarity index 100%
rename from src/test/ui/trait-object-auto-dedup-in-impl.stderr
rename to src/test/ui/traits/trait-object-auto-dedup-in-impl.stderr
diff --git a/src/test/compile-fail/trait-object-macro-matcher.rs b/src/test/ui/traits/trait-object-macro-matcher.rs
similarity index 100%
rename from src/test/compile-fail/trait-object-macro-matcher.rs
rename to src/test/ui/traits/trait-object-macro-matcher.rs
diff --git a/src/test/ui/traits/trait-object-macro-matcher.stderr b/src/test/ui/traits/trait-object-macro-matcher.stderr
new file mode 100644
index 0000000..05511b5
--- /dev/null
+++ b/src/test/ui/traits/trait-object-macro-matcher.stderr
@@ -0,0 +1,18 @@
+error[E0224]: at least one non-builtin trait is required for an object type
+ --> $DIR/trait-object-macro-matcher.rs:20:8
+ |
+LL | m!('static +); //~ ERROR at least one non-builtin trait is required for an object type
+ | ^^^^^^^^^
+
+error[E0038]: the trait `std::marker::Copy` cannot be made into an object
+ --> $DIR/trait-object-macro-matcher.rs:18:8
+ |
+LL | m!(Copy + Send + 'static); //~ ERROR the trait `std::marker::Copy` cannot be made into an object
+ | ^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` cannot be made into an object
+ |
+ = note: the trait cannot require that `Self : Sized`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0038, E0224.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/trait-object-safety.rs b/src/test/ui/traits/trait-object-safety.rs
similarity index 100%
rename from src/test/compile-fail/trait-object-safety.rs
rename to src/test/ui/traits/trait-object-safety.rs
diff --git a/src/test/ui/traits/trait-object-safety.stderr b/src/test/ui/traits/trait-object-safety.stderr
new file mode 100644
index 0000000..be0440d
--- /dev/null
+++ b/src/test/ui/traits/trait-object-safety.stderr
@@ -0,0 +1,20 @@
+error[E0038]: the trait `Tr` cannot be made into an object
+ --> $DIR/trait-object-safety.rs:25:18
+ |
+LL | let _: &Tr = &St; //~ ERROR E0038
+ | ^^^ the trait `Tr` cannot be made into an object
+ |
+ = note: method `foo` has no receiver
+ = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<&dyn Tr>` for `&St`
+
+error[E0038]: the trait `Tr` cannot be made into an object
+ --> $DIR/trait-object-safety.rs:25:12
+ |
+LL | let _: &Tr = &St; //~ ERROR E0038
+ | ^^^ the trait `Tr` cannot be made into an object
+ |
+ = note: method `foo` has no receiver
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/trait-object-vs-lifetime-2.rs b/src/test/ui/traits/trait-object-vs-lifetime-2.rs
similarity index 100%
rename from src/test/compile-fail/trait-object-vs-lifetime-2.rs
rename to src/test/ui/traits/trait-object-vs-lifetime-2.rs
diff --git a/src/test/ui/traits/trait-object-vs-lifetime-2.stderr b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr
new file mode 100644
index 0000000..db38aca
--- /dev/null
+++ b/src/test/ui/traits/trait-object-vs-lifetime-2.stderr
@@ -0,0 +1,9 @@
+error[E0224]: at least one non-builtin trait is required for an object type
+ --> $DIR/trait-object-vs-lifetime-2.rs:19:5
+ |
+LL | 'static +: 'static + Copy,
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0224`.
diff --git a/src/test/compile-fail/trait-object-vs-lifetime.rs b/src/test/ui/traits/trait-object-vs-lifetime.rs
similarity index 100%
rename from src/test/compile-fail/trait-object-vs-lifetime.rs
rename to src/test/ui/traits/trait-object-vs-lifetime.rs
diff --git a/src/test/ui/traits/trait-object-vs-lifetime.stderr b/src/test/ui/traits/trait-object-vs-lifetime.stderr
new file mode 100644
index 0000000..d875e7d
--- /dev/null
+++ b/src/test/ui/traits/trait-object-vs-lifetime.stderr
@@ -0,0 +1,34 @@
+error: lifetime parameters must be declared prior to type parameters
+ --> $DIR/trait-object-vs-lifetime.rs:26:25
+ |
+LL | let _: S<'static +, 'static>;
+ | ^^^^^^^
+
+error[E0224]: at least one non-builtin trait is required for an object type
+ --> $DIR/trait-object-vs-lifetime.rs:21:23
+ |
+LL | let _: S<'static, 'static +>;
+ | ^^^^^^^^^
+
+error[E0107]: wrong number of lifetime parameters: expected 1, found 2
+ --> $DIR/trait-object-vs-lifetime.rs:23:12
+ |
+LL | let _: S<'static, 'static>;
+ | ^^^^^^^^^^^^^^^^^^^ unexpected lifetime parameter
+
+error[E0243]: wrong number of type arguments: expected 1, found 0
+ --> $DIR/trait-object-vs-lifetime.rs:23:12
+ |
+LL | let _: S<'static, 'static>;
+ | ^^^^^^^^^^^^^^^^^^^ expected 1 type argument
+
+error[E0224]: at least one non-builtin trait is required for an object type
+ --> $DIR/trait-object-vs-lifetime.rs:26:14
+ |
+LL | let _: S<'static +, 'static>;
+ | ^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0107, E0224, E0243.
+For more information about an error, try `rustc --explain E0107`.
diff --git a/src/test/compile-fail/trait-or-new-type-instead.rs b/src/test/ui/traits/trait-or-new-type-instead.rs
similarity index 100%
rename from src/test/compile-fail/trait-or-new-type-instead.rs
rename to src/test/ui/traits/trait-or-new-type-instead.rs
diff --git a/src/test/ui/traits/trait-or-new-type-instead.stderr b/src/test/ui/traits/trait-or-new-type-instead.stderr
new file mode 100644
index 0000000..1b4d173
--- /dev/null
+++ b/src/test/ui/traits/trait-or-new-type-instead.stderr
@@ -0,0 +1,14 @@
+error[E0116]: cannot define inherent `impl` for a type outside of the crate where the type is defined
+ --> $DIR/trait-or-new-type-instead.rs:11:1
+ |
+LL | / impl<T> Option<T> {
+LL | | //~^ ERROR cannot define inherent `impl` for a type outside of the crate where the type is defined
+LL | | pub fn foo(&self) { }
+LL | | }
+ | |_^ impl for type defined outside of crate.
+ |
+ = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0116`.
diff --git a/src/test/compile-fail/trait-privacy.rs b/src/test/ui/traits/trait-privacy.rs
similarity index 100%
rename from src/test/compile-fail/trait-privacy.rs
rename to src/test/ui/traits/trait-privacy.rs
diff --git a/src/test/ui/traits/trait-privacy.stderr b/src/test/ui/traits/trait-privacy.stderr
new file mode 100644
index 0000000..d38e869
--- /dev/null
+++ b/src/test/ui/traits/trait-privacy.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/trait-privacy.rs:35:1
+ |
+LL | fn main() {} //~ ERROR compilation successful
+ | ^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/trait-resolution-in-overloaded-op.rs b/src/test/ui/traits/trait-resolution-in-overloaded-op.rs
similarity index 100%
rename from src/test/compile-fail/trait-resolution-in-overloaded-op.rs
rename to src/test/ui/traits/trait-resolution-in-overloaded-op.rs
diff --git a/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr
new file mode 100644
index 0000000..ba20eae
--- /dev/null
+++ b/src/test/ui/traits/trait-resolution-in-overloaded-op.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `*` cannot be applied to type `&T`
+ --> $DIR/trait-resolution-in-overloaded-op.rs:18:5
+ |
+LL | a * b //~ ERROR binary operation `*` cannot be applied to type `&T`
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Mul` might be missing for `&T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/ui/trait-safety-fn-body.rs b/src/test/ui/traits/trait-safety-fn-body.rs
similarity index 100%
rename from src/test/ui/trait-safety-fn-body.rs
rename to src/test/ui/traits/trait-safety-fn-body.rs
diff --git a/src/test/ui/trait-safety-fn-body.stderr b/src/test/ui/traits/trait-safety-fn-body.stderr
similarity index 100%
rename from src/test/ui/trait-safety-fn-body.stderr
rename to src/test/ui/traits/trait-safety-fn-body.stderr
diff --git a/src/test/compile-fail/trait-safety-inherent-impl.rs b/src/test/ui/traits/trait-safety-inherent-impl.rs
similarity index 100%
rename from src/test/compile-fail/trait-safety-inherent-impl.rs
rename to src/test/ui/traits/trait-safety-inherent-impl.rs
diff --git a/src/test/ui/traits/trait-safety-inherent-impl.stderr b/src/test/ui/traits/trait-safety-inherent-impl.stderr
new file mode 100644
index 0000000..5154a59
--- /dev/null
+++ b/src/test/ui/traits/trait-safety-inherent-impl.stderr
@@ -0,0 +1,11 @@
+error[E0197]: inherent impls cannot be unsafe
+ --> $DIR/trait-safety-inherent-impl.rs:15:1
+ |
+LL | / unsafe impl SomeStruct { //~ ERROR inherent impls cannot be unsafe
+LL | | fn foo(self) { }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0197`.
diff --git a/src/test/compile-fail/trait-safety-trait-impl-cc.rs b/src/test/ui/traits/trait-safety-trait-impl-cc.rs
similarity index 100%
rename from src/test/compile-fail/trait-safety-trait-impl-cc.rs
rename to src/test/ui/traits/trait-safety-trait-impl-cc.rs
diff --git a/src/test/ui/traits/trait-safety-trait-impl-cc.stderr b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr
new file mode 100644
index 0000000..0611d2d
--- /dev/null
+++ b/src/test/ui/traits/trait-safety-trait-impl-cc.stderr
@@ -0,0 +1,13 @@
+error[E0200]: the trait `lib::Foo` requires an `unsafe impl` declaration
+ --> $DIR/trait-safety-trait-impl-cc.rs:19:1
+ |
+LL | / impl lib::Foo for Bar { //~ ERROR requires an `unsafe impl` declaration
+LL | | fn foo(&self) -> isize {
+LL | | panic!();
+LL | | }
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0200`.
diff --git a/src/test/compile-fail/trait-safety-trait-impl.rs b/src/test/ui/traits/trait-safety-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/trait-safety-trait-impl.rs
rename to src/test/ui/traits/trait-safety-trait-impl.rs
diff --git a/src/test/ui/traits/trait-safety-trait-impl.stderr b/src/test/ui/traits/trait-safety-trait-impl.stderr
new file mode 100644
index 0000000..137e9f7
--- /dev/null
+++ b/src/test/ui/traits/trait-safety-trait-impl.stderr
@@ -0,0 +1,16 @@
+error[E0200]: the trait `UnsafeTrait` requires an `unsafe impl` declaration
+ --> $DIR/trait-safety-trait-impl.rs:24:1
+ |
+LL | impl UnsafeTrait for u16 { } //~ ERROR requires an `unsafe impl` declaration
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0199]: implementing the trait `SafeTrait` is not unsafe
+ --> $DIR/trait-safety-trait-impl.rs:26:1
+ |
+LL | unsafe impl SafeTrait for u32 { } //~ ERROR the trait `SafeTrait` is not unsafe
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0199, E0200.
+For more information about an error, try `rustc --explain E0199`.
diff --git a/src/test/compile-fail/trait-static-method-generic-inference.rs b/src/test/ui/traits/trait-static-method-generic-inference.rs
similarity index 100%
rename from src/test/compile-fail/trait-static-method-generic-inference.rs
rename to src/test/ui/traits/trait-static-method-generic-inference.rs
diff --git a/src/test/ui/traits/trait-static-method-generic-inference.stderr b/src/test/ui/traits/trait-static-method-generic-inference.stderr
new file mode 100644
index 0000000..a903bd9
--- /dev/null
+++ b/src/test/ui/traits/trait-static-method-generic-inference.stderr
@@ -0,0 +1,15 @@
+error[E0283]: type annotations required: cannot resolve `_: base::HasNew<base::Foo>`
+ --> $DIR/trait-static-method-generic-inference.rs:34:25
+ |
+LL | let _f: base::Foo = base::HasNew::new();
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: required by `base::HasNew::new`
+ --> $DIR/trait-static-method-generic-inference.rs:18:9
+ |
+LL | fn new() -> T;
+ | ^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/src/test/ui/trait-suggest-where-clause.rs b/src/test/ui/traits/trait-suggest-where-clause.rs
similarity index 100%
rename from src/test/ui/trait-suggest-where-clause.rs
rename to src/test/ui/traits/trait-suggest-where-clause.rs
diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr
new file mode 100644
index 0000000..3b33596
--- /dev/null
+++ b/src/test/ui/traits/trait-suggest-where-clause.stderr
@@ -0,0 +1,72 @@
+error[E0277]: the size for values of type `U` cannot be known at compilation time
+ --> $DIR/trait-suggest-where-clause.rs:17:5
+ |
+LL | mem::size_of::<U>();
+ | ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `U`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where U: std::marker::Sized` bound
+ = note: required by `std::mem::size_of`
+
+error[E0277]: the size for values of type `U` cannot be known at compilation time
+ --> $DIR/trait-suggest-where-clause.rs:20:5
+ |
+LL | mem::size_of::<Misc<U>>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Misc<U>`, the trait `std::marker::Sized` is not implemented for `U`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where U: std::marker::Sized` bound
+ = note: required because it appears within the type `Misc<U>`
+ = note: required by `std::mem::size_of`
+
+error[E0277]: the trait bound `u64: std::convert::From<T>` is not satisfied
+ --> $DIR/trait-suggest-where-clause.rs:25:5
+ |
+LL | <u64 as From<T>>::from;
+ | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `u64`
+ |
+ = help: consider adding a `where u64: std::convert::From<T>` bound
+ = note: required by `std::convert::From::from`
+
+error[E0277]: the trait bound `u64: std::convert::From<<T as std::iter::Iterator>::Item>` is not satisfied
+ --> $DIR/trait-suggest-where-clause.rs:28:5
+ |
+LL | <u64 as From<<T as Iterator>::Item>>::from;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<<T as std::iter::Iterator>::Item>` is not implemented for `u64`
+ |
+ = help: consider adding a `where u64: std::convert::From<<T as std::iter::Iterator>::Item>` bound
+ = note: required by `std::convert::From::from`
+
+error[E0277]: the trait bound `Misc<_>: std::convert::From<T>` is not satisfied
+ --> $DIR/trait-suggest-where-clause.rs:33:5
+ |
+LL | <Misc<_> as From<T>>::from;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<T>` is not implemented for `Misc<_>`
+ |
+ = note: required by `std::convert::From::from`
+
+error[E0277]: the size for values of type `[T]` cannot be known at compilation time
+ --> $DIR/trait-suggest-where-clause.rs:38:5
+ |
+LL | mem::size_of::<[T]>();
+ | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[T]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::mem::size_of`
+
+error[E0277]: the size for values of type `[&U]` cannot be known at compilation time
+ --> $DIR/trait-suggest-where-clause.rs:41:5
+ |
+LL | mem::size_of::<[&U]>();
+ | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[&U]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required by `std::mem::size_of`
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/trait-test-2.rs b/src/test/ui/traits/trait-test-2.rs
similarity index 100%
rename from src/test/compile-fail/trait-test-2.rs
rename to src/test/ui/traits/trait-test-2.rs
diff --git a/src/test/ui/traits/trait-test-2.stderr b/src/test/ui/traits/trait-test-2.stderr
new file mode 100644
index 0000000..58e9144
--- /dev/null
+++ b/src/test/ui/traits/trait-test-2.stderr
@@ -0,0 +1,41 @@
+error[E0087]: too many type parameters provided: expected at most 0 type parameters, found 1 type parameter
+ --> $DIR/trait-test-2.rs:18:14
+ |
+LL | 10.dup::<i32>(); //~ ERROR expected at most 0 type parameters, found 1 type parameter
+ | ^^^ expected 0 type parameters
+
+error[E0087]: too many type parameters provided: expected at most 1 type parameter, found 2 type parameters
+ --> $DIR/trait-test-2.rs:19:20
+ |
+LL | 10.blah::<i32, i32>(); //~ ERROR expected at most 1 type parameter, found 2 type parameters
+ | ^^^ expected 1 type parameter
+
+error[E0277]: the trait bound `dyn bar: bar` is not satisfied
+ --> $DIR/trait-test-2.rs:20:26
+ |
+LL | (box 10 as Box<bar>).dup();
+ | ^^^ the trait `bar` is not implemented for `dyn bar`
+
+error[E0038]: the trait `bar` cannot be made into an object
+ --> $DIR/trait-test-2.rs:20:16
+ |
+LL | (box 10 as Box<bar>).dup();
+ | ^^^^^^^^ the trait `bar` cannot be made into an object
+ |
+ = note: method `dup` references the `Self` type in its arguments or return type
+ = note: method `blah` has generic type parameters
+
+error[E0038]: the trait `bar` cannot be made into an object
+ --> $DIR/trait-test-2.rs:20:6
+ |
+LL | (box 10 as Box<bar>).dup();
+ | ^^^^^^ the trait `bar` cannot be made into an object
+ |
+ = note: method `dup` references the `Self` type in its arguments or return type
+ = note: method `blah` has generic type parameters
+ = note: required because of the requirements on the impl of `std::ops::CoerceUnsized<std::boxed::Box<dyn bar>>` for `std::boxed::Box<{integer}>`
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0038, E0087, E0277.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/trait-test.rs b/src/test/ui/traits/trait-test.rs
similarity index 100%
rename from src/test/compile-fail/trait-test.rs
rename to src/test/ui/traits/trait-test.rs
diff --git a/src/test/ui/traits/trait-test.stderr b/src/test/ui/traits/trait-test.stderr
new file mode 100644
index 0000000..89dbb3d
--- /dev/null
+++ b/src/test/ui/traits/trait-test.stderr
@@ -0,0 +1,9 @@
+error[E0404]: expected trait, found builtin type `isize`
+ --> $DIR/trait-test.rs:13:6
+ |
+LL | impl isize for usize { fn foo(&self) {} } //~ ERROR trait
+ | ^^^^^ not a trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0404`.
diff --git a/src/test/compile-fail/traits-assoc-type-in-supertrait-bad.rs b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.rs
similarity index 100%
rename from src/test/compile-fail/traits-assoc-type-in-supertrait-bad.rs
rename to src/test/ui/traits/traits-assoc-type-in-supertrait-bad.rs
diff --git a/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr
new file mode 100644
index 0000000..bf5e8a7
--- /dev/null
+++ b/src/test/ui/traits/traits-assoc-type-in-supertrait-bad.stderr
@@ -0,0 +1,12 @@
+error[E0271]: type mismatch resolving `<std::vec::IntoIter<i32> as std::iter::Iterator>::Item == u32`
+ --> $DIR/traits-assoc-type-in-supertrait-bad.rs:21:6
+ |
+LL | impl Foo for IntoIter<i32> { //~ ERROR type mismatch
+ | ^^^ expected i32, found u32
+ |
+ = note: expected type `i32`
+ found type `u32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/compile-fail/traits-inductive-overflow-simultaneous.rs b/src/test/ui/traits/traits-inductive-overflow-simultaneous.rs
similarity index 100%
rename from src/test/compile-fail/traits-inductive-overflow-simultaneous.rs
rename to src/test/ui/traits/traits-inductive-overflow-simultaneous.rs
diff --git a/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr b/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr
new file mode 100644
index 0000000..7eabb00
--- /dev/null
+++ b/src/test/ui/traits/traits-inductive-overflow-simultaneous.stderr
@@ -0,0 +1,16 @@
+error[E0275]: overflow evaluating the requirement `{integer}: Tweedledum`
+ --> $DIR/traits-inductive-overflow-simultaneous.rs:28:5
+ |
+LL | is_ee(4);
+ | ^^^^^
+ |
+ = note: required because of the requirements on the impl of `Combo` for `{integer}`
+note: required by `is_ee`
+ --> $DIR/traits-inductive-overflow-simultaneous.rs:23:1
+ |
+LL | fn is_ee<T: Combo>(t: T) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/src/test/compile-fail/traits-inductive-overflow-supertrait-oibit.rs b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.rs
similarity index 100%
rename from src/test/compile-fail/traits-inductive-overflow-supertrait-oibit.rs
rename to src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.rs
diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr
new file mode 100644
index 0000000..5438cc5
--- /dev/null
+++ b/src/test/ui/traits/traits-inductive-overflow-supertrait-oibit.stderr
@@ -0,0 +1,23 @@
+error[E0568]: auto traits cannot have super traits
+ --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:17:1
+ |
+LL | auto trait Magic: Copy {} //~ ERROR E0568
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `NoClone: std::marker::Copy` is not satisfied
+ --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:25:18
+ |
+LL | let (a, b) = copy(NoClone); //~ ERROR
+ | ^^^^ the trait `std::marker::Copy` is not implemented for `NoClone`
+ |
+ = note: required because of the requirements on the impl of `Magic` for `NoClone`
+note: required by `copy`
+ --> $DIR/traits-inductive-overflow-supertrait-oibit.rs:19:1
+ |
+LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0568.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/traits-inductive-overflow-supertrait.rs b/src/test/ui/traits/traits-inductive-overflow-supertrait.rs
similarity index 100%
rename from src/test/compile-fail/traits-inductive-overflow-supertrait.rs
rename to src/test/ui/traits/traits-inductive-overflow-supertrait.rs
diff --git a/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr
new file mode 100644
index 0000000..6f0929d
--- /dev/null
+++ b/src/test/ui/traits/traits-inductive-overflow-supertrait.stderr
@@ -0,0 +1,16 @@
+error[E0275]: overflow evaluating the requirement `NoClone: Magic`
+ --> $DIR/traits-inductive-overflow-supertrait.rs:23:18
+ |
+LL | let (a, b) = copy(NoClone); //~ ERROR E0275
+ | ^^^^
+ |
+ = note: required because of the requirements on the impl of `Magic` for `NoClone`
+note: required by `copy`
+ --> $DIR/traits-inductive-overflow-supertrait.rs:17:1
+ |
+LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/src/test/compile-fail/traits-inductive-overflow-two-traits.rs b/src/test/ui/traits/traits-inductive-overflow-two-traits.rs
similarity index 100%
rename from src/test/compile-fail/traits-inductive-overflow-two-traits.rs
rename to src/test/ui/traits/traits-inductive-overflow-two-traits.rs
diff --git a/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr
new file mode 100644
index 0000000..900ed1b
--- /dev/null
+++ b/src/test/ui/traits/traits-inductive-overflow-two-traits.stderr
@@ -0,0 +1,15 @@
+error[E0275]: overflow evaluating the requirement `*mut (): Magic`
+ --> $DIR/traits-inductive-overflow-two-traits.rs:29:5
+ |
+LL | wizard::<*mut ()>(); //~ ERROR E0275
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: required by `wizard`
+ --> $DIR/traits-inductive-overflow-two-traits.rs:26:1
+ |
+LL | fn wizard<T: Magic>() { check::<<T as Magic>::X>(); }
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/src/test/compile-fail/traits-issue-23003-overflow.rs b/src/test/ui/traits/traits-issue-23003-overflow.rs
similarity index 100%
rename from src/test/compile-fail/traits-issue-23003-overflow.rs
rename to src/test/ui/traits/traits-issue-23003-overflow.rs
diff --git a/src/test/ui/traits/traits-issue-23003-overflow.stderr b/src/test/ui/traits/traits-issue-23003-overflow.stderr
new file mode 100644
index 0000000..3c26e42
--- /dev/null
+++ b/src/test/ui/traits/traits-issue-23003-overflow.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/traits-issue-23003-overflow.rs:39:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/traits-multidispatch-bad.rs b/src/test/ui/traits/traits-multidispatch-bad.rs
similarity index 100%
rename from src/test/compile-fail/traits-multidispatch-bad.rs
rename to src/test/ui/traits/traits-multidispatch-bad.rs
diff --git a/src/test/ui/traits/traits-multidispatch-bad.stderr b/src/test/ui/traits/traits-multidispatch-bad.stderr
new file mode 100644
index 0000000..6068ede
--- /dev/null
+++ b/src/test/ui/traits/traits-multidispatch-bad.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/traits-multidispatch-bad.rs:29:17
+ |
+LL | test(22i32, 44i32); //~ ERROR mismatched types
+ | ^^^^^ expected u32, found i32
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/traits-multidispatch-convert-ambig-dest.rs b/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.rs
similarity index 100%
rename from src/test/ui/traits-multidispatch-convert-ambig-dest.rs
rename to src/test/ui/traits/traits-multidispatch-convert-ambig-dest.rs
diff --git a/src/test/ui/traits-multidispatch-convert-ambig-dest.stderr b/src/test/ui/traits/traits-multidispatch-convert-ambig-dest.stderr
similarity index 100%
rename from src/test/ui/traits-multidispatch-convert-ambig-dest.stderr
rename to src/test/ui/traits/traits-multidispatch-convert-ambig-dest.stderr
diff --git a/src/test/compile-fail/traits-negative-impls.rs b/src/test/ui/traits/traits-negative-impls.rs
similarity index 100%
rename from src/test/compile-fail/traits-negative-impls.rs
rename to src/test/ui/traits/traits-negative-impls.rs
diff --git a/src/test/ui/traits/traits-negative-impls.stderr b/src/test/ui/traits/traits-negative-impls.stderr
new file mode 100644
index 0000000..0d10f48
--- /dev/null
+++ b/src/test/ui/traits/traits-negative-impls.stderr
@@ -0,0 +1,101 @@
+error[E0277]: `dummy::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:33:5
+ |
+LL | Outer(TestType);
+ | ^^^^^ `dummy::TestType` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `dummy::TestType`
+note: required by `Outer`
+ --> $DIR/traits-negative-impls.rs:20:1
+ |
+LL | struct Outer<T: Send>(T);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dummy::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:33:5
+ |
+LL | Outer(TestType);
+ | ^^^^^^^^^^^^^^^ `dummy::TestType` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `dummy::TestType`
+note: required by `Outer`
+ --> $DIR/traits-negative-impls.rs:20:1
+ |
+LL | struct Outer<T: Send>(T);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dummy1b::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:42:5
+ |
+LL | is_send(TestType);
+ | ^^^^^^^ `dummy1b::TestType` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `dummy1b::TestType`
+note: required by `is_send`
+ --> $DIR/traits-negative-impls.rs:26:1
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dummy1c::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:50:5
+ |
+LL | is_send((8, TestType));
+ | ^^^^^^^ `dummy1c::TestType` cannot be sent between threads safely
+ |
+ = help: within `({integer}, dummy1c::TestType)`, the trait `std::marker::Send` is not implemented for `dummy1c::TestType`
+ = note: required because it appears within the type `({integer}, dummy1c::TestType)`
+note: required by `is_send`
+ --> $DIR/traits-negative-impls.rs:26:1
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dummy2::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:58:5
+ |
+LL | is_send(Box::new(TestType));
+ | ^^^^^^^ `dummy2::TestType` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `dummy2::TestType`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<dummy2::TestType>`
+ = note: required because it appears within the type `std::boxed::Box<dummy2::TestType>`
+note: required by `is_send`
+ --> $DIR/traits-negative-impls.rs:26:1
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `dummy3::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:66:5
+ |
+LL | is_send(Box::new(Outer2(TestType)));
+ | ^^^^^^^ `dummy3::TestType` cannot be sent between threads safely
+ |
+ = help: within `Outer2<dummy3::TestType>`, the trait `std::marker::Send` is not implemented for `dummy3::TestType`
+ = note: required because it appears within the type `Outer2<dummy3::TestType>`
+ = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<Outer2<dummy3::TestType>>`
+ = note: required because it appears within the type `std::boxed::Box<Outer2<dummy3::TestType>>`
+note: required by `is_send`
+ --> $DIR/traits-negative-impls.rs:26:1
+ |
+LL | fn is_send<T: Send>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `main::TestType` cannot be sent between threads safely
+ --> $DIR/traits-negative-impls.rs:76:5
+ |
+LL | is_sync(Outer2(TestType));
+ | ^^^^^^^ `main::TestType` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `main::TestType`
+ = note: required because of the requirements on the impl of `std::marker::Sync` for `Outer2<main::TestType>`
+note: required by `is_sync`
+ --> $DIR/traits-negative-impls.rs:27:1
+ |
+LL | fn is_sync<T: Sync>(_: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/traits-repeated-supertrait-ambig.rs b/src/test/ui/traits/traits-repeated-supertrait-ambig.rs
similarity index 100%
rename from src/test/compile-fail/traits-repeated-supertrait-ambig.rs
rename to src/test/ui/traits/traits-repeated-supertrait-ambig.rs
diff --git a/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr
new file mode 100644
index 0000000..87d3c81
--- /dev/null
+++ b/src/test/ui/traits/traits-repeated-supertrait-ambig.stderr
@@ -0,0 +1,52 @@
+error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied
+ --> $DIR/traits-repeated-supertrait-ambig.rs:36:7
+ |
+LL | c.same_as(22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
+ | ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
+
+error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
+ --> $DIR/traits-repeated-supertrait-ambig.rs:40:7
+ |
+LL | c.same_as(22) //~ ERROR `C: CompareTo<i32>` is not satisfied
+ | ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `C`
+ |
+ = help: consider adding a `where C: CompareTo<i32>` bound
+
+error[E0277]: the trait bound `dyn CompareToInts: CompareTo<i32>` is not satisfied
+ --> $DIR/traits-repeated-supertrait-ambig.rs:44:5
+ |
+LL | CompareToInts::same_as(c, 22) //~ ERROR `dyn CompareToInts: CompareTo<i32>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `dyn CompareToInts`
+ |
+note: required by `CompareTo::same_as`
+ --> $DIR/traits-repeated-supertrait-ambig.rs:19:5
+ |
+LL | fn same_as(&self, t: T) -> bool;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `C: CompareTo<i32>` is not satisfied
+ --> $DIR/traits-repeated-supertrait-ambig.rs:48:5
+ |
+LL | CompareTo::same_as(c, 22) //~ ERROR `C: CompareTo<i32>` is not satisfied
+ | ^^^^^^^^^^^^^^^^^^ the trait `CompareTo<i32>` is not implemented for `C`
+ |
+ = help: consider adding a `where C: CompareTo<i32>` bound
+note: required by `CompareTo::same_as`
+ --> $DIR/traits-repeated-supertrait-ambig.rs:19:5
+ |
+LL | fn same_as(&self, t: T) -> bool;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `i64: CompareTo<i32>` is not satisfied
+ --> $DIR/traits-repeated-supertrait-ambig.rs:52:23
+ |
+LL | assert_eq!(22_i64.same_as(22), true); //~ ERROR `i64: CompareTo<i32>` is not satisfied
+ | ^^^^^^^ the trait `CompareTo<i32>` is not implemented for `i64`
+ |
+ = help: the following implementations were found:
+ <i64 as CompareTo<i64>>
+ <i64 as CompareTo<u64>>
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/transmute/transmute-different-sizes.rs b/src/test/ui/transmute/transmute-different-sizes.rs
new file mode 100644
index 0000000..62e9ceb
--- /dev/null
+++ b/src/test/ui/transmute/transmute-different-sizes.rs
@@ -0,0 +1,41 @@
+// Copyright 2012 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.
+
+// normalize-stderr-test "\d+ bits" -> "N bits"
+
+// Tests that `transmute` cannot be called on types of different size.
+
+#![allow(warnings)]
+#![feature(specialization)]
+
+use std::mem::transmute;
+
+unsafe fn f() {
+ let _: i8 = transmute(16i16);
+ //~^ ERROR transmute called with types of different sizes
+}
+
+unsafe fn g<T>(x: &T) {
+ let _: i8 = transmute(x);
+ //~^ ERROR transmute called with types of different sizes
+}
+
+trait Specializable { type Output; }
+
+impl<T> Specializable for T {
+ default type Output = u16;
+}
+
+unsafe fn specializable<T>(x: u16) -> <T as Specializable>::Output {
+ transmute(x)
+ //~^ ERROR transmute called with types of different sizes
+}
+
+fn main() {}
diff --git a/src/test/ui/transmute/transmute-different-sizes.stderr b/src/test/ui/transmute/transmute-different-sizes.stderr
new file mode 100644
index 0000000..a07b75e
--- /dev/null
+++ b/src/test/ui/transmute/transmute-different-sizes.stderr
@@ -0,0 +1,30 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-different-sizes.rs:21:17
+ |
+LL | let _: i8 = transmute(16i16);
+ | ^^^^^^^^^
+ |
+ = note: source type: i16 (N bits)
+ = note: target type: i8 (N bits)
+
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-different-sizes.rs:26:17
+ |
+LL | let _: i8 = transmute(x);
+ | ^^^^^^^^^
+ |
+ = note: source type: &T (N bits)
+ = note: target type: i8 (N bits)
+
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-different-sizes.rs:37:5
+ |
+LL | transmute(x)
+ | ^^^^^^^^^
+ |
+ = note: source type: u16 (N bits)
+ = note: target type: <T as Specializable>::Output (this type's size can vary)
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/ui/transmute/transmute-fat-pointers.rs b/src/test/ui/transmute/transmute-fat-pointers.rs
new file mode 100644
index 0000000..c1e6ee3
--- /dev/null
+++ b/src/test/ui/transmute/transmute-fat-pointers.rs
@@ -0,0 +1,43 @@
+// Copyright 2012 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.
+
+// normalize-stderr-test "\d+ bits" -> "N bits"
+
+// Tests that are conservative around thin/fat pointer mismatches.
+
+#![allow(dead_code)]
+
+use std::mem::transmute;
+
+fn a<T, U: ?Sized>(x: &[T]) -> &U {
+ unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+}
+
+fn b<T: ?Sized, U: ?Sized>(x: &T) -> &U {
+ unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+}
+
+fn c<T, U>(x: &T) -> &U {
+ unsafe { transmute(x) }
+}
+
+fn d<T, U>(x: &[T]) -> &[U] {
+ unsafe { transmute(x) }
+}
+
+fn e<T: ?Sized, U>(x: &T) -> &U {
+ unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+}
+
+fn f<T, U: ?Sized>(x: &T) -> &U {
+ unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+}
+
+fn main() { }
diff --git a/src/test/ui/transmute/transmute-fat-pointers.stderr b/src/test/ui/transmute/transmute-fat-pointers.stderr
new file mode 100644
index 0000000..8ea71e1
--- /dev/null
+++ b/src/test/ui/transmute/transmute-fat-pointers.stderr
@@ -0,0 +1,39 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-fat-pointers.rs:20:14
+ |
+LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^
+ |
+ = note: source type: &[T] (N bits)
+ = note: target type: &U (pointer to U)
+
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-fat-pointers.rs:24:14
+ |
+LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^
+ |
+ = note: source type: &T (pointer to T)
+ = note: target type: &U (pointer to U)
+
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-fat-pointers.rs:36:14
+ |
+LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^
+ |
+ = note: source type: &T (pointer to T)
+ = note: target type: &U (N bits)
+
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-fat-pointers.rs:40:14
+ |
+LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^
+ |
+ = note: source type: &T (N bits)
+ = note: target type: &U (pointer to U)
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/ui/transmute/transmute-impl.rs b/src/test/ui/transmute/transmute-impl.rs
new file mode 100644
index 0000000..3bf4ca5
--- /dev/null
+++ b/src/test/ui/transmute/transmute-impl.rs
@@ -0,0 +1,35 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// normalize-stderr-test "\d+ bits" -> "N bits"
+
+// Tests that are conservative around thin/fat pointer mismatches.
+
+#![allow(dead_code)]
+
+use std::mem::transmute;
+
+struct Foo<T: ?Sized> {
+ t: Box<T>
+}
+
+impl<T: ?Sized> Foo<T> {
+ fn m(x: &T) -> &isize where T : Sized {
+ // OK here, because T : Sized is in scope.
+ unsafe { transmute(x) }
+ }
+
+ fn n(x: &T) -> &isize {
+ // Not OK here, because T : Sized is not in scope.
+ unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+ }
+}
+
+fn main() { }
diff --git a/src/test/ui/transmute/transmute-impl.stderr b/src/test/ui/transmute/transmute-impl.stderr
new file mode 100644
index 0000000..21f272b
--- /dev/null
+++ b/src/test/ui/transmute/transmute-impl.stderr
@@ -0,0 +1,12 @@
+error[E0512]: transmute called with types of different sizes
+ --> $DIR/transmute-impl.rs:31:18
+ |
+LL | unsafe { transmute(x) } //~ ERROR transmute called with types of different sizes
+ | ^^^^^^^^^
+ |
+ = note: source type: &T (pointer to T)
+ = note: target type: &isize (N bits)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0512`.
diff --git a/src/test/compile-fail/transmute-imut-to-mut.rs b/src/test/ui/transmute/transmute-imut-to-mut.rs
similarity index 100%
rename from src/test/compile-fail/transmute-imut-to-mut.rs
rename to src/test/ui/transmute/transmute-imut-to-mut.rs
diff --git a/src/test/ui/transmute/transmute-imut-to-mut.stderr b/src/test/ui/transmute/transmute-imut-to-mut.stderr
new file mode 100644
index 0000000..4434e35
--- /dev/null
+++ b/src/test/ui/transmute/transmute-imut-to-mut.stderr
@@ -0,0 +1,10 @@
+error: mutating transmuted &mut T from &T may cause undefined behavior, consider instead using an UnsafeCell
+ --> $DIR/transmute-imut-to-mut.rs:16:32
+ |
+LL | let _a: &mut u8 = unsafe { transmute(&1u8) };
+ | ^^^^^^^^^
+ |
+ = note: #[deny(mutable_transmutes)] on by default
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds-leak.stderr
deleted file mode 100644
index 5510b9f..0000000
--- a/src/test/ui/trivial-bounds-leak.stderr
+++ /dev/null
@@ -1,48 +0,0 @@
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/trivial-bounds-leak.rs:22:25
- |
-LL | fn cant_return_str() -> str { //~ ERROR
- | ^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: the return type of a function must have a statically known size
-
-error[E0599]: no method named `test` found for type `i32` in the current scope
- --> $DIR/trivial-bounds-leak.rs:34:10
- |
-LL | 3i32.test(); //~ ERROR
- | ^^^^
- |
- = help: items from traits can only be used if the trait is implemented and in scope
- = note: the following trait defines an item `test`, perhaps you need to implement it:
- candidate #1: `Foo`
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/trivial-bounds-leak.rs:35:5
- |
-LL | Foo::test(&4i32); //~ ERROR
- | ^^^^^^^^^ the trait `Foo` is not implemented for `i32`
- |
-note: required by `Foo::test`
- --> $DIR/trivial-bounds-leak.rs:15:5
- |
-LL | fn test(&self);
- | ^^^^^^^^^^^^^^^
-
-error[E0277]: the trait bound `i32: Foo` is not satisfied
- --> $DIR/trivial-bounds-leak.rs:36:5
- |
-LL | generic_function(5i32); //~ ERROR
- | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
- |
-note: required by `generic_function`
- --> $DIR/trivial-bounds-leak.rs:39:1
- |
-LL | fn generic_function<T: Foo>(t: T) {}
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 4 previous errors
-
-Some errors occurred: E0277, E0599.
-For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/trivial-bounds-inconsistent-associated-functions.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-associated-functions.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-associated-functions.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-associated-functions.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.nll.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-copy-reborrow.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy-reborrow.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-copy-reborrow.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-copy.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-copy.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-copy.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent-projection-error.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-projection-error.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-projection-error.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-projection-error.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection-error.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent-projection.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-projection.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-projection.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-projection.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-projection.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent-sized.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-sized.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-sized.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-sized.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-sized.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent-well-formed.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-well-formed.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent-well-formed.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent-well-formed.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent-well-formed.stderr
diff --git a/src/test/ui/trivial-bounds-inconsistent.rs b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent.rs
diff --git a/src/test/ui/trivial-bounds-inconsistent.stderr b/src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-inconsistent.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-inconsistent.stderr
diff --git a/src/test/ui/trivial-bounds-leak-copy.rs b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-leak-copy.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-leak-copy.rs
diff --git a/src/test/ui/trivial-bounds-leak-copy.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-leak-copy.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-leak-copy.stderr
diff --git a/src/test/ui/trivial-bounds-leak.rs b/src/test/ui/trivial-bounds/trivial-bounds-leak.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-leak.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-leak.rs
diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr
new file mode 100644
index 0000000..984e4922
--- /dev/null
+++ b/src/test/ui/trivial-bounds/trivial-bounds-leak.stderr
@@ -0,0 +1,48 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/trivial-bounds-leak.rs:22:25
+ |
+LL | fn cant_return_str() -> str { //~ ERROR
+ | ^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: the return type of a function must have a statically known size
+
+error[E0599]: no method named `test` found for type `i32` in the current scope
+ --> $DIR/trivial-bounds-leak.rs:34:10
+ |
+LL | 3i32.test(); //~ ERROR
+ | ^^^^
+ |
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `test`, perhaps you need to implement it:
+ candidate #1: `Foo`
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/trivial-bounds-leak.rs:35:5
+ |
+LL | Foo::test(&4i32); //~ ERROR
+ | ^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+note: required by `Foo::test`
+ --> $DIR/trivial-bounds-leak.rs:15:5
+ |
+LL | fn test(&self);
+ | ^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `i32: Foo` is not satisfied
+ --> $DIR/trivial-bounds-leak.rs:36:5
+ |
+LL | generic_function(5i32); //~ ERROR
+ | ^^^^^^^^^^^^^^^^ the trait `Foo` is not implemented for `i32`
+ |
+note: required by `generic_function`
+ --> $DIR/trivial-bounds-leak.rs:39:1
+ |
+LL | fn generic_function<T: Foo>(t: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0277, E0599.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/trivial-bounds-lint.rs b/src/test/ui/trivial-bounds/trivial-bounds-lint.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-lint.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-lint.rs
diff --git a/src/test/ui/trivial-bounds-lint.stderr b/src/test/ui/trivial-bounds/trivial-bounds-lint.stderr
similarity index 100%
rename from src/test/ui/trivial-bounds-lint.stderr
rename to src/test/ui/trivial-bounds/trivial-bounds-lint.stderr
diff --git a/src/test/ui/trivial-bounds-object.rs b/src/test/ui/trivial-bounds/trivial-bounds-object.rs
similarity index 100%
rename from src/test/ui/trivial-bounds-object.rs
rename to src/test/ui/trivial-bounds/trivial-bounds-object.rs
diff --git a/src/test/compile-fail/trivial_casts.rs b/src/test/ui/trivial_casts.rs
similarity index 100%
rename from src/test/compile-fail/trivial_casts.rs
rename to src/test/ui/trivial_casts.rs
diff --git a/src/test/ui/trivial_casts.stderr b/src/test/ui/trivial_casts.stderr
new file mode 100644
index 0000000..dc2a6a0
--- /dev/null
+++ b/src/test/ui/trivial_casts.stderr
@@ -0,0 +1,164 @@
+error: trivial numeric cast: `i32` as `i32`
+ --> $DIR/trivial_casts.rs:26:13
+ |
+LL | let _ = 42_i32 as i32; //~ ERROR trivial numeric cast: `i32` as `i32`
+ | ^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/trivial_casts.rs:14:24
+ |
+LL | #![deny(trivial_casts, trivial_numeric_casts)]
+ | ^^^^^^^^^^^^^^^^^^^^^
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial numeric cast: `u8` as `u8`
+ --> $DIR/trivial_casts.rs:29:13
+ |
+LL | let _ = 42_u8 as u8; //~ ERROR trivial numeric cast: `u8` as `u8`
+ | ^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&u32` as `*const u32`
+ --> $DIR/trivial_casts.rs:34:13
+ |
+LL | let _ = x as *const u32; //~ERROR trivial cast: `&u32` as `*const u32`
+ | ^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/trivial_casts.rs:14:9
+ |
+LL | #![deny(trivial_casts, trivial_numeric_casts)]
+ | ^^^^^^^^^^^^^
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&mut u32` as `*mut u32`
+ --> $DIR/trivial_casts.rs:38:13
+ |
+LL | let _ = x as *mut u32; //~ERROR trivial cast: `&mut u32` as `*mut u32`
+ | ^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&[u32; 3]` as `&[u32]`
+ --> $DIR/trivial_casts.rs:43:13
+ |
+LL | let _ = x as &[u32]; //~ERROR trivial cast: `&[u32; 3]` as `&[u32]`
+ | ^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&[u32; 3]` as `*const [u32]`
+ --> $DIR/trivial_casts.rs:44:13
+ |
+LL | let _ = x as *const [u32]; //~ERROR trivial cast: `&[u32; 3]` as `*const [u32]`
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&mut [u32; 3]` as `&mut [u32]`
+ --> $DIR/trivial_casts.rs:49:13
+ |
+LL | let _ = x as &mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `&mut [u32]`
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&mut [u32; 3]` as `*mut [u32]`
+ --> $DIR/trivial_casts.rs:50:13
+ |
+LL | let _ = x as *mut [u32]; //~ERROR trivial cast: `&mut [u32; 3]` as `*mut [u32]`
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `std::boxed::Box<[u32; 3]>` as `std::boxed::Box<[u32]>`
+ --> $DIR/trivial_casts.rs:55:13
+ |
+LL | let _ = x as Box<[u32]>;
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&Bar` as `&dyn Foo`
+ --> $DIR/trivial_casts.rs:62:13
+ |
+LL | let _ = x as &Foo; //~ERROR trivial cast: `&Bar` as `&dyn Foo`
+ | ^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&Bar` as `*const dyn Foo`
+ --> $DIR/trivial_casts.rs:63:13
+ |
+LL | let _ = x as *const Foo; //~ERROR trivial cast: `&Bar` as `*const dyn Foo`
+ | ^^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&mut Bar` as `&mut dyn Foo`
+ --> $DIR/trivial_casts.rs:68:13
+ |
+LL | let _ = x as &mut Foo; //~ERROR trivial cast: `&mut Bar` as `&mut dyn Foo`
+ | ^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&mut Bar` as `*mut dyn Foo`
+ --> $DIR/trivial_casts.rs:69:13
+ |
+LL | let _ = x as *mut Foo; //~ERROR trivial cast: `&mut Bar` as `*mut dyn Foo`
+ | ^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
+ --> $DIR/trivial_casts.rs:74:13
+ |
+LL | let _ = x as Box<Foo>; //~ERROR `std::boxed::Box<Bar>` as `std::boxed::Box<dyn Foo>`
+ | ^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
+ --> $DIR/trivial_casts.rs:80:13
+ |
+LL | let _ = &baz as &Fn(i32); //~ERROR `&fn(i32) {main::baz}` as `&dyn std::ops::Fn(i32)`
+ | ^^^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&[closure@$DIR/trivial_casts.rs:82:13: 82:25]` as `&dyn std::ops::Fn(i32)`
+ --> $DIR/trivial_casts.rs:83:13
+ |
+LL | let _ = &x as &Fn(i32); //~ERROR trivial cast
+ | ^^^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&'a Bar` as `&'a Bar`
+ --> $DIR/trivial_casts.rs:89:13
+ |
+LL | let _ = a as &'a Bar; //~ERROR trivial cast
+ | ^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&'b Bar` as `&'a Bar`
+ --> $DIR/trivial_casts.rs:91:13
+ |
+LL | let _ = b as &'a Bar; //~ERROR trivial cast
+ | ^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: trivial cast: `&'b Bar` as `&'b Bar`
+ --> $DIR/trivial_casts.rs:93:13
+ |
+LL | let _ = b as &'b Bar; //~ERROR trivial cast
+ | ^^^^^^^^^^^^
+ |
+ = help: cast can be replaced by coercion; this might require a temporary variable
+
+error: aborting due to 19 previous errors
+
diff --git a/src/test/compile-fail/tuple-arity-mismatch.rs b/src/test/ui/tuple/tuple-arity-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/tuple-arity-mismatch.rs
rename to src/test/ui/tuple/tuple-arity-mismatch.rs
diff --git a/src/test/ui/tuple/tuple-arity-mismatch.stderr b/src/test/ui/tuple/tuple-arity-mismatch.stderr
new file mode 100644
index 0000000..574a1f0
--- /dev/null
+++ b/src/test/ui/tuple/tuple-arity-mismatch.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/tuple-arity-mismatch.rs:16:20
+ |
+LL | let y = first ((1,2.0,3));
+ | ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements
+ |
+ = note: expected type `(isize, f64)`
+ found type `(isize, f64, {integer})`
+
+error[E0308]: mismatched types
+ --> $DIR/tuple-arity-mismatch.rs:22:20
+ |
+LL | let y = first ((1,));
+ | ^^^^ expected a tuple with 2 elements, found one with 1 elements
+ |
+ = note: expected type `(isize, f64)`
+ found type `(isize,)`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/tuple-float-index.fixed b/src/test/ui/tuple/tuple-float-index.fixed
similarity index 100%
rename from src/test/ui/tuple-float-index.fixed
rename to src/test/ui/tuple/tuple-float-index.fixed
diff --git a/src/test/ui/tuple-float-index.rs b/src/test/ui/tuple/tuple-float-index.rs
similarity index 100%
rename from src/test/ui/tuple-float-index.rs
rename to src/test/ui/tuple/tuple-float-index.rs
diff --git a/src/test/ui/tuple-float-index.stderr b/src/test/ui/tuple/tuple-float-index.stderr
similarity index 100%
rename from src/test/ui/tuple-float-index.stderr
rename to src/test/ui/tuple/tuple-float-index.stderr
diff --git a/src/test/compile-fail/tuple-index-not-tuple.rs b/src/test/ui/tuple/tuple-index-not-tuple.rs
similarity index 100%
rename from src/test/compile-fail/tuple-index-not-tuple.rs
rename to src/test/ui/tuple/tuple-index-not-tuple.rs
diff --git a/src/test/ui/tuple/tuple-index-not-tuple.stderr b/src/test/ui/tuple/tuple-index-not-tuple.stderr
new file mode 100644
index 0000000..fa0d0b4
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-not-tuple.stderr
@@ -0,0 +1,15 @@
+error[E0609]: no field `0` on type `Point`
+ --> $DIR/tuple-index-not-tuple.rs:16:12
+ |
+LL | origin.0;
+ | ^ did you mean `x`?
+
+error[E0609]: no field `0` on type `Empty`
+ --> $DIR/tuple-index-not-tuple.rs:18:11
+ |
+LL | Empty.0;
+ | ^ unknown field
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/compile-fail/tuple-index-out-of-bounds.rs b/src/test/ui/tuple/tuple-index-out-of-bounds.rs
similarity index 100%
rename from src/test/compile-fail/tuple-index-out-of-bounds.rs
rename to src/test/ui/tuple/tuple-index-out-of-bounds.rs
diff --git a/src/test/ui/tuple/tuple-index-out-of-bounds.stderr b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr
new file mode 100644
index 0000000..068e83a
--- /dev/null
+++ b/src/test/ui/tuple/tuple-index-out-of-bounds.stderr
@@ -0,0 +1,15 @@
+error[E0609]: no field `2` on type `Point`
+ --> $DIR/tuple-index-out-of-bounds.rs:17:12
+ |
+LL | origin.2;
+ | ^ did you mean `0`?
+
+error[E0609]: no field `2` on type `({integer}, {integer})`
+ --> $DIR/tuple-index-out-of-bounds.rs:22:11
+ |
+LL | tuple.2;
+ | ^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/ui/tuple-struct-fields/test.rs b/src/test/ui/tuple/tuple-struct-fields/test.rs
similarity index 100%
rename from src/test/ui/tuple-struct-fields/test.rs
rename to src/test/ui/tuple/tuple-struct-fields/test.rs
diff --git a/src/test/ui/tuple-struct-fields/test.stderr b/src/test/ui/tuple/tuple-struct-fields/test.stderr
similarity index 100%
rename from src/test/ui/tuple-struct-fields/test.stderr
rename to src/test/ui/tuple/tuple-struct-fields/test.stderr
diff --git a/src/test/ui/tuple-struct-fields/test2.rs b/src/test/ui/tuple/tuple-struct-fields/test2.rs
similarity index 100%
rename from src/test/ui/tuple-struct-fields/test2.rs
rename to src/test/ui/tuple/tuple-struct-fields/test2.rs
diff --git a/src/test/ui/tuple-struct-fields/test2.stderr b/src/test/ui/tuple/tuple-struct-fields/test2.stderr
similarity index 100%
rename from src/test/ui/tuple-struct-fields/test2.stderr
rename to src/test/ui/tuple/tuple-struct-fields/test2.stderr
diff --git a/src/test/ui/tuple-struct-fields/test3.rs b/src/test/ui/tuple/tuple-struct-fields/test3.rs
similarity index 100%
rename from src/test/ui/tuple-struct-fields/test3.rs
rename to src/test/ui/tuple/tuple-struct-fields/test3.rs
diff --git a/src/test/ui/tuple-struct-fields/test3.stderr b/src/test/ui/tuple/tuple-struct-fields/test3.stderr
similarity index 100%
rename from src/test/ui/tuple-struct-fields/test3.stderr
rename to src/test/ui/tuple/tuple-struct-fields/test3.stderr
diff --git a/src/test/compile-fail/tuple-struct-nonexhaustive.rs b/src/test/ui/tuple/tuple-struct-nonexhaustive.rs
similarity index 100%
rename from src/test/compile-fail/tuple-struct-nonexhaustive.rs
rename to src/test/ui/tuple/tuple-struct-nonexhaustive.rs
diff --git a/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr
new file mode 100644
index 0000000..ee274be
--- /dev/null
+++ b/src/test/ui/tuple/tuple-struct-nonexhaustive.stderr
@@ -0,0 +1,9 @@
+error[E0004]: non-exhaustive patterns: `Foo(_, _)` not covered
+ --> $DIR/tuple-struct-nonexhaustive.rs:15:11
+ |
+LL | match x { //~ ERROR non-exhaustive
+ | ^ pattern `Foo(_, _)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/tutorial-suffix-inference-test.rs b/src/test/ui/tutorial-suffix-inference-test.rs
similarity index 100%
rename from src/test/compile-fail/tutorial-suffix-inference-test.rs
rename to src/test/ui/tutorial-suffix-inference-test.rs
diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/tutorial-suffix-inference-test.stderr
new file mode 100644
index 0000000..d315f9b
--- /dev/null
+++ b/src/test/ui/tutorial-suffix-inference-test.stderr
@@ -0,0 +1,25 @@
+error[E0308]: mismatched types
+ --> $DIR/tutorial-suffix-inference-test.rs:19:18
+ |
+LL | identity_u16(x);
+ | ^ expected u16, found u8
+help: you can cast an `u8` to `u16`, which will zero-extend the source value
+ |
+LL | identity_u16(x.into());
+ | ^^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/tutorial-suffix-inference-test.rs:22:18
+ |
+LL | identity_u16(y);
+ | ^ expected u16, found i32
+
+error[E0308]: mismatched types
+ --> $DIR/tutorial-suffix-inference-test.rs:31:18
+ |
+LL | identity_u16(a);
+ | ^ expected u16, found isize
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/auxiliary/crate_a1.rs b/src/test/ui/type/auxiliary/crate_a1.rs
similarity index 100%
copy from src/test/compile-fail/auxiliary/crate_a1.rs
copy to src/test/ui/type/auxiliary/crate_a1.rs
diff --git a/src/test/compile-fail/auxiliary/crate_a2.rs b/src/test/ui/type/auxiliary/crate_a2.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/crate_a2.rs
rename to src/test/ui/type/auxiliary/crate_a2.rs
diff --git a/src/test/ui/type-alias-bounds.rs b/src/test/ui/type/type-alias-bounds.rs
similarity index 100%
rename from src/test/ui/type-alias-bounds.rs
rename to src/test/ui/type/type-alias-bounds.rs
diff --git a/src/test/ui/type-alias-bounds.stderr b/src/test/ui/type/type-alias-bounds.stderr
similarity index 100%
rename from src/test/ui/type-alias-bounds.stderr
rename to src/test/ui/type/type-alias-bounds.stderr
diff --git a/src/test/ui/type-annotation-needed.rs b/src/test/ui/type/type-annotation-needed.rs
similarity index 100%
rename from src/test/ui/type-annotation-needed.rs
rename to src/test/ui/type/type-annotation-needed.rs
diff --git a/src/test/ui/type-annotation-needed.stderr b/src/test/ui/type/type-annotation-needed.stderr
similarity index 100%
rename from src/test/ui/type-annotation-needed.stderr
rename to src/test/ui/type/type-annotation-needed.stderr
diff --git a/src/test/compile-fail/type-arg-out-of-scope.rs b/src/test/ui/type/type-arg-out-of-scope.rs
similarity index 100%
rename from src/test/compile-fail/type-arg-out-of-scope.rs
rename to src/test/ui/type/type-arg-out-of-scope.rs
diff --git a/src/test/ui/type/type-arg-out-of-scope.stderr b/src/test/ui/type/type-arg-out-of-scope.stderr
new file mode 100644
index 0000000..20bf303
--- /dev/null
+++ b/src/test/ui/type/type-arg-out-of-scope.stderr
@@ -0,0 +1,23 @@
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/type-arg-out-of-scope.rs:13:25
+ |
+LL | fn foo<T>(x: T) {
+ | - type variable from outer function
+LL | fn bar(f: Box<FnMut(T) -> T>) { }
+ | --- ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `bar<T>`
+
+error[E0401]: can't use type parameters from outer function
+ --> $DIR/type-arg-out-of-scope.rs:13:31
+ |
+LL | fn foo<T>(x: T) {
+ | - type variable from outer function
+LL | fn bar(f: Box<FnMut(T) -> T>) { }
+ | --- ^ use of type variable from outer function
+ | |
+ | help: try using a local type parameter instead: `bar<T>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0401`.
diff --git a/src/test/ui/type-ascription-instead-of-initializer.rs b/src/test/ui/type/type-ascription-instead-of-initializer.rs
similarity index 100%
rename from src/test/ui/type-ascription-instead-of-initializer.rs
rename to src/test/ui/type/type-ascription-instead-of-initializer.rs
diff --git a/src/test/ui/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr
similarity index 100%
rename from src/test/ui/type-ascription-instead-of-initializer.stderr
rename to src/test/ui/type/type-ascription-instead-of-initializer.stderr
diff --git a/src/test/ui/type-ascription-instead-of-statement-end.rs b/src/test/ui/type/type-ascription-instead-of-statement-end.rs
similarity index 100%
rename from src/test/ui/type-ascription-instead-of-statement-end.rs
rename to src/test/ui/type/type-ascription-instead-of-statement-end.rs
diff --git a/src/test/ui/type-ascription-instead-of-statement-end.stderr b/src/test/ui/type/type-ascription-instead-of-statement-end.stderr
similarity index 100%
rename from src/test/ui/type-ascription-instead-of-statement-end.stderr
rename to src/test/ui/type/type-ascription-instead-of-statement-end.stderr
diff --git a/src/test/compile-fail/type-ascription-precedence.rs b/src/test/ui/type/type-ascription-precedence.rs
similarity index 100%
rename from src/test/compile-fail/type-ascription-precedence.rs
rename to src/test/ui/type/type-ascription-precedence.rs
diff --git a/src/test/ui/type/type-ascription-precedence.stderr b/src/test/ui/type/type-ascription-precedence.stderr
new file mode 100644
index 0000000..252b523
--- /dev/null
+++ b/src/test/ui/type/type-ascription-precedence.stderr
@@ -0,0 +1,72 @@
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-precedence.rs:41:7
+ |
+LL | &(S: &S); //~ ERROR mismatched types
+ | ^ expected &S, found struct `S`
+ |
+ = note: expected type `&S`
+ found type `S`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-precedence.rs:45:7
+ |
+LL | *(S: Z); //~ ERROR mismatched types
+ | ^ expected struct `Z`, found struct `S`
+ |
+ = note: expected type `Z`
+ found type `S`
+
+error[E0614]: type `Z` cannot be dereferenced
+ --> $DIR/type-ascription-precedence.rs:45:5
+ |
+LL | *(S: Z); //~ ERROR mismatched types
+ | ^^^^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-precedence.rs:50:7
+ |
+LL | -(S: Z); //~ ERROR mismatched types
+ | ^ expected struct `Z`, found struct `S`
+ |
+ = note: expected type `Z`
+ found type `S`
+
+error[E0600]: cannot apply unary operator `-` to type `Z`
+ --> $DIR/type-ascription-precedence.rs:50:5
+ |
+LL | -(S: Z); //~ ERROR mismatched types
+ | ^^^^^^^ cannot apply unary operator `-`
+ |
+ = note: an implementation of `std::ops::Neg` might be missing for `Z`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-precedence.rs:55:5
+ |
+LL | (S + Z): Z; //~ ERROR mismatched types
+ | ^^^^^^^ expected struct `Z`, found struct `S`
+ |
+ = note: expected type `Z`
+ found type `S`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-precedence.rs:59:5
+ |
+LL | (S * Z): Z; //~ ERROR mismatched types
+ | ^^^^^^^ expected struct `Z`, found struct `S`
+ |
+ = note: expected type `Z`
+ found type `S`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-precedence.rs:63:5
+ |
+LL | (S .. S): S; //~ ERROR mismatched types
+ | ^^^^^^^^ expected struct `S`, found struct `std::ops::Range`
+ |
+ = note: expected type `S`
+ found type `std::ops::Range<S>`
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0308, E0600, E0614.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/type-ascription-soundness.rs b/src/test/ui/type/type-ascription-soundness.rs
similarity index 100%
rename from src/test/compile-fail/type-ascription-soundness.rs
rename to src/test/ui/type/type-ascription-soundness.rs
diff --git a/src/test/ui/type/type-ascription-soundness.stderr b/src/test/ui/type/type-ascription-soundness.stderr
new file mode 100644
index 0000000..3dcd6ff
--- /dev/null
+++ b/src/test/ui/type/type-ascription-soundness.stderr
@@ -0,0 +1,39 @@
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-soundness.rs:17:17
+ |
+LL | let ref x = arr: &[u8]; //~ ERROR mismatched types
+ | ^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[u8]`
+ found type `&[u8; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-soundness.rs:18:21
+ |
+LL | let ref mut x = arr: &[u8]; //~ ERROR mismatched types
+ | ^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[u8]`
+ found type `&[u8; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-soundness.rs:19:11
+ |
+LL | match arr: &[u8] { //~ ERROR mismatched types
+ | ^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[u8]`
+ found type `&[u8; 3]`
+
+error[E0308]: mismatched types
+ --> $DIR/type-ascription-soundness.rs:22:17
+ |
+LL | let _len = (arr: &[u8]).len(); //~ ERROR mismatched types
+ | ^^^ expected slice, found array of 3 elements
+ |
+ = note: expected type `&[u8]`
+ found type `&[u8; 3]`
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/type-ascription-with-fn-call.rs b/src/test/ui/type/type-ascription-with-fn-call.rs
similarity index 100%
rename from src/test/ui/type-ascription-with-fn-call.rs
rename to src/test/ui/type/type-ascription-with-fn-call.rs
diff --git a/src/test/ui/type-ascription-with-fn-call.stderr b/src/test/ui/type/type-ascription-with-fn-call.stderr
similarity index 100%
rename from src/test/ui/type-ascription-with-fn-call.stderr
rename to src/test/ui/type/type-ascription-with-fn-call.stderr
diff --git a/src/test/ui/type-check-defaults.rs b/src/test/ui/type/type-check-defaults.rs
similarity index 100%
rename from src/test/ui/type-check-defaults.rs
rename to src/test/ui/type/type-check-defaults.rs
diff --git a/src/test/ui/type-check-defaults.stderr b/src/test/ui/type/type-check-defaults.stderr
similarity index 100%
rename from src/test/ui/type-check-defaults.stderr
rename to src/test/ui/type/type-check-defaults.stderr
diff --git a/src/test/ui/type-check/assignment-in-if.rs b/src/test/ui/type/type-check/assignment-in-if.rs
similarity index 100%
rename from src/test/ui/type-check/assignment-in-if.rs
rename to src/test/ui/type/type-check/assignment-in-if.rs
diff --git a/src/test/ui/type-check/assignment-in-if.stderr b/src/test/ui/type/type-check/assignment-in-if.stderr
similarity index 100%
rename from src/test/ui/type-check/assignment-in-if.stderr
rename to src/test/ui/type/type-check/assignment-in-if.stderr
diff --git a/src/test/ui/type-check/cannot_infer_local_or_array.rs b/src/test/ui/type/type-check/cannot_infer_local_or_array.rs
similarity index 100%
rename from src/test/ui/type-check/cannot_infer_local_or_array.rs
rename to src/test/ui/type/type-check/cannot_infer_local_or_array.rs
diff --git a/src/test/ui/type-check/cannot_infer_local_or_array.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_array.stderr
similarity index 100%
rename from src/test/ui/type-check/cannot_infer_local_or_array.stderr
rename to src/test/ui/type/type-check/cannot_infer_local_or_array.stderr
diff --git a/src/test/ui/type-check/cannot_infer_local_or_vec.rs b/src/test/ui/type/type-check/cannot_infer_local_or_vec.rs
similarity index 100%
rename from src/test/ui/type-check/cannot_infer_local_or_vec.rs
rename to src/test/ui/type/type-check/cannot_infer_local_or_vec.rs
diff --git a/src/test/ui/type-check/cannot_infer_local_or_vec.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr
similarity index 100%
rename from src/test/ui/type-check/cannot_infer_local_or_vec.stderr
rename to src/test/ui/type/type-check/cannot_infer_local_or_vec.stderr
diff --git a/src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.rs b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs
similarity index 100%
rename from src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.rs
rename to src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.rs
diff --git a/src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr b/src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr
similarity index 100%
rename from src/test/ui/type-check/cannot_infer_local_or_vec_in_tuples.stderr
rename to src/test/ui/type/type-check/cannot_infer_local_or_vec_in_tuples.stderr
diff --git a/src/test/ui/type-check/issue-22897.rs b/src/test/ui/type/type-check/issue-22897.rs
similarity index 100%
rename from src/test/ui/type-check/issue-22897.rs
rename to src/test/ui/type/type-check/issue-22897.rs
diff --git a/src/test/ui/type-check/issue-22897.stderr b/src/test/ui/type/type-check/issue-22897.stderr
similarity index 100%
rename from src/test/ui/type-check/issue-22897.stderr
rename to src/test/ui/type/type-check/issue-22897.stderr
diff --git a/src/test/ui/type-check/issue-40294.rs b/src/test/ui/type/type-check/issue-40294.rs
similarity index 100%
rename from src/test/ui/type-check/issue-40294.rs
rename to src/test/ui/type/type-check/issue-40294.rs
diff --git a/src/test/ui/type-check/issue-40294.stderr b/src/test/ui/type/type-check/issue-40294.stderr
similarity index 100%
rename from src/test/ui/type-check/issue-40294.stderr
rename to src/test/ui/type/type-check/issue-40294.stderr
diff --git a/src/test/ui/type-check/issue-41314.rs b/src/test/ui/type/type-check/issue-41314.rs
similarity index 100%
rename from src/test/ui/type-check/issue-41314.rs
rename to src/test/ui/type/type-check/issue-41314.rs
diff --git a/src/test/ui/type-check/issue-41314.stderr b/src/test/ui/type/type-check/issue-41314.stderr
similarity index 100%
rename from src/test/ui/type-check/issue-41314.stderr
rename to src/test/ui/type/type-check/issue-41314.stderr
diff --git a/src/test/ui/type-check/missing_trait_impl.rs b/src/test/ui/type/type-check/missing_trait_impl.rs
similarity index 100%
rename from src/test/ui/type-check/missing_trait_impl.rs
rename to src/test/ui/type/type-check/missing_trait_impl.rs
diff --git a/src/test/ui/type-check/missing_trait_impl.stderr b/src/test/ui/type/type-check/missing_trait_impl.stderr
similarity index 100%
rename from src/test/ui/type-check/missing_trait_impl.stderr
rename to src/test/ui/type/type-check/missing_trait_impl.stderr
diff --git a/src/test/ui/type-check/unknown_type_for_closure.rs b/src/test/ui/type/type-check/unknown_type_for_closure.rs
similarity index 100%
rename from src/test/ui/type-check/unknown_type_for_closure.rs
rename to src/test/ui/type/type-check/unknown_type_for_closure.rs
diff --git a/src/test/ui/type-check/unknown_type_for_closure.stderr b/src/test/ui/type/type-check/unknown_type_for_closure.stderr
similarity index 100%
rename from src/test/ui/type-check/unknown_type_for_closure.stderr
rename to src/test/ui/type/type-check/unknown_type_for_closure.stderr
diff --git a/src/test/ui/type-dependent-def-issue-49241.rs b/src/test/ui/type/type-dependent-def-issue-49241.rs
similarity index 100%
rename from src/test/ui/type-dependent-def-issue-49241.rs
rename to src/test/ui/type/type-dependent-def-issue-49241.rs
diff --git a/src/test/ui/type-dependent-def-issue-49241.stderr b/src/test/ui/type/type-dependent-def-issue-49241.stderr
similarity index 100%
rename from src/test/ui/type-dependent-def-issue-49241.stderr
rename to src/test/ui/type/type-dependent-def-issue-49241.stderr
diff --git a/src/test/compile-fail/type-mismatch-multiple.rs b/src/test/ui/type/type-mismatch-multiple.rs
similarity index 100%
rename from src/test/compile-fail/type-mismatch-multiple.rs
rename to src/test/ui/type/type-mismatch-multiple.rs
diff --git a/src/test/ui/type/type-mismatch-multiple.stderr b/src/test/ui/type/type-mismatch-multiple.stderr
new file mode 100644
index 0000000..b9721a5
--- /dev/null
+++ b/src/test/ui/type/type-mismatch-multiple.stderr
@@ -0,0 +1,18 @@
+error[E0308]: mismatched types
+ --> $DIR/type-mismatch-multiple.rs:13:27
+ |
+LL | fn main() { let a: bool = 1; let b: i32 = true; }
+ | ^ expected bool, found integral variable
+ |
+ = note: expected type `bool`
+ found type `{integer}`
+
+error[E0308]: mismatched types
+ --> $DIR/type-mismatch-multiple.rs:13:43
+ |
+LL | fn main() { let a: bool = 1; let b: i32 = true; }
+ | ^^^^ expected i32, found bool
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/type-mismatch-same-crate-name.rs b/src/test/ui/type/type-mismatch-same-crate-name.rs
similarity index 100%
rename from src/test/compile-fail/type-mismatch-same-crate-name.rs
rename to src/test/ui/type/type-mismatch-same-crate-name.rs
diff --git a/src/test/ui/type/type-mismatch-same-crate-name.stderr b/src/test/ui/type/type-mismatch-same-crate-name.stderr
new file mode 100644
index 0000000..c686092
--- /dev/null
+++ b/src/test/ui/type/type-mismatch-same-crate-name.stderr
@@ -0,0 +1,31 @@
+error[E0308]: mismatched types
+ --> $DIR/type-mismatch-same-crate-name.rs:26:20
+ |
+LL | a::try_foo(foo2);
+ | ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo`
+ |
+ = note: expected type `main::a::Foo` (struct `main::a::Foo`)
+ found type `main::a::Foo` (struct `main::a::Foo`)
+note: Perhaps two different versions of crate `crate_a1` are being used?
+ --> $DIR/type-mismatch-same-crate-name.rs:26:20
+ |
+LL | a::try_foo(foo2);
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/type-mismatch-same-crate-name.rs:32:20
+ |
+LL | a::try_bar(bar2);
+ | ^^^^ expected trait `main::a::Bar`, found a different trait `main::a::Bar`
+ |
+ = note: expected type `std::boxed::Box<(dyn main::a::Bar + 'static)>`
+ found type `std::boxed::Box<dyn main::a::Bar>`
+note: Perhaps two different versions of crate `crate_a1` are being used?
+ --> $DIR/type-mismatch-same-crate-name.rs:32:20
+ |
+LL | a::try_bar(bar2);
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/type-mismatch.rs b/src/test/ui/type/type-mismatch.rs
similarity index 100%
rename from src/test/ui/type-mismatch.rs
rename to src/test/ui/type/type-mismatch.rs
diff --git a/src/test/ui/type-mismatch.stderr b/src/test/ui/type/type-mismatch.stderr
similarity index 100%
rename from src/test/ui/type-mismatch.stderr
rename to src/test/ui/type/type-mismatch.stderr
diff --git a/src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs
similarity index 100%
rename from src/test/compile-fail/type-parameter-defaults-referencing-Self-ppaux.rs
rename to src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.rs
diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
new file mode 100644
index 0000000..f02bf05
--- /dev/null
+++ b/src/test/ui/type/type-parameter-defaults-referencing-Self-ppaux.stderr
@@ -0,0 +1,24 @@
+error[E0620]: cast to unsized type: `i32` as `dyn MyAdd<i32>`
+ --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:24:13
+ |
+LL | let y = x as MyAdd<i32>;
+ | ^^^^^^^^^^^^^^^
+ |
+help: consider using a box or reference as appropriate
+ --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:24:13
+ |
+LL | let y = x as MyAdd<i32>;
+ | ^
+
+error[E0038]: the trait `MyAdd` cannot be made into an object
+ --> $DIR/type-parameter-defaults-referencing-Self-ppaux.rs:24:18
+ |
+LL | let y = x as MyAdd<i32>;
+ | ^^^^^^^^^^ the trait `MyAdd` cannot be made into an object
+ |
+ = note: method `add` references the `Self` type in its arguments or return type
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0038, E0620.
+For more information about an error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/type-parameter-defaults-referencing-Self.rs b/src/test/ui/type/type-parameter-defaults-referencing-Self.rs
similarity index 100%
rename from src/test/compile-fail/type-parameter-defaults-referencing-Self.rs
rename to src/test/ui/type/type-parameter-defaults-referencing-Self.rs
diff --git a/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr
new file mode 100644
index 0000000..e163253
--- /dev/null
+++ b/src/test/ui/type/type-parameter-defaults-referencing-Self.stderr
@@ -0,0 +1,11 @@
+error[E0393]: the type parameter `T` must be explicitly specified
+ --> $DIR/type-parameter-defaults-referencing-Self.rs:20:12
+ |
+LL | fn foo(x: &Foo) { }
+ | ^^^ missing reference to `T`
+ |
+ = note: because of the default `Self` reference, type parameters must be specified on object types
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0393`.
diff --git a/src/test/compile-fail/type-parameter-names.rs b/src/test/ui/type/type-parameter-names.rs
similarity index 100%
rename from src/test/compile-fail/type-parameter-names.rs
rename to src/test/ui/type/type-parameter-names.rs
diff --git a/src/test/ui/type/type-parameter-names.stderr b/src/test/ui/type/type-parameter-names.stderr
new file mode 100644
index 0000000..8e3d393
--- /dev/null
+++ b/src/test/ui/type/type-parameter-names.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/type-parameter-names.rs:15:5
+ |
+LL | fn foo<Foo, Bar>(x: Foo) -> Bar {
+ | --- expected `Bar` because of return type
+LL | x
+ | ^ expected type parameter, found a different type parameter
+ |
+ = note: expected type `Bar`
+ found type `Foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/type-params-in-different-spaces-1.rs b/src/test/ui/type/type-params-in-different-spaces-1.rs
similarity index 100%
rename from src/test/compile-fail/type-params-in-different-spaces-1.rs
rename to src/test/ui/type/type-params-in-different-spaces-1.rs
diff --git a/src/test/ui/type/type-params-in-different-spaces-1.stderr b/src/test/ui/type/type-params-in-different-spaces-1.stderr
new file mode 100644
index 0000000..31f332f
--- /dev/null
+++ b/src/test/ui/type/type-params-in-different-spaces-1.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/type-params-in-different-spaces-1.rs:15:17
+ |
+LL | *self + rhs //~ ERROR mismatched types
+ | ^^^ expected Self, found type parameter
+ |
+ = note: expected type `Self`
+ found type `T`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/type-params-in-different-spaces-2.rs b/src/test/ui/type/type-params-in-different-spaces-2.rs
similarity index 100%
rename from src/test/compile-fail/type-params-in-different-spaces-2.rs
rename to src/test/ui/type/type-params-in-different-spaces-2.rs
diff --git a/src/test/ui/type/type-params-in-different-spaces-2.stderr b/src/test/ui/type/type-params-in-different-spaces-2.stderr
new file mode 100644
index 0000000..af18185
--- /dev/null
+++ b/src/test/ui/type/type-params-in-different-spaces-2.stderr
@@ -0,0 +1,29 @@
+error[E0277]: the trait bound `Self: Tr<U>` is not satisfied
+ --> $DIR/type-params-in-different-spaces-2.rs:20:9
+ |
+LL | Tr::op(u) //~ ERROR E0277
+ | ^^^^^^ the trait `Tr<U>` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: Tr<U>` bound
+note: required by `Tr::op`
+ --> $DIR/type-params-in-different-spaces-2.rs:15:5
+ |
+LL | fn op(_: T) -> Self;
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `Self: Tr<U>` is not satisfied
+ --> $DIR/type-params-in-different-spaces-2.rs:26:9
+ |
+LL | Tr::op(u) //~ ERROR E0277
+ | ^^^^^^ the trait `Tr<U>` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: Tr<U>` bound
+note: required by `Tr::op`
+ --> $DIR/type-params-in-different-spaces-2.rs:15:5
+ |
+LL | fn op(_: T) -> Self;
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/type-params-in-different-spaces-3.rs b/src/test/ui/type/type-params-in-different-spaces-3.rs
similarity index 100%
rename from src/test/compile-fail/type-params-in-different-spaces-3.rs
rename to src/test/ui/type/type-params-in-different-spaces-3.rs
diff --git a/src/test/ui/type/type-params-in-different-spaces-3.stderr b/src/test/ui/type/type-params-in-different-spaces-3.stderr
new file mode 100644
index 0000000..e1b4cbb
--- /dev/null
+++ b/src/test/ui/type/type-params-in-different-spaces-3.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/type-params-in-different-spaces-3.rs:13:9
+ |
+LL | fn test<X>(u: X) -> Self {
+ | ---- expected `Self` because of return type
+LL | u //~ ERROR mismatched types
+ | ^ expected Self, found type parameter
+ |
+ = note: expected type `Self`
+ found type `X`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/type-path-err-node-types.rs b/src/test/ui/type/type-path-err-node-types.rs
similarity index 100%
rename from src/test/compile-fail/type-path-err-node-types.rs
rename to src/test/ui/type/type-path-err-node-types.rs
diff --git a/src/test/ui/type/type-path-err-node-types.stderr b/src/test/ui/type/type-path-err-node-types.stderr
new file mode 100644
index 0000000..c28b30b
--- /dev/null
+++ b/src/test/ui/type/type-path-err-node-types.stderr
@@ -0,0 +1,28 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `NonExistent`
+ --> $DIR/type-path-err-node-types.rs:25:5
+ |
+LL | NonExistent::Assoc::<u8>; //~ ERROR undeclared type or module `NonExistent`
+ | ^^^^^^^^^^^ Use of undeclared type or module `NonExistent`
+
+error[E0412]: cannot find type `Nonexistent` in this scope
+ --> $DIR/type-path-err-node-types.rs:17:12
+ |
+LL | let _: Nonexistent<u8, Assoc = u16>; //~ ERROR cannot find type `Nonexistent` in this scope
+ | ^^^^^^^^^^^ not found in this scope
+
+error[E0576]: cannot find method or associated constant `nonexistent` in trait `Tr`
+ --> $DIR/type-path-err-node-types.rs:21:21
+ |
+LL | <u8 as Tr<u8>>::nonexistent(); //~ ERROR cannot find method or associated constant `nonexistent`
+ | ^^^^^^^^^^^ not found in `Tr`
+
+error[E0425]: cannot find value `nonexistent` in this scope
+ --> $DIR/type-path-err-node-types.rs:29:5
+ |
+LL | nonexistent.nonexistent::<u8>(); //~ ERROR cannot find value `nonexistent`
+ | ^^^^^^^^^^^ not found in this scope
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0412, E0425, E0433, E0576.
+For more information about an error, try `rustc --explain E0412`.
diff --git a/src/test/ui/type-recursive.rs b/src/test/ui/type/type-recursive.rs
similarity index 100%
rename from src/test/ui/type-recursive.rs
rename to src/test/ui/type/type-recursive.rs
diff --git a/src/test/ui/type-recursive.stderr b/src/test/ui/type/type-recursive.stderr
similarity index 100%
rename from src/test/ui/type-recursive.stderr
rename to src/test/ui/type/type-recursive.stderr
diff --git a/src/test/compile-fail/type-shadow.rs b/src/test/ui/type/type-shadow.rs
similarity index 100%
rename from src/test/compile-fail/type-shadow.rs
rename to src/test/ui/type/type-shadow.rs
diff --git a/src/test/ui/type/type-shadow.stderr b/src/test/ui/type/type-shadow.stderr
new file mode 100644
index 0000000..29e6e43
--- /dev/null
+++ b/src/test/ui/type/type-shadow.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/type-shadow.rs:16:20
+ |
+LL | let y: Y = "hello"; //~ ERROR mismatched types
+ | ^^^^^^^ expected isize, found reference
+ |
+ = note: expected type `isize`
+ found type `&'static str`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/type_length_limit.rs b/src/test/ui/type_length_limit.rs
similarity index 100%
rename from src/test/compile-fail/type_length_limit.rs
rename to src/test/ui/type_length_limit.rs
diff --git a/src/test/ui/type_length_limit.stderr b/src/test/ui/type_length_limit.stderr
new file mode 100644
index 0000000..910eca0
--- /dev/null
+++ b/src/test/ui/type_length_limit.stderr
@@ -0,0 +1,6 @@
+error: reached the type-length limit while instantiating `std::mem::drop::<std::option::Option<((((((G, G, G), (G, G, G), ...`
+ |
+ = note: consider adding a `#![type_length_limit="512"]` attribute to your crate
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/auxiliary/tdticc_coherence_lib.rs b/src/test/ui/typeck/auxiliary/tdticc_coherence_lib.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/tdticc_coherence_lib.rs
rename to src/test/ui/typeck/auxiliary/tdticc_coherence_lib.rs
diff --git a/src/test/compile-fail/typeck-auto-trait-no-supertraits-2.rs b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.rs
similarity index 100%
rename from src/test/compile-fail/typeck-auto-trait-no-supertraits-2.rs
rename to src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.rs
diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr
new file mode 100644
index 0000000..8fff0e2
--- /dev/null
+++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits-2.stderr
@@ -0,0 +1,9 @@
+error[E0568]: auto traits cannot have super traits
+ --> $DIR/typeck-auto-trait-no-supertraits-2.rs:13:1
+ |
+LL | auto trait Magic : Sized where Option<Self> : Magic {} //~ ERROR E0568
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0568`.
diff --git a/src/test/compile-fail/typeck-auto-trait-no-supertraits.rs b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.rs
similarity index 100%
rename from src/test/compile-fail/typeck-auto-trait-no-supertraits.rs
rename to src/test/ui/typeck/typeck-auto-trait-no-supertraits.rs
diff --git a/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr
new file mode 100644
index 0000000..2654228
--- /dev/null
+++ b/src/test/ui/typeck/typeck-auto-trait-no-supertraits.stderr
@@ -0,0 +1,9 @@
+error[E0568]: auto traits cannot have super traits
+ --> $DIR/typeck-auto-trait-no-supertraits.rs:37:1
+ |
+LL | auto trait Magic: Copy {} //~ ERROR E0568
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0568`.
diff --git a/src/test/ui/typeck-builtin-bound-type-parameters.rs b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs
similarity index 100%
rename from src/test/ui/typeck-builtin-bound-type-parameters.rs
rename to src/test/ui/typeck/typeck-builtin-bound-type-parameters.rs
diff --git a/src/test/ui/typeck-builtin-bound-type-parameters.stderr b/src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr
similarity index 100%
rename from src/test/ui/typeck-builtin-bound-type-parameters.stderr
rename to src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr
diff --git a/src/test/compile-fail/typeck-cast-pointer-to-float.rs b/src/test/ui/typeck/typeck-cast-pointer-to-float.rs
similarity index 100%
rename from src/test/compile-fail/typeck-cast-pointer-to-float.rs
rename to src/test/ui/typeck/typeck-cast-pointer-to-float.rs
diff --git a/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr b/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr
new file mode 100644
index 0000000..437675c
--- /dev/null
+++ b/src/test/ui/typeck/typeck-cast-pointer-to-float.stderr
@@ -0,0 +1,9 @@
+error[E0606]: casting `*const i16` as `f32` is invalid
+ --> $DIR/typeck-cast-pointer-to-float.rs:13:5
+ |
+LL | ((&x) as *const i16) as f32;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-assoc-type.rs b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-assoc-type.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-assoc-type.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr
new file mode 100644
index 0000000..ad47fcd
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-assoc-type.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `<T as Trait>::AssocType` cannot be sent between threads safely
+ --> $DIR/typeck-default-trait-impl-assoc-type.rs:19:5
+ |
+LL | is_send::<T::AssocType>(); //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^ `<T as Trait>::AssocType` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `<T as Trait>::AssocType`
+ = help: consider adding a `where <T as Trait>::AssocType: std::marker::Send` bound
+note: required by `is_send`
+ --> $DIR/typeck-default-trait-impl-assoc-type.rs:22:1
+ |
+LL | fn is_send<T:Send>() {
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-constituent-types-2.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr
new file mode 100644
index 0000000..a52628e
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types-2.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied in `(MyS2, MyS)`
+ --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:26:5
+ |
+LL | is_mytrait::<(MyS2, MyS)>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ within `(MyS2, MyS)`, the trait `MyTrait` is not implemented for `MyS2`
+ |
+ = help: the following implementations were found:
+ <MyS2 as MyTrait>
+ = note: required because it appears within the type `(MyS2, MyS)`
+note: required by `is_mytrait`
+ --> $DIR/typeck-default-trait-impl-constituent-types-2.rs:21:1
+ |
+LL | fn is_mytrait<T: MyTrait>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-constituent-types.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-constituent-types.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr
new file mode 100644
index 0000000..2e382dd
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-constituent-types.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `MyS2: MyTrait` is not satisfied
+ --> $DIR/typeck-default-trait-impl-constituent-types.rs:30:5
+ |
+LL | is_mytrait::<MyS2>();
+ | ^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `MyS2`
+ |
+ = help: the following implementations were found:
+ <MyS2 as MyTrait>
+note: required by `is_mytrait`
+ --> $DIR/typeck-default-trait-impl-constituent-types.rs:25:1
+ |
+LL | fn is_mytrait<T: MyTrait>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-cross-crate-coherence.rs b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-cross-crate-coherence.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
new file mode 100644
index 0000000..6efb7f3
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-cross-crate-coherence.stderr
@@ -0,0 +1,37 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:23:1
+ |
+LL | impl DefaultedTrait for (A,) { } //~ ERROR E0117
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:26:1
+ |
+LL | impl !DefaultedTrait for (B,) { } //~ ERROR E0117
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0321]: cross-crate traits with a default impl, like `lib::DefaultedTrait`, can only be implemented for a struct/enum type defined in the current crate
+ --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:30:1
+ |
+LL | impl DefaultedTrait for Box<C> { } //~ ERROR E0321
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't implement cross-crate trait for type in another crate
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/typeck-default-trait-impl-cross-crate-coherence.rs:31:1
+ |
+LL | impl DefaultedTrait for lib::Something<C> { } //~ ERROR E0117
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference any types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0117, E0321.
+For more information about an error, try `rustc --explain E0117`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-send.rs b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-negation-send.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-negation-send.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr
new file mode 100644
index 0000000..8dc7df9
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-send.stderr
@@ -0,0 +1,16 @@
+error[E0277]: `MyNotSendable` cannot be sent between threads safely
+ --> $DIR/typeck-default-trait-impl-negation-send.rs:29:5
+ |
+LL | is_send::<MyNotSendable>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `MyNotSendable` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `MyNotSendable`
+note: required by `is_send`
+ --> $DIR/typeck-default-trait-impl-negation-send.rs:25:1
+ |
+LL | fn is_send<T: Send>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-negation-sync.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-negation-sync.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr
new file mode 100644
index 0000000..b0fe2c5
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-negation-sync.stderr
@@ -0,0 +1,44 @@
+error[E0277]: `MyNotSync` cannot be shared between threads safely
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:45:5
+ |
+LL | is_sync::<MyNotSync>();
+ | ^^^^^^^^^^^^^^^^^^^^ `MyNotSync` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `MyNotSync`
+note: required by `is_sync`
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:1
+ |
+LL | fn is_sync<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::cell::UnsafeCell<u8>` cannot be shared between threads safely
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:48:5
+ |
+LL | is_sync::<MyTypeWUnsafe>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `std::cell::UnsafeCell<u8>` cannot be shared between threads safely
+ |
+ = help: within `MyTypeWUnsafe`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<u8>`
+ = note: required because it appears within the type `MyTypeWUnsafe`
+note: required by `is_sync`
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:1
+ |
+LL | fn is_sync<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `Managed` cannot be shared between threads safely
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:51:5
+ |
+LL | is_sync::<MyTypeManaged>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ `Managed` cannot be shared between threads safely
+ |
+ = help: within `MyTypeManaged`, the trait `std::marker::Sync` is not implemented for `Managed`
+ = note: required because it appears within the type `MyTypeManaged`
+note: required by `is_sync`
+ --> $DIR/typeck-default-trait-impl-negation-sync.rs:41:1
+ |
+LL | fn is_sync<T: Sync>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-negation.rs b/src/test/ui/typeck/typeck-default-trait-impl-negation.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-negation.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-negation.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr b/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr
new file mode 100644
index 0000000..4427955
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-negation.stderr
@@ -0,0 +1,31 @@
+error[E0277]: the trait bound `ThisImplsUnsafeTrait: MyTrait` is not satisfied
+ --> $DIR/typeck-default-trait-impl-negation.rs:31:5
+ |
+LL | is_my_trait::<ThisImplsUnsafeTrait>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyTrait` is not implemented for `ThisImplsUnsafeTrait`
+ |
+ = help: the following implementations were found:
+ <ThisImplsUnsafeTrait as MyTrait>
+note: required by `is_my_trait`
+ --> $DIR/typeck-default-trait-impl-negation.rs:26:1
+ |
+LL | fn is_my_trait<T: MyTrait>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `ThisImplsTrait: MyUnsafeTrait` is not satisfied
+ --> $DIR/typeck-default-trait-impl-negation.rs:34:5
+ |
+LL | is_my_unsafe_trait::<ThisImplsTrait>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `MyUnsafeTrait` is not implemented for `ThisImplsTrait`
+ |
+ = help: the following implementations were found:
+ <ThisImplsTrait as MyUnsafeTrait>
+note: required by `is_my_unsafe_trait`
+ --> $DIR/typeck-default-trait-impl-negation.rs:27:1
+ |
+LL | fn is_my_unsafe_trait<T: MyUnsafeTrait>() {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-precedence.rs b/src/test/ui/typeck/typeck-default-trait-impl-precedence.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-precedence.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-precedence.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr b/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr
new file mode 100644
index 0000000..0ab5eaa
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-precedence.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `u32: Signed` is not satisfied
+ --> $DIR/typeck-default-trait-impl-precedence.rs:28:5
+ |
+LL | is_defaulted::<&'static u32>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Signed` is not implemented for `u32`
+ |
+ = note: required because of the requirements on the impl of `Defaulted` for `&'static u32`
+note: required by `is_defaulted`
+ --> $DIR/typeck-default-trait-impl-precedence.rs:21:1
+ |
+LL | fn is_defaulted<T:Defaulted>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-default-trait-impl-send-param.rs b/src/test/ui/typeck/typeck-default-trait-impl-send-param.rs
similarity index 100%
rename from src/test/compile-fail/typeck-default-trait-impl-send-param.rs
rename to src/test/ui/typeck/typeck-default-trait-impl-send-param.rs
diff --git a/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr
new file mode 100644
index 0000000..82f3117
--- /dev/null
+++ b/src/test/ui/typeck/typeck-default-trait-impl-send-param.stderr
@@ -0,0 +1,17 @@
+error[E0277]: `T` cannot be sent between threads safely
+ --> $DIR/typeck-default-trait-impl-send-param.rs:15:5
+ |
+LL | is_send::<T>() //~ ERROR E0277
+ | ^^^^^^^^^^^^ `T` cannot be sent between threads safely
+ |
+ = help: the trait `std::marker::Send` is not implemented for `T`
+ = help: consider adding a `where T: std::marker::Send` bound
+note: required by `is_send`
+ --> $DIR/typeck-default-trait-impl-send-param.rs:18:1
+ |
+LL | fn is_send<T:Send>() {
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/typeck-negative-impls-builtin.rs b/src/test/ui/typeck/typeck-negative-impls-builtin.rs
similarity index 100%
rename from src/test/compile-fail/typeck-negative-impls-builtin.rs
rename to src/test/ui/typeck/typeck-negative-impls-builtin.rs
diff --git a/src/test/ui/typeck/typeck-negative-impls-builtin.stderr b/src/test/ui/typeck/typeck-negative-impls-builtin.stderr
new file mode 100644
index 0000000..6ae323a
--- /dev/null
+++ b/src/test/ui/typeck/typeck-negative-impls-builtin.stderr
@@ -0,0 +1,9 @@
+error[E0192]: negative impls are only allowed for auto traits (e.g., `Send` and `Sync`)
+ --> $DIR/typeck-negative-impls-builtin.rs:19:1
+ |
+LL | impl !TestTrait for TestType {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0192`.
diff --git a/src/test/compile-fail/typeck-unsafe-always-share.rs b/src/test/ui/typeck/typeck-unsafe-always-share.rs
similarity index 100%
rename from src/test/compile-fail/typeck-unsafe-always-share.rs
rename to src/test/ui/typeck/typeck-unsafe-always-share.rs
diff --git a/src/test/ui/typeck/typeck-unsafe-always-share.stderr b/src/test/ui/typeck/typeck-unsafe-always-share.stderr
new file mode 100644
index 0000000..57c4bdf
--- /dev/null
+++ b/src/test/ui/typeck/typeck-unsafe-always-share.stderr
@@ -0,0 +1,56 @@
+error[E0277]: `std::cell::UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely
+ --> $DIR/typeck-unsafe-always-share.rs:29:5
+ |
+LL | test(us);
+ | ^^^^ `std::cell::UnsafeCell<MySync<{integer}>>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<MySync<{integer}>>`
+note: required by `test`
+ --> $DIR/typeck-unsafe-always-share.rs:25:1
+ |
+LL | fn test<T: Sync>(s: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::cell::UnsafeCell<NoSync>` cannot be shared between threads safely
+ --> $DIR/typeck-unsafe-always-share.rs:33:5
+ |
+LL | test(uns);
+ | ^^^^ `std::cell::UnsafeCell<NoSync>` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<NoSync>`
+note: required by `test`
+ --> $DIR/typeck-unsafe-always-share.rs:25:1
+ |
+LL | fn test<T: Sync>(s: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `std::cell::UnsafeCell<NoSync>` cannot be shared between threads safely
+ --> $DIR/typeck-unsafe-always-share.rs:37:5
+ |
+LL | test(ms);
+ | ^^^^ `std::cell::UnsafeCell<NoSync>` cannot be shared between threads safely
+ |
+ = help: within `MySync<NoSync>`, the trait `std::marker::Sync` is not implemented for `std::cell::UnsafeCell<NoSync>`
+ = note: required because it appears within the type `MySync<NoSync>`
+note: required by `test`
+ --> $DIR/typeck-unsafe-always-share.rs:25:1
+ |
+LL | fn test<T: Sync>(s: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: `NoSync` cannot be shared between threads safely
+ --> $DIR/typeck-unsafe-always-share.rs:40:5
+ |
+LL | test(NoSync);
+ | ^^^^ `NoSync` cannot be shared between threads safely
+ |
+ = help: the trait `std::marker::Sync` is not implemented for `NoSync`
+note: required by `test`
+ --> $DIR/typeck-unsafe-always-share.rs:25:1
+ |
+LL | fn test<T: Sync>(s: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/typeck_type_placeholder_item.rs b/src/test/ui/typeck/typeck_type_placeholder_item.rs
similarity index 100%
rename from src/test/ui/typeck_type_placeholder_item.rs
rename to src/test/ui/typeck/typeck_type_placeholder_item.rs
diff --git a/src/test/ui/typeck_type_placeholder_item.stderr b/src/test/ui/typeck/typeck_type_placeholder_item.stderr
similarity index 100%
rename from src/test/ui/typeck_type_placeholder_item.stderr
rename to src/test/ui/typeck/typeck_type_placeholder_item.stderr
diff --git a/src/test/ui/typeck_type_placeholder_lifetime_1.rs b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs
similarity index 100%
rename from src/test/ui/typeck_type_placeholder_lifetime_1.rs
rename to src/test/ui/typeck/typeck_type_placeholder_lifetime_1.rs
diff --git a/src/test/ui/typeck_type_placeholder_lifetime_1.stderr b/src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
similarity index 100%
rename from src/test/ui/typeck_type_placeholder_lifetime_1.stderr
rename to src/test/ui/typeck/typeck_type_placeholder_lifetime_1.stderr
diff --git a/src/test/ui/typeck_type_placeholder_lifetime_2.rs b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs
similarity index 100%
rename from src/test/ui/typeck_type_placeholder_lifetime_2.rs
rename to src/test/ui/typeck/typeck_type_placeholder_lifetime_2.rs
diff --git a/src/test/ui/typeck_type_placeholder_lifetime_2.stderr b/src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
similarity index 100%
rename from src/test/ui/typeck_type_placeholder_lifetime_2.stderr
rename to src/test/ui/typeck/typeck_type_placeholder_lifetime_2.stderr
diff --git a/src/test/compile-fail/typeck_type_placeholder_mismatch.rs b/src/test/ui/typeck/typeck_type_placeholder_mismatch.rs
similarity index 100%
rename from src/test/compile-fail/typeck_type_placeholder_mismatch.rs
rename to src/test/ui/typeck/typeck_type_placeholder_mismatch.rs
diff --git a/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr
new file mode 100644
index 0000000..6a76235
--- /dev/null
+++ b/src/test/ui/typeck/typeck_type_placeholder_mismatch.stderr
@@ -0,0 +1,21 @@
+error[E0308]: mismatched types
+ --> $DIR/typeck_type_placeholder_mismatch.rs:23:21
+ |
+LL | let x: Foo<_> = Bar::<usize>(PhantomData);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar`
+ |
+ = note: expected type `Foo<_>`
+ found type `Bar<usize>`
+
+error[E0308]: mismatched types
+ --> $DIR/typeck_type_placeholder_mismatch.rs:32:21
+ |
+LL | let x: Foo<_> = Bar::<usize>(PhantomData);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Foo`, found struct `Bar`
+ |
+ = note: expected type `Foo<_>`
+ found type `Bar<usize>`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/ufcs-explicit-self-bad.rs b/src/test/ui/ufcs/ufcs-explicit-self-bad.rs
similarity index 100%
rename from src/test/compile-fail/ufcs-explicit-self-bad.rs
rename to src/test/ui/ufcs/ufcs-explicit-self-bad.rs
diff --git a/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr
new file mode 100644
index 0000000..fce7460
--- /dev/null
+++ b/src/test/ui/ufcs/ufcs-explicit-self-bad.stderr
@@ -0,0 +1,107 @@
+error[E0307]: invalid `self` type: isize
+ --> $DIR/ufcs-explicit-self-bad.rs:18:18
+ |
+LL | fn foo(self: isize, x: isize) -> isize {
+ | ^^^^^
+ |
+ = note: type must be `Foo` or a type that dereferences to it
+ = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
+
+error[E0307]: invalid `self` type: Bar<isize>
+ --> $DIR/ufcs-explicit-self-bad.rs:29:18
+ |
+LL | fn foo(self: Bar<isize>, x: isize) -> isize {
+ | ^^^^^^^^^^
+ |
+ = note: type must be `Bar<T>` or a type that dereferences to it
+ = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
+
+error[E0307]: invalid `self` type: &Bar<usize>
+ --> $DIR/ufcs-explicit-self-bad.rs:33:18
+ |
+LL | fn bar(self: &Bar<usize>, x: isize) -> isize {
+ | ^^^^^^^^^^^
+ |
+ = note: type must be `Bar<T>` or a type that dereferences to it
+ = help: consider changing to `self`, `&self`, `&mut self`, or `self: Box<Self>`
+
+error[E0308]: mismatched method receiver
+ --> $DIR/ufcs-explicit-self-bad.rs:47:21
+ |
+LL | fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched method receiver
+ | ^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `&'a Bar<T>`
+ found type `&Bar<T>`
+note: the anonymous lifetime #1 defined on the method body at 47:5...
+ --> $DIR/ufcs-explicit-self-bad.rs:47:5
+ |
+LL | fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched method receiver
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 45:6
+ --> $DIR/ufcs-explicit-self-bad.rs:45:6
+ |
+LL | impl<'a, T> SomeTrait for &'a Bar<T> {
+ | ^^
+
+error[E0308]: mismatched method receiver
+ --> $DIR/ufcs-explicit-self-bad.rs:47:21
+ |
+LL | fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched method receiver
+ | ^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `&'a Bar<T>`
+ found type `&Bar<T>`
+note: the lifetime 'a as defined on the impl at 45:6...
+ --> $DIR/ufcs-explicit-self-bad.rs:45:6
+ |
+LL | impl<'a, T> SomeTrait for &'a Bar<T> {
+ | ^^
+note: ...does not necessarily outlive the anonymous lifetime #1 defined on the method body at 47:5
+ --> $DIR/ufcs-explicit-self-bad.rs:47:5
+ |
+LL | fn dummy2(self: &Bar<T>) {} //~ ERROR mismatched method receiver
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0308]: mismatched method receiver
+ --> $DIR/ufcs-explicit-self-bad.rs:49:21
+ |
+LL | fn dummy3(self: &&Bar<T>) {}
+ | ^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `&'a Bar<T>`
+ found type `&Bar<T>`
+note: the anonymous lifetime #2 defined on the method body at 49:5...
+ --> $DIR/ufcs-explicit-self-bad.rs:49:5
+ |
+LL | fn dummy3(self: &&Bar<T>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+note: ...does not necessarily outlive the lifetime 'a as defined on the impl at 45:6
+ --> $DIR/ufcs-explicit-self-bad.rs:45:6
+ |
+LL | impl<'a, T> SomeTrait for &'a Bar<T> {
+ | ^^
+
+error[E0308]: mismatched method receiver
+ --> $DIR/ufcs-explicit-self-bad.rs:49:21
+ |
+LL | fn dummy3(self: &&Bar<T>) {}
+ | ^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `&'a Bar<T>`
+ found type `&Bar<T>`
+note: the lifetime 'a as defined on the impl at 45:6...
+ --> $DIR/ufcs-explicit-self-bad.rs:45:6
+ |
+LL | impl<'a, T> SomeTrait for &'a Bar<T> {
+ | ^^
+note: ...does not necessarily outlive the anonymous lifetime #2 defined on the method body at 49:5
+ --> $DIR/ufcs-explicit-self-bad.rs:49:5
+ |
+LL | fn dummy3(self: &&Bar<T>) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0307, E0308.
+For more information about an error, try `rustc --explain E0307`.
diff --git a/src/test/compile-fail/ufcs-partially-resolved.rs b/src/test/ui/ufcs/ufcs-partially-resolved.rs
similarity index 100%
rename from src/test/compile-fail/ufcs-partially-resolved.rs
rename to src/test/ui/ufcs/ufcs-partially-resolved.rs
diff --git a/src/test/ui/ufcs/ufcs-partially-resolved.stderr b/src/test/ui/ufcs/ufcs-partially-resolved.stderr
new file mode 100644
index 0000000..5de8fb1
--- /dev/null
+++ b/src/test/ui/ufcs/ufcs-partially-resolved.stderr
@@ -0,0 +1,206 @@
+error[E0433]: failed to resolve. Not a module `Y`
+ --> $DIR/ufcs-partially-resolved.rs:58:22
+ |
+LL | let _: <u8 as E::Y>::NN; //~ ERROR failed to resolve. Not a module `Y`
+ | ^ Not a module `Y`
+
+error[E0433]: failed to resolve. Not a module `Y`
+ --> $DIR/ufcs-partially-resolved.rs:60:15
+ |
+LL | <u8 as E::Y>::NN; //~ ERROR failed to resolve. Not a module `Y`
+ | ^ Not a module `Y`
+
+error[E0576]: cannot find associated type `N` in trait `Tr`
+ --> $DIR/ufcs-partially-resolved.rs:29:24
+ |
+LL | let _: <u8 as Tr>::N; //~ ERROR cannot find associated type `N` in trait `Tr`
+ | ^ did you mean `Y`?
+
+error[E0576]: cannot find associated type `N` in enum `E`
+ --> $DIR/ufcs-partially-resolved.rs:30:23
+ |
+LL | let _: <u8 as E>::N; //~ ERROR cannot find associated type `N` in enum `E`
+ | ^ not found in `E`
+
+error[E0576]: cannot find associated type `N` in `A`
+ --> $DIR/ufcs-partially-resolved.rs:31:23
+ |
+LL | let _: <u8 as A>::N; //~ ERROR cannot find associated type `N` in `A`
+ | ^ not found in `A`
+
+error[E0576]: cannot find method or associated constant `N` in trait `Tr`
+ --> $DIR/ufcs-partially-resolved.rs:32:17
+ |
+LL | <u8 as Tr>::N; //~ ERROR cannot find method or associated constant `N` in trait `Tr`
+ | ^ did you mean `Y`?
+
+error[E0576]: cannot find method or associated constant `N` in enum `E`
+ --> $DIR/ufcs-partially-resolved.rs:33:16
+ |
+LL | <u8 as E>::N; //~ ERROR cannot find method or associated constant `N` in enum `E`
+ | ^ not found in `E`
+
+error[E0576]: cannot find method or associated constant `N` in `A`
+ --> $DIR/ufcs-partially-resolved.rs:34:16
+ |
+LL | <u8 as A>::N; //~ ERROR cannot find method or associated constant `N` in `A`
+ | ^ not found in `A`
+
+error[E0575]: expected associated type, found variant `E::Y`
+ --> $DIR/ufcs-partially-resolved.rs:36:12
+ |
+LL | let _: <u8 as E>::Y; //~ ERROR expected associated type, found variant `E::Y`
+ | ^^^^^^^^^^^^ not a associated type
+
+error[E0575]: expected method or associated constant, found unit variant `E::Y`
+ --> $DIR/ufcs-partially-resolved.rs:38:5
+ |
+LL | <u8 as E>::Y; //~ ERROR expected method or associated constant, found unit variant `E::Y`
+ | ^^^^^^^^^^^^ not a method or associated constant
+
+error[E0576]: cannot find associated type `N` in trait `Tr`
+ --> $DIR/ufcs-partially-resolved.rs:40:24
+ |
+LL | let _: <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
+ | ^ did you mean `Y`?
+
+error[E0576]: cannot find associated type `N` in enum `E`
+ --> $DIR/ufcs-partially-resolved.rs:41:23
+ |
+LL | let _: <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E`
+ | ^ not found in `E`
+
+error[E0576]: cannot find associated type `N` in `A`
+ --> $DIR/ufcs-partially-resolved.rs:42:23
+ |
+LL | let _: <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A`
+ | ^ not found in `A`
+
+error[E0576]: cannot find associated type `N` in trait `Tr`
+ --> $DIR/ufcs-partially-resolved.rs:43:17
+ |
+LL | <u8 as Tr>::N::NN; //~ ERROR cannot find associated type `N` in trait `Tr`
+ | ^ did you mean `Y`?
+
+error[E0576]: cannot find associated type `N` in enum `E`
+ --> $DIR/ufcs-partially-resolved.rs:44:16
+ |
+LL | <u8 as E>::N::NN; //~ ERROR cannot find associated type `N` in enum `E`
+ | ^ not found in `E`
+
+error[E0576]: cannot find associated type `N` in `A`
+ --> $DIR/ufcs-partially-resolved.rs:45:16
+ |
+LL | <u8 as A>::N::NN; //~ ERROR cannot find associated type `N` in `A`
+ | ^ not found in `A`
+
+error[E0575]: expected associated type, found variant `E::Y`
+ --> $DIR/ufcs-partially-resolved.rs:47:12
+ |
+LL | let _: <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y`
+ | ^^^^^^^^^^^^^^^^ not a associated type
+
+error[E0575]: expected associated type, found variant `E::Y`
+ --> $DIR/ufcs-partially-resolved.rs:49:5
+ |
+LL | <u8 as E>::Y::NN; //~ ERROR expected associated type, found variant `E::Y`
+ | ^^^^^^^^^^^^^^^^ not a associated type
+
+error[E0576]: cannot find associated type `NN` in `Tr::N`
+ --> $DIR/ufcs-partially-resolved.rs:51:27
+ |
+LL | let _: <u8 as Tr::N>::NN; //~ ERROR cannot find associated type `NN` in `Tr::N`
+ | ^^ not found in `Tr::N`
+
+error[E0576]: cannot find associated type `NN` in `E::N`
+ --> $DIR/ufcs-partially-resolved.rs:52:26
+ |
+LL | let _: <u8 as E::N>::NN; //~ ERROR cannot find associated type `NN` in `E::N`
+ | ^^ not found in `E::N`
+
+error[E0576]: cannot find associated type `NN` in `A::N`
+ --> $DIR/ufcs-partially-resolved.rs:53:26
+ |
+LL | let _: <u8 as A::N>::NN; //~ ERROR cannot find associated type `NN` in `A::N`
+ | ^^ not found in `A::N`
+
+error[E0576]: cannot find method or associated constant `NN` in `Tr::N`
+ --> $DIR/ufcs-partially-resolved.rs:54:20
+ |
+LL | <u8 as Tr::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::N`
+ | ^^ not found in `Tr::N`
+
+error[E0576]: cannot find method or associated constant `NN` in `E::N`
+ --> $DIR/ufcs-partially-resolved.rs:55:19
+ |
+LL | <u8 as E::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `E::N`
+ | ^^ not found in `E::N`
+
+error[E0576]: cannot find method or associated constant `NN` in `A::N`
+ --> $DIR/ufcs-partially-resolved.rs:56:19
+ |
+LL | <u8 as A::N>::NN; //~ ERROR cannot find method or associated constant `NN` in `A::N`
+ | ^^ not found in `A::N`
+
+error[E0576]: cannot find associated type `NN` in `Tr::Y`
+ --> $DIR/ufcs-partially-resolved.rs:57:27
+ |
+LL | let _: <u8 as Tr::Y>::NN; //~ ERROR cannot find associated type `NN` in `Tr::Y`
+ | ^^ not found in `Tr::Y`
+
+error[E0576]: cannot find method or associated constant `NN` in `Tr::Y`
+ --> $DIR/ufcs-partially-resolved.rs:59:20
+ |
+LL | <u8 as Tr::Y>::NN; //~ ERROR cannot find method or associated constant `NN` in `Tr::Y`
+ | ^^ not found in `Tr::Y`
+
+error[E0575]: expected associated type, found method `Dr::Z`
+ --> $DIR/ufcs-partially-resolved.rs:62:12
+ |
+LL | let _: <u8 as Dr>::Z; //~ ERROR expected associated type, found method `Dr::Z`
+ | ^^^^^^^^^^^^-
+ | |
+ | did you mean `X`?
+
+error[E0575]: expected method or associated constant, found associated type `Dr::X`
+ --> $DIR/ufcs-partially-resolved.rs:63:5
+ |
+LL | <u8 as Dr>::X; //~ ERROR expected method or associated constant, found associated type `Dr::X`
+ | ^^^^^^^^^^^^-
+ | |
+ | did you mean `Z`?
+ |
+ = note: can't use a type alias as a constructor
+
+error[E0575]: expected associated type, found method `Dr::Z`
+ --> $DIR/ufcs-partially-resolved.rs:64:12
+ |
+LL | let _: <u8 as Dr>::Z::N; //~ ERROR expected associated type, found method `Dr::Z`
+ | ^^^^^^^^^^^^-^^^
+ | |
+ | did you mean `X`?
+
+error[E0223]: ambiguous associated type
+ --> $DIR/ufcs-partially-resolved.rs:46:12
+ |
+LL | let _: <u8 as Tr>::Y::NN; //~ ERROR ambiguous associated type
+ | ^^^^^^^^^^^^^^^^^ ambiguous associated type
+ |
+ = note: specify the type using the syntax `<<u8 as Tr>::Y as Trait>::NN`
+
+error[E0599]: no associated item named `NN` found for type `<u8 as Tr>::Y` in the current scope
+ --> $DIR/ufcs-partially-resolved.rs:48:5
+ |
+LL | <u8 as Tr>::Y::NN; //~ ERROR no associated item named `NN` found for type `<u8 as Tr>::Y`
+ | ^^^^^^^^^^^^^^^^^ associated item not found in `<u8 as Tr>::Y`
+
+error[E0599]: no associated item named `N` found for type `<u8 as Dr>::X` in the current scope
+ --> $DIR/ufcs-partially-resolved.rs:65:5
+ |
+LL | <u8 as Dr>::X::N; //~ ERROR no associated item named `N` found for type `<u8 as Dr>::X`
+ | ^^^^^^^^^^^^^^^^ associated item not found in `<u8 as Dr>::X`
+
+error: aborting due to 32 previous errors
+
+Some errors occurred: E0223, E0433, E0575, E0576, E0599.
+For more information about an error, try `rustc --explain E0223`.
diff --git a/src/test/compile-fail/ufcs-qpath-missing-params.rs b/src/test/ui/ufcs/ufcs-qpath-missing-params.rs
similarity index 100%
rename from src/test/compile-fail/ufcs-qpath-missing-params.rs
rename to src/test/ui/ufcs/ufcs-qpath-missing-params.rs
diff --git a/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr
new file mode 100644
index 0000000..6c752db
--- /dev/null
+++ b/src/test/ui/ufcs/ufcs-qpath-missing-params.stderr
@@ -0,0 +1,9 @@
+error[E0089]: too few type parameters provided: expected 1 type parameter, found 0 type parameters
+ --> $DIR/ufcs-qpath-missing-params.rs:24:5
+ |
+LL | <String as IntoCow>::into_cow("foo".to_string());
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 1 type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0089`.
diff --git a/src/test/compile-fail/ufcs-qpath-self-mismatch.rs b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/ufcs-qpath-self-mismatch.rs
rename to src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs
diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr
new file mode 100644
index 0000000..f422263
--- /dev/null
+++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr
@@ -0,0 +1,24 @@
+error[E0277]: cannot add `u32` to `i32`
+ --> $DIR/ufcs-qpath-self-mismatch.rs:14:5
+ |
+LL | <i32 as Add<u32>>::add(1, 2);
+ | ^^^^^^^^^^^^^^^^^^^^^^ no implementation for `i32 + u32`
+ |
+ = help: the trait `std::ops::Add<u32>` is not implemented for `i32`
+
+error[E0308]: mismatched types
+ --> $DIR/ufcs-qpath-self-mismatch.rs:16:28
+ |
+LL | <i32 as Add<i32>>::add(1u32, 2);
+ | ^^^^ expected i32, found u32
+
+error[E0308]: mismatched types
+ --> $DIR/ufcs-qpath-self-mismatch.rs:18:31
+ |
+LL | <i32 as Add<i32>>::add(1, 2u32);
+ | ^^^^ expected i32, found u32
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unboxed-closure-feature-gate.rs b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-feature-gate.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-feature-gate.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr
new file mode 100644
index 0000000..aea57d9
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-feature-gate.stderr
@@ -0,0 +1,11 @@
+error[E0658]: parenthetical notation is only stable when used with `Fn`-family traits (see issue #29625)
+ --> $DIR/unboxed-closure-feature-gate.rs:23:16
+ |
+LL | let x: Box<Foo(isize)>;
+ | ^^^^^^^^^^
+ |
+ = help: add #![feature(unboxed_closures)] to the crate attributes to enable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr
new file mode 100644
index 0000000..4baa54e
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr
@@ -0,0 +1,35 @@
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:25:31
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured variable in an `Fn` closure
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:29:35
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured variable in an `FnMut` closure
+
+error[E0507]: cannot move out of captured variable in an `Fn` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:38:36
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured variable in an `Fn` closure
+
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:42:40
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured variable in an `FnMut` closure
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/compile-fail/unboxed-closure-illegal-move.rs b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-illegal-move.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-illegal-move.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr
new file mode 100644
index 0000000..7ff4c1c
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.stderr
@@ -0,0 +1,35 @@
+error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:25:31
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured outer variable in an `Fn` closure
+
+error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:29:35
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn_mut(|| drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured outer variable in an `FnMut` closure
+
+error[E0507]: cannot move out of captured outer variable in an `Fn` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:38:36
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured outer variable in an `Fn` closure
+
+error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
+ --> $DIR/unboxed-closure-illegal-move.rs:42:40
+ |
+LL | let x = Box::new(0);
+ | - captured outer variable
+LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move
+ | ^ cannot move out of captured outer variable in an `FnMut` closure
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr
new file mode 100644
index 0000000..084d7ff
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.nll.stderr
@@ -0,0 +1,75 @@
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:19:13
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+LL | move || x = 1; //~ ERROR cannot assign
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:20:17
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+LL | move || x = 1; //~ ERROR cannot assign
+LL | move || set(&mut x); //~ ERROR cannot borrow
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:21:13
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | move || x = 1; //~ ERROR cannot assign
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:22:17
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | move || set(&mut x); //~ ERROR cannot borrow
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:23:8
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || x = 1; //~ ERROR cannot assign
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:25:12
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || set(&mut x); //~ ERROR cannot assign
+ | ^^^^^^ cannot borrow as mutable
+
+error[E0594]: cannot assign to `x`, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:26:8
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || x = 1; //~ ERROR cannot assign
+ | ^^^^^ cannot assign
+
+error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:28:12
+ |
+LL | let x = 0;
+ | - help: consider changing this to be mutable: `mut x`
+...
+LL | || set(&mut x); //~ ERROR cannot assign
+ | ^^^^^^ cannot borrow as mutable
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0594, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/unboxed-closure-immutable-capture.rs b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-immutable-capture.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr
new file mode 100644
index 0000000..02fbb5f
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-immutable-capture.stderr
@@ -0,0 +1,69 @@
+error[E0595]: closure cannot assign to immutable local variable `x`
+ --> $DIR/unboxed-closure-immutable-capture.rs:23:5
+ |
+LL | let x = 0;
+ | - consider changing this to `mut x`
+...
+LL | || x = 1; //~ ERROR cannot assign
+ | ^^ cannot borrow mutably
+
+error[E0595]: closure cannot assign to immutable local variable `x`
+ --> $DIR/unboxed-closure-immutable-capture.rs:25:5
+ |
+LL | let x = 0;
+ | - consider changing this to `mut x`
+...
+LL | || set(&mut x); //~ ERROR cannot assign
+ | ^^ cannot borrow mutably
+
+error[E0595]: closure cannot assign to immutable local variable `x`
+ --> $DIR/unboxed-closure-immutable-capture.rs:26:5
+ |
+LL | let x = 0;
+ | - consider changing this to `mut x`
+...
+LL | || x = 1; //~ ERROR cannot assign
+ | ^^ cannot borrow mutably
+
+error[E0595]: closure cannot assign to immutable local variable `x`
+ --> $DIR/unboxed-closure-immutable-capture.rs:28:5
+ |
+LL | let x = 0;
+ | - consider changing this to `mut x`
+...
+LL | || set(&mut x); //~ ERROR cannot assign
+ | ^^ cannot borrow mutably
+
+error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+ --> $DIR/unboxed-closure-immutable-capture.rs:19:13
+ |
+LL | let x = 0;
+ | - help: consider making `x` mutable: `mut x`
+LL | move || x = 1; //~ ERROR cannot assign
+ | ^^^^^
+
+error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:20:22
+ |
+LL | move || set(&mut x); //~ ERROR cannot borrow
+ | ^
+
+error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+ --> $DIR/unboxed-closure-immutable-capture.rs:21:13
+ |
+LL | let x = 0;
+ | - help: consider making `x` mutable: `mut x`
+...
+LL | move || x = 1; //~ ERROR cannot assign
+ | ^^^^^
+
+error[E0596]: cannot borrow captured outer variable in an `FnMut` closure as mutable
+ --> $DIR/unboxed-closure-immutable-capture.rs:22:22
+ |
+LL | move || set(&mut x); //~ ERROR cannot borrow
+ | ^
+
+error: aborting due to 8 previous errors
+
+Some errors occurred: E0594, E0595, E0596.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/unboxed-closure-no-cyclic-sig.rs b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
similarity index 100%
rename from src/test/ui/unboxed-closure-no-cyclic-sig.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.rs
diff --git a/src/test/ui/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
similarity index 100%
rename from src/test/ui/unboxed-closure-no-cyclic-sig.stderr
rename to src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr
new file mode 100644
index 0000000..6ad57a1
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-region.nll.stderr
@@ -0,0 +1,15 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/unboxed-closure-region.rs:18:12
+ |
+LL | || x //~ ERROR `x` does not live long enough
+ | -- ^ borrowed value does not live long enough
+ | |
+ | value captured here
+LL | };
+ | - `x` dropped here while still borrowed
+LL | _f;
+ | -- borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.rs b/src/test/ui/unboxed-closures/unboxed-closure-region.rs
new file mode 100644
index 0000000..da6dbc6
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-region.rs
@@ -0,0 +1,21 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that an unboxed closure that captures a free variable by
+// reference cannot escape the region of that variable.
+
+
+fn main() {
+ let _f = {
+ let x = 0;
+ || x //~ ERROR `x` does not live long enough
+ };
+ _f;
+}
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr
new file mode 100644
index 0000000..f85f3af
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-region.stderr
@@ -0,0 +1,16 @@
+error[E0597]: `x` does not live long enough
+ --> $DIR/unboxed-closure-region.rs:18:12
+ |
+LL | || x //~ ERROR `x` does not live long enough
+ | -- ^ borrowed value does not live long enough
+ | |
+ | capture occurs here
+LL | };
+ | - borrowed value only lives until here
+LL | _f;
+LL | }
+ | - borrowed value needs to live until here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-default.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-default.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-default.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr
new file mode 100644
index 0000000..fccf295
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-default.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `dyn Foo<(isize,), isize, Output=()>: Eq<dyn Foo<(isize,), Output=()>>` is not satisfied
+ --> $DIR/unboxed-closure-sugar-default.rs:31:5
+ |
+LL | eq::< Foo<(isize,),isize,Output=()>, Foo(isize) >();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Eq<dyn Foo<(isize,), Output=()>>` is not implemented for `dyn Foo<(isize,), isize, Output=()>`
+ |
+note: required by `eq`
+ --> $DIR/unboxed-closure-sugar-default.rs:24:1
+ |
+LL | fn eq<A: ?Sized,B: ?Sized>() where A : Eq<B> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-equiv.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-equiv.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr
new file mode 100644
index 0000000..7d687a5
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-equiv.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `dyn Foo<(char,), Output=()>: Eq<dyn Foo<(), Output=()>>` is not satisfied
+ --> $DIR/unboxed-closure-sugar-equiv.rs:53:5
+ |
+LL | / eq::< Foo<(),Output=()>,
+LL | | Foo(char) >();
+ | |___________________________________________________________________^ the trait `Eq<dyn Foo<(), Output=()>>` is not implemented for `dyn Foo<(char,), Output=()>`
+ |
+note: required by `eq`
+ --> $DIR/unboxed-closure-sugar-equiv.rs:26:1
+ |
+LL | fn eq<A: ?Sized,B: ?Sized +Eq<A>>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-lifetime-elision.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr
new file mode 100644
index 0000000..fa74e6e
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-lifetime-elision.stderr
@@ -0,0 +1,11 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/unboxed-closure-sugar-lifetime-elision.rs:36:35
+ |
+LL | let _: Foo(&isize, &usize) -> &usize; //~ ERROR missing lifetime specifier
+ | ^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from argument 1 or argument 2
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0106`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-not-used-on-fn.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr
new file mode 100644
index 0000000..bda88f4
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-not-used-on-fn.stderr
@@ -0,0 +1,19 @@
+error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
+ --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:14:13
+ |
+LL | fn bar1(x: &Fn<(), Output=()>) {
+ | ^^^^^^^^^^^^^^^^^
+ |
+ = help: add #![feature(unboxed_closures)] to the crate attributes to enable
+
+error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change. Use parenthetical notation (Fn(Foo, Bar) -> Baz) instead (see issue #29625)
+ --> $DIR/unboxed-closure-sugar-not-used-on-fn.rs:18:28
+ |
+LL | fn bar2<T>(x: &T) where T: Fn<()> {
+ | ^^^^^^
+ |
+ = help: add #![feature(unboxed_closures)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-region.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-region.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-region.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr
new file mode 100644
index 0000000..663034b
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-region.stderr
@@ -0,0 +1,9 @@
+error[E0107]: wrong number of lifetime parameters: expected 1, found 0
+ --> $DIR/unboxed-closure-sugar-region.rs:40:43
+ |
+LL | fn test2(x: &Foo<(isize,),Output=()>, y: &Foo(isize)) {
+ | ^^^^^^^^^^ expected 1 lifetime parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0107`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-used-on-struct-1.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr
new file mode 100644
index 0000000..1ca9968
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-1.stderr
@@ -0,0 +1,9 @@
+error[E0214]: parenthesized parameters may only be used with a trait
+ --> $DIR/unboxed-closure-sugar-used-on-struct-1.rs:19:19
+ |
+LL | let x: Box<Bar()> = panic!();
+ | ^^ only traits may use parentheses
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0214`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-used-on-struct-3.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr
new file mode 100644
index 0000000..d6c08a7
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct-3.stderr
@@ -0,0 +1,9 @@
+error[E0214]: parenthesized parameters may only be used with a trait
+ --> $DIR/unboxed-closure-sugar-used-on-struct-3.rs:24:16
+ |
+LL | let b = Bar::(isize, usize)::new(); // OK too (for the parser)
+ | ^^^^^^^^^^^^^^^^ only traits may use parentheses
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0214`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-used-on-struct.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr
new file mode 100644
index 0000000..954ec4d
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-used-on-struct.stderr
@@ -0,0 +1,16 @@
+error[E0214]: parenthesized parameters may only be used with a trait
+ --> $DIR/unboxed-closure-sugar-used-on-struct.rs:17:18
+ |
+LL | fn foo(b: Box<Bar()>) {
+ | ^^ only traits may use parentheses
+
+error[E0121]: the type placeholder `_` is not allowed within types on item signatures
+ --> $DIR/unboxed-closure-sugar-used-on-struct.rs:17:15
+ |
+LL | fn foo(b: Box<Bar()>) {
+ | ^^^^^ not allowed in type signatures
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0121, E0214.
+For more information about an error, try `rustc --explain E0121`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr
new file mode 100644
index 0000000..e7476f0
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-1.stderr
@@ -0,0 +1,9 @@
+error[E0220]: associated type `Output` not found for `One<()>`
+ --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-1.rs:15:15
+ |
+LL | fn foo(_: &One()) //~ ERROR associated type `Output` not found for `One<()>`
+ | ^^ associated type `Output` not found
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0220`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr
new file mode 100644
index 0000000..feac427
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters-3.stderr
@@ -0,0 +1,16 @@
+error[E0243]: wrong number of type arguments: expected 3, found 1
+ --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:15:12
+ |
+LL | fn foo(_: &Three())
+ | ^^^^^^^ expected 3 type arguments
+
+error[E0220]: associated type `Output` not found for `Three<(), [type error], [type error]>`
+ --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters-3.rs:15:17
+ |
+LL | fn foo(_: &Three())
+ | ^^ associated type `Output` not found
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0220, E0243.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closure-sugar-wrong-number-number-type-parameters.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr
new file mode 100644
index 0000000..457bea0
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr
@@ -0,0 +1,16 @@
+error[E0244]: wrong number of type arguments: expected 0, found 1
+ --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:11
+ |
+LL | fn foo(_: Zero())
+ | ^^^^^^ expected no type arguments
+
+error[E0220]: associated type `Output` not found for `Zero`
+ --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15
+ |
+LL | fn foo(_: Zero())
+ | ^^ associated type `Output` not found
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0220, E0244.
+For more information about an error, try `rustc --explain E0220`.
diff --git a/src/test/ui/unboxed-closure-sugar-wrong-trait.rs b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs
similarity index 100%
rename from src/test/ui/unboxed-closure-sugar-wrong-trait.rs
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.rs
diff --git a/src/test/ui/unboxed-closure-sugar-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr
similarity index 100%
rename from src/test/ui/unboxed-closure-sugar-wrong-trait.stderr
rename to src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr
new file mode 100644
index 0000000..cadda39
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.nll.stderr
@@ -0,0 +1,15 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/unboxed-closures-borrow-conflict.rs:19:14
+ |
+LL | let f = || x += 1;
+ | -- - borrow occurs due to use of `x` in closure
+ | |
+ | borrow of `x` occurs here
+LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
+ | ^ use of borrowed `x`
+LL | f;
+ | - borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
new file mode 100644
index 0000000..aa50fb8
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.rs
@@ -0,0 +1,21 @@
+// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that an unboxed closure that mutates a free variable will
+// cause borrow conflicts.
+
+
+
+fn main() {
+ let mut x = 0;
+ let f = || x += 1;
+ let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
+ f;
+}
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr
new file mode 100644
index 0000000..9bdd102
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-borrow-conflict.stderr
@@ -0,0 +1,11 @@
+error[E0503]: cannot use `x` because it was mutably borrowed
+ --> $DIR/unboxed-closures-borrow-conflict.rs:19:9
+ |
+LL | let f = || x += 1;
+ | -- borrow of `x` occurs here
+LL | let _y = x; //~ ERROR cannot use `x` because it was mutably borrowed
+ | ^^ use of borrowed `x`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0503`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr
new file mode 100644
index 0000000..8cda1e6
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.nll.stderr
@@ -0,0 +1,62 @@
+error[E0597]: `factorial` does not live long enough
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:25:17
+ |
+LL | let f = |x: u32| -> u32 {
+ | --------------- value captured here
+LL | let g = factorial.as_ref().unwrap();
+ | ^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | -
+ | |
+ | `factorial` dropped here while still borrowed
+ | borrow later used here, when `factorial` is dropped
+ |
+ = note: values in a scope are dropped in the opposite order they are defined
+
+error[E0506]: cannot assign to `factorial` because it is borrowed
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:30:5
+ |
+LL | let f = |x: u32| -> u32 {
+ | --------------- borrow of `factorial` occurs here
+LL | let g = factorial.as_ref().unwrap();
+ | --------- borrow occurs due to use in closure
+...
+LL | factorial = Some(Box::new(f));
+ | ^^^^^^^^^
+ | |
+ | assignment to borrowed `factorial` occurs here
+ | borrow later used here
+
+error[E0597]: `factorial` does not live long enough
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:38:17
+ |
+LL | let f = |x: u32| -> u32 {
+ | --------------- value captured here
+LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
+LL | let g = factorial.as_ref().unwrap();
+ | ^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - `factorial` dropped here while still borrowed
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error[E0506]: cannot assign to `factorial` because it is borrowed
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:42:5
+ |
+LL | let f = |x: u32| -> u32 {
+ | --------------- borrow of `factorial` occurs here
+LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
+LL | let g = factorial.as_ref().unwrap();
+ | --------- borrow occurs due to use in closure
+...
+LL | factorial = Some(Box::new(f));
+ | ^^^^^^^^^ assignment to borrowed `factorial` occurs here
+ |
+ = note: borrowed value must be valid for the static lifetime...
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0506, E0597.
+For more information about an error, try `rustc --explain E0506`.
diff --git a/src/test/compile-fail/unboxed-closures-failed-recursive-fn-1.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-failed-recursive-fn-1.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr
new file mode 100644
index 0000000..8390e9f
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-1.stderr
@@ -0,0 +1,30 @@
+error[E0597]: `factorial` does not live long enough
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:25:17
+ |
+LL | let f = |x: u32| -> u32 {
+ | --------------- capture occurs here
+LL | let g = factorial.as_ref().unwrap();
+ | ^^^^^^^^^ borrowed value does not live long enough
+...
+LL | }
+ | - borrowed value dropped before borrower
+ |
+ = note: values in a scope are dropped in the opposite order they are created
+
+error[E0373]: closure may outlive the current function, but it borrows `factorial`, which is owned by the current function
+ --> $DIR/unboxed-closures-failed-recursive-fn-1.rs:36:13
+ |
+LL | let f = |x: u32| -> u32 {
+ | ^^^^^^^^^^^^^^^ may outlive borrowed value `factorial`
+LL | //~^ ERROR closure may outlive the current function, but it borrows `factorial`
+LL | let g = factorial.as_ref().unwrap();
+ | --------- `factorial` is borrowed here
+help: to force the closure to take ownership of `factorial` (and any other referenced variables), use the `move` keyword
+ |
+LL | let f = move |x: u32| -> u32 {
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0373, E0597.
+For more information about an error, try `rustc --explain E0373`.
diff --git a/src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-failed-recursive-fn-2.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr
new file mode 100644
index 0000000..fd6858c
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-failed-recursive-fn-2.stderr
@@ -0,0 +1,14 @@
+error[E0282]: type annotations needed
+ --> $DIR/unboxed-closures-failed-recursive-fn-2.rs:26:32
+ |
+LL | let mut closure0 = None;
+ | ------------ consider giving `closure0` a type
+...
+LL | return c();
+ | ^^^ cannot infer type
+ |
+ = note: type must be known at this point
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-fnmut-as-fn.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
new file mode 100644
index 0000000..95aa3f1
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `S: std::ops::Fn<(isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-fnmut-as-fn.rs:38:13
+ |
+LL | let x = call_it(&S, 22);
+ | ^^^^^^^ the trait `std::ops::Fn<(isize,)>` is not implemented for `S`
+ |
+note: required by `call_it`
+ --> $DIR/unboxed-closures-fnmut-as-fn.rs:33:1
+ |
+LL | fn call_it<F:Fn(isize)->isize>(f: &F, x: isize) -> isize {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr
new file mode 100644
index 0000000..a113c1a
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.nll.stderr
@@ -0,0 +1,18 @@
+warning: not reporting region error due to nll
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:27:15
+ |
+LL | x.set(y); //~ ERROR E0312
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:27:9
+ |
+LL | doit(0, &|x, y| {
+ | - - has type `&'1 i32`
+ | |
+ | has type `&std::cell::Cell<&'2 i32>`
+LL | x.set(y); //~ ERROR E0312
+ | ^^^^^^^^ argument requires that `'1` must outlive `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-infer-argument-types-two-region-pointers.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr
new file mode 100644
index 0000000..7e59347
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-argument-types-two-region-pointers.stderr
@@ -0,0 +1,26 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:27:15
+ |
+LL | x.set(y); //~ ERROR E0312
+ | ^
+ |
+note: ...the reference is valid for the anonymous lifetime #3 defined on the body at 26:14...
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:26:14
+ |
+LL | doit(0, &|x, y| {
+ | ______________^
+LL | | x.set(y); //~ ERROR E0312
+LL | | });
+ | |_____^
+note: ...but the borrowed content is only valid for the anonymous lifetime #4 defined on the body at 26:14
+ --> $DIR/unboxed-closures-infer-argument-types-two-region-pointers.rs:26:14
+ |
+LL | doit(0, &|x, y| {
+ | ______________^
+LL | | x.set(y); //~ ERROR E0312
+LL | | });
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0312`.
diff --git a/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs
similarity index 100%
rename from src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.rs
diff --git a/src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr
similarity index 100%
rename from src/test/ui/unboxed-closures-infer-fn-once-move-from-projection.stderr
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fn-once-move-from-projection.stderr
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr
new file mode 100644
index 0000000..718c3a1
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.nll.stderr
@@ -0,0 +1,21 @@
+error[E0596]: cannot borrow `tick1` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:27:9
+ |
+LL | let tick1 = || {
+ | ----- help: consider changing this to be mutable: `mut tick1`
+...
+LL | tick1();
+ | ^^^^^ cannot borrow as mutable
+
+error[E0596]: cannot borrow `tick2` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5
+ |
+LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1`
+ | ----- help: consider changing this to be mutable: `mut tick2`
+...
+LL | tick2(); //~ ERROR cannot borrow
+ | ^^^^^ cannot borrow as mutable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
new file mode 100644
index 0000000..bb2ffcd
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.stderr
@@ -0,0 +1,22 @@
+error[E0595]: closure cannot assign to immutable local variable `tick1`
+ --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:26:17
+ |
+LL | let tick1 = || {
+ | ----- consider changing this to `mut tick1`
+...
+LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1`
+ | ^^ cannot borrow mutably
+
+error[E0596]: cannot borrow immutable local variable `tick2` as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-calling-fnmut-no-mut.rs:30:5
+ |
+LL | let tick2 = || { //~ ERROR closure cannot assign to immutable local variable `tick1`
+ | ----- consider changing this to `mut tick2`
+...
+LL | tick2(); //~ ERROR cannot borrow
+ | ^^^^^ cannot borrow mutably
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0595, E0596.
+For more information about an error, try `rustc --explain E0595`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr
new file mode 100644
index 0000000..c57f976
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:17:5
+ |
+LL | let tick = || counter += 1;
+ | ---- help: consider changing this to be mutable: `mut tick`
+LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
+ | ^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-missing-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-infer-fnmut-missing-mut.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr
new file mode 100644
index 0000000..22e11b6
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-missing-mut.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `tick` as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-missing-mut.rs:17:5
+ |
+LL | let tick = || counter += 1;
+ | ---- consider changing this to `mut tick`
+LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
+ | ^^^^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr
new file mode 100644
index 0000000..a26dc08
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `tick` as mutable, as it is not declared as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:17:5
+ |
+LL | let tick = move || counter += 1;
+ | ---- help: consider changing this to be mutable: `mut tick`
+LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
+ | ^^^^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/unboxed-closures-infer-fnmut-move-missing-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-infer-fnmut-move-missing-mut.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr
new file mode 100644
index 0000000..f9fd6c2
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnmut-move-missing-mut.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `tick` as mutable
+ --> $DIR/unboxed-closures-infer-fnmut-move-missing-mut.rs:17:5
+ |
+LL | let tick = move || counter += 1;
+ | ---- consider changing this to `mut tick`
+LL | tick(); //~ ERROR cannot borrow immutable local variable `tick` as mutable
+ | ^^^^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.nll.stderr
new file mode 100644
index 0000000..f475669
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.nll.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `tick`
+ --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:20:5
+ |
+LL | tick();
+ | ---- value moved here
+LL | tick(); //~ ERROR use of moved value: `tick`
+ | ^^^^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/unboxed-closures-infer-fnonce-call-twice.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-infer-fnonce-call-twice.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr
new file mode 100644
index 0000000..c713b3d
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr
@@ -0,0 +1,17 @@
+error[E0382]: use of moved value: `tick`
+ --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:20:5
+ |
+LL | tick();
+ | ---- value moved here
+LL | tick(); //~ ERROR use of moved value: `tick`
+ | ^^^^ value used here after move
+ |
+note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment
+ --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:18:29
+ |
+LL | let tick = || mem::drop(counter);
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.nll.stderr
new file mode 100644
index 0000000..95ed673
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.nll.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `tick`
+ --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:20:5
+ |
+LL | tick();
+ | ---- value moved here
+LL | tick(); //~ ERROR use of moved value: `tick`
+ | ^^^^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/unboxed-closures-infer-fnonce-move-call-twice.rs b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-infer-fnonce-move-call-twice.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr
new file mode 100644
index 0000000..a900631
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr
@@ -0,0 +1,17 @@
+error[E0382]: use of moved value: `tick`
+ --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:20:5
+ |
+LL | tick();
+ | ---- value moved here
+LL | tick(); //~ ERROR use of moved value: `tick`
+ | ^^^^ value used here after move
+ |
+note: closure cannot be invoked more than once because it moves the variable `counter` out of its environment
+ --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:18:34
+ |
+LL | let tick = move || mem::drop(counter);
+ | ^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr
new file mode 100644
index 0000000..f765f20
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.nll.stderr
@@ -0,0 +1,45 @@
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
+ --> $DIR/unboxed-closures-mutate-upvar.rs:25:9
+ |
+LL | let n = 0;
+ | - help: consider changing this to be mutable: `mut n`
+LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
+LL | n += 1;
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
+ --> $DIR/unboxed-closures-mutate-upvar.rs:42:9
+ |
+LL | let n = 0;
+ | - help: consider changing this to be mutable: `mut n`
+...
+LL | n += 1; //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `n`, as it is not declared as mutable
+ --> $DIR/unboxed-closures-mutate-upvar.rs:56:9
+ |
+LL | let n = 0;
+ | - help: consider changing this to be mutable: `mut n`
+LL | let mut f = to_fn(move || {
+LL | n += 1; //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+
+error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure
+ --> $DIR/unboxed-closures-mutate-upvar.rs:63:9
+ |
+LL | n += 1; //~ ERROR cannot assign
+ | ^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/unboxed-closures-mutate-upvar.rs:62:23
+ |
+LL | let mut f = to_fn(move || {
+ | _______________________^
+LL | | n += 1; //~ ERROR cannot assign
+LL | | });
+ | |_____^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/unboxed-closures-mutate-upvar.rs b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-mutate-upvar.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr
new file mode 100644
index 0000000..1164a86
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr
@@ -0,0 +1,53 @@
+error[E0595]: closure cannot assign to immutable local variable `n`
+ --> $DIR/unboxed-closures-mutate-upvar.rs:24:27
+ |
+LL | let n = 0;
+ | - consider changing this to `mut n`
+LL | let mut f = to_fn_mut(|| { //~ ERROR closure cannot assign
+ | ^^ cannot borrow mutably
+
+error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
+ --> $DIR/unboxed-closures-mutate-upvar.rs:42:9
+ |
+LL | let n = 0;
+ | - help: consider making `n` mutable: `mut n`
+...
+LL | n += 1; //~ ERROR cannot assign
+ | ^^^^^^
+
+error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+ --> $DIR/unboxed-closures-mutate-upvar.rs:56:9
+ |
+LL | n += 1; //~ ERROR cannot assign
+ | ^^^^^^
+ |
+ = note: `Fn` closures cannot capture their enclosing environment for modifications
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/unboxed-closures-mutate-upvar.rs:55:23
+ |
+LL | let mut f = to_fn(move || {
+ | _______________________^
+LL | | n += 1; //~ ERROR cannot assign
+LL | | });
+ | |_____^
+
+error[E0594]: cannot assign to captured outer variable in an `Fn` closure
+ --> $DIR/unboxed-closures-mutate-upvar.rs:63:9
+ |
+LL | n += 1; //~ ERROR cannot assign
+ | ^^^^^^
+ |
+ = note: `Fn` closures cannot capture their enclosing environment for modifications
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/unboxed-closures-mutate-upvar.rs:62:23
+ |
+LL | let mut f = to_fn(move || {
+ | _______________________^
+LL | | n += 1; //~ ERROR cannot assign
+LL | | });
+ | |_____^
+
+error: aborting due to 4 previous errors
+
+Some errors occurred: E0594, E0595.
+For more information about an error, try `rustc --explain E0594`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr
new file mode 100644
index 0000000..be18e7c
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.nll.stderr
@@ -0,0 +1,20 @@
+error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:24:9
+ |
+LL | counter += 1;
+ | ^^^^^^^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:23:10
+ |
+LL | call(|| {
+ | __________^
+LL | | counter += 1;
+LL | | //[ast]~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure
+LL | | //[mir]~^^ ERROR cannot assign to `counter`
+LL | | });
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr
new file mode 100644
index 0000000..756bf06
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.ast.stderr
@@ -0,0 +1,20 @@
+error[E0387]: cannot assign to data in a captured outer variable in an `Fn` closure
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:24:9
+ |
+LL | counter += 1;
+ | ^^^^^^^^^^^^
+ |
+help: consider changing this closure to take self by mutable reference
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:23:10
+ |
+LL | call(|| {
+ | __________^
+LL | | counter += 1;
+LL | | //[ast]~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure
+LL | | //[mir]~^^ ERROR cannot assign to `counter`
+LL | | });
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0387`.
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr
new file mode 100644
index 0000000..be18e7c
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.mir.stderr
@@ -0,0 +1,20 @@
+error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:24:9
+ |
+LL | counter += 1;
+ | ^^^^^^^^^^^^ cannot assign
+ |
+help: consider changing this to accept closures that implement `FnMut`
+ --> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:23:10
+ |
+LL | call(|| {
+ | __________^
+LL | | counter += 1;
+LL | | //[ast]~^ ERROR cannot assign to data in a captured outer variable in an `Fn` closure
+LL | | //[mir]~^^ ERROR cannot assign to `counter`
+LL | | });
+ | |_____^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0594`.
diff --git a/src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs b/src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-mutated-upvar-from-fn-closure.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-mutated-upvar-from-fn-closure.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr
new file mode 100644
index 0000000..e2747e1
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.nll.stderr
@@ -0,0 +1,13 @@
+error[E0499]: cannot borrow `*self` as mutable more than once at a time
+ --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:32:21
+ |
+LL | (self.func)(self, arg)
+ | ------------^^^^------
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+ | borrow later used here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-recursive-fn-using-fn-mut.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr
new file mode 100644
index 0000000..eec48dd
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-recursive-fn-using-fn-mut.stderr
@@ -0,0 +1,12 @@
+error[E0499]: cannot borrow `*self` as mutable more than once at a time
+ --> $DIR/unboxed-closures-recursive-fn-using-fn-mut.rs:32:21
+ |
+LL | (self.func)(self, arg)
+ | ----------- ^^^^ - first borrow ends here
+ | | |
+ | | second mutable borrow occurs here
+ | first mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-static-call-wrong-trait.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
new file mode 100644
index 0000000..53386f0
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-static-call-wrong-trait.stderr
@@ -0,0 +1,11 @@
+error[E0599]: no method named `call` found for type `[closure@$DIR/unboxed-closures-static-call-wrong-trait.rs:16:26: 16:31]` in the current scope
+ --> $DIR/unboxed-closures-static-call-wrong-trait.rs:17:10
+ |
+LL | mut_.call((0, )); //~ ERROR no method named `call` found
+ | ^^^^
+ |
+ = note: mut_ is a function, perhaps you wish to call it
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/unboxed-closures-type-mismatch.rs b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-type-mismatch.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
new file mode 100644
index 0000000..7e11130
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/unboxed-closures-type-mismatch.rs:15:15
+ |
+LL | let z = f(1_usize, 2); //~ ERROR mismatched types
+ | ^^^^^^^ expected isize, found usize
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-unsafe-extern-fn.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
new file mode 100644
index 0000000..16b2b11
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the trait bound `for<'r> for<'s> unsafe fn(&'s isize) -> isize {square}: std::ops::Fn<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-unsafe-extern-fn.rs:22:13
+ |
+LL | let x = call_it(&square, 22);
+ | ^^^^^^^ the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}`
+ |
+note: required by `call_it`
+ --> $DIR/unboxed-closures-unsafe-extern-fn.rs:17:1
+ |
+LL | fn call_it<F:Fn(&isize)->isize>(_: &F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `for<'r> for<'s> unsafe fn(&'s isize) -> isize {square}: std::ops::FnMut<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-unsafe-extern-fn.rs:27:13
+ |
+LL | let y = call_it_mut(&mut square, 22);
+ | ^^^^^^^^^^^ the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}`
+ |
+note: required by `call_it_mut`
+ --> $DIR/unboxed-closures-unsafe-extern-fn.rs:18:1
+ |
+LL | fn call_it_mut<F:FnMut(&isize)->isize>(_: &mut F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `for<'r> for<'s> unsafe fn(&'s isize) -> isize {square}: std::ops::FnOnce<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-unsafe-extern-fn.rs:32:13
+ |
+LL | let z = call_it_once(square, 22);
+ | ^^^^^^^^^^^^ the trait `for<'r> std::ops::FnOnce<(&'r isize,)>` is not implemented for `for<'r> unsafe fn(&'r isize) -> isize {square}`
+ |
+note: required by `call_it_once`
+ --> $DIR/unboxed-closures-unsafe-extern-fn.rs:19:1
+ |
+LL | fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unboxed-closures-wrong-abi.rs b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-wrong-abi.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
new file mode 100644
index 0000000..6e5e1b9
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the trait bound `for<'r> for<'s> extern "C" fn(&'s isize) -> isize {square}: std::ops::Fn<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-wrong-abi.rs:22:13
+ |
+LL | let x = call_it(&square, 22);
+ | ^^^^^^^ the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}`
+ |
+note: required by `call_it`
+ --> $DIR/unboxed-closures-wrong-abi.rs:17:1
+ |
+LL | fn call_it<F:Fn(&isize)->isize>(_: &F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `for<'r> for<'s> extern "C" fn(&'s isize) -> isize {square}: std::ops::FnMut<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-wrong-abi.rs:27:13
+ |
+LL | let y = call_it_mut(&mut square, 22);
+ | ^^^^^^^^^^^ the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}`
+ |
+note: required by `call_it_mut`
+ --> $DIR/unboxed-closures-wrong-abi.rs:18:1
+ |
+LL | fn call_it_mut<F:FnMut(&isize)->isize>(_: &mut F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `for<'r> for<'s> extern "C" fn(&'s isize) -> isize {square}: std::ops::FnOnce<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-wrong-abi.rs:32:13
+ |
+LL | let z = call_it_once(square, 22);
+ | ^^^^^^^^^^^^ the trait `for<'r> std::ops::FnOnce<(&'r isize,)>` is not implemented for `for<'r> extern "C" fn(&'r isize) -> isize {square}`
+ |
+note: required by `call_it_once`
+ --> $DIR/unboxed-closures-wrong-abi.rs:19:1
+ |
+LL | fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.rs
similarity index 100%
rename from src/test/compile-fail/unboxed-closures-wrong-arg-type-extern-fn.rs
rename to src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.rs
diff --git a/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
new file mode 100644
index 0000000..5c2e73f
--- /dev/null
+++ b/src/test/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr
@@ -0,0 +1,39 @@
+error[E0277]: the trait bound `for<'r> unsafe fn(isize) -> isize {square}: std::ops::Fn<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:23:13
+ |
+LL | let x = call_it(&square, 22);
+ | ^^^^^^^ the trait `for<'r> std::ops::Fn<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}`
+ |
+note: required by `call_it`
+ --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:18:1
+ |
+LL | fn call_it<F:Fn(&isize)->isize>(_: &F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `for<'r> unsafe fn(isize) -> isize {square}: std::ops::FnMut<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:28:13
+ |
+LL | let y = call_it_mut(&mut square, 22);
+ | ^^^^^^^^^^^ the trait `for<'r> std::ops::FnMut<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}`
+ |
+note: required by `call_it_mut`
+ --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:19:1
+ |
+LL | fn call_it_mut<F:FnMut(&isize)->isize>(_: &mut F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `for<'r> unsafe fn(isize) -> isize {square}: std::ops::FnOnce<(&'r isize,)>` is not satisfied
+ --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:33:13
+ |
+LL | let z = call_it_once(square, 22);
+ | ^^^^^^^^^^^^ the trait `for<'r> std::ops::FnOnce<(&'r isize,)>` is not implemented for `unsafe fn(isize) -> isize {square}`
+ |
+note: required by `call_it_once`
+ --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:20:1
+ |
+LL | fn call_it_once<F:FnOnce(&isize)->isize>(_: F, _: isize) -> isize { 0 }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
index 5b4c669..799b098 100644
--- a/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
+++ b/src/test/ui/underscore-lifetime/dyn-trait-underscore.nll.stderr
@@ -32,7 +32,7 @@
LL | | // ^^^^^^^^^^^^^^^^^^^^^ bound *here* defaults to `'static`
LL | | Box::new(items.iter()) //~ ERROR cannot infer an appropriate lifetime
LL | | }
- | |_^ return requires that `'1` must outlive `'static`
+ | |_^ returning this value requires that `'1` must outlive `'static`
error: aborting due to previous error
diff --git a/src/test/compile-fail/underscore-lifetime-binders.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs
similarity index 100%
rename from src/test/compile-fail/underscore-lifetime-binders.rs
rename to src/test/ui/underscore-lifetime/underscore-lifetime-binders.rs
diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr
new file mode 100644
index 0000000..4917c27
--- /dev/null
+++ b/src/test/ui/underscore-lifetime/underscore-lifetime-binders.stderr
@@ -0,0 +1,45 @@
+error[E0106]: missing lifetime specifier
+ --> $DIR/underscore-lifetime-binders.rs:12:17
+ |
+LL | struct Baz<'a>(&'_ &'a u8); //~ ERROR missing lifetime specifier
+ | ^^ expected lifetime parameter
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/underscore-lifetime-binders.rs:14:10
+ |
+LL | impl Foo<'_> { //~ ERROR missing lifetime specifier
+ | ^^ expected lifetime parameter
+
+error[E0262]: invalid lifetime parameter name: `'_`
+ --> $DIR/underscore-lifetime-binders.rs:18:8
+ |
+LL | fn foo<'_> //~ ERROR invalid lifetime parameter name: `'_`
+ | ^^ '_ is a reserved lifetime name
+
+error[E0262]: invalid lifetime parameter name: `'_`
+ --> $DIR/underscore-lifetime-binders.rs:24:21
+ |
+LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR invalid lifetime parameter name: `'_`
+ | ^^ '_ is a reserved lifetime name
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/underscore-lifetime-binders.rs:24:29
+ |
+LL | fn meh() -> Box<for<'_> Meh<'_>> //~ ERROR invalid lifetime parameter name: `'_`
+ | ^^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
+ = help: consider giving it a 'static lifetime
+
+error[E0106]: missing lifetime specifier
+ --> $DIR/underscore-lifetime-binders.rs:30:35
+ |
+LL | fn foo2(_: &'_ u8, y: &'_ u8) -> &'_ u8 { y } //~ ERROR missing lifetime specifier
+ | ^^ expected lifetime parameter
+ |
+ = help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `_` or `y`
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0106, E0262.
+For more information about an error, try `rustc --explain E0106`.
diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr
new file mode 100644
index 0000000..eef04cb
--- /dev/null
+++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.nll.stderr
@@ -0,0 +1,17 @@
+warning: not reporting region error due to nll
+ --> $DIR/underscore-lifetime-elison-mismatch.rs:11:49
+ |
+LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/underscore-lifetime-elison-mismatch.rs:11:42
+ |
+LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
+ | - - ^^^^^^^^^ argument requires that `'1` must outlive `'2`
+ | | |
+ | | let's call the lifetime of this reference `'1`
+ | let's call the lifetime of this reference `'2`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/underscore-lifetime-elison-mismatch.rs b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/underscore-lifetime-elison-mismatch.rs
rename to src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.rs
diff --git a/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
new file mode 100644
index 0000000..0847ea3
--- /dev/null
+++ b/src/test/ui/underscore-lifetime/underscore-lifetime-elison-mismatch.stderr
@@ -0,0 +1,11 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/underscore-lifetime-elison-mismatch.rs:11:49
+ |
+LL | fn foo(x: &mut Vec<&'_ u8>, y: &'_ u8) { x.push(y); } //~ ERROR lifetime mismatch
+ | ------ ------ ^ ...but data from `y` flows into `x` here
+ | |
+ | these two types are declared with different lifetimes...
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/compile-fail/uninhabited-enum-cast.rs b/src/test/ui/uninhabited/uninhabited-enum-cast.rs
similarity index 100%
rename from src/test/compile-fail/uninhabited-enum-cast.rs
rename to src/test/ui/uninhabited/uninhabited-enum-cast.rs
diff --git a/src/test/ui/uninhabited/uninhabited-enum-cast.stderr b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr
new file mode 100644
index 0000000..058f8fb
--- /dev/null
+++ b/src/test/ui/uninhabited/uninhabited-enum-cast.stderr
@@ -0,0 +1,11 @@
+error[E0605]: non-primitive cast: `E` as `isize`
+ --> $DIR/uninhabited-enum-cast.rs:14:20
+ |
+LL | println!("{}", (e as isize).to_string()); //~ ERROR non-primitive cast
+ | ^^^^^^^^^^^^
+ |
+ = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0605`.
diff --git a/src/test/compile-fail/uninhabited-irrefutable.rs b/src/test/ui/uninhabited/uninhabited-irrefutable.rs
similarity index 100%
rename from src/test/compile-fail/uninhabited-irrefutable.rs
rename to src/test/ui/uninhabited/uninhabited-irrefutable.rs
diff --git a/src/test/ui/uninhabited/uninhabited-irrefutable.stderr b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr
new file mode 100644
index 0000000..e14ca62
--- /dev/null
+++ b/src/test/ui/uninhabited/uninhabited-irrefutable.stderr
@@ -0,0 +1,9 @@
+error[E0005]: refutable pattern in local binding: `A(_)` not covered
+ --> $DIR/uninhabited-irrefutable.rs:37:9
+ |
+LL | let Foo::D(_y) = x; //~ ERROR refutable pattern in local binding: `A(_)` not covered
+ | ^^^^^^^^^^ pattern `A(_)` not covered
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0005`.
diff --git a/src/test/compile-fail/uninhabited-matches-feature-gated.rs b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs
similarity index 100%
rename from src/test/compile-fail/uninhabited-matches-feature-gated.rs
rename to src/test/ui/uninhabited/uninhabited-matches-feature-gated.rs
diff --git a/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
new file mode 100644
index 0000000..d86ebda
--- /dev/null
+++ b/src/test/ui/uninhabited/uninhabited-matches-feature-gated.stderr
@@ -0,0 +1,64 @@
+error[E0004]: non-exhaustive patterns: `Err(_)` not covered
+ --> $DIR/uninhabited-matches-feature-gated.rs:15:19
+ |
+LL | let _ = match x { //~ ERROR non-exhaustive
+ | ^ pattern `Err(_)` not covered
+
+error[E0004]: non-exhaustive patterns: type &Void is non-empty
+ --> $DIR/uninhabited-matches-feature-gated.rs:20:19
+ |
+LL | let _ = match x {}; //~ ERROR non-exhaustive
+ | ^
+ |
+help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+ --> $DIR/uninhabited-matches-feature-gated.rs:20:19
+ |
+LL | let _ = match x {}; //~ ERROR non-exhaustive
+ | ^
+
+error[E0004]: non-exhaustive patterns: type (Void,) is non-empty
+ --> $DIR/uninhabited-matches-feature-gated.rs:23:19
+ |
+LL | let _ = match x {}; //~ ERROR non-exhaustive
+ | ^
+ |
+help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+ --> $DIR/uninhabited-matches-feature-gated.rs:23:19
+ |
+LL | let _ = match x {}; //~ ERROR non-exhaustive
+ | ^
+
+error[E0004]: non-exhaustive patterns: type [Void; 1] is non-empty
+ --> $DIR/uninhabited-matches-feature-gated.rs:26:19
+ |
+LL | let _ = match x {}; //~ ERROR non-exhaustive
+ | ^
+ |
+help: Please ensure that all possible cases are being handled; possibly adding wildcards or more match arms.
+ --> $DIR/uninhabited-matches-feature-gated.rs:26:19
+ |
+LL | let _ = match x {}; //~ ERROR non-exhaustive
+ | ^
+
+error[E0004]: non-exhaustive patterns: `&[_]` not covered
+ --> $DIR/uninhabited-matches-feature-gated.rs:29:19
+ |
+LL | let _ = match x { //~ ERROR non-exhaustive
+ | ^ pattern `&[_]` not covered
+
+error[E0004]: non-exhaustive patterns: `Err(_)` not covered
+ --> $DIR/uninhabited-matches-feature-gated.rs:37:19
+ |
+LL | let _ = match x { //~ ERROR non-exhaustive
+ | ^ pattern `Err(_)` not covered
+
+error[E0005]: refutable pattern in local binding: `Err(_)` not covered
+ --> $DIR/uninhabited-matches-feature-gated.rs:42:9
+ |
+LL | let Ok(x) = x;
+ | ^^^^^ pattern `Err(_)` not covered
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0004, E0005.
+For more information about an error, try `rustc --explain E0004`.
diff --git a/src/test/compile-fail/uninhabited-patterns.rs b/src/test/ui/uninhabited/uninhabited-patterns.rs
similarity index 100%
rename from src/test/compile-fail/uninhabited-patterns.rs
rename to src/test/ui/uninhabited/uninhabited-patterns.rs
diff --git a/src/test/ui/uninhabited/uninhabited-patterns.stderr b/src/test/ui/uninhabited/uninhabited-patterns.stderr
new file mode 100644
index 0000000..f11ff7c
--- /dev/null
+++ b/src/test/ui/uninhabited/uninhabited-patterns.stderr
@@ -0,0 +1,38 @@
+error: unreachable pattern
+ --> $DIR/uninhabited-patterns.rs:37:9
+ |
+LL | &[..] => (), //~ ERROR unreachable pattern
+ | ^^^^^
+ |
+note: lint level defined here
+ --> $DIR/uninhabited-patterns.rs:16:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/uninhabited-patterns.rs:42:9
+ |
+LL | Ok(box _) => (), //~ ERROR unreachable pattern
+ | ^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/uninhabited-patterns.rs:44:9
+ |
+LL | Err(&[..]) => (), //~ ERROR unreachable pattern
+ | ^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/uninhabited-patterns.rs:51:9
+ |
+LL | Err(Ok(_y)) => (), //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^
+
+error: unreachable pattern
+ --> $DIR/uninhabited-patterns.rs:54:15
+ |
+LL | while let Some(_y) = foo() {
+ | ^^^^^^^^
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/ui/union-ub-fat-ptr.rs b/src/test/ui/union-ub-fat-ptr.rs
new file mode 100644
index 0000000..cfce92e
--- /dev/null
+++ b/src/test/ui/union-ub-fat-ptr.rs
@@ -0,0 +1,94 @@
+// 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.
+
+// normalize-stderr-test "alignment \d+" -> "alignment N"
+// normalize-stderr-test "offset \d+" -> "offset N"
+// normalize-stderr-test "allocation \d+" -> "allocation N"
+// normalize-stderr-test "size \d+" -> "size N"
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct SliceRepr {
+ ptr: *const u8,
+ len: usize,
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct BadSliceRepr {
+ ptr: *const u8,
+ len: &'static u8,
+}
+
+union SliceTransmute {
+ repr: SliceRepr,
+ bad: BadSliceRepr,
+ slice: &'static [u8],
+ str: &'static str,
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct DynRepr {
+ ptr: *const u8,
+ vtable: *const u8,
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct DynRepr2 {
+ ptr: *const u8,
+ vtable: *const u64,
+}
+
+#[repr(C)]
+#[derive(Copy, Clone)]
+struct BadDynRepr {
+ ptr: *const u8,
+ vtable: usize,
+}
+
+union DynTransmute {
+ repr: DynRepr,
+ repr2: DynRepr2,
+ bad: BadDynRepr,
+ rust: &'static Trait,
+}
+
+trait Trait {}
+
+// OK
+const A: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 1 } }.str};
+// should lint
+const B: &str = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.str};
+// bad
+const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str};
+//~^ ERROR this constant likely exhibits undefined behavior
+
+// OK
+const A2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 1 } }.slice};
+// should lint
+const B2: &[u8] = unsafe { SliceTransmute { repr: SliceRepr { ptr: &42, len: 999 } }.slice};
+// bad
+const C2: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice};
+//~^ ERROR this constant likely exhibits undefined behavior
+
+// bad
+const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust};
+//~^ ERROR this constant likely exhibits undefined behavior
+// bad
+const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust};
+//~^ ERROR this constant likely exhibits undefined behavior
+// bad
+const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust};
+//~^ ERROR this constant likely exhibits undefined behavior
+
+fn main() {
+}
diff --git a/src/test/ui/union-ub-fat-ptr.stderr b/src/test/ui/union-ub-fat-ptr.stderr
new file mode 100644
index 0000000..f0298d9
--- /dev/null
+++ b/src/test/ui/union-ub-fat-ptr.stderr
@@ -0,0 +1,43 @@
+error[E0080]: this constant likely exhibits undefined behavior
+ --> $DIR/union-ub-fat-ptr.rs:72:1
+ |
+LL | const C: &str = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.str};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered length is not a valid integer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: this constant likely exhibits undefined behavior
+ --> $DIR/union-ub-fat-ptr.rs:80:1
+ |
+LL | const C2: &[u8] = unsafe { SliceTransmute { bad: BadSliceRepr { ptr: &42, len: &3 } }.slice};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered length is not a valid integer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: this constant likely exhibits undefined behavior
+ --> $DIR/union-ub-fat-ptr.rs:84:1
+ |
+LL | const D: &Trait = unsafe { DynTransmute { repr: DynRepr { ptr: &92, vtable: &3 } }.rust};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ tried to access memory with alignment N, but alignment N is required
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: this constant likely exhibits undefined behavior
+ --> $DIR/union-ub-fat-ptr.rs:87:1
+ |
+LL | const E: &Trait = unsafe { DynTransmute { repr2: DynRepr2 { ptr: &92, vtable: &3 } }.rust};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ memory access at offset N, outside bounds of allocation N which has size N
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error[E0080]: this constant likely exhibits undefined behavior
+ --> $DIR/union-ub-fat-ptr.rs:90:1
+ |
+LL | const F: &Trait = unsafe { DynTransmute { bad: BadDynRepr { ptr: &92, vtable: 3 } }.rust};
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type validation failed: encountered vtable address is not a pointer
+ |
+ = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rust compiler repository if you believe it should not be considered undefined behavior
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0080`.
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
new file mode 100644
index 0000000..1ca2a56
--- /dev/null
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.nll.stderr
@@ -0,0 +1,33 @@
+error[E0382]: use of moved value: `u.y`
+ --> $DIR/union-borrow-move-parent-sibling.rs:29:13
+ |
+LL | let a = u.x.0;
+ | ----- value moved here
+LL | let a = u.y; //~ ERROR use of moved value: `u.y`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.y`
+ --> $DIR/union-borrow-move-parent-sibling.rs:41:13
+ |
+LL | let a = (u.x.0).0;
+ | --------- value moved here
+LL | let a = u.y; //~ ERROR use of moved value: `u.y`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
+
+error[E0382]: use of moved value: `u.x`
+ --> $DIR/union-borrow-move-parent-sibling.rs:53:13
+ |
+LL | let a = *u.y;
+ | ---- value moved here
+LL | let a = u.x; //~ ERROR use of moved value: `u.x`
+ | ^^^ value used here after move
+ |
+ = note: move occurs because `u` has type `U`, which does not implement the `Copy` trait
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/union/union-borrow-move-parent-sibling.rs b/src/test/ui/union/union-borrow-move-parent-sibling.rs
similarity index 100%
rename from src/test/compile-fail/union/union-borrow-move-parent-sibling.rs
rename to src/test/ui/union/union-borrow-move-parent-sibling.rs
diff --git a/src/test/ui/union/union-borrow-move-parent-sibling.stderr b/src/test/ui/union/union-borrow-move-parent-sibling.stderr
new file mode 100644
index 0000000..d855435
--- /dev/null
+++ b/src/test/ui/union/union-borrow-move-parent-sibling.stderr
@@ -0,0 +1,64 @@
+error[E0502]: cannot borrow `u.y` as immutable because `u.x.0` is also borrowed as mutable
+ --> $DIR/union-borrow-move-parent-sibling.rs:23:14
+ |
+LL | let a = &mut u.x.0;
+ | ----- mutable borrow occurs here
+LL | let a = &u.y; //~ ERROR cannot borrow `u.y`
+ | ^^^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error[E0382]: use of moved value: `u.y`
+ --> $DIR/union-borrow-move-parent-sibling.rs:29:9
+ |
+LL | let a = u.x.0;
+ | - value moved here
+LL | let a = u.y; //~ ERROR use of moved value: `u.y`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
+
+error[E0502]: cannot borrow `u.y` as immutable because `u.x.0.0` is also borrowed as mutable
+ --> $DIR/union-borrow-move-parent-sibling.rs:35:14
+ |
+LL | let a = &mut (u.x.0).0;
+ | --------- mutable borrow occurs here
+LL | let a = &u.y; //~ ERROR cannot borrow `u.y`
+ | ^^^ immutable borrow occurs here
+LL | }
+ | - mutable borrow ends here
+
+error[E0382]: use of moved value: `u.y`
+ --> $DIR/union-borrow-move-parent-sibling.rs:41:9
+ |
+LL | let a = (u.x.0).0;
+ | - value moved here
+LL | let a = u.y; //~ ERROR use of moved value: `u.y`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.y` has type `[type error]`, which does not implement the `Copy` trait
+
+error[E0502]: cannot borrow `u` (via `u.x`) as immutable because `u` is also borrowed as mutable (via `*u.y`)
+ --> $DIR/union-borrow-move-parent-sibling.rs:47:14
+ |
+LL | let a = &mut *u.y;
+ | ---- mutable borrow occurs here (via `*u.y`)
+LL | let a = &u.x; //~ ERROR cannot borrow `u` (via `u.x`)
+ | ^^^ immutable borrow occurs here (via `u.x`)
+LL | }
+ | - mutable borrow ends here
+
+error[E0382]: use of moved value: `u.x`
+ --> $DIR/union-borrow-move-parent-sibling.rs:53:9
+ |
+LL | let a = *u.y;
+ | - value moved here
+LL | let a = u.x; //~ ERROR use of moved value: `u.x`
+ | ^ value used here after move
+ |
+ = note: move occurs because `u.x` has type `[type error]`, which does not implement the `Copy` trait
+
+error: aborting due to 6 previous errors
+
+Some errors occurred: E0382, E0502.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/union/union-const-pat.rs b/src/test/ui/union/union-const-pat.rs
similarity index 100%
rename from src/test/compile-fail/union/union-const-pat.rs
rename to src/test/ui/union/union-const-pat.rs
diff --git a/src/test/ui/union/union-const-pat.stderr b/src/test/ui/union/union-const-pat.stderr
new file mode 100644
index 0000000..2d9c9a5
--- /dev/null
+++ b/src/test/ui/union/union-const-pat.stderr
@@ -0,0 +1,8 @@
+error: cannot use unions in constant patterns
+ --> $DIR/union-const-pat.rs:20:9
+ |
+LL | C => {} //~ ERROR cannot use unions in constant patterns
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/union/union-copy.rs b/src/test/ui/union/union-copy.rs
similarity index 100%
rename from src/test/compile-fail/union/union-copy.rs
rename to src/test/ui/union/union-copy.rs
diff --git a/src/test/ui/union/union-copy.stderr b/src/test/ui/union/union-copy.stderr
new file mode 100644
index 0000000..05da9e9
--- /dev/null
+++ b/src/test/ui/union/union-copy.stderr
@@ -0,0 +1,12 @@
+error[E0204]: the trait `Copy` may not be implemented for this type
+ --> $DIR/union-copy.rs:24:6
+ |
+LL | a: String
+ | --------- this field does not implement `Copy`
+...
+LL | impl Copy for W {} //~ ERROR the trait `Copy` may not be implemented for this type
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0204`.
diff --git a/src/test/compile-fail/union/union-derive-clone.rs b/src/test/ui/union/union-derive-clone.rs
similarity index 100%
rename from src/test/compile-fail/union/union-derive-clone.rs
rename to src/test/ui/union/union-derive-clone.rs
diff --git a/src/test/ui/union/union-derive-clone.stderr b/src/test/ui/union/union-derive-clone.stderr
new file mode 100644
index 0000000..e9a92b4
--- /dev/null
+++ b/src/test/ui/union/union-derive-clone.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `U1: std::marker::Copy` is not satisfied
+ --> $DIR/union-derive-clone.rs:13:10
+ |
+LL | #[derive(Clone)] //~ ERROR the trait bound `U1: std::marker::Copy` is not satisfied
+ | ^^^^^ the trait `std::marker::Copy` is not implemented for `U1`
+ |
+ = note: required by `std::clone::AssertParamIsCopy`
+
+error[E0599]: no method named `clone` found for type `U4<CloneNoCopy>` in the current scope
+ --> $DIR/union-derive-clone.rs:40:15
+ |
+LL | union U4<T> {
+ | ----------- method `clone` not found for this
+...
+LL | let w = u.clone(); //~ ERROR no method named `clone` found for type `U4<CloneNoCopy>`
+ | ^^^^^
+ |
+ = note: the method `clone` exists but the following trait bounds were not satisfied:
+ `U4<CloneNoCopy> : std::clone::Clone`
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0277, E0599.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/union/union-derive.rs b/src/test/ui/union/union-derive.rs
similarity index 100%
rename from src/test/compile-fail/union/union-derive.rs
rename to src/test/ui/union/union-derive.rs
diff --git a/src/test/ui/union/union-derive.stderr b/src/test/ui/union/union-derive.stderr
new file mode 100644
index 0000000..e8e11e8
--- /dev/null
+++ b/src/test/ui/union/union-derive.stderr
@@ -0,0 +1,38 @@
+error: this trait cannot be derived for unions
+ --> $DIR/union-derive.rs:19:5
+ |
+LL | Debug, //~ ERROR this trait cannot be derived for unions
+ | ^^^^^
+
+error: this trait cannot be derived for unions
+ --> $DIR/union-derive.rs:18:5
+ |
+LL | Default, //~ ERROR this trait cannot be derived for unions
+ | ^^^^^^^
+
+error: this trait cannot be derived for unions
+ --> $DIR/union-derive.rs:17:5
+ |
+LL | Hash, //~ ERROR this trait cannot be derived for unions
+ | ^^^^
+
+error: this trait cannot be derived for unions
+ --> $DIR/union-derive.rs:16:5
+ |
+LL | Ord, //~ ERROR this trait cannot be derived for unions
+ | ^^^
+
+error: this trait cannot be derived for unions
+ --> $DIR/union-derive.rs:15:5
+ |
+LL | PartialOrd, //~ ERROR this trait cannot be derived for unions
+ | ^^^^^^^^^^
+
+error: this trait cannot be derived for unions
+ --> $DIR/union-derive.rs:14:5
+ |
+LL | PartialEq, //~ ERROR this trait cannot be derived for unions
+ | ^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/compile-fail/union/union-empty.rs b/src/test/ui/union/union-empty.rs
similarity index 100%
rename from src/test/compile-fail/union/union-empty.rs
rename to src/test/ui/union/union-empty.rs
diff --git a/src/test/ui/union/union-empty.stderr b/src/test/ui/union/union-empty.stderr
new file mode 100644
index 0000000..5abe458
--- /dev/null
+++ b/src/test/ui/union/union-empty.stderr
@@ -0,0 +1,8 @@
+error: unions cannot have zero fields
+ --> $DIR/union-empty.rs:11:1
+ |
+LL | union U {} //~ ERROR unions cannot have zero fields
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/union/union-generic.rs b/src/test/ui/union/union-generic.rs
similarity index 100%
rename from src/test/compile-fail/union/union-generic.rs
rename to src/test/ui/union/union-generic.rs
diff --git a/src/test/ui/union/union-generic.stderr b/src/test/ui/union/union-generic.stderr
new file mode 100644
index 0000000..dbfffa0
--- /dev/null
+++ b/src/test/ui/union/union-generic.stderr
@@ -0,0 +1,27 @@
+error[E0277]: the trait bound `std::rc::Rc<u32>: std::marker::Copy` is not satisfied
+ --> $DIR/union-generic.rs:18:13
+ |
+LL | let u = U { a: Rc::new(0u32) };
+ | ^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc<u32>`
+ |
+note: required by `U`
+ --> $DIR/union-generic.rs:13:1
+ |
+LL | union U<T: Copy> {
+ | ^^^^^^^^^^^^^^^^
+
+error[E0277]: the trait bound `std::rc::Rc<u32>: std::marker::Copy` is not satisfied
+ --> $DIR/union-generic.rs:20:13
+ |
+LL | let u = U::<Rc<u32>> { a: Default::default() };
+ | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `std::rc::Rc<u32>`
+ |
+note: required by `U`
+ --> $DIR/union-generic.rs:13:1
+ |
+LL | union U<T: Copy> {
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/union/union-lint-dead-code.rs b/src/test/ui/union/union-lint-dead-code.rs
similarity index 100%
rename from src/test/compile-fail/union/union-lint-dead-code.rs
rename to src/test/ui/union/union-lint-dead-code.rs
diff --git a/src/test/ui/union/union-lint-dead-code.stderr b/src/test/ui/union/union-lint-dead-code.stderr
new file mode 100644
index 0000000..2cd3aab
--- /dev/null
+++ b/src/test/ui/union/union-lint-dead-code.stderr
@@ -0,0 +1,14 @@
+error: field is never used: `b`
+ --> $DIR/union-lint-dead-code.rs:15:5
+ |
+LL | b: bool, //~ ERROR: field is never used
+ | ^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/union-lint-dead-code.rs:11:9
+ |
+LL | #![deny(dead_code)]
+ | ^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/union/union-nonrepresentable.rs b/src/test/ui/union/union-nonrepresentable.rs
similarity index 100%
rename from src/test/compile-fail/union/union-nonrepresentable.rs
rename to src/test/ui/union/union-nonrepresentable.rs
diff --git a/src/test/ui/union/union-nonrepresentable.stderr b/src/test/ui/union/union-nonrepresentable.stderr
new file mode 100644
index 0000000..17d78ea
--- /dev/null
+++ b/src/test/ui/union/union-nonrepresentable.stderr
@@ -0,0 +1,14 @@
+error[E0072]: recursive type `U` has infinite size
+ --> $DIR/union-nonrepresentable.rs:13:1
+ |
+LL | union U { //~ ERROR recursive type `U` has infinite size
+ | ^^^^^^^ recursive type has infinite size
+LL | a: u8,
+LL | b: U,
+ | ---- recursive without indirection
+ |
+ = help: insert indirection (e.g., a `Box`, `Rc`, or `&`) at some point to make `U` representable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0072`.
diff --git a/src/test/compile-fail/union/union-repr-c.rs b/src/test/ui/union/union-repr-c.rs
similarity index 100%
rename from src/test/compile-fail/union/union-repr-c.rs
rename to src/test/ui/union/union-repr-c.rs
diff --git a/src/test/ui/union/union-repr-c.stderr b/src/test/ui/union/union-repr-c.stderr
new file mode 100644
index 0000000..ddf5004
--- /dev/null
+++ b/src/test/ui/union/union-repr-c.stderr
@@ -0,0 +1,22 @@
+error: `extern` block uses type `W` which is not FFI-safe: this union has unspecified layout
+ --> $DIR/union-repr-c.rs:25:22
+ |
+LL | static FOREIGN2: W; //~ ERROR union has unspecified layout
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/union-repr-c.rs:12:9
+ |
+LL | #![deny(improper_ctypes)]
+ | ^^^^^^^^^^^^^^^
+ = help: consider adding a #[repr(C)] attribute to this union
+note: type defined here
+ --> $DIR/union-repr-c.rs:19:1
+ |
+LL | / union W {
+LL | | a: u8,
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/union/union-sized-field.stderr b/src/test/ui/union/union-sized-field.stderr
index 75a6542..85e9702 100644
--- a/src/test/ui/union/union-sized-field.stderr
+++ b/src/test/ui/union/union-sized-field.stderr
@@ -5,7 +5,7 @@
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= help: consider adding a `where T: std::marker::Sized` bound
= note: no field of a union may have a dynamically sized type
@@ -16,7 +16,7 @@
| ^^^^^^^^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= help: consider adding a `where T: std::marker::Sized` bound
= note: only the last field of a struct may have a dynamically sized type
@@ -27,7 +27,7 @@
| ^ doesn't have a size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
= help: consider adding a `where T: std::marker::Sized` bound
= note: no field of an enum variant may have a dynamically sized type
diff --git a/src/test/compile-fail/union/union-unsafe.rs b/src/test/ui/union/union-unsafe.rs
similarity index 100%
rename from src/test/compile-fail/union/union-unsafe.rs
rename to src/test/ui/union/union-unsafe.rs
diff --git a/src/test/ui/union/union-unsafe.stderr b/src/test/ui/union/union-unsafe.stderr
new file mode 100644
index 0000000..a0b3d98
--- /dev/null
+++ b/src/test/ui/union/union-unsafe.stderr
@@ -0,0 +1,51 @@
+error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:31:5
+ |
+LL | u3.a = T::default(); //~ ERROR assignment to non-`Copy` union field is unsafe
+ | ^^^^ assignment to non-`Copy` union field
+ |
+ = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:43:13
+ |
+LL | let a = u1.a; //~ ERROR access to union field is unsafe
+ | ^^^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:45:14
+ |
+LL | let U1 { a } = u1; //~ ERROR access to union field is unsafe
+ | ^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: access to union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:46:20
+ |
+LL | if let U1 { a: 12 } = u1 {} //~ ERROR access to union field is unsafe
+ | ^^ access to union field
+ |
+ = note: the field may not be properly initialized: using uninitialized data will cause undefined behavior
+
+error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:50:5
+ |
+LL | u2.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe
+ | ^^^^ assignment to non-`Copy` union field
+ |
+ = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
+
+error[E0133]: assignment to non-`Copy` union field is unsafe and requires unsafe function or block
+ --> $DIR/union-unsafe.rs:54:5
+ |
+LL | u3.a = String::from("new"); //~ ERROR assignment to non-`Copy` union field is unsafe
+ | ^^^^ assignment to non-`Copy` union field
+ |
+ = note: the previous content of the field will be dropped, which causes undefined behavior if the field was not properly initialized
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/union/union-unsized.rs b/src/test/ui/union/union-unsized.rs
similarity index 100%
rename from src/test/compile-fail/union/union-unsized.rs
rename to src/test/ui/union/union-unsized.rs
diff --git a/src/test/ui/union/union-unsized.stderr b/src/test/ui/union/union-unsized.stderr
new file mode 100644
index 0000000..e2da603
--- /dev/null
+++ b/src/test/ui/union/union-unsized.stderr
@@ -0,0 +1,23 @@
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/union-unsized.rs:14:5
+ |
+LL | a: str,
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of a union may have a dynamically sized type
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/union-unsized.rs:22:5
+ |
+LL | b: str,
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of a union may have a dynamically sized type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/union/union-with-drop-fields-lint.rs b/src/test/ui/union/union-with-drop-fields-lint.rs
similarity index 100%
rename from src/test/compile-fail/union/union-with-drop-fields-lint.rs
rename to src/test/ui/union/union-with-drop-fields-lint.rs
diff --git a/src/test/ui/union/union-with-drop-fields-lint.stderr b/src/test/ui/union/union-with-drop-fields-lint.stderr
new file mode 100644
index 0000000..2d3d539
--- /dev/null
+++ b/src/test/ui/union/union-with-drop-fields-lint.stderr
@@ -0,0 +1,26 @@
+error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union
+ --> $DIR/union-with-drop-fields-lint.rs:20:5
+ |
+LL | a: String, //~ ERROR union contains a field with possibly non-trivial drop code
+ | ^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/union-with-drop-fields-lint.rs:13:9
+ |
+LL | #![deny(unions_with_drop_fields)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union
+ --> $DIR/union-with-drop-fields-lint.rs:28:5
+ |
+LL | a: S, //~ ERROR union contains a field with possibly non-trivial drop code
+ | ^^^^
+
+error: union contains a field with possibly non-trivial drop code, drop code of union fields is ignored when dropping the union
+ --> $DIR/union-with-drop-fields-lint.rs:33:5
+ |
+LL | a: T, //~ ERROR union contains a field with possibly non-trivial drop code
+ | ^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/unique-object-noncopyable.rs b/src/test/ui/unique-object-noncopyable.rs
similarity index 100%
rename from src/test/compile-fail/unique-object-noncopyable.rs
rename to src/test/ui/unique-object-noncopyable.rs
diff --git a/src/test/ui/unique-object-noncopyable.stderr b/src/test/ui/unique-object-noncopyable.stderr
new file mode 100644
index 0000000..777b9f1
--- /dev/null
+++ b/src/test/ui/unique-object-noncopyable.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no method named `clone` found for type `std::boxed::Box<dyn Foo>` in the current scope
+ --> $DIR/unique-object-noncopyable.rs:34:16
+ |
+LL | let _z = y.clone(); //~ ERROR no method named `clone` found
+ | ^^^^^
+ |
+ = note: the method `clone` exists but the following trait bounds were not satisfied:
+ `std::boxed::Box<dyn Foo> : std::clone::Clone`
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/ui/unique-pinned-nocopy.rs
similarity index 100%
rename from src/test/compile-fail/unique-pinned-nocopy.rs
rename to src/test/ui/unique-pinned-nocopy.rs
diff --git a/src/test/ui/unique-pinned-nocopy.stderr b/src/test/ui/unique-pinned-nocopy.stderr
new file mode 100644
index 0000000..ddc6766
--- /dev/null
+++ b/src/test/ui/unique-pinned-nocopy.stderr
@@ -0,0 +1,15 @@
+error[E0599]: no method named `clone` found for type `std::boxed::Box<r>` in the current scope
+ --> $DIR/unique-pinned-nocopy.rs:22:16
+ |
+LL | let _j = i.clone(); //~ ERROR no method named `clone` found
+ | ^^^^^
+ |
+ = note: the method `clone` exists but the following trait bounds were not satisfied:
+ `std::boxed::Box<r> : std::clone::Clone`
+ = help: items from traits can only be used if the trait is implemented and in scope
+ = note: the following trait defines an item `clone`, perhaps you need to implement it:
+ candidate #1: `std::clone::Clone`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0599`.
diff --git a/src/test/compile-fail/unknown-lint-tool-name.rs b/src/test/ui/unknown-lint-tool-name.rs
similarity index 100%
rename from src/test/compile-fail/unknown-lint-tool-name.rs
rename to src/test/ui/unknown-lint-tool-name.rs
diff --git a/src/test/ui/unknown-lint-tool-name.stderr b/src/test/ui/unknown-lint-tool-name.stderr
new file mode 100644
index 0000000..29c3a64
--- /dev/null
+++ b/src/test/ui/unknown-lint-tool-name.stderr
@@ -0,0 +1,15 @@
+error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
+ --> $DIR/unknown-lint-tool-name.rs:13:9
+ |
+LL | #![deny(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar`
+ | ^^^
+
+error[E0710]: an unknown tool name found in scoped lint: `foo::bar`
+ --> $DIR/unknown-lint-tool-name.rs:15:9
+ |
+LL | #[allow(foo::bar)] //~ ERROR an unknown tool name found in scoped lint: `foo::bar`
+ | ^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0710`.
diff --git a/src/test/compile-fail/unknown-tool-name.rs b/src/test/ui/unknown-tool-name.rs
similarity index 100%
rename from src/test/compile-fail/unknown-tool-name.rs
rename to src/test/ui/unknown-tool-name.rs
diff --git a/src/test/ui/unknown-tool-name.stderr b/src/test/ui/unknown-tool-name.stderr
new file mode 100644
index 0000000..151f957
--- /dev/null
+++ b/src/test/ui/unknown-tool-name.stderr
@@ -0,0 +1,9 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `foo`
+ --> $DIR/unknown-tool-name.rs:13:3
+ |
+LL | #[foo::bar] //~ ERROR failed to resolve. Use of undeclared type or module `foo`
+ | ^^^ Use of undeclared type or module `foo`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0433`.
diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr
new file mode 100644
index 0000000..111940a
--- /dev/null
+++ b/src/test/ui/unop-move-semantics.nll.stderr
@@ -0,0 +1,27 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/unop-move-semantics.rs:18:5
+ |
+LL | !x;
+ | - value moved here
+LL |
+LL | x.clone(); //~ ERROR: use of moved value
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/unop-move-semantics.rs:34:6
+ |
+LL | !*m; //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/unop-move-semantics.rs:36:6
+ |
+LL | !*n; //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0382, E0507.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/unop-move-semantics.rs b/src/test/ui/unop-move-semantics.rs
similarity index 100%
rename from src/test/compile-fail/unop-move-semantics.rs
rename to src/test/ui/unop-move-semantics.rs
diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr
new file mode 100644
index 0000000..42d17e5
--- /dev/null
+++ b/src/test/ui/unop-move-semantics.stderr
@@ -0,0 +1,45 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/unop-move-semantics.rs:18:5
+ |
+LL | !x;
+ | - value moved here
+LL |
+LL | x.clone(); //~ ERROR: use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+
+error[E0505]: cannot move out of `x` because it is borrowed
+ --> $DIR/unop-move-semantics.rs:25:6
+ |
+LL | let m = &x;
+ | - borrow of `x` occurs here
+...
+LL | !x; //~ ERROR: cannot move out of `x` because it is borrowed
+ | ^ move out of `x` occurs here
+
+error[E0505]: cannot move out of `y` because it is borrowed
+ --> $DIR/unop-move-semantics.rs:27:6
+ |
+LL | let n = &mut y;
+ | - borrow of `y` occurs here
+...
+LL | !y; //~ ERROR: cannot move out of `y` because it is borrowed
+ | ^ move out of `y` occurs here
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/unop-move-semantics.rs:34:6
+ |
+LL | !*m; //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+ --> $DIR/unop-move-semantics.rs:36:6
+ |
+LL | !*n; //~ ERROR: cannot move out of borrowed content
+ | ^^ cannot move out of borrowed content
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0382, E0505, E0507.
+For more information about an error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/unop-neg-bool.rs b/src/test/ui/unop-neg-bool.rs
similarity index 100%
rename from src/test/compile-fail/unop-neg-bool.rs
rename to src/test/ui/unop-neg-bool.rs
diff --git a/src/test/ui/unop-neg-bool.stderr b/src/test/ui/unop-neg-bool.stderr
new file mode 100644
index 0000000..8ffb71e
--- /dev/null
+++ b/src/test/ui/unop-neg-bool.stderr
@@ -0,0 +1,11 @@
+error[E0600]: cannot apply unary operator `-` to type `bool`
+ --> $DIR/unop-neg-bool.rs:12:5
+ |
+LL | -true; //~ ERROR cannot apply unary operator `-` to type `bool`
+ | ^^^^^ cannot apply unary operator `-`
+ |
+ = note: an implementation of `std::ops::Neg` might be missing for `bool`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0600`.
diff --git a/src/test/compile-fail/auxiliary/unreachable_variant.rs b/src/test/ui/unreachable/auxiliary/unreachable_variant.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/unreachable_variant.rs
rename to src/test/ui/unreachable/auxiliary/unreachable_variant.rs
diff --git a/src/test/compile-fail/unreachable-arm.rs b/src/test/ui/unreachable/unreachable-arm.rs
similarity index 100%
rename from src/test/compile-fail/unreachable-arm.rs
rename to src/test/ui/unreachable/unreachable-arm.rs
diff --git a/src/test/ui/unreachable/unreachable-arm.stderr b/src/test/ui/unreachable/unreachable-arm.stderr
new file mode 100644
index 0000000..6bd3f28
--- /dev/null
+++ b/src/test/ui/unreachable/unreachable-arm.stderr
@@ -0,0 +1,14 @@
+error: unreachable pattern
+ --> $DIR/unreachable-arm.rs:21:9
+ |
+LL | Foo::A(_, 1) => { } //~ ERROR unreachable pattern
+ | ^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unreachable-arm.rs:14:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unreachable-code.rs b/src/test/ui/unreachable/unreachable-code.rs
similarity index 100%
rename from src/test/compile-fail/unreachable-code.rs
rename to src/test/ui/unreachable/unreachable-code.rs
diff --git a/src/test/ui/unreachable/unreachable-code.stderr b/src/test/ui/unreachable/unreachable-code.stderr
new file mode 100644
index 0000000..0c5d94c
--- /dev/null
+++ b/src/test/ui/unreachable/unreachable-code.stderr
@@ -0,0 +1,14 @@
+error: unreachable statement
+ --> $DIR/unreachable-code.rs:17:3
+ |
+LL | let a = 3; //~ ERROR: unreachable statement
+ | ^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unreachable-code.rs:11:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unreachable-in-call.rs b/src/test/ui/unreachable/unreachable-in-call.rs
similarity index 100%
rename from src/test/compile-fail/unreachable-in-call.rs
rename to src/test/ui/unreachable/unreachable-in-call.rs
diff --git a/src/test/ui/unreachable/unreachable-in-call.stderr b/src/test/ui/unreachable/unreachable-in-call.stderr
new file mode 100644
index 0000000..215829a
--- /dev/null
+++ b/src/test/ui/unreachable/unreachable-in-call.stderr
@@ -0,0 +1,22 @@
+error: unreachable expression
+ --> $DIR/unreachable-in-call.rs:24:10
+ |
+LL | get_u8()); //~ ERROR unreachable expression
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unreachable-in-call.rs:12:9
+ |
+LL | #![deny(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+error: unreachable expression
+ --> $DIR/unreachable-in-call.rs:27:5
+ |
+LL | / call( //~ ERROR unreachable expression
+LL | | get_u8(),
+LL | | diverge());
+ | |__________________^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/unreachable-loop-patterns.rs b/src/test/ui/unreachable/unreachable-loop-patterns.rs
similarity index 100%
rename from src/test/compile-fail/unreachable-loop-patterns.rs
rename to src/test/ui/unreachable/unreachable-loop-patterns.rs
diff --git a/src/test/ui/unreachable/unreachable-loop-patterns.stderr b/src/test/ui/unreachable/unreachable-loop-patterns.stderr
new file mode 100644
index 0000000..724a92b
--- /dev/null
+++ b/src/test/ui/unreachable/unreachable-loop-patterns.stderr
@@ -0,0 +1,14 @@
+error: unreachable pattern
+ --> $DIR/unreachable-loop-patterns.rs:18:9
+ |
+LL | for _ in x {}
+ | ^
+ |
+note: lint level defined here
+ --> $DIR/unreachable-loop-patterns.rs:13:9
+ |
+LL | #![deny(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unreachable-try-pattern.rs b/src/test/ui/unreachable/unreachable-try-pattern.rs
similarity index 100%
rename from src/test/compile-fail/unreachable-try-pattern.rs
rename to src/test/ui/unreachable/unreachable-try-pattern.rs
diff --git a/src/test/ui/unreachable/unreachable-try-pattern.stderr b/src/test/ui/unreachable/unreachable-try-pattern.stderr
new file mode 100644
index 0000000..a8a0ed3
--- /dev/null
+++ b/src/test/ui/unreachable/unreachable-try-pattern.stderr
@@ -0,0 +1,43 @@
+warning: unreachable expression
+ --> $DIR/unreachable-try-pattern.rs:29:36
+ |
+LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?;
+ | ^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unreachable-try-pattern.rs:13:9
+ |
+LL | #![warn(unreachable_code)]
+ | ^^^^^^^^^^^^^^^^
+
+warning: unreachable pattern
+ --> $DIR/unreachable-try-pattern.rs:29:24
+ |
+LL | let y = (match x { Ok(n) => Ok(n as u32), Err(e) => Err(e) })?;
+ | ^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unreachable-try-pattern.rs:14:9
+ |
+LL | #![warn(unreachable_patterns)]
+ | ^^^^^^^^^^^^^^^^^^^^
+
+warning: unreachable pattern
+ --> $DIR/unreachable-try-pattern.rs:40:40
+ |
+LL | let y = (match x { Ok(n) => Ok(n), Err(e) => Err(e) })?;
+ | ^^^^^^
+
+error: compilation successful
+ --> $DIR/unreachable-try-pattern.rs:46:1
+ |
+LL | / fn main() { //~ ERROR: compilation successful
+LL | | let _ = bar(Err(123));
+LL | | let _ = foo(Err(123));
+LL | | let _ = qux(Ok(123));
+LL | | let _ = vom(Ok(123));
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unreachable-variant.rs b/src/test/ui/unreachable/unreachable-variant.rs
similarity index 100%
rename from src/test/compile-fail/unreachable-variant.rs
rename to src/test/ui/unreachable/unreachable-variant.rs
diff --git a/src/test/ui/unreachable/unreachable-variant.stderr b/src/test/ui/unreachable/unreachable-variant.stderr
new file mode 100644
index 0000000..fff7758
--- /dev/null
+++ b/src/test/ui/unreachable/unreachable-variant.stderr
@@ -0,0 +1,9 @@
+error[E0603]: module `super_sekrit` is private
+ --> $DIR/unreachable-variant.rs:16:14
+ |
+LL | let _x = other::super_sekrit::sooper_sekrit::baz; //~ ERROR is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/unresolved-extern-mod-suggestion.rs b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.rs
similarity index 100%
rename from src/test/compile-fail/unresolved-extern-mod-suggestion.rs
rename to src/test/ui/unresolved/unresolved-extern-mod-suggestion.rs
diff --git a/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr
new file mode 100644
index 0000000..4e3ea57
--- /dev/null
+++ b/src/test/ui/unresolved/unresolved-extern-mod-suggestion.stderr
@@ -0,0 +1,17 @@
+error[E0254]: the name `core` is defined multiple times
+ --> $DIR/unresolved-extern-mod-suggestion.rs:12:5
+ |
+LL | extern crate core;
+ | ------------------ previous import of the extern crate `core` here
+LL | use core;
+ | ^^^^ `core` reimported here
+ |
+ = note: `core` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use core as other_core;
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0254`.
diff --git a/src/test/compile-fail/unresolved-import-recovery.rs b/src/test/ui/unresolved/unresolved-import-recovery.rs
similarity index 100%
rename from src/test/compile-fail/unresolved-import-recovery.rs
rename to src/test/ui/unresolved/unresolved-import-recovery.rs
diff --git a/src/test/ui/unresolved/unresolved-import-recovery.stderr b/src/test/ui/unresolved/unresolved-import-recovery.stderr
new file mode 100644
index 0000000..d430419
--- /dev/null
+++ b/src/test/ui/unresolved/unresolved-import-recovery.stderr
@@ -0,0 +1,9 @@
+error[E0432]: unresolved import `unresolved`
+ --> $DIR/unresolved-import-recovery.rs:14:13
+ |
+LL | pub use unresolved; //~ ERROR unresolved import `unresolved`
+ | ^^^^^^^^^^ no `unresolved` in the root
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/unresolved-import.rs b/src/test/ui/unresolved/unresolved-import.rs
similarity index 100%
rename from src/test/compile-fail/unresolved-import.rs
rename to src/test/ui/unresolved/unresolved-import.rs
diff --git a/src/test/ui/unresolved/unresolved-import.stderr b/src/test/ui/unresolved/unresolved-import.stderr
new file mode 100644
index 0000000..1e663cd
--- /dev/null
+++ b/src/test/ui/unresolved/unresolved-import.stderr
@@ -0,0 +1,44 @@
+error[E0432]: unresolved import `foo`
+ --> $DIR/unresolved-import.rs:13:5
+ |
+LL | use foo::bar; //~ ERROR unresolved import `foo` [E0432]
+ | ^^^ Maybe a missing `extern crate foo;`?
+
+error[E0432]: unresolved import `bar::Baz`
+ --> $DIR/unresolved-import.rs:16:5
+ |
+LL | use bar::Baz as x; //~ ERROR unresolved import `bar::Baz` [E0432]
+ | ^^^^^^^^^^^^^ no `Baz` in `bar`. Did you mean to use `Bar`?
+
+error[E0432]: unresolved import `food::baz`
+ --> $DIR/unresolved-import.rs:19:5
+ |
+LL | use food::baz; //~ ERROR unresolved import `food::baz`
+ | ^^^^^^^^^ no `baz` in `food`. Did you mean to use `bag`?
+
+error[E0432]: unresolved import `food::beens`
+ --> $DIR/unresolved-import.rs:22:12
+ |
+LL | use food::{beens as Foo}; //~ ERROR unresolved import `food::beens` [E0432]
+ | ^^^^^^^^^^^^ no `beens` in `food`. Did you mean to use `beans`?
+
+error[E0432]: unresolved import `MyEnum`
+ --> $DIR/unresolved-import.rs:44:9
+ |
+LL | use MyEnum::*; //~ ERROR unresolved import `MyEnum` [E0432]
+ | ^^^^^^ Did you mean `self::MyEnum`?
+
+error[E0432]: unresolved import `Enum`
+ --> $DIR/unresolved-import.rs:53:9
+ |
+LL | use Enum::*; //~ ERROR unresolved import `Enum` [E0432]
+ | ^^^^ Did you mean `self::Enum`?
+
+error[E0601]: `main` function not found in crate `unresolved_import`
+ |
+ = note: consider adding a `main` function to `$DIR/unresolved-import.rs`
+
+error: aborting due to 7 previous errors
+
+Some errors occurred: E0432, E0601.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/ui/unrestricted-attribute-tokens.rs b/src/test/ui/unrestricted-attribute-tokens.rs
new file mode 100644
index 0000000..2971b50
--- /dev/null
+++ b/src/test/ui/unrestricted-attribute-tokens.rs
@@ -0,0 +1,16 @@
+// 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.
+
+// compile-pass
+
+#![feature(custom_attribute, unrestricted_attribute_tokens)]
+
+#[my_attr(a b c d)]
+fn main() {}
diff --git a/src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-around-compiler-generated-unsafe.rs
rename to src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.rs
diff --git a/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr
new file mode 100644
index 0000000..849630a
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-around-compiler-generated-unsafe.stderr
@@ -0,0 +1,14 @@
+error: unnecessary `unsafe` block
+ --> $DIR/unsafe-around-compiler-generated-unsafe.rs:16:5
+ |
+LL | unsafe { println!("foo"); } //~ ERROR unnecessary `unsafe`
+ | ^^^^^^ unnecessary `unsafe` block
+ |
+note: lint level defined here
+ --> $DIR/unsafe-around-compiler-generated-unsafe.rs:13:9
+ |
+LL | #![deny(unused_unsafe)]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/unsafe-block-without-braces.rs b/src/test/ui/unsafe/unsafe-block-without-braces.rs
similarity index 100%
rename from src/test/ui/unsafe-block-without-braces.rs
rename to src/test/ui/unsafe/unsafe-block-without-braces.rs
diff --git a/src/test/ui/unsafe-block-without-braces.stderr b/src/test/ui/unsafe/unsafe-block-without-braces.stderr
similarity index 100%
rename from src/test/ui/unsafe-block-without-braces.stderr
rename to src/test/ui/unsafe/unsafe-block-without-braces.stderr
diff --git a/src/test/ui/unsafe-const-fn.rs b/src/test/ui/unsafe/unsafe-const-fn.rs
similarity index 100%
rename from src/test/ui/unsafe-const-fn.rs
rename to src/test/ui/unsafe/unsafe-const-fn.rs
diff --git a/src/test/ui/unsafe-const-fn.stderr b/src/test/ui/unsafe/unsafe-const-fn.stderr
similarity index 100%
rename from src/test/ui/unsafe-const-fn.stderr
rename to src/test/ui/unsafe/unsafe-const-fn.stderr
diff --git a/src/test/compile-fail/unsafe-fn-assign-deref-ptr.rs b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-fn-assign-deref-ptr.rs
rename to src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.rs
diff --git a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr
new file mode 100644
index 0000000..e98600a
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.stderr
@@ -0,0 +1,11 @@
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-assign-deref-ptr.rs:14:5
+ |
+LL | *p = 0; //~ ERROR dereference of raw pointer is unsafe
+ | ^^^^^^ dereference of raw pointer
+ |
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/unsafe-fn-autoderef.rs b/src/test/ui/unsafe/unsafe-fn-autoderef.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-fn-autoderef.rs
rename to src/test/ui/unsafe/unsafe-fn-autoderef.rs
diff --git a/src/test/ui/unsafe/unsafe-fn-autoderef.stderr b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr
new file mode 100644
index 0000000..13fcbb3
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-fn-autoderef.stderr
@@ -0,0 +1,9 @@
+error[E0609]: no field `f` on type `*const Rec`
+ --> $DIR/unsafe-fn-autoderef.rs:29:14
+ |
+LL | return p.f; //~ ERROR no field `f` on type `*const Rec`
+ | ^ help: `p` is a native pointer; try dereferencing it: `(*p).f`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0609`.
diff --git a/src/test/compile-fail/unsafe-fn-called-from-safe.rs b/src/test/ui/unsafe/unsafe-fn-called-from-safe.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-fn-called-from-safe.rs
rename to src/test/ui/unsafe/unsafe-fn-called-from-safe.rs
diff --git a/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr
new file mode 100644
index 0000000..a781347
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-fn-called-from-safe.stderr
@@ -0,0 +1,11 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-called-from-safe.rs:15:5
+ |
+LL | f(); //~ ERROR call to unsafe function is unsafe
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/unsafe-fn-deref-ptr.rs b/src/test/ui/unsafe/unsafe-fn-deref-ptr.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-fn-deref-ptr.rs
rename to src/test/ui/unsafe/unsafe-fn-deref-ptr.rs
diff --git a/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr
new file mode 100644
index 0000000..885f6e4
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-fn-deref-ptr.stderr
@@ -0,0 +1,11 @@
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-deref-ptr.rs:13:12
+ |
+LL | return *p; //~ ERROR dereference of raw pointer is unsafe
+ | ^^ dereference of raw pointer
+ |
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/unsafe-fn-used-as-value.rs b/src/test/ui/unsafe/unsafe-fn-used-as-value.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-fn-used-as-value.rs
rename to src/test/ui/unsafe/unsafe-fn-used-as-value.rs
diff --git a/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr
new file mode 100644
index 0000000..7f8af30
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-fn-used-as-value.stderr
@@ -0,0 +1,11 @@
+error[E0133]: call to unsafe function is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-fn-used-as-value.rs:16:5
+ |
+LL | x(); //~ ERROR call to unsafe function is unsafe
+ | ^^^ call to unsafe function
+ |
+ = note: consult the function's documentation for information on how to avoid undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/unsafe-move-val-init.rs b/src/test/ui/unsafe/unsafe-move-val-init.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-move-val-init.rs
rename to src/test/ui/unsafe/unsafe-move-val-init.rs
diff --git a/src/test/ui/unsafe/unsafe-move-val-init.stderr b/src/test/ui/unsafe/unsafe-move-val-init.stderr
new file mode 100644
index 0000000..be92623
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-move-val-init.stderr
@@ -0,0 +1,11 @@
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe function or block
+ --> $DIR/unsafe-move-val-init.rs:18:5
+ |
+LL | intrinsics::move_val_init(1 as *mut u32, 1);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer
+ |
+ = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/src/test/compile-fail/unsafe-subtyping.rs b/src/test/ui/unsafe/unsafe-subtyping.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-subtyping.rs
rename to src/test/ui/unsafe/unsafe-subtyping.rs
diff --git a/src/test/ui/unsafe/unsafe-subtyping.stderr b/src/test/ui/unsafe/unsafe-subtyping.stderr
new file mode 100644
index 0000000..645f2a7
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-subtyping.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+ --> $DIR/unsafe-subtyping.rs:14:5
+ |
+LL | fn foo(x: Option<fn(i32)>) -> Option<unsafe fn(i32)> {
+ | ---------------------- expected `std::option::Option<unsafe fn(i32)>` because of return type
+LL | x //~ ERROR mismatched types
+ | ^ expected unsafe fn, found normal fn
+ |
+ = note: expected type `std::option::Option<unsafe fn(i32)>`
+ found type `std::option::Option<fn(i32)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/unsafe-trait-impl.rs b/src/test/ui/unsafe/unsafe-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/unsafe-trait-impl.rs
rename to src/test/ui/unsafe/unsafe-trait-impl.rs
diff --git a/src/test/ui/unsafe/unsafe-trait-impl.stderr b/src/test/ui/unsafe/unsafe-trait-impl.stderr
new file mode 100644
index 0000000..ae47d6c
--- /dev/null
+++ b/src/test/ui/unsafe/unsafe-trait-impl.stderr
@@ -0,0 +1,15 @@
+error[E0053]: method `len` has an incompatible type for trait
+ --> $DIR/unsafe-trait-impl.rs:18:5
+ |
+LL | unsafe fn len(&self) -> u32;
+ | ---------------------------- type in trait
+...
+LL | fn len(&self) -> u32 { *self }
+ | ^^^^^^^^^^^^^^^^^^^^ expected unsafe fn, found normal fn
+ |
+ = note: expected type `unsafe fn(&u32) -> u32`
+ found type `fn(&u32) -> u32`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/ui/unsized-enum2.stderr b/src/test/ui/unsized-enum2.stderr
deleted file mode 100644
index bd97978..0000000
--- a/src/test/ui/unsized-enum2.stderr
+++ /dev/null
@@ -1,211 +0,0 @@
-error[E0277]: the size for values of type `W` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:33:8
- |
-LL | VA(W),
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `W`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where W: std::marker::Sized` bound
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `X` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:35:8
- |
-LL | VB{x: X},
- | ^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `X`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where X: std::marker::Sized` bound
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `Y` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:37:15
- |
-LL | VC(isize, Y),
- | ^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `Y`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where Y: std::marker::Sized` bound
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `Z` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:39:18
- |
-LL | VD{u: isize, x: Z},
- | ^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `Z`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = help: consider adding a `where Z: std::marker::Sized` bound
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:43:8
- |
-LL | VE([u8]),
- | ^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[u8]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `str` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:45:8
- |
-LL | VF{x: str},
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `str`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[f32]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:47:15
- |
-LL | VG(isize, [f32]),
- | ^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[f32]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[u32]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:49:18
- |
-LL | VH{u: isize, x: [u32]},
- | ^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[u32]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:63:8
- |
-LL | VM(Foo),
- | ^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:65:8
- |
-LL | VN{x: Bar},
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:67:15
- |
-LL | VO(isize, FooBar),
- | ^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:69:18
- |
-LL | VP{u: isize, x: BarFoo},
- | ^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:73:8
- |
-LL | VQ(<&'static [i8] as Deref>::Target),
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[i8]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[char]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:75:8
- |
-LL | VR{x: <&'static [char] as Deref>::Target},
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[char]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[f64]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:77:15
- |
-LL | VS(isize, <&'static [f64] as Deref>::Target),
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[f64]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:79:18
- |
-LL | VT{u: isize, x: <&'static [i32] as Deref>::Target},
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `[i32]`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:53:8
- |
-LL | VI(Path1),
- | ^^^^^ doesn't have a size known at compile-time
- |
- = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper1 + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required because it appears within the type `Path1`
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:55:8
- |
-LL | VJ{x: Path2},
- | ^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper2 + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required because it appears within the type `Path2`
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:57:15
- |
-LL | VK(isize, Path3),
- | ^^^^^ doesn't have a size known at compile-time
- |
- = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper3 + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required because it appears within the type `Path3`
- = note: no field of an enum variant may have a dynamically sized type
-
-error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time
- --> $DIR/unsized-enum2.rs:59:18
- |
-LL | VL{u: isize, x: Path4},
- | ^^^^^^^^ doesn't have a size known at compile-time
- |
- = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper4 + 'static)`
- = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-sized>
- = note: required because it appears within the type `Path4`
- = note: no field of an enum variant may have a dynamically sized type
-
-error: aborting due to 20 previous errors
-
-For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized-bare-typaram.rs b/src/test/ui/unsized/unsized-bare-typaram.rs
similarity index 100%
rename from src/test/compile-fail/unsized-bare-typaram.rs
rename to src/test/ui/unsized/unsized-bare-typaram.rs
diff --git a/src/test/ui/unsized/unsized-bare-typaram.stderr b/src/test/ui/unsized/unsized-bare-typaram.stderr
new file mode 100644
index 0000000..314e47b
--- /dev/null
+++ b/src/test/ui/unsized/unsized-bare-typaram.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/unsized-bare-typaram.rs:12:23
+ |
+LL | fn foo<T: ?Sized>() { bar::<T>() }
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+note: required by `bar`
+ --> $DIR/unsized-bare-typaram.rs:11:1
+ |
+LL | fn bar<T: Sized>() { }
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized-enum.rs b/src/test/ui/unsized/unsized-enum.rs
similarity index 100%
rename from src/test/compile-fail/unsized-enum.rs
rename to src/test/ui/unsized/unsized-enum.rs
diff --git a/src/test/ui/unsized/unsized-enum.stderr b/src/test/ui/unsized/unsized-enum.stderr
new file mode 100644
index 0000000..f518859
--- /dev/null
+++ b/src/test/ui/unsized/unsized-enum.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/unsized-enum.rs:17:36
+ |
+LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+note: required by `Foo`
+ --> $DIR/unsized-enum.rs:15:1
+ |
+LL | enum Foo<U> { FooSome(U), FooNone }
+ | ^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/unsized-enum2.rs b/src/test/ui/unsized/unsized-enum2.rs
similarity index 100%
rename from src/test/ui/unsized-enum2.rs
rename to src/test/ui/unsized/unsized-enum2.rs
diff --git a/src/test/ui/unsized/unsized-enum2.stderr b/src/test/ui/unsized/unsized-enum2.stderr
new file mode 100644
index 0000000..ecaa014
--- /dev/null
+++ b/src/test/ui/unsized/unsized-enum2.stderr
@@ -0,0 +1,211 @@
+error[E0277]: the size for values of type `W` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:33:8
+ |
+LL | VA(W),
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `W`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where W: std::marker::Sized` bound
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:35:8
+ |
+LL | VB{x: X},
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `Y` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:37:15
+ |
+LL | VC(isize, Y),
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Y`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Y: std::marker::Sized` bound
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `Z` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:39:18
+ |
+LL | VD{u: isize, x: Z},
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Z`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Z: std::marker::Sized` bound
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:43:8
+ |
+LL | VE([u8]),
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[u8]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:45:8
+ |
+LL | VF{x: str},
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[f32]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:47:15
+ |
+LL | VG(isize, [f32]),
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[f32]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[u32]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:49:18
+ |
+LL | VH{u: isize, x: [u32]},
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[u32]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn Foo + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:63:8
+ |
+LL | VM(Foo),
+ | ^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn Foo + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn Bar + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:65:8
+ |
+LL | VN{x: Bar},
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn Bar + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn FooBar + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:67:15
+ |
+LL | VO(isize, FooBar),
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn FooBar + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn BarFoo + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:69:18
+ |
+LL | VP{u: isize, x: BarFoo},
+ | ^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `(dyn BarFoo + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[i8]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:73:8
+ |
+LL | VQ(<&'static [i8] as Deref>::Target),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[i8]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[char]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:75:8
+ |
+LL | VR{x: <&'static [char] as Deref>::Target},
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[char]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[f64]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:77:15
+ |
+LL | VS(isize, <&'static [f64] as Deref>::Target),
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[f64]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `[i32]` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:79:18
+ |
+LL | VT{u: isize, x: <&'static [i32] as Deref>::Target},
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[i32]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn PathHelper1 + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:53:8
+ |
+LL | VI(Path1),
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Path1`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper1 + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Path1`
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn PathHelper2 + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:55:8
+ |
+LL | VJ{x: Path2},
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Path2`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper2 + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Path2`
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn PathHelper3 + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:57:15
+ |
+LL | VK(isize, Path3),
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Path3`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper3 + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Path3`
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `(dyn PathHelper4 + 'static)` cannot be known at compilation time
+ --> $DIR/unsized-enum2.rs:59:18
+ |
+LL | VL{u: isize, x: Path4},
+ | ^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Path4`, the trait `std::marker::Sized` is not implemented for `(dyn PathHelper4 + 'static)`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: required because it appears within the type `Path4`
+ = note: no field of an enum variant may have a dynamically sized type
+
+error: aborting due to 20 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized-inherent-impl-self-type.rs b/src/test/ui/unsized/unsized-inherent-impl-self-type.rs
similarity index 100%
rename from src/test/compile-fail/unsized-inherent-impl-self-type.rs
rename to src/test/ui/unsized/unsized-inherent-impl-self-type.rs
diff --git a/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr
new file mode 100644
index 0000000..8b6d9c6
--- /dev/null
+++ b/src/test/ui/unsized/unsized-inherent-impl-self-type.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized-inherent-impl-self-type.rs:17:17
+ |
+LL | impl<X: ?Sized> S5<X> {
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+note: required by `S5`
+ --> $DIR/unsized-inherent-impl-self-type.rs:15:1
+ |
+LL | struct S5<Y>(Y);
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized-struct.rs b/src/test/ui/unsized/unsized-struct.rs
similarity index 100%
rename from src/test/compile-fail/unsized-struct.rs
rename to src/test/ui/unsized/unsized-struct.rs
diff --git a/src/test/ui/unsized/unsized-struct.stderr b/src/test/ui/unsized/unsized-struct.stderr
new file mode 100644
index 0000000..0e2d000
--- /dev/null
+++ b/src/test/ui/unsized/unsized-struct.stderr
@@ -0,0 +1,34 @@
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/unsized-struct.rs:17:36
+ |
+LL | fn foo2<T: ?Sized>() { not_sized::<Foo<T>>() }
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+note: required by `Foo`
+ --> $DIR/unsized-struct.rs:15:1
+ |
+LL | struct Foo<T> { data: T }
+ | ^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+ --> $DIR/unsized-struct.rs:24:24
+ |
+LL | fn bar2<T: ?Sized>() { is_sized::<Bar<T>>() }
+ | ^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `Bar<T>`, the trait `std::marker::Sized` is not implemented for `T`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where T: std::marker::Sized` bound
+ = note: required because it appears within the type `Bar<T>`
+note: required by `is_sized`
+ --> $DIR/unsized-struct.rs:12:1
+ |
+LL | fn is_sized<T:Sized>() { }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized-trait-impl-self-type.rs b/src/test/ui/unsized/unsized-trait-impl-self-type.rs
similarity index 100%
rename from src/test/compile-fail/unsized-trait-impl-self-type.rs
rename to src/test/ui/unsized/unsized-trait-impl-self-type.rs
diff --git a/src/test/ui/unsized/unsized-trait-impl-self-type.stderr b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr
new file mode 100644
index 0000000..b51787e
--- /dev/null
+++ b/src/test/ui/unsized/unsized-trait-impl-self-type.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized-trait-impl-self-type.rs:20:17
+ |
+LL | impl<X: ?Sized> T3<X> for S5<X> {
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+note: required by `S5`
+ --> $DIR/unsized-trait-impl-self-type.rs:18:1
+ |
+LL | struct S5<Y>(Y);
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized-trait-impl-trait-arg.rs b/src/test/ui/unsized/unsized-trait-impl-trait-arg.rs
similarity index 100%
rename from src/test/compile-fail/unsized-trait-impl-trait-arg.rs
rename to src/test/ui/unsized/unsized-trait-impl-trait-arg.rs
diff --git a/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr
new file mode 100644
index 0000000..187fac9
--- /dev/null
+++ b/src/test/ui/unsized/unsized-trait-impl-trait-arg.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized-trait-impl-trait-arg.rs:18:17
+ |
+LL | impl<X: ?Sized> T2<X> for S4<X> {
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized3.rs b/src/test/ui/unsized3.rs
similarity index 100%
rename from src/test/compile-fail/unsized3.rs
rename to src/test/ui/unsized3.rs
diff --git a/src/test/ui/unsized3.stderr b/src/test/ui/unsized3.stderr
new file mode 100644
index 0000000..1d7b146
--- /dev/null
+++ b/src/test/ui/unsized3.stderr
@@ -0,0 +1,91 @@
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized3.rs:17:5
+ |
+LL | f2::<X>(x);
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+note: required by `f2`
+ --> $DIR/unsized3.rs:20:1
+ |
+LL | fn f2<X>(x: &X) {
+ | ^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized3.rs:28:5
+ |
+LL | f4::<X>(x);
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+note: required by `f4`
+ --> $DIR/unsized3.rs:31:1
+ |
+LL | fn f4<X: T>(x: &X) {
+ | ^^^^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized3.rs:43:5
+ |
+LL | f5(x1);
+ | ^^ doesn't have a size known at compile-time
+ |
+ = help: within `S<X>`, the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: required because it appears within the type `S<X>`
+note: required by `f5`
+ --> $DIR/unsized3.rs:34:1
+ |
+LL | fn f5<Y>(x: &Y) {}
+ | ^^^^^^^^^^^^^^^
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized3.rs:50:5
+ |
+LL | f5(&(*x1, 34));
+ | ^^ doesn't have a size known at compile-time
+ |
+ = help: within `S<X>`, the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: required because it appears within the type `S<X>`
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized3.rs:55:9
+ |
+LL | f5(&(32, *x1));
+ | ^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: within `({integer}, S<X>)`, the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: required because it appears within the type `S<X>`
+ = note: required because it appears within the type `({integer}, S<X>)`
+ = note: tuples must have a statically known size to be initialized
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized3.rs:55:5
+ |
+LL | f5(&(32, *x1));
+ | ^^ doesn't have a size known at compile-time
+ |
+ = help: within `({integer}, S<X>)`, the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: required because it appears within the type `S<X>`
+ = note: required because it appears within the type `({integer}, S<X>)`
+note: required by `f5`
+ --> $DIR/unsized3.rs:34:1
+ |
+LL | fn f5<Y>(x: &Y) {}
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized5.rs b/src/test/ui/unsized5.rs
similarity index 100%
rename from src/test/compile-fail/unsized5.rs
rename to src/test/ui/unsized5.rs
diff --git a/src/test/ui/unsized5.stderr b/src/test/ui/unsized5.stderr
new file mode 100644
index 0000000..73553f8
--- /dev/null
+++ b/src/test/ui/unsized5.stderr
@@ -0,0 +1,67 @@
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized5.rs:14:5
+ |
+LL | f1: X,
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: only the last field of a struct may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized5.rs:20:5
+ |
+LL | g: X,
+ | ^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: only the last field of a struct may have a dynamically sized type
+
+error[E0277]: the size for values of type `str` cannot be known at compilation time
+ --> $DIR/unsized5.rs:25:5
+ |
+LL | f: str,
+ | ^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `str`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: only the last field of a struct may have a dynamically sized type
+
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/unsized5.rs:30:5
+ |
+LL | f: [u8],
+ | ^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[u8]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: only the last field of a struct may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized5.rs:35:8
+ |
+LL | V1(X, isize),
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: no field of an enum variant may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized5.rs:39:8
+ |
+LL | V2{f1: X, f: isize},
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: no field of an enum variant may have a dynamically sized type
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized6.rs b/src/test/ui/unsized6.rs
similarity index 100%
rename from src/test/compile-fail/unsized6.rs
rename to src/test/ui/unsized6.rs
diff --git a/src/test/ui/unsized6.stderr b/src/test/ui/unsized6.stderr
new file mode 100644
index 0000000..5a09533
--- /dev/null
+++ b/src/test/ui/unsized6.stderr
@@ -0,0 +1,156 @@
+error[E0277]: the size for values of type `Y` cannot be known at compilation time
+ --> $DIR/unsized6.rs:19:9
+ |
+LL | let y: Y;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Y`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Y: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:17:12
+ |
+LL | let _: (isize, (X, isize));
+ | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error[E0277]: the size for values of type `Z` cannot be known at compilation time
+ --> $DIR/unsized6.rs:21:12
+ |
+LL | let y: (isize, (Z, usize));
+ | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Z`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Z: std::marker::Sized` bound
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:25:9
+ |
+LL | let y: X;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `Y` cannot be known at compilation time
+ --> $DIR/unsized6.rs:27:12
+ |
+LL | let y: (isize, (Y, isize));
+ | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `Y`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where Y: std::marker::Sized` bound
+ = note: only the last element of a tuple may have a dynamically sized type
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:32:9
+ |
+LL | let y: X = *x1;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:34:9
+ |
+LL | let y = *x2;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:36:10
+ |
+LL | let (y, z) = (*x3, 4);
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:40:9
+ |
+LL | let y: X = *x1;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:42:9
+ |
+LL | let y = *x2;
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:44:10
+ |
+LL | let (y, z) = (*x3, 4);
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:48:18
+ |
+LL | fn g1<X: ?Sized>(x: X) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized6.rs:50:22
+ |
+LL | fn g2<X: ?Sized + T>(x: X) {}
+ | ^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+ = note: all local variables must have a statically known size
+ = help: unsized locals are gated as an unstable feature
+
+error: aborting due to 13 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unsized7.rs b/src/test/ui/unsized7.rs
similarity index 100%
rename from src/test/compile-fail/unsized7.rs
rename to src/test/ui/unsized7.rs
diff --git a/src/test/ui/unsized7.stderr b/src/test/ui/unsized7.stderr
new file mode 100644
index 0000000..6721765
--- /dev/null
+++ b/src/test/ui/unsized7.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `X` cannot be known at compilation time
+ --> $DIR/unsized7.rs:22:21
+ |
+LL | impl<X: ?Sized + T> T1<X> for S3<X> {
+ | ^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `X`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = help: consider adding a `where X: std::marker::Sized` bound
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/unspecified-self-in-trait-ref.rs b/src/test/ui/unspecified-self-in-trait-ref.rs
similarity index 100%
rename from src/test/compile-fail/unspecified-self-in-trait-ref.rs
rename to src/test/ui/unspecified-self-in-trait-ref.rs
diff --git a/src/test/ui/unspecified-self-in-trait-ref.stderr b/src/test/ui/unspecified-self-in-trait-ref.stderr
new file mode 100644
index 0000000..c036540
--- /dev/null
+++ b/src/test/ui/unspecified-self-in-trait-ref.stderr
@@ -0,0 +1,36 @@
+error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope
+ --> $DIR/unspecified-self-in-trait-ref.rs:20:13
+ |
+LL | let a = Foo::lol();
+ | ^^^^^^^^ function or associated item not found in `dyn Foo<_>`
+
+error[E0599]: no function or associated item named `lol` found for type `dyn Foo<_>` in the current scope
+ --> $DIR/unspecified-self-in-trait-ref.rs:22:13
+ |
+LL | let b = Foo::<_>::lol();
+ | ^^^^^^^^^^^^^ function or associated item not found in `dyn Foo<_>`
+
+error[E0599]: no function or associated item named `lol` found for type `dyn Bar<_, _>` in the current scope
+ --> $DIR/unspecified-self-in-trait-ref.rs:24:13
+ |
+LL | let c = Bar::lol();
+ | ^^^^^^^^ function or associated item not found in `dyn Bar<_, _>`
+
+error[E0599]: no function or associated item named `lol` found for type `dyn Bar<usize, _>` in the current scope
+ --> $DIR/unspecified-self-in-trait-ref.rs:26:13
+ |
+LL | let d = Bar::<usize, _>::lol();
+ | ^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `dyn Bar<usize, _>`
+
+error[E0393]: the type parameter `A` must be explicitly specified
+ --> $DIR/unspecified-self-in-trait-ref.rs:28:13
+ |
+LL | let e = Bar::<usize>::lol();
+ | ^^^^^^^^^^^^^^^^^ missing reference to `A`
+ |
+ = note: because of the default `Self` reference, type parameters must be specified on object types
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0393, E0599.
+For more information about an error, try `rustc --explain E0393`.
diff --git a/src/test/compile-fail/unsupported-cast.rs b/src/test/ui/unsupported-cast.rs
similarity index 100%
rename from src/test/compile-fail/unsupported-cast.rs
rename to src/test/ui/unsupported-cast.rs
diff --git a/src/test/ui/unsupported-cast.stderr b/src/test/ui/unsupported-cast.stderr
new file mode 100644
index 0000000..4babc01
--- /dev/null
+++ b/src/test/ui/unsupported-cast.stderr
@@ -0,0 +1,9 @@
+error[E0606]: casting `f64` as `*const A` is invalid
+ --> $DIR/unsupported-cast.rs:16:20
+ |
+LL | println!("{:?}", 1.0 as *const A); // Can't cast float to foreign.
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/src/test/compile-fail/unused-attr.rs b/src/test/ui/unused/unused-attr.rs
similarity index 100%
rename from src/test/compile-fail/unused-attr.rs
rename to src/test/ui/unused/unused-attr.rs
diff --git a/src/test/ui/unused/unused-attr.stderr b/src/test/ui/unused/unused-attr.stderr
new file mode 100644
index 0000000..7265dd3
--- /dev/null
+++ b/src/test/ui/unused/unused-attr.stderr
@@ -0,0 +1,98 @@
+error: unused attribute
+ --> $DIR/unused-attr.rs:17:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-attr.rs:11:9
+ |
+LL | #![deny(unused_attributes)]
+ | ^^^^^^^^^^^^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:20:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:25:5
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:23:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:33:9
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:31:5
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:29:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:41:9
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:38:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:48:5
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:46:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:54:5
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:56:5
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:52:1
+ |
+LL | #[foo] //~ ERROR unused attribute
+ | ^^^^^^
+
+error: unused attribute
+ --> $DIR/unused-attr.rs:15:1
+ |
+LL | #![foo] //~ ERROR unused attribute
+ | ^^^^^^^
+
+error: aborting due to 15 previous errors
+
diff --git a/src/test/compile-fail/unused-macro-rules.rs b/src/test/ui/unused/unused-macro-rules.rs
similarity index 100%
rename from src/test/compile-fail/unused-macro-rules.rs
rename to src/test/ui/unused/unused-macro-rules.rs
diff --git a/src/test/ui/unused/unused-macro-rules.stderr b/src/test/ui/unused/unused-macro-rules.stderr
new file mode 100644
index 0000000..8ced410
--- /dev/null
+++ b/src/test/ui/unused/unused-macro-rules.stderr
@@ -0,0 +1,41 @@
+error: unused macro definition
+ --> $DIR/unused-macro-rules.rs:14:1
+ |
+LL | / macro_rules! unused { //~ ERROR: unused macro definition
+LL | | () => {};
+LL | | }
+ | |_^
+ |
+note: lint level defined here
+ --> $DIR/unused-macro-rules.rs:11:9
+ |
+LL | #![deny(unused_macros)]
+ | ^^^^^^^^^^^^^
+
+error: unused macro definition
+ --> $DIR/unused-macro-rules.rs:21:9
+ |
+LL | / macro_rules! m { //~ ERROR: unused macro definition
+LL | | () => {};
+LL | | }
+ | |_________^
+...
+LL | create_macro!();
+ | ---------------- in this macro invocation
+
+error: unused macro definition
+ --> $DIR/unused-macro-rules.rs:34:5
+ |
+LL | / macro_rules! unused { //~ ERROR: unused macro definition
+LL | | () => {};
+LL | | }
+ | |_____^
+ |
+note: lint level defined here
+ --> $DIR/unused-macro-rules.rs:33:12
+ |
+LL | #[deny(unused_macros)]
+ | ^^^^^^^^^^^^^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/unused-macro-with-bad-frag-spec.rs b/src/test/ui/unused/unused-macro-with-bad-frag-spec.rs
similarity index 100%
rename from src/test/compile-fail/unused-macro-with-bad-frag-spec.rs
rename to src/test/ui/unused/unused-macro-with-bad-frag-spec.rs
diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr
new file mode 100644
index 0000000..8843587
--- /dev/null
+++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr
@@ -0,0 +1,10 @@
+error: invalid fragment specifier `t_ty`
+ --> $DIR/unused-macro-with-bad-frag-spec.rs:16:6
+ |
+LL | ($wrong:t_ty) => () //~ ERROR invalid fragment specifier `t_ty`
+ | ^^^^^^^^^^^
+ |
+ = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unused-macro-with-follow-violation.rs b/src/test/ui/unused/unused-macro-with-follow-violation.rs
similarity index 100%
rename from src/test/compile-fail/unused-macro-with-follow-violation.rs
rename to src/test/ui/unused/unused-macro-with-follow-violation.rs
diff --git a/src/test/ui/unused/unused-macro-with-follow-violation.stderr b/src/test/ui/unused/unused-macro-with-follow-violation.stderr
new file mode 100644
index 0000000..8efb191
--- /dev/null
+++ b/src/test/ui/unused/unused-macro-with-follow-violation.stderr
@@ -0,0 +1,8 @@
+error: `$e:expr` is followed by `+`, which is not allowed for `expr` fragments
+ --> $DIR/unused-macro-with-follow-violation.rs:14:14
+ |
+LL | ($e:expr +) => () //~ ERROR not allowed for `expr` fragments
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unused-macro.rs b/src/test/ui/unused/unused-macro.rs
similarity index 100%
rename from src/test/compile-fail/unused-macro.rs
rename to src/test/ui/unused/unused-macro.rs
diff --git a/src/test/ui/unused/unused-macro.stderr b/src/test/ui/unused/unused-macro.stderr
new file mode 100644
index 0000000..3e1c116
--- /dev/null
+++ b/src/test/ui/unused/unused-macro.stderr
@@ -0,0 +1,38 @@
+error: unused macro definition
+ --> $DIR/unused-macro.rs:15:1
+ |
+LL | / macro unused { //~ ERROR: unused macro definition
+LL | | () => {}
+LL | | }
+ | |_^
+ |
+note: lint level defined here
+ --> $DIR/unused-macro.rs:12:9
+ |
+LL | #![deny(unused_macros)]
+ | ^^^^^^^^^^^^^
+
+error: unused macro definition
+ --> $DIR/unused-macro.rs:25:5
+ |
+LL | / macro unused { //~ ERROR: unused macro definition
+LL | | () => {}
+LL | | }
+ | |_____^
+ |
+note: lint level defined here
+ --> $DIR/unused-macro.rs:24:12
+ |
+LL | #[deny(unused_macros)]
+ | ^^^^^^^^^^^^^
+
+error: unused macro definition
+ --> $DIR/unused-macro.rs:31:5
+ |
+LL | / pub(crate) macro unused { //~ ERROR: unused macro definition
+LL | | () => {}
+LL | | }
+ | |_____^
+
+error: aborting due to 3 previous errors
+
diff --git a/src/test/compile-fail/unused-mut-warning-captured-var.rs b/src/test/ui/unused/unused-mut-warning-captured-var.rs
similarity index 100%
rename from src/test/compile-fail/unused-mut-warning-captured-var.rs
rename to src/test/ui/unused/unused-mut-warning-captured-var.rs
diff --git a/src/test/ui/unused/unused-mut-warning-captured-var.stderr b/src/test/ui/unused/unused-mut-warning-captured-var.stderr
new file mode 100644
index 0000000..ae976d8
--- /dev/null
+++ b/src/test/ui/unused/unused-mut-warning-captured-var.stderr
@@ -0,0 +1,16 @@
+error: variable does not need to be mutable
+ --> $DIR/unused-mut-warning-captured-var.rs:14:9
+ |
+LL | let mut x = 1;
+ | ----^
+ | |
+ | help: remove this `mut`
+ |
+note: lint level defined here
+ --> $DIR/unused-mut-warning-captured-var.rs:11:11
+ |
+LL | #![forbid(unused_mut)]
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/unused-result.rs b/src/test/ui/unused/unused-result.rs
similarity index 100%
rename from src/test/compile-fail/unused-result.rs
rename to src/test/ui/unused/unused-result.rs
diff --git a/src/test/ui/unused/unused-result.stderr b/src/test/ui/unused/unused-result.stderr
new file mode 100644
index 0000000..e6ca7b8
--- /dev/null
+++ b/src/test/ui/unused/unused-result.stderr
@@ -0,0 +1,48 @@
+error: unused `MustUse` which must be used
+ --> $DIR/unused-result.rs:31:5
+ |
+LL | foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-result.rs:12:25
+ |
+LL | #![deny(unused_results, unused_must_use)]
+ | ^^^^^^^^^^^^^^^
+
+error: unused `MustUseMsg` which must be used
+ --> $DIR/unused-result.rs:32:5
+ |
+LL | foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: some message
+
+error: unused result
+ --> $DIR/unused-result.rs:44:5
+ |
+LL | foo::<isize>(); //~ ERROR: unused result
+ | ^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/unused-result.rs:12:9
+ |
+LL | #![deny(unused_results, unused_must_use)]
+ | ^^^^^^^^^^^^^^
+
+error: unused `MustUse` which must be used
+ --> $DIR/unused-result.rs:45:5
+ |
+LL | foo::<MustUse>(); //~ ERROR: unused `MustUse` which must be used
+ | ^^^^^^^^^^^^^^^^^
+
+error: unused `MustUseMsg` which must be used
+ --> $DIR/unused-result.rs:46:5
+ |
+LL | foo::<MustUseMsg>(); //~ ERROR: unused `MustUseMsg` which must be used
+ | ^^^^^^^^^^^^^^^^^^^^
+ |
+ = note: some message
+
+error: aborting due to 5 previous errors
+
diff --git a/src/test/compile-fail/auxiliary/use_from_trait_xc.rs b/src/test/ui/use/auxiliary/use_from_trait_xc.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/use_from_trait_xc.rs
rename to src/test/ui/use/auxiliary/use_from_trait_xc.rs
diff --git a/src/test/ui/use/use-after-move-based-on-type.nll.stderr b/src/test/ui/use/use-after-move-based-on-type.nll.stderr
new file mode 100644
index 0000000..a18c25c
--- /dev/null
+++ b/src/test/ui/use/use-after-move-based-on-type.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: borrow of moved value: `x`
+ --> $DIR/use-after-move-based-on-type.rs:14:20
+ |
+LL | let _y = x;
+ | - value moved here
+LL | println!("{}", x); //~ ERROR use of moved value
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/use-after-move-based-on-type.rs b/src/test/ui/use/use-after-move-based-on-type.rs
similarity index 100%
rename from src/test/compile-fail/use-after-move-based-on-type.rs
rename to src/test/ui/use/use-after-move-based-on-type.rs
diff --git a/src/test/ui/use/use-after-move-based-on-type.stderr b/src/test/ui/use/use-after-move-based-on-type.stderr
new file mode 100644
index 0000000..510cc70
--- /dev/null
+++ b/src/test/ui/use/use-after-move-based-on-type.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/use-after-move-based-on-type.rs:14:20
+ |
+LL | let _y = x;
+ | -- value moved here
+LL | println!("{}", x); //~ ERROR use of moved value
+ | ^ value used here after move
+ |
+ = note: move occurs because `x` has type `std::string::String`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr
new file mode 100644
index 0000000..2375350
--- /dev/null
+++ b/src/test/ui/use/use-after-move-implicity-coerced-object.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: borrow of moved value: `n`
+ --> $DIR/use-after-move-implicity-coerced-object.rs:38:13
+ |
+LL | l.push(n);
+ | - value moved here
+LL | let x = n.to_string();
+ | ^ value borrowed here after move
+ |
+ = note: move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs b/src/test/ui/use/use-after-move-implicity-coerced-object.rs
similarity index 100%
rename from src/test/compile-fail/use-after-move-implicity-coerced-object.rs
rename to src/test/ui/use/use-after-move-implicity-coerced-object.rs
diff --git a/src/test/ui/use/use-after-move-implicity-coerced-object.stderr b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
new file mode 100644
index 0000000..ab74947
--- /dev/null
+++ b/src/test/ui/use/use-after-move-implicity-coerced-object.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `n`
+ --> $DIR/use-after-move-implicity-coerced-object.rs:38:13
+ |
+LL | l.push(n);
+ | - value moved here
+LL | let x = n.to_string();
+ | ^ value used here after move
+ |
+ = note: move occurs because `n` has type `std::boxed::Box<Number>`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/use-after-move-self-based-on-type.rs b/src/test/ui/use/use-after-move-self-based-on-type.rs
similarity index 100%
rename from src/test/compile-fail/use-after-move-self-based-on-type.rs
rename to src/test/ui/use/use-after-move-self-based-on-type.rs
diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr
new file mode 100644
index 0000000..60cd142
--- /dev/null
+++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `self.x`
+ --> $DIR/use-after-move-self-based-on-type.rs:22:16
+ |
+LL | self.bar();
+ | ---- value moved here
+LL | return self.x; //~ ERROR use of moved value: `self.x`
+ | ^^^^^^ value used here after move
+ |
+ = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/ui/use/use-after-move-self.nll.stderr b/src/test/ui/use/use-after-move-self.nll.stderr
new file mode 100644
index 0000000..3b19e96
--- /dev/null
+++ b/src/test/ui/use/use-after-move-self.nll.stderr
@@ -0,0 +1,11 @@
+error[E0382]: use of moved value: `*self.x`
+ --> $DIR/use-after-move-self.rs:20:16
+ |
+LL | self.bar();
+ | ---- value moved here
+LL | return *self.x; //~ ERROR use of moved value: `*self.x`
+ | ^^^^^^^ value used here after move
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/use-after-move-self.rs b/src/test/ui/use/use-after-move-self.rs
similarity index 100%
rename from src/test/compile-fail/use-after-move-self.rs
rename to src/test/ui/use/use-after-move-self.rs
diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr
new file mode 100644
index 0000000..7273602
--- /dev/null
+++ b/src/test/ui/use/use-after-move-self.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `*self.x`
+ --> $DIR/use-after-move-self.rs:20:16
+ |
+LL | self.bar();
+ | ---- value moved here
+LL | return *self.x; //~ ERROR use of moved value: `*self.x`
+ | ^^^^^^^ value used here after move
+ |
+ = note: move occurs because `self` has type `S`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/use-from-trait-xc.rs b/src/test/ui/use/use-from-trait-xc.rs
similarity index 100%
rename from src/test/compile-fail/use-from-trait-xc.rs
rename to src/test/ui/use/use-from-trait-xc.rs
diff --git a/src/test/ui/use/use-from-trait-xc.stderr b/src/test/ui/use/use-from-trait-xc.stderr
new file mode 100644
index 0000000..130aca8
--- /dev/null
+++ b/src/test/ui/use/use-from-trait-xc.stderr
@@ -0,0 +1,58 @@
+error[E0253]: `foo` is not directly importable
+ --> $DIR/use-from-trait-xc.rs:15:5
+ |
+LL | use use_from_trait_xc::Trait::foo;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
+
+error[E0253]: `Assoc` is not directly importable
+ --> $DIR/use-from-trait-xc.rs:18:5
+ |
+LL | use use_from_trait_xc::Trait::Assoc;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
+
+error[E0253]: `CONST` is not directly importable
+ --> $DIR/use-from-trait-xc.rs:21:5
+ |
+LL | use use_from_trait_xc::Trait::CONST;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot be imported directly
+
+error[E0432]: unresolved import `use_from_trait_xc::Foo`
+ --> $DIR/use-from-trait-xc.rs:24:24
+ |
+LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private
+ | ^^^ Not a module `Foo`
+
+error[E0432]: unresolved import `use_from_trait_xc::Foo`
+ --> $DIR/use-from-trait-xc.rs:27:24
+ |
+LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private
+ | ^^^ Not a module `Foo`
+
+error[E0432]: unresolved import `use_from_trait_xc::Bar`
+ --> $DIR/use-from-trait-xc.rs:30:24
+ |
+LL | use use_from_trait_xc::Bar::new as bnew;
+ | ^^^ Not a module `Bar`
+
+error[E0432]: unresolved import `use_from_trait_xc::Baz::new`
+ --> $DIR/use-from-trait-xc.rs:33:5
+ |
+LL | use use_from_trait_xc::Baz::new as baznew;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `new` in `Baz`
+
+error[E0603]: struct `Foo` is private
+ --> $DIR/use-from-trait-xc.rs:24:5
+ |
+LL | use use_from_trait_xc::Foo::new; //~ ERROR struct `Foo` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: struct `Foo` is private
+ --> $DIR/use-from-trait-xc.rs:27:5
+ |
+LL | use use_from_trait_xc::Foo::C; //~ ERROR struct `Foo` is private
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 9 previous errors
+
+Some errors occurred: E0253, E0432, E0603.
+For more information about an error, try `rustc --explain E0253`.
diff --git a/src/test/compile-fail/use-from-trait.rs b/src/test/ui/use/use-from-trait.rs
similarity index 100%
rename from src/test/compile-fail/use-from-trait.rs
rename to src/test/ui/use/use-from-trait.rs
diff --git a/src/test/ui/use/use-from-trait.stderr b/src/test/ui/use/use-from-trait.stderr
new file mode 100644
index 0000000..b43a329
--- /dev/null
+++ b/src/test/ui/use/use-from-trait.stderr
@@ -0,0 +1,34 @@
+error[E0253]: `foo` is not directly importable
+ --> $DIR/use-from-trait.rs:12:5
+ |
+LL | use Trait::foo;
+ | ^^^^^^^^^^ cannot be imported directly
+
+error[E0253]: `Assoc` is not directly importable
+ --> $DIR/use-from-trait.rs:14:5
+ |
+LL | use Trait::Assoc;
+ | ^^^^^^^^^^^^ cannot be imported directly
+
+error[E0253]: `C` is not directly importable
+ --> $DIR/use-from-trait.rs:16:5
+ |
+LL | use Trait::C;
+ | ^^^^^^^^ cannot be imported directly
+
+error[E0432]: unresolved import `Foo`
+ --> $DIR/use-from-trait.rs:19:5
+ |
+LL | use Foo::new;
+ | ^^^ Not a module `Foo`
+
+error[E0432]: unresolved import `Foo`
+ --> $DIR/use-from-trait.rs:23:5
+ |
+LL | use Foo::C2;
+ | ^^^ Not a module `Foo`
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0253, E0432.
+For more information about an error, try `rustc --explain E0253`.
diff --git a/src/test/compile-fail/use-keyword.rs b/src/test/ui/use/use-keyword.rs
similarity index 100%
rename from src/test/compile-fail/use-keyword.rs
rename to src/test/ui/use/use-keyword.rs
diff --git a/src/test/ui/use/use-keyword.stderr b/src/test/ui/use/use-keyword.stderr
new file mode 100644
index 0000000..11893bc
--- /dev/null
+++ b/src/test/ui/use/use-keyword.stderr
@@ -0,0 +1,22 @@
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-keyword.rs:16:13
+ |
+LL | use self as A;
+ | ^^^^^^^^^
+
+error[E0432]: unresolved import `super`
+ --> $DIR/use-keyword.rs:18:13
+ |
+LL | use super as B;
+ | ^^^^^^^^^^ no `super` in the root
+
+error[E0432]: unresolved import `super`
+ --> $DIR/use-keyword.rs:21:21
+ |
+LL | use super::{self as C};
+ | ^^^^^^^^^ no `super` in the root
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0429, E0432.
+For more information about an error, try `rustc --explain E0429`.
diff --git a/src/test/compile-fail/use-meta-mismatch.rs b/src/test/ui/use/use-meta-mismatch.rs
similarity index 100%
rename from src/test/compile-fail/use-meta-mismatch.rs
rename to src/test/ui/use/use-meta-mismatch.rs
diff --git a/src/test/ui/use/use-meta-mismatch.stderr b/src/test/ui/use/use-meta-mismatch.stderr
new file mode 100644
index 0000000..063de29
--- /dev/null
+++ b/src/test/ui/use/use-meta-mismatch.stderr
@@ -0,0 +1,9 @@
+error[E0463]: can't find crate for `extra`
+ --> $DIR/use-meta-mismatch.rs:13:1
+ |
+LL | extern crate fake_crate as extra;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0463`.
diff --git a/src/test/ui/use-mod.rs b/src/test/ui/use/use-mod.rs
similarity index 100%
rename from src/test/ui/use-mod.rs
rename to src/test/ui/use/use-mod.rs
diff --git a/src/test/ui/use-mod.stderr b/src/test/ui/use/use-mod.stderr
similarity index 100%
rename from src/test/ui/use-mod.stderr
rename to src/test/ui/use/use-mod.stderr
diff --git a/src/test/compile-fail/use-mod-2.rs b/src/test/ui/use/use-mod/use-mod-2.rs
similarity index 100%
rename from src/test/compile-fail/use-mod-2.rs
rename to src/test/ui/use/use-mod/use-mod-2.rs
diff --git a/src/test/ui/use/use-mod/use-mod-2.stderr b/src/test/ui/use/use-mod/use-mod-2.stderr
new file mode 100644
index 0000000..f343dc2
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-2.stderr
@@ -0,0 +1,15 @@
+error[E0432]: unresolved import `self`
+ --> $DIR/use-mod-2.rs:12:16
+ |
+LL | use self::{self};
+ | ^^^^ no `self` in the root
+
+error[E0432]: unresolved import `super`
+ --> $DIR/use-mod-2.rs:16:17
+ |
+LL | use super::{self};
+ | ^^^^ no `super` in the root
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/use-mod-3.rs b/src/test/ui/use/use-mod/use-mod-3.rs
similarity index 100%
rename from src/test/compile-fail/use-mod-3.rs
rename to src/test/ui/use/use-mod/use-mod-3.rs
diff --git a/src/test/ui/use/use-mod/use-mod-3.stderr b/src/test/ui/use/use-mod/use-mod-3.stderr
new file mode 100644
index 0000000..6192398
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-3.stderr
@@ -0,0 +1,15 @@
+error[E0603]: module `bar` is private
+ --> $DIR/use-mod-3.rs:12:5
+ |
+LL | self //~ ERROR module `bar` is private
+ | ^^^^
+
+error[E0603]: module `bar` is private
+ --> $DIR/use-mod-3.rs:15:5
+ |
+LL | Bar //~ ERROR module `bar` is private
+ | ^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/use-mod-4.rs b/src/test/ui/use/use-mod/use-mod-4.rs
similarity index 100%
rename from src/test/compile-fail/use-mod-4.rs
rename to src/test/ui/use/use-mod/use-mod-4.rs
diff --git a/src/test/ui/use/use-mod/use-mod-4.stderr b/src/test/ui/use/use-mod/use-mod-4.stderr
new file mode 100644
index 0000000..9a6d608
--- /dev/null
+++ b/src/test/ui/use/use-mod/use-mod-4.stderr
@@ -0,0 +1,22 @@
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-mod-4.rs:11:5
+ |
+LL | use foo::self; //~ ERROR unresolved import `foo`
+ | ^^^^^^^^^
+
+error[E0429]: `self` imports are only allowed within a { } list
+ --> $DIR/use-mod-4.rs:14:5
+ |
+LL | use std::mem::self;
+ | ^^^^^^^^^^^^^^
+
+error[E0432]: unresolved import `foo`
+ --> $DIR/use-mod-4.rs:11:5
+ |
+LL | use foo::self; //~ ERROR unresolved import `foo`
+ | ^^^ Maybe a missing `extern crate foo;`?
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0429, E0432.
+For more information about an error, try `rustc --explain E0429`.
diff --git a/src/test/ui/use-nested-groups-error.rs b/src/test/ui/use/use-nested-groups-error.rs
similarity index 100%
rename from src/test/ui/use-nested-groups-error.rs
rename to src/test/ui/use/use-nested-groups-error.rs
diff --git a/src/test/ui/use-nested-groups-error.stderr b/src/test/ui/use/use-nested-groups-error.stderr
similarity index 100%
rename from src/test/ui/use-nested-groups-error.stderr
rename to src/test/ui/use/use-nested-groups-error.stderr
diff --git a/src/test/ui/use-nested-groups-unused-imports.rs b/src/test/ui/use/use-nested-groups-unused-imports.rs
similarity index 100%
rename from src/test/ui/use-nested-groups-unused-imports.rs
rename to src/test/ui/use/use-nested-groups-unused-imports.rs
diff --git a/src/test/ui/use-nested-groups-unused-imports.stderr b/src/test/ui/use/use-nested-groups-unused-imports.stderr
similarity index 100%
rename from src/test/ui/use-nested-groups-unused-imports.stderr
rename to src/test/ui/use/use-nested-groups-unused-imports.stderr
diff --git a/src/test/compile-fail/use-paths-as-items.rs b/src/test/ui/use/use-paths-as-items.rs
similarity index 100%
rename from src/test/compile-fail/use-paths-as-items.rs
rename to src/test/ui/use/use-paths-as-items.rs
diff --git a/src/test/ui/use/use-paths-as-items.stderr b/src/test/ui/use/use-paths-as-items.stderr
new file mode 100644
index 0000000..200cefc
--- /dev/null
+++ b/src/test/ui/use/use-paths-as-items.stderr
@@ -0,0 +1,17 @@
+error[E0252]: the name `mem` is defined multiple times
+ --> $DIR/use-paths-as-items.rs:17:5
+ |
+LL | use std::{mem, ptr};
+ | --- previous import of the module `mem` here
+LL | use std::mem; //~ ERROR the name `mem` is defined multiple times
+ | ^^^^^^^^ `mem` reimported here
+ |
+ = note: `mem` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | use std::mem as other_mem; //~ ERROR the name `mem` is defined multiple times
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0252`.
diff --git a/src/test/compile-fail/use-self-type.rs b/src/test/ui/use/use-self-type.rs
similarity index 100%
rename from src/test/compile-fail/use-self-type.rs
rename to src/test/ui/use/use-self-type.rs
diff --git a/src/test/ui/use/use-self-type.stderr b/src/test/ui/use/use-self-type.stderr
new file mode 100644
index 0000000..5a1e5ea
--- /dev/null
+++ b/src/test/ui/use/use-self-type.stderr
@@ -0,0 +1,16 @@
+error[E0433]: failed to resolve. Use of undeclared type or module `Self`
+ --> $DIR/use-self-type.rs:17:16
+ |
+LL | pub(in Self::f) struct Z; //~ ERROR Use of undeclared type or module `Self`
+ | ^^^^ Use of undeclared type or module `Self`
+
+error[E0432]: unresolved import `Self`
+ --> $DIR/use-self-type.rs:16:13
+ |
+LL | use Self::f; //~ ERROR unresolved import
+ | ^^^^ Use of undeclared type or module `Self`
+
+error: aborting due to 2 previous errors
+
+Some errors occurred: E0432, E0433.
+For more information about an error, try `rustc --explain E0432`.
diff --git a/src/test/compile-fail/use-super-global-path.rs b/src/test/ui/use/use-super-global-path.rs
similarity index 100%
rename from src/test/compile-fail/use-super-global-path.rs
rename to src/test/ui/use/use-super-global-path.rs
diff --git a/src/test/ui/use/use-super-global-path.stderr b/src/test/ui/use/use-super-global-path.stderr
new file mode 100644
index 0000000..4730653
--- /dev/null
+++ b/src/test/ui/use/use-super-global-path.stderr
@@ -0,0 +1,26 @@
+error[E0433]: failed to resolve. global paths cannot start with `super`
+ --> $DIR/use-super-global-path.rs:17:11
+ |
+LL | use ::super::{S, Z}; //~ ERROR global paths cannot start with `super`
+ | ^^^^^ global paths cannot start with `super`
+
+error[E0433]: failed to resolve. global paths cannot start with `super`
+ --> $DIR/use-super-global-path.rs:20:15
+ |
+LL | use ::super::main; //~ ERROR global paths cannot start with `super`
+ | ^^^^^ global paths cannot start with `super`
+
+error[E0425]: cannot find function `main` in this scope
+ --> $DIR/use-super-global-path.rs:21:9
+ |
+LL | main(); //~ ERROR cannot find function `main` in this scope
+ | ^^^^ not found in this scope
+help: possible candidate is found in another module, you can import it into scope
+ |
+LL | use main;
+ |
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0425, E0433.
+For more information about an error, try `rustc --explain E0425`.
diff --git a/src/test/compile-fail/used.rs b/src/test/ui/used.rs
similarity index 100%
rename from src/test/compile-fail/used.rs
rename to src/test/ui/used.rs
diff --git a/src/test/ui/used.stderr b/src/test/ui/used.stderr
new file mode 100644
index 0000000..b8d0f42
--- /dev/null
+++ b/src/test/ui/used.stderr
@@ -0,0 +1,26 @@
+error: attribute must be applied to a `static` variable
+ --> $DIR/used.rs:16:1
+ |
+LL | #[used] //~ ERROR attribute must be applied to a `static` variable
+ | ^^^^^^^
+
+error: attribute must be applied to a `static` variable
+ --> $DIR/used.rs:19:1
+ |
+LL | #[used] //~ ERROR attribute must be applied to a `static` variable
+ | ^^^^^^^
+
+error: attribute must be applied to a `static` variable
+ --> $DIR/used.rs:22:1
+ |
+LL | #[used] //~ ERROR attribute must be applied to a `static` variable
+ | ^^^^^^^
+
+error: attribute must be applied to a `static` variable
+ --> $DIR/used.rs:25:1
+ |
+LL | #[used] //~ ERROR attribute must be applied to a `static` variable
+ | ^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/useless-pub.rs b/src/test/ui/useless-pub.rs
similarity index 100%
rename from src/test/compile-fail/useless-pub.rs
rename to src/test/ui/useless-pub.rs
diff --git a/src/test/ui/useless-pub.stderr b/src/test/ui/useless-pub.stderr
new file mode 100644
index 0000000..7e36bf2
--- /dev/null
+++ b/src/test/ui/useless-pub.stderr
@@ -0,0 +1,21 @@
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/useless-pub.rs:18:5
+ |
+LL | pub fn foo(&self) {} //~ ERROR: unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/useless-pub.rs:22:10
+ |
+LL | V1 { pub f: i32 }, //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error[E0449]: unnecessary visibility qualifier
+ --> $DIR/useless-pub.rs:23:8
+ |
+LL | V2(pub i32), //~ ERROR unnecessary visibility qualifier
+ | ^^^ `pub` not permitted here because it's implied
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0449`.
diff --git a/src/test/compile-fail/useless_comment.rs b/src/test/ui/useless_comment.rs
similarity index 100%
rename from src/test/compile-fail/useless_comment.rs
rename to src/test/ui/useless_comment.rs
diff --git a/src/test/ui/useless_comment.stderr b/src/test/ui/useless_comment.stderr
new file mode 100644
index 0000000..78c6787
--- /dev/null
+++ b/src/test/ui/useless_comment.stderr
@@ -0,0 +1,32 @@
+error: doc comment not used by rustdoc
+ --> $DIR/useless_comment.rs:14:5
+ |
+LL | /// a //~ ERROR doc comment not used by rustdoc
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/useless_comment.rs:11:9
+ |
+LL | #![deny(unused_doc_comments)]
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: doc comment not used by rustdoc
+ --> $DIR/useless_comment.rs:17:5
+ |
+LL | /// b //~ doc comment not used by rustdoc
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: doc comment not used by rustdoc
+ --> $DIR/useless_comment.rs:19:9
+ |
+LL | /// c //~ ERROR doc comment not used by rustdoc
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: doc comment not used by rustdoc
+ --> $DIR/useless_comment.rs:24:5
+ |
+LL | /// foo //~ ERROR doc comment not used by rustdoc
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 4 previous errors
+
diff --git a/src/test/compile-fail/user-defined-macro-rules.rs b/src/test/ui/user-defined-macro-rules.rs
similarity index 100%
rename from src/test/compile-fail/user-defined-macro-rules.rs
rename to src/test/ui/user-defined-macro-rules.rs
diff --git a/src/test/ui/user-defined-macro-rules.stderr b/src/test/ui/user-defined-macro-rules.stderr
new file mode 100644
index 0000000..3359aa4
--- /dev/null
+++ b/src/test/ui/user-defined-macro-rules.stderr
@@ -0,0 +1,13 @@
+error: user-defined macros may not be named `macro_rules`
+ --> $DIR/user-defined-macro-rules.rs:13:1
+ |
+LL | macro_rules! macro_rules { () => {} } //~ ERROR user-defined macros may not be named `macro_rules`
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0601]: `main` function not found in crate `user_defined_macro_rules`
+ |
+ = note: consider adding a `main` function to `$DIR/user-defined-macro-rules.rs`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0601`.
diff --git a/src/test/compile-fail/utf8_idents.rs b/src/test/ui/utf8_idents.rs
similarity index 100%
rename from src/test/compile-fail/utf8_idents.rs
rename to src/test/ui/utf8_idents.rs
diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr
new file mode 100644
index 0000000..42ee13e
--- /dev/null
+++ b/src/test/ui/utf8_idents.stderr
@@ -0,0 +1,35 @@
+error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+ --> $DIR/utf8_idents.rs:13:5
+ |
+LL | 'β, //~ ERROR non-ascii idents are not fully supported
+ | ^^
+ |
+ = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
+
+error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+ --> $DIR/utf8_idents.rs:14:5
+ |
+LL | γ //~ ERROR non-ascii idents are not fully supported
+ | ^
+ |
+ = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
+
+error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+ --> $DIR/utf8_idents.rs:18:5
+ |
+LL | δ: usize //~ ERROR non-ascii idents are not fully supported
+ | ^
+ |
+ = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
+
+error[E0658]: non-ascii idents are not fully supported. (see issue #28979)
+ --> $DIR/utf8_idents.rs:22:9
+ |
+LL | let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported
+ | ^
+ |
+ = help: add #![feature(non_ascii_idents)] to the crate attributes to enable
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/compile-fail/variadic-ffi-2.rs b/src/test/ui/variadic/variadic-ffi-2.rs
similarity index 100%
rename from src/test/compile-fail/variadic-ffi-2.rs
rename to src/test/ui/variadic/variadic-ffi-2.rs
diff --git a/src/test/ui/variadic/variadic-ffi-2.stderr b/src/test/ui/variadic/variadic-ffi-2.stderr
new file mode 100644
index 0000000..9af7b5b
--- /dev/null
+++ b/src/test/ui/variadic/variadic-ffi-2.stderr
@@ -0,0 +1,9 @@
+error[E0045]: variadic function must have C or cdecl calling convention
+ --> $DIR/variadic-ffi-2.rs:13:11
+ |
+LL | fn baz(f: extern "stdcall" fn(usize, ...)) {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0045`.
diff --git a/src/test/ui/variadic-ffi-3.rs b/src/test/ui/variadic/variadic-ffi-3.rs
similarity index 100%
rename from src/test/ui/variadic-ffi-3.rs
rename to src/test/ui/variadic/variadic-ffi-3.rs
diff --git a/src/test/ui/variadic-ffi-3.stderr b/src/test/ui/variadic/variadic-ffi-3.stderr
similarity index 100%
rename from src/test/ui/variadic-ffi-3.stderr
rename to src/test/ui/variadic/variadic-ffi-3.stderr
diff --git a/src/test/compile-fail/variadic-ffi.rs b/src/test/ui/variadic/variadic-ffi.rs
similarity index 100%
rename from src/test/compile-fail/variadic-ffi.rs
rename to src/test/ui/variadic/variadic-ffi.rs
diff --git a/src/test/ui/variadic/variadic-ffi.stderr b/src/test/ui/variadic/variadic-ffi.stderr
new file mode 100644
index 0000000..0d0462b
--- /dev/null
+++ b/src/test/ui/variadic/variadic-ffi.stderr
@@ -0,0 +1,9 @@
+error[E0045]: variadic function must have C or cdecl calling convention
+ --> $DIR/variadic-ffi.rs:15:5
+ |
+LL | fn printf(_: *const u8, ...); //~ ERROR: variadic function must have C or cdecl calling
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ variadics require C or cdecl calling convention
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0045`.
diff --git a/src/test/compile-fail/variance-associated-types.rs b/src/test/ui/variance/variance-associated-types.rs
similarity index 100%
rename from src/test/compile-fail/variance-associated-types.rs
rename to src/test/ui/variance/variance-associated-types.rs
diff --git a/src/test/ui/variance/variance-associated-types.stderr b/src/test/ui/variance/variance-associated-types.stderr
new file mode 100644
index 0000000..03ea1e6
--- /dev/null
+++ b/src/test/ui/variance/variance-associated-types.stderr
@@ -0,0 +1,19 @@
+error[E0208]: [-, +]
+ --> $DIR/variance-associated-types.rs:23:1
+ |
+LL | / struct Foo<'a, T : Trait<'a>> { //~ ERROR [-, +]
+LL | | field: (T, &'a ())
+LL | | }
+ | |_^
+
+error[E0208]: [o, o]
+ --> $DIR/variance-associated-types.rs:28:1
+ |
+LL | / struct Bar<'a, T : Trait<'a>> { //~ ERROR [o, o]
+LL | | field: <T as Trait<'a>>::Type
+LL | | }
+ | |_^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/ui/variance/variance-btree-invariant-types.nll.stderr b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr
new file mode 100644
index 0000000..8770365
--- /dev/null
+++ b/src/test/ui/variance/variance-btree-invariant-types.nll.stderr
@@ -0,0 +1,178 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:16:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:19:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:22:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:25:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:30:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:34:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:38:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:42:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:47:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:51:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:55:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-btree-invariant-types.rs:59:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:16:5
+ |
+LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
+ | ---- lifetime `'new` defined here
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:19:5
+ |
+LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
+ | ---- lifetime `'new` defined here
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:22:5
+ |
+LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
+ | ---- lifetime `'new` defined here
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:25:5
+ |
+LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
+ | ---- lifetime `'new` defined here
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:30:5
+ |
+LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
+ | ---- lifetime `'new` defined here
+LL | -> OccupiedEntry<'a, &'new (), ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:34:5
+ |
+LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
+ | ---- lifetime `'new` defined here
+LL | -> OccupiedEntry<'a, (), &'new ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:38:5
+ |
+LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
+ | ---- lifetime `'new` defined here
+LL | -> OccupiedEntry<'a, &'static (), ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:42:5
+ |
+LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
+ | ---- lifetime `'new` defined here
+LL | -> OccupiedEntry<'a, (), &'static ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:47:5
+ |
+LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
+ | ---- lifetime `'new` defined here
+LL | -> VacantEntry<'a, &'new (), ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:51:5
+ |
+LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
+ | ---- lifetime `'new` defined here
+LL | -> VacantEntry<'a, (), &'new ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:55:5
+ |
+LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
+ | ---- lifetime `'new` defined here
+LL | -> VacantEntry<'a, &'static (), ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-btree-invariant-types.rs:59:5
+ |
+LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
+ | ---- lifetime `'new` defined here
+LL | -> VacantEntry<'a, (), &'static ()> {
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'new` must outlive `'static`
+
+error: aborting due to 12 previous errors
+
diff --git a/src/test/compile-fail/variance-btree-invariant-types.rs b/src/test/ui/variance/variance-btree-invariant-types.rs
similarity index 100%
rename from src/test/compile-fail/variance-btree-invariant-types.rs
rename to src/test/ui/variance/variance-btree-invariant-types.rs
diff --git a/src/test/ui/variance/variance-btree-invariant-types.stderr b/src/test/ui/variance/variance-btree-invariant-types.stderr
new file mode 100644
index 0000000..96f76fa
--- /dev/null
+++ b/src/test/ui/variance/variance-btree-invariant-types.stderr
@@ -0,0 +1,183 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:16:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::IterMut<'_, &'new (), _>`
+ found type `std::collections::btree_map::IterMut<'_, &'static (), _>`
+note: the lifetime 'new as defined on the function body at 15:21...
+ --> $DIR/variance-btree-invariant-types.rs:15:21
+ |
+LL | fn iter_cov_key<'a, 'new>(v: IterMut<'a, &'static (), ()>) -> IterMut<'a, &'new (), ()> {
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:19:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::IterMut<'_, _, &'new ()>`
+ found type `std::collections::btree_map::IterMut<'_, _, &'static ()>`
+note: the lifetime 'new as defined on the function body at 18:21...
+ --> $DIR/variance-btree-invariant-types.rs:18:21
+ |
+LL | fn iter_cov_val<'a, 'new>(v: IterMut<'a, (), &'static ()>) -> IterMut<'a, (), &'new ()> {
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:22:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::IterMut<'_, &'static (), _>`
+ found type `std::collections::btree_map::IterMut<'_, &'new (), _>`
+note: the lifetime 'new as defined on the function body at 21:24...
+ --> $DIR/variance-btree-invariant-types.rs:21:24
+ |
+LL | fn iter_contra_key<'a, 'new>(v: IterMut<'a, &'new (), ()>) -> IterMut<'a, &'static (), ()> {
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:25:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::IterMut<'_, _, &'static ()>`
+ found type `std::collections::btree_map::IterMut<'_, _, &'new ()>`
+note: the lifetime 'new as defined on the function body at 24:24...
+ --> $DIR/variance-btree-invariant-types.rs:24:24
+ |
+LL | fn iter_contra_val<'a, 'new>(v: IterMut<'a, (), &'new ()>) -> IterMut<'a, (), &'static ()> {
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:30:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
+ found type `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
+note: the lifetime 'new as defined on the function body at 28:20...
+ --> $DIR/variance-btree-invariant-types.rs:28:20
+ |
+LL | fn occ_cov_key<'a, 'new>(v: OccupiedEntry<'a, &'static (), ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:34:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
+ found type `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
+note: the lifetime 'new as defined on the function body at 32:20...
+ --> $DIR/variance-btree-invariant-types.rs:32:20
+ |
+LL | fn occ_cov_val<'a, 'new>(v: OccupiedEntry<'a, (), &'static ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:38:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::OccupiedEntry<'_, &'static (), _>`
+ found type `std::collections::btree_map::OccupiedEntry<'_, &'new (), _>`
+note: the lifetime 'new as defined on the function body at 36:23...
+ --> $DIR/variance-btree-invariant-types.rs:36:23
+ |
+LL | fn occ_contra_key<'a, 'new>(v: OccupiedEntry<'a, &'new (), ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:42:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::OccupiedEntry<'_, _, &'static ()>`
+ found type `std::collections::btree_map::OccupiedEntry<'_, _, &'new ()>`
+note: the lifetime 'new as defined on the function body at 40:23...
+ --> $DIR/variance-btree-invariant-types.rs:40:23
+ |
+LL | fn occ_contra_val<'a, 'new>(v: OccupiedEntry<'a, (), &'new ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:47:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
+ found type `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
+note: the lifetime 'new as defined on the function body at 45:20...
+ --> $DIR/variance-btree-invariant-types.rs:45:20
+ |
+LL | fn vac_cov_key<'a, 'new>(v: VacantEntry<'a, &'static (), ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:51:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
+ found type `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
+note: the lifetime 'new as defined on the function body at 49:20...
+ --> $DIR/variance-btree-invariant-types.rs:49:20
+ |
+LL | fn vac_cov_val<'a, 'new>(v: VacantEntry<'a, (), &'static ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:55:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::VacantEntry<'_, &'static (), _>`
+ found type `std::collections::btree_map::VacantEntry<'_, &'new (), _>`
+note: the lifetime 'new as defined on the function body at 53:23...
+ --> $DIR/variance-btree-invariant-types.rs:53:23
+ |
+LL | fn vac_contra_key<'a, 'new>(v: VacantEntry<'a, &'new (), ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error[E0308]: mismatched types
+ --> $DIR/variance-btree-invariant-types.rs:59:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `std::collections::btree_map::VacantEntry<'_, _, &'static ()>`
+ found type `std::collections::btree_map::VacantEntry<'_, _, &'new ()>`
+note: the lifetime 'new as defined on the function body at 57:23...
+ --> $DIR/variance-btree-invariant-types.rs:57:23
+ |
+LL | fn vac_contra_val<'a, 'new>(v: VacantEntry<'a, (), &'new ()>)
+ | ^^^^
+ = note: ...does not necessarily outlive the static lifetime
+
+error: aborting due to 12 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-cell-is-invariant.rs b/src/test/ui/variance/variance-cell-is-invariant.rs
new file mode 100644
index 0000000..39d87a5
--- /dev/null
+++ b/src/test/ui/variance/variance-cell-is-invariant.rs
@@ -0,0 +1,30 @@
+// Copyright 2012 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-compare-mode-nll
+
+// Test that Cell is considered invariant with respect to its
+// type.
+
+use std::cell::Cell;
+
+struct Foo<'a> {
+ x: Cell<Option<&'a isize>>,
+}
+
+fn use_<'short,'long>(c: Foo<'short>,
+ s: &'short isize,
+ l: &'long isize,
+ _where:Option<&'short &'long ()>) {
+ let _: Foo<'long> = c; //~ ERROR E0623
+}
+
+fn main() {
+}
diff --git a/src/test/ui/variance/variance-cell-is-invariant.stderr b/src/test/ui/variance/variance-cell-is-invariant.stderr
new file mode 100644
index 0000000..8fb5d9b
--- /dev/null
+++ b/src/test/ui/variance/variance-cell-is-invariant.stderr
@@ -0,0 +1,15 @@
+error[E0623]: lifetime mismatch
+ --> $DIR/variance-cell-is-invariant.rs:26:25
+ |
+LL | fn use_<'short,'long>(c: Foo<'short>,
+ | ----------- these two types are declared with different lifetimes...
+LL | s: &'short isize,
+LL | l: &'long isize,
+ | ------------
+LL | _where:Option<&'short &'long ()>) {
+LL | let _: Foo<'long> = c; //~ ERROR E0623
+ | ^ ...but data from `c` flows into `l` here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0623`.
diff --git a/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr
new file mode 100644
index 0000000..67d43dd
--- /dev/null
+++ b/src/test/ui/variance/variance-contravariant-arg-object.nll.stderr
@@ -0,0 +1,36 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-contravariant-arg-object.rs:24:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-contravariant-arg-object.rs:32:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-contravariant-arg-object.rs:24:5
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ cast requires that `'min` must outlive `'max`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-contravariant-arg-object.rs:32:5
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ cast requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/variance-contravariant-arg-object.rs b/src/test/ui/variance/variance-contravariant-arg-object.rs
similarity index 100%
rename from src/test/compile-fail/variance-contravariant-arg-object.rs
rename to src/test/ui/variance/variance-contravariant-arg-object.rs
diff --git a/src/test/ui/variance/variance-contravariant-arg-object.stderr b/src/test/ui/variance/variance-contravariant-arg-object.stderr
new file mode 100644
index 0000000..aeed037
--- /dev/null
+++ b/src/test/ui/variance/variance-contravariant-arg-object.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-contravariant-arg-object.rs:24:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `dyn Get<&'min i32>`
+ found type `dyn Get<&'max i32>`
+note: the lifetime 'min as defined on the function body at 20:21...
+ --> $DIR/variance-contravariant-arg-object.rs:20:21
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27
+ --> $DIR/variance-contravariant-arg-object.rs:20:27
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-contravariant-arg-object.rs:32:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `dyn Get<&'max i32>`
+ found type `dyn Get<&'min i32>`
+note: the lifetime 'min as defined on the function body at 27:21...
+ --> $DIR/variance-contravariant-arg-object.rs:27:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 27:27
+ --> $DIR/variance-contravariant-arg-object.rs:27:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.rs b/src/test/ui/variance/variance-contravariant-arg-trait-match.rs
new file mode 100644
index 0000000..9679130
--- /dev/null
+++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.rs
@@ -0,0 +1,38 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(dead_code)]
+
+// Test that even when `T` is only used in contravariant position, it
+// is treated as invariant.
+
+trait Get<T> {
+ fn get(&self, t: T);
+}
+
+fn get_min_from_max<'min, 'max, G>()
+ where 'max : 'min, G : Get<&'max i32>
+{
+ impls_get::<G,&'min i32>() //~ ERROR mismatched types
+}
+
+fn get_max_from_min<'min, 'max, G>()
+ where 'max : 'min, G : Get<&'min i32>
+{
+ // Previously OK, but now an error because traits are invariant:
+
+ impls_get::<G,&'max i32>() //~ ERROR mismatched types
+}
+
+fn impls_get<G,T>() where G : Get<T> { }
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr
new file mode 100644
index 0000000..282220d
--- /dev/null
+++ b/src/test/ui/variance/variance-contravariant-arg-trait-match.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-contravariant-arg-trait-match.rs:25:5
+ |
+LL | impls_get::<G,&'min i32>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get<&'min i32>`
+ found type `Get<&'max i32>`
+note: the lifetime 'min as defined on the function body at 22:21...
+ --> $DIR/variance-contravariant-arg-trait-match.rs:22:21
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
+ --> $DIR/variance-contravariant-arg-trait-match.rs:22:27
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-contravariant-arg-trait-match.rs:33:5
+ |
+LL | impls_get::<G,&'max i32>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get<&'max i32>`
+ found type `Get<&'min i32>`
+note: the lifetime 'min as defined on the function body at 28:21...
+ --> $DIR/variance-contravariant-arg-trait-match.rs:28:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 28:27
+ --> $DIR/variance-contravariant-arg-trait-match.rs:28:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.rs b/src/test/ui/variance/variance-contravariant-self-trait-match.rs
new file mode 100644
index 0000000..c04ba88
--- /dev/null
+++ b/src/test/ui/variance/variance-contravariant-self-trait-match.rs
@@ -0,0 +1,39 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(dead_code)]
+
+// Test that even when `Self` is only used in contravariant position, it
+// is treated as invariant.
+
+trait Get {
+ fn get(&self);
+}
+
+fn get_min_from_max<'min, 'max, G>()
+ where 'max : 'min, G : 'max, &'max G : Get
+{
+ impls_get::<&'min G>(); //~ ERROR mismatched types
+}
+
+fn get_max_from_min<'min, 'max, G>()
+ where 'max : 'min, G : 'max, &'min G : Get
+{
+ // Previously OK, but now error because traits are invariant with
+ // respect to all inputs.
+
+ impls_get::<&'max G>(); //~ ERROR mismatched types
+}
+
+fn impls_get<G>() where G : Get { }
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-contravariant-self-trait-match.stderr b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr
new file mode 100644
index 0000000..9e60a70
--- /dev/null
+++ b/src/test/ui/variance/variance-contravariant-self-trait-match.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-contravariant-self-trait-match.rs:25:5
+ |
+LL | impls_get::<&'min G>(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get`
+ found type `Get`
+note: the lifetime 'min as defined on the function body at 22:21...
+ --> $DIR/variance-contravariant-self-trait-match.rs:22:21
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
+ --> $DIR/variance-contravariant-self-trait-match.rs:22:27
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-contravariant-self-trait-match.rs:34:5
+ |
+LL | impls_get::<&'max G>(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get`
+ found type `Get`
+note: the lifetime 'min as defined on the function body at 28:21...
+ --> $DIR/variance-contravariant-self-trait-match.rs:28:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 28:27
+ --> $DIR/variance-contravariant-self-trait-match.rs:28:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-covariant-arg-object.nll.stderr b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr
new file mode 100644
index 0000000..55413e5
--- /dev/null
+++ b/src/test/ui/variance/variance-covariant-arg-object.nll.stderr
@@ -0,0 +1,36 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-covariant-arg-object.rs:25:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-covariant-arg-object.rs:32:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-covariant-arg-object.rs:25:5
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ cast requires that `'min` must outlive `'max`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-covariant-arg-object.rs:32:5
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ cast requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/variance-covariant-arg-object.rs b/src/test/ui/variance/variance-covariant-arg-object.rs
similarity index 100%
rename from src/test/compile-fail/variance-covariant-arg-object.rs
rename to src/test/ui/variance/variance-covariant-arg-object.rs
diff --git a/src/test/ui/variance/variance-covariant-arg-object.stderr b/src/test/ui/variance/variance-covariant-arg-object.stderr
new file mode 100644
index 0000000..074ef65
--- /dev/null
+++ b/src/test/ui/variance/variance-covariant-arg-object.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-covariant-arg-object.rs:25:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `dyn Get<&'min i32>`
+ found type `dyn Get<&'max i32>`
+note: the lifetime 'min as defined on the function body at 20:21...
+ --> $DIR/variance-covariant-arg-object.rs:20:21
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 20:27
+ --> $DIR/variance-covariant-arg-object.rs:20:27
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-covariant-arg-object.rs:32:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `dyn Get<&'max i32>`
+ found type `dyn Get<&'min i32>`
+note: the lifetime 'min as defined on the function body at 28:21...
+ --> $DIR/variance-covariant-arg-object.rs:28:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 28:27
+ --> $DIR/variance-covariant-arg-object.rs:28:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.rs b/src/test/ui/variance/variance-covariant-arg-trait-match.rs
new file mode 100644
index 0000000..fbda62f
--- /dev/null
+++ b/src/test/ui/variance/variance-covariant-arg-trait-match.rs
@@ -0,0 +1,37 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(dead_code)]
+
+// Test that even when `T` is only used in covariant position, it
+// is treated as invariant.
+
+trait Get<T> {
+ fn get(&self) -> T;
+}
+
+fn get_min_from_max<'min, 'max, G>()
+ where 'max : 'min, G : Get<&'max i32>
+{
+ // Previously OK, now an error as traits are invariant.
+ impls_get::<G,&'min i32>() //~ ERROR mismatched types
+}
+
+fn get_max_from_min<'min, 'max, G>()
+ where 'max : 'min, G : Get<&'min i32>
+{
+ impls_get::<G,&'max i32>() //~ ERROR mismatched types
+}
+
+fn impls_get<G,T>() where G : Get<T> { }
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-covariant-arg-trait-match.stderr b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr
new file mode 100644
index 0000000..648acc2
--- /dev/null
+++ b/src/test/ui/variance/variance-covariant-arg-trait-match.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-covariant-arg-trait-match.rs:26:5
+ |
+LL | impls_get::<G,&'min i32>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get<&'min i32>`
+ found type `Get<&'max i32>`
+note: the lifetime 'min as defined on the function body at 22:21...
+ --> $DIR/variance-covariant-arg-trait-match.rs:22:21
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
+ --> $DIR/variance-covariant-arg-trait-match.rs:22:27
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-covariant-arg-trait-match.rs:32:5
+ |
+LL | impls_get::<G,&'max i32>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get<&'max i32>`
+ found type `Get<&'min i32>`
+note: the lifetime 'min as defined on the function body at 29:21...
+ --> $DIR/variance-covariant-arg-trait-match.rs:29:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 29:27
+ --> $DIR/variance-covariant-arg-trait-match.rs:29:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.rs b/src/test/ui/variance/variance-covariant-self-trait-match.rs
new file mode 100644
index 0000000..3e0c1da
--- /dev/null
+++ b/src/test/ui/variance/variance-covariant-self-trait-match.rs
@@ -0,0 +1,37 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(dead_code)]
+
+// Test that even when `Self` is only used in covariant position, it
+// is treated as invariant.
+
+trait Get {
+ fn get() -> Self;
+}
+
+fn get_min_from_max<'min, 'max, G>()
+ where 'max : 'min, G : 'max, &'max G : Get
+{
+ // Previously OK, now an error as traits are invariant.
+ impls_get::<&'min G>(); //~ ERROR mismatched types
+}
+
+fn get_max_from_min<'min, 'max, G>()
+ where 'max : 'min, G : 'max, &'min G : Get
+{
+ impls_get::<&'max G>(); //~ ERROR mismatched types
+}
+
+fn impls_get<G>() where G : Get { }
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-covariant-self-trait-match.stderr b/src/test/ui/variance/variance-covariant-self-trait-match.stderr
new file mode 100644
index 0000000..cb8fe0b
--- /dev/null
+++ b/src/test/ui/variance/variance-covariant-self-trait-match.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-covariant-self-trait-match.rs:26:5
+ |
+LL | impls_get::<&'min G>(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get`
+ found type `Get`
+note: the lifetime 'min as defined on the function body at 22:21...
+ --> $DIR/variance-covariant-self-trait-match.rs:22:21
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 22:27
+ --> $DIR/variance-covariant-self-trait-match.rs:22:27
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-covariant-self-trait-match.rs:32:5
+ |
+LL | impls_get::<&'max G>(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get`
+ found type `Get`
+note: the lifetime 'min as defined on the function body at 29:21...
+ --> $DIR/variance-covariant-self-trait-match.rs:29:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 29:27
+ --> $DIR/variance-covariant-self-trait-match.rs:29:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-invariant-arg-object.nll.stderr b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr
new file mode 100644
index 0000000..f909751
--- /dev/null
+++ b/src/test/ui/variance/variance-invariant-arg-object.nll.stderr
@@ -0,0 +1,36 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-invariant-arg-object.rs:21:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-invariant-arg-object.rs:28:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-invariant-arg-object.rs:21:5
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ cast requires that `'min` must outlive `'max`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-invariant-arg-object.rs:28:5
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ cast requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/variance-invariant-arg-object.rs b/src/test/ui/variance/variance-invariant-arg-object.rs
similarity index 100%
rename from src/test/compile-fail/variance-invariant-arg-object.rs
rename to src/test/ui/variance/variance-invariant-arg-object.rs
diff --git a/src/test/ui/variance/variance-invariant-arg-object.stderr b/src/test/ui/variance/variance-invariant-arg-object.stderr
new file mode 100644
index 0000000..3283ae6
--- /dev/null
+++ b/src/test/ui/variance/variance-invariant-arg-object.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-invariant-arg-object.rs:21:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `dyn Get<&'min i32>`
+ found type `dyn Get<&'max i32>`
+note: the lifetime 'min as defined on the function body at 17:21...
+ --> $DIR/variance-invariant-arg-object.rs:17:21
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 17:27
+ --> $DIR/variance-invariant-arg-object.rs:17:27
+ |
+LL | fn get_min_from_max<'min, 'max>(v: Box<Get<&'max i32>>)
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-invariant-arg-object.rs:28:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `dyn Get<&'max i32>`
+ found type `dyn Get<&'min i32>`
+note: the lifetime 'min as defined on the function body at 24:21...
+ --> $DIR/variance-invariant-arg-object.rs:24:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 24:27
+ --> $DIR/variance-invariant-arg-object.rs:24:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>(v: Box<Get<&'min i32>>)
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.rs b/src/test/ui/variance/variance-invariant-arg-trait-match.rs
new file mode 100644
index 0000000..771fcde
--- /dev/null
+++ b/src/test/ui/variance/variance-invariant-arg-trait-match.rs
@@ -0,0 +1,33 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(dead_code)]
+
+trait Get<T> {
+ fn get(&self, t: T) -> T;
+}
+
+fn get_min_from_max<'min, 'max, G>()
+ where 'max : 'min, G : Get<&'max i32>
+{
+ impls_get::<G,&'min i32>() //~ ERROR mismatched types
+}
+
+fn get_max_from_min<'min, 'max, G>()
+ where 'max : 'min, G : Get<&'min i32>
+{
+ impls_get::<G,&'max i32>() //~ ERROR mismatched types
+}
+
+fn impls_get<G,T>() where G : Get<T> { }
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-invariant-arg-trait-match.stderr b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr
new file mode 100644
index 0000000..3f63549
--- /dev/null
+++ b/src/test/ui/variance/variance-invariant-arg-trait-match.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-invariant-arg-trait-match.rs:22:5
+ |
+LL | impls_get::<G,&'min i32>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get<&'min i32>`
+ found type `Get<&'max i32>`
+note: the lifetime 'min as defined on the function body at 19:21...
+ --> $DIR/variance-invariant-arg-trait-match.rs:19:21
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 19:27
+ --> $DIR/variance-invariant-arg-trait-match.rs:19:27
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-invariant-arg-trait-match.rs:28:5
+ |
+LL | impls_get::<G,&'max i32>() //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get<&'max i32>`
+ found type `Get<&'min i32>`
+note: the lifetime 'min as defined on the function body at 25:21...
+ --> $DIR/variance-invariant-arg-trait-match.rs:25:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 25:27
+ --> $DIR/variance-invariant-arg-trait-match.rs:25:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.rs b/src/test/ui/variance/variance-invariant-self-trait-match.rs
new file mode 100644
index 0000000..57abf6f
--- /dev/null
+++ b/src/test/ui/variance/variance-invariant-self-trait-match.rs
@@ -0,0 +1,33 @@
+// Copyright 2015 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-compare-mode-nll
+
+#![allow(dead_code)]
+
+trait Get {
+ fn get(&self) -> Self;
+}
+
+fn get_min_from_max<'min, 'max, G>()
+ where 'max : 'min, &'max G : Get, G : 'max
+{
+ impls_get::<&'min G>(); //~ ERROR mismatched types
+}
+
+fn get_max_from_min<'min, 'max, G>()
+ where 'max : 'min, &'min G : Get, G : 'min
+{
+ impls_get::<&'max G>(); //~ ERROR mismatched types
+}
+
+fn impls_get<G>() where G : Get { }
+
+fn main() { }
diff --git a/src/test/ui/variance/variance-invariant-self-trait-match.stderr b/src/test/ui/variance/variance-invariant-self-trait-match.stderr
new file mode 100644
index 0000000..1b864ab
--- /dev/null
+++ b/src/test/ui/variance/variance-invariant-self-trait-match.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-invariant-self-trait-match.rs:22:5
+ |
+LL | impls_get::<&'min G>(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get`
+ found type `Get`
+note: the lifetime 'min as defined on the function body at 19:21...
+ --> $DIR/variance-invariant-self-trait-match.rs:19:21
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 19:27
+ --> $DIR/variance-invariant-self-trait-match.rs:19:27
+ |
+LL | fn get_min_from_max<'min, 'max, G>()
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-invariant-self-trait-match.rs:28:5
+ |
+LL | impls_get::<&'max G>(); //~ ERROR mismatched types
+ | ^^^^^^^^^^^^^^^^^^^^ lifetime mismatch
+ |
+ = note: expected type `Get`
+ found type `Get`
+note: the lifetime 'min as defined on the function body at 25:21...
+ --> $DIR/variance-invariant-self-trait-match.rs:25:21
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 25:27
+ --> $DIR/variance-invariant-self-trait-match.rs:25:27
+ |
+LL | fn get_max_from_min<'min, 'max, G>()
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/variance/variance-issue-20533.nll.stderr b/src/test/ui/variance/variance-issue-20533.nll.stderr
new file mode 100644
index 0000000..f9e2ae8
--- /dev/null
+++ b/src/test/ui/variance/variance-issue-20533.nll.stderr
@@ -0,0 +1,33 @@
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/variance-issue-20533.rs:38:14
+ |
+LL | let x = foo(&a);
+ | -- borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a`
+ | ^ move out of `a` occurs here
+LL | drop(x);
+ | - borrow later used here
+
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/variance-issue-20533.rs:44:14
+ |
+LL | let x = bar(&a);
+ | -- borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a`
+ | ^ move out of `a` occurs here
+LL | drop(x);
+ | - borrow later used here
+
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/variance-issue-20533.rs:50:14
+ |
+LL | let x = baz(&a);
+ | -- borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a`
+ | ^ move out of `a` occurs here
+LL | drop(x);
+ | - borrow later used here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/variance-issue-20533.rs b/src/test/ui/variance/variance-issue-20533.rs
similarity index 100%
rename from src/test/compile-fail/variance-issue-20533.rs
rename to src/test/ui/variance/variance-issue-20533.rs
diff --git a/src/test/ui/variance/variance-issue-20533.stderr b/src/test/ui/variance/variance-issue-20533.stderr
new file mode 100644
index 0000000..680dea2
--- /dev/null
+++ b/src/test/ui/variance/variance-issue-20533.stderr
@@ -0,0 +1,27 @@
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/variance-issue-20533.rs:38:14
+ |
+LL | let x = foo(&a);
+ | - borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a`
+ | ^ move out of `a` occurs here
+
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/variance-issue-20533.rs:44:14
+ |
+LL | let x = bar(&a);
+ | - borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a`
+ | ^ move out of `a` occurs here
+
+error[E0505]: cannot move out of `a` because it is borrowed
+ --> $DIR/variance-issue-20533.rs:50:14
+ |
+LL | let x = baz(&a);
+ | - borrow of `a` occurs here
+LL | drop(a); //~ ERROR cannot move out of `a`
+ | ^ move out of `a` occurs here
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/compile-fail/variance-object-types.rs b/src/test/ui/variance/variance-object-types.rs
similarity index 100%
rename from src/test/compile-fail/variance-object-types.rs
rename to src/test/ui/variance/variance-object-types.rs
diff --git a/src/test/ui/variance/variance-object-types.stderr b/src/test/ui/variance/variance-object-types.stderr
new file mode 100644
index 0000000..9a1c996
--- /dev/null
+++ b/src/test/ui/variance/variance-object-types.stderr
@@ -0,0 +1,11 @@
+error[E0208]: [o]
+ --> $DIR/variance-object-types.rs:21:1
+ |
+LL | / struct Foo<'a> { //~ ERROR [o]
+LL | | x: Box<Fn(i32) -> &'a i32 + 'static>
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/compile-fail/variance-regions-direct.rs b/src/test/ui/variance/variance-regions-direct.rs
similarity index 100%
rename from src/test/compile-fail/variance-regions-direct.rs
rename to src/test/ui/variance/variance-regions-direct.rs
diff --git a/src/test/ui/variance/variance-regions-direct.stderr b/src/test/ui/variance/variance-regions-direct.stderr
new file mode 100644
index 0000000..81cb929
--- /dev/null
+++ b/src/test/ui/variance/variance-regions-direct.stderr
@@ -0,0 +1,65 @@
+error[E0208]: [-, -, -]
+ --> $DIR/variance-regions-direct.rs:19:1
+ |
+LL | / struct Test2<'a, 'b, 'c> { //~ ERROR [-, -, -]
+LL | | x: &'a isize,
+LL | | y: &'b [isize],
+LL | | c: &'c str
+LL | | }
+ | |_^
+
+error[E0208]: [+, +, +]
+ --> $DIR/variance-regions-direct.rs:28:1
+ |
+LL | / struct Test3<'a, 'b, 'c> { //~ ERROR [+, +, +]
+LL | | x: extern "Rust" fn(&'a isize),
+LL | | y: extern "Rust" fn(&'b [isize]),
+LL | | c: extern "Rust" fn(&'c str),
+LL | | }
+ | |_^
+
+error[E0208]: [-, o]
+ --> $DIR/variance-regions-direct.rs:37:1
+ |
+LL | / struct Test4<'a, 'b:'a> { //~ ERROR [-, o]
+LL | | x: &'a mut &'b isize,
+LL | | }
+ | |_^
+
+error[E0208]: [+, o]
+ --> $DIR/variance-regions-direct.rs:45:1
+ |
+LL | / struct Test5<'a, 'b:'a> { //~ ERROR [+, o]
+LL | | x: extern "Rust" fn(&'a mut &'b isize),
+LL | | }
+ | |_^
+
+error[E0208]: [-, o]
+ --> $DIR/variance-regions-direct.rs:55:1
+ |
+LL | / struct Test6<'a, 'b:'a> { //~ ERROR [-, o]
+LL | | x: &'a mut extern "Rust" fn(&'b isize),
+LL | | }
+ | |_^
+
+error[E0208]: [*]
+ --> $DIR/variance-regions-direct.rs:62:1
+ |
+LL | / struct Test7<'a> { //~ ERROR [*]
+LL | | x: isize
+LL | | }
+ | |_^
+
+error[E0208]: [+, -, o]
+ --> $DIR/variance-regions-direct.rs:69:1
+ |
+LL | / enum Test8<'a, 'b, 'c:'b> { //~ ERROR [+, -, o]
+LL | | Test8A(extern "Rust" fn(&'a isize)),
+LL | | Test8B(&'b [isize]),
+LL | | Test8C(&'b mut &'c str),
+LL | | }
+ | |_^
+
+error: aborting due to 7 previous errors
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/compile-fail/variance-regions-indirect.rs b/src/test/ui/variance/variance-regions-indirect.rs
similarity index 100%
rename from src/test/compile-fail/variance-regions-indirect.rs
rename to src/test/ui/variance/variance-regions-indirect.rs
diff --git a/src/test/ui/variance/variance-regions-indirect.stderr b/src/test/ui/variance/variance-regions-indirect.stderr
new file mode 100644
index 0000000..edf3953
--- /dev/null
+++ b/src/test/ui/variance/variance-regions-indirect.stderr
@@ -0,0 +1,45 @@
+error[E0208]: [+, -, o, *]
+ --> $DIR/variance-regions-indirect.rs:18:1
+ |
+LL | / enum Base<'a, 'b, 'c:'b, 'd> { //~ ERROR [+, -, o, *]
+LL | | Test8A(extern "Rust" fn(&'a isize)),
+LL | | Test8B(&'b [isize]),
+LL | | Test8C(&'b mut &'c str),
+LL | | }
+ | |_^
+
+error[E0208]: [*, o, -, +]
+ --> $DIR/variance-regions-indirect.rs:25:1
+ |
+LL | / struct Derived1<'w, 'x:'y, 'y, 'z> { //~ ERROR [*, o, -, +]
+LL | | f: Base<'z, 'y, 'x, 'w>
+LL | | }
+ | |_^
+
+error[E0208]: [o, o, *]
+ --> $DIR/variance-regions-indirect.rs:30:1
+ |
+LL | / struct Derived2<'a, 'b:'a, 'c> { //~ ERROR [o, o, *]
+LL | | f: Base<'a, 'a, 'b, 'c>
+LL | | }
+ | |_^
+
+error[E0208]: [o, -, *]
+ --> $DIR/variance-regions-indirect.rs:35:1
+ |
+LL | / struct Derived3<'a:'b, 'b, 'c> { //~ ERROR [o, -, *]
+LL | | f: Base<'a, 'b, 'a, 'c>
+LL | | }
+ | |_^
+
+error[E0208]: [+, -, o]
+ --> $DIR/variance-regions-indirect.rs:40:1
+ |
+LL | / struct Derived4<'a, 'b, 'c:'b> { //~ ERROR [+, -, o]
+LL | | f: Base<'a, 'b, 'c, 'a>
+LL | | }
+ | |_^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/compile-fail/variance-regions-unused-direct.rs b/src/test/ui/variance/variance-regions-unused-direct.rs
similarity index 100%
rename from src/test/compile-fail/variance-regions-unused-direct.rs
rename to src/test/ui/variance/variance-regions-unused-direct.rs
diff --git a/src/test/ui/variance/variance-regions-unused-direct.stderr b/src/test/ui/variance/variance-regions-unused-direct.stderr
new file mode 100644
index 0000000..e3d02c6
--- /dev/null
+++ b/src/test/ui/variance/variance-regions-unused-direct.stderr
@@ -0,0 +1,19 @@
+error[E0392]: parameter `'a` is never used
+ --> $DIR/variance-regions-unused-direct.rs:15:18
+ |
+LL | struct Bivariant<'a>; //~ ERROR parameter `'a` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
+
+error[E0392]: parameter `'d` is never used
+ --> $DIR/variance-regions-unused-direct.rs:17:19
+ |
+LL | struct Struct<'a, 'd> { //~ ERROR parameter `'d` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'d` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0392`.
diff --git a/src/test/compile-fail/variance-regions-unused-indirect.rs b/src/test/ui/variance/variance-regions-unused-indirect.rs
similarity index 100%
rename from src/test/compile-fail/variance-regions-unused-indirect.rs
rename to src/test/ui/variance/variance-regions-unused-indirect.rs
diff --git a/src/test/ui/variance/variance-regions-unused-indirect.stderr b/src/test/ui/variance/variance-regions-unused-indirect.stderr
new file mode 100644
index 0000000..f3eee86
--- /dev/null
+++ b/src/test/ui/variance/variance-regions-unused-indirect.stderr
@@ -0,0 +1,19 @@
+error[E0392]: parameter `'a` is never used
+ --> $DIR/variance-regions-unused-indirect.rs:13:10
+ |
+LL | enum Foo<'a> { //~ ERROR parameter `'a` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
+
+error[E0392]: parameter `'a` is never used
+ --> $DIR/variance-regions-unused-indirect.rs:17:10
+ |
+LL | enum Bar<'a> { //~ ERROR parameter `'a` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0392`.
diff --git a/src/test/compile-fail/variance-trait-bounds.rs b/src/test/ui/variance/variance-trait-bounds.rs
similarity index 100%
rename from src/test/compile-fail/variance-trait-bounds.rs
rename to src/test/ui/variance/variance-trait-bounds.rs
diff --git a/src/test/ui/variance/variance-trait-bounds.stderr b/src/test/ui/variance/variance-trait-bounds.stderr
new file mode 100644
index 0000000..1c82ed7
--- /dev/null
+++ b/src/test/ui/variance/variance-trait-bounds.stderr
@@ -0,0 +1,35 @@
+error[E0208]: [+, +]
+ --> $DIR/variance-trait-bounds.rs:26:1
+ |
+LL | / struct TestStruct<U,T:Setter<U>> { //~ ERROR [+, +]
+LL | | t: T, u: U
+LL | | }
+ | |_^
+
+error[E0208]: [*, +]
+ --> $DIR/variance-trait-bounds.rs:31:1
+ |
+LL | / enum TestEnum<U,T:Setter<U>> { //~ ERROR [*, +]
+LL | | Foo(T)
+LL | | }
+ | |_^
+
+error[E0208]: [*, +]
+ --> $DIR/variance-trait-bounds.rs:36:1
+ |
+LL | / struct TestContraStruct<U,T:Setter<U>> { //~ ERROR [*, +]
+LL | | t: T
+LL | | }
+ | |_^
+
+error[E0208]: [*, +]
+ --> $DIR/variance-trait-bounds.rs:41:1
+ |
+LL | / struct TestBox<U,T:Getter<U>+Setter<U>> { //~ ERROR [*, +]
+LL | | t: T
+LL | | }
+ | |_^
+
+error: aborting due to 4 previous errors
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/ui/variance/variance-trait-matching.nll.stderr b/src/test/ui/variance/variance-trait-matching.nll.stderr
new file mode 100644
index 0000000..baf75b7
--- /dev/null
+++ b/src/test/ui/variance/variance-trait-matching.nll.stderr
@@ -0,0 +1,30 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-trait-matching.rs:34:10
+ |
+LL | pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621]
+ | ^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-trait-matching.rs:34:5
+ |
+LL | pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621]
+ | ^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-trait-matching.rs:34:5
+ |
+LL | pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621]
+ | ^^^^
+
+error[E0621]: explicit lifetime required in the type of `get`
+ --> $DIR/variance-trait-matching.rs:34:5
+ |
+LL | fn get<'a, G>(get: &G) -> i32
+ | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
+...
+LL | pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621]
+ | ^^^^^^^^^^^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/variance-trait-matching.rs b/src/test/ui/variance/variance-trait-matching.rs
similarity index 100%
rename from src/test/compile-fail/variance-trait-matching.rs
rename to src/test/ui/variance/variance-trait-matching.rs
diff --git a/src/test/ui/variance/variance-trait-matching.stderr b/src/test/ui/variance/variance-trait-matching.stderr
new file mode 100644
index 0000000..645d0ff
--- /dev/null
+++ b/src/test/ui/variance/variance-trait-matching.stderr
@@ -0,0 +1,12 @@
+error[E0621]: explicit lifetime required in the type of `get`
+ --> $DIR/variance-trait-matching.rs:34:5
+ |
+LL | fn get<'a, G>(get: &G) -> i32
+ | -- help: add explicit lifetime `'a` to the type of `get`: `&'a G`
+...
+LL | pick(get, &22) //~ ERROR 34:5: 34:9: explicit lifetime required in the type of `get` [E0621]
+ | ^^^^ lifetime `'a` required
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0621`.
diff --git a/src/test/compile-fail/variance-trait-object-bound.rs b/src/test/ui/variance/variance-trait-object-bound.rs
similarity index 100%
rename from src/test/compile-fail/variance-trait-object-bound.rs
rename to src/test/ui/variance/variance-trait-object-bound.rs
diff --git a/src/test/ui/variance/variance-trait-object-bound.stderr b/src/test/ui/variance/variance-trait-object-bound.stderr
new file mode 100644
index 0000000..b44fa94
--- /dev/null
+++ b/src/test/ui/variance/variance-trait-object-bound.stderr
@@ -0,0 +1,11 @@
+error[E0208]: [-]
+ --> $DIR/variance-trait-object-bound.rs:24:1
+ |
+LL | / struct TOption<'a> { //~ ERROR [-]
+LL | | v: Option<Box<T + 'a>>,
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/compile-fail/variance-types-bounds.rs b/src/test/ui/variance/variance-types-bounds.rs
similarity index 100%
rename from src/test/compile-fail/variance-types-bounds.rs
rename to src/test/ui/variance/variance-types-bounds.rs
diff --git a/src/test/ui/variance/variance-types-bounds.stderr b/src/test/ui/variance/variance-types-bounds.stderr
new file mode 100644
index 0000000..e4b0887
--- /dev/null
+++ b/src/test/ui/variance/variance-types-bounds.stderr
@@ -0,0 +1,47 @@
+error[E0208]: [+, +]
+ --> $DIR/variance-types-bounds.rs:17:1
+ |
+LL | / struct TestImm<A, B> { //~ ERROR [+, +]
+LL | | x: A,
+LL | | y: B,
+LL | | }
+ | |_^
+
+error[E0208]: [+, o]
+ --> $DIR/variance-types-bounds.rs:23:1
+ |
+LL | / struct TestMut<A, B:'static> { //~ ERROR [+, o]
+LL | | x: A,
+LL | | y: &'static mut B,
+LL | | }
+ | |_^
+
+error[E0208]: [+, o]
+ --> $DIR/variance-types-bounds.rs:29:1
+ |
+LL | / struct TestIndirect<A:'static, B:'static> { //~ ERROR [+, o]
+LL | | m: TestMut<A, B>
+LL | | }
+ | |_^
+
+error[E0208]: [o, o]
+ --> $DIR/variance-types-bounds.rs:34:1
+ |
+LL | / struct TestIndirect2<A:'static, B:'static> { //~ ERROR [o, o]
+LL | | n: TestMut<A, B>,
+LL | | m: TestMut<B, A>
+LL | | }
+ | |_^
+
+error[E0208]: [o, o]
+ --> $DIR/variance-types-bounds.rs:48:1
+ |
+LL | / struct TestObject<A, R> { //~ ERROR [o, o]
+LL | | n: Box<Setter<A>+Send>,
+LL | | m: Box<Getter<R>+Send>,
+LL | | }
+ | |_^
+
+error: aborting due to 5 previous errors
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/compile-fail/variance-types.rs b/src/test/ui/variance/variance-types.rs
similarity index 100%
rename from src/test/compile-fail/variance-types.rs
rename to src/test/ui/variance/variance-types.rs
diff --git a/src/test/ui/variance/variance-types.stderr b/src/test/ui/variance/variance-types.stderr
new file mode 100644
index 0000000..59975fa
--- /dev/null
+++ b/src/test/ui/variance/variance-types.stderr
@@ -0,0 +1,53 @@
+error[E0208]: [-, o, o]
+ --> $DIR/variance-types.rs:20:1
+ |
+LL | / struct InvariantMut<'a,A:'a,B:'a> { //~ ERROR [-, o, o]
+LL | | t: &'a mut (A,B)
+LL | | }
+ | |_^
+
+error[E0208]: [o]
+ --> $DIR/variance-types.rs:25:1
+ |
+LL | / struct InvariantCell<A> { //~ ERROR [o]
+LL | | t: Cell<A>
+LL | | }
+ | |_^
+
+error[E0208]: [o]
+ --> $DIR/variance-types.rs:30:1
+ |
+LL | / struct InvariantIndirect<A> { //~ ERROR [o]
+LL | | t: InvariantCell<A>
+LL | | }
+ | |_^
+
+error[E0208]: [+]
+ --> $DIR/variance-types.rs:35:1
+ |
+LL | / struct Covariant<A> { //~ ERROR [+]
+LL | | t: A, u: fn() -> A
+LL | | }
+ | |_^
+
+error[E0208]: [-]
+ --> $DIR/variance-types.rs:40:1
+ |
+LL | / struct Contravariant<A> { //~ ERROR [-]
+LL | | t: fn(A)
+LL | | }
+ | |_^
+
+error[E0208]: [+, -, o]
+ --> $DIR/variance-types.rs:45:1
+ |
+LL | / enum Enum<A,B,C> { //~ ERROR [+, -, o]
+LL | | Foo(Covariant<A>),
+LL | | Bar(Contravariant<B>),
+LL | | Zed(Covariant<C>,Contravariant<C>)
+LL | | }
+ | |_^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0208`.
diff --git a/src/test/compile-fail/variance-unused-region-param.rs b/src/test/ui/variance/variance-unused-region-param.rs
similarity index 100%
rename from src/test/compile-fail/variance-unused-region-param.rs
rename to src/test/ui/variance/variance-unused-region-param.rs
diff --git a/src/test/ui/variance/variance-unused-region-param.stderr b/src/test/ui/variance/variance-unused-region-param.stderr
new file mode 100644
index 0000000..354fcf3
--- /dev/null
+++ b/src/test/ui/variance/variance-unused-region-param.stderr
@@ -0,0 +1,19 @@
+error[E0392]: parameter `'a` is never used
+ --> $DIR/variance-unused-region-param.rs:13:19
+ |
+LL | struct SomeStruct<'a> { x: u32 } //~ ERROR parameter `'a` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
+
+error[E0392]: parameter `'a` is never used
+ --> $DIR/variance-unused-region-param.rs:14:15
+ |
+LL | enum SomeEnum<'a> { Nothing } //~ ERROR parameter `'a` is never used
+ | ^^ unused type parameter
+ |
+ = help: consider removing `'a` or using a marker such as `std::marker::PhantomData`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0392`.
diff --git a/src/test/ui/variance-unused-type-param.rs b/src/test/ui/variance/variance-unused-type-param.rs
similarity index 100%
rename from src/test/ui/variance-unused-type-param.rs
rename to src/test/ui/variance/variance-unused-type-param.rs
diff --git a/src/test/ui/variance-unused-type-param.stderr b/src/test/ui/variance/variance-unused-type-param.stderr
similarity index 100%
rename from src/test/ui/variance-unused-type-param.stderr
rename to src/test/ui/variance/variance-unused-type-param.stderr
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr
new file mode 100644
index 0000000..643b858
--- /dev/null
+++ b/src/test/ui/variance/variance-use-contravariant-struct-1.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-use-contravariant-struct-1.rs:22:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-use-contravariant-struct-1.rs:22:5
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/variance-use-contravariant-struct-1.rs b/src/test/ui/variance/variance-use-contravariant-struct-1.rs
similarity index 100%
rename from src/test/compile-fail/variance-use-contravariant-struct-1.rs
rename to src/test/ui/variance/variance-use-contravariant-struct-1.rs
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-1.stderr b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr
new file mode 100644
index 0000000..48e0d38
--- /dev/null
+++ b/src/test/ui/variance/variance-use-contravariant-struct-1.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-use-contravariant-struct-1.rs:22:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `SomeStruct<&'min ()>`
+ found type `SomeStruct<&'max ()>`
+note: the lifetime 'min as defined on the function body at 18:8...
+ --> $DIR/variance-use-contravariant-struct-1.rs:18:8
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:13
+ --> $DIR/variance-use-contravariant-struct-1.rs:18:13
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/variance-use-contravariant-struct-2.rs b/src/test/ui/variance/variance-use-contravariant-struct-2.rs
similarity index 100%
rename from src/test/compile-fail/variance-use-contravariant-struct-2.rs
rename to src/test/ui/variance/variance-use-contravariant-struct-2.rs
diff --git a/src/test/ui/variance/variance-use-contravariant-struct-2.stderr b/src/test/ui/variance/variance-use-contravariant-struct-2.stderr
new file mode 100644
index 0000000..e3663eb
--- /dev/null
+++ b/src/test/ui/variance/variance-use-contravariant-struct-2.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/variance-use-contravariant-struct-2.rs:27:1
+ |
+LL | fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr
new file mode 100644
index 0000000..f0c9c44
--- /dev/null
+++ b/src/test/ui/variance/variance-use-covariant-struct-1.nll.stderr
@@ -0,0 +1,19 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-use-covariant-struct-1.rs:20:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-use-covariant-struct-1.rs:20:5
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/variance-use-covariant-struct-1.rs b/src/test/ui/variance/variance-use-covariant-struct-1.rs
similarity index 100%
rename from src/test/compile-fail/variance-use-covariant-struct-1.rs
rename to src/test/ui/variance/variance-use-covariant-struct-1.rs
diff --git a/src/test/ui/variance/variance-use-covariant-struct-1.stderr b/src/test/ui/variance/variance-use-covariant-struct-1.stderr
new file mode 100644
index 0000000..947abe2
--- /dev/null
+++ b/src/test/ui/variance/variance-use-covariant-struct-1.stderr
@@ -0,0 +1,22 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-use-covariant-struct-1.rs:20:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `SomeStruct<&'max ()>`
+ found type `SomeStruct<&'min ()>`
+note: the lifetime 'min as defined on the function body at 16:8...
+ --> $DIR/variance-use-covariant-struct-1.rs:16:8
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 16:13
+ --> $DIR/variance-use-covariant-struct-1.rs:16:13
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'min ()>)
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/variance-use-covariant-struct-2.rs b/src/test/ui/variance/variance-use-covariant-struct-2.rs
similarity index 100%
rename from src/test/compile-fail/variance-use-covariant-struct-2.rs
rename to src/test/ui/variance/variance-use-covariant-struct-2.rs
diff --git a/src/test/ui/variance/variance-use-covariant-struct-2.stderr b/src/test/ui/variance/variance-use-covariant-struct-2.stderr
new file mode 100644
index 0000000..9c3a1cf
--- /dev/null
+++ b/src/test/ui/variance/variance-use-covariant-struct-2.stderr
@@ -0,0 +1,8 @@
+error: compilation successful
+ --> $DIR/variance-use-covariant-struct-2.rs:26:16
+ |
+LL | #[rustc_error] fn main() { } //~ ERROR compilation successful
+ | ^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr
new file mode 100644
index 0000000..8b6d610
--- /dev/null
+++ b/src/test/ui/variance/variance-use-invariant-struct-1.nll.stderr
@@ -0,0 +1,36 @@
+warning: not reporting region error due to nll
+ --> $DIR/variance-use-invariant-struct-1.rs:22:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/variance-use-invariant-struct-1.rs:29:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-use-invariant-struct-1.rs:22:5
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'min` must outlive `'max`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/variance-use-invariant-struct-1.rs:29:5
+ |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+ | ---- ---- lifetime `'max` defined here
+ | |
+ | lifetime `'min` defined here
+...
+LL | v //~ ERROR mismatched types
+ | ^ returning this value requires that `'min` must outlive `'max`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/variance-use-invariant-struct-1.rs b/src/test/ui/variance/variance-use-invariant-struct-1.rs
similarity index 100%
rename from src/test/compile-fail/variance-use-invariant-struct-1.rs
rename to src/test/ui/variance/variance-use-invariant-struct-1.rs
diff --git a/src/test/ui/variance/variance-use-invariant-struct-1.stderr b/src/test/ui/variance/variance-use-invariant-struct-1.stderr
new file mode 100644
index 0000000..30da7e3
--- /dev/null
+++ b/src/test/ui/variance/variance-use-invariant-struct-1.stderr
@@ -0,0 +1,41 @@
+error[E0308]: mismatched types
+ --> $DIR/variance-use-invariant-struct-1.rs:22:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `SomeStruct<&'min ()>`
+ found type `SomeStruct<&'max ()>`
+note: the lifetime 'min as defined on the function body at 18:8...
+ --> $DIR/variance-use-invariant-struct-1.rs:18:8
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 18:13
+ --> $DIR/variance-use-invariant-struct-1.rs:18:13
+ |
+LL | fn foo<'min,'max>(v: SomeStruct<&'max ()>)
+ | ^^^^
+
+error[E0308]: mismatched types
+ --> $DIR/variance-use-invariant-struct-1.rs:29:5
+ |
+LL | v //~ ERROR mismatched types
+ | ^ lifetime mismatch
+ |
+ = note: expected type `SomeStruct<&'max ()>`
+ found type `SomeStruct<&'min ()>`
+note: the lifetime 'min as defined on the function body at 25:8...
+ --> $DIR/variance-use-invariant-struct-1.rs:25:8
+ |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+ | ^^^^
+note: ...does not necessarily outlive the lifetime 'max as defined on the function body at 25:13
+ --> $DIR/variance-use-invariant-struct-1.rs:25:13
+ |
+LL | fn bar<'min,'max>(v: SomeStruct<&'min ()>)
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/auxiliary/variant-namespacing.rs b/src/test/ui/variants/auxiliary/variant-namespacing.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/variant-namespacing.rs
rename to src/test/ui/variants/auxiliary/variant-namespacing.rs
diff --git a/src/test/compile-fail/variant-namespacing.rs b/src/test/ui/variants/variant-namespacing.rs
similarity index 100%
rename from src/test/compile-fail/variant-namespacing.rs
rename to src/test/ui/variants/variant-namespacing.rs
diff --git a/src/test/ui/variants/variant-namespacing.stderr b/src/test/ui/variants/variant-namespacing.stderr
new file mode 100644
index 0000000..322ea61
--- /dev/null
+++ b/src/test/ui/variants/variant-namespacing.stderr
@@ -0,0 +1,93 @@
+error[E0255]: the name `XStruct` is defined multiple times
+ --> $DIR/variant-namespacing.rs:34:35
+ |
+LL | type XStruct = u8;
+ | ------------------ previous definition of the type `XStruct` here
+...
+LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
+ | ^^^^^^^ `XStruct` reimported here
+ |
+ = note: `XStruct` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use variant_namespacing::XE::{XStruct as OtherXStruct, XTuple, XUnit};
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0255]: the name `XTuple` is defined multiple times
+ --> $DIR/variant-namespacing.rs:34:44
+ |
+LL | type XTuple = u8;
+ | ----------------- previous definition of the type `XTuple` here
+...
+LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
+ | ^^^^^^ `XTuple` reimported here
+ |
+ = note: `XTuple` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use variant_namespacing::XE::{XStruct, XTuple as OtherXTuple, XUnit};
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0255]: the name `XUnit` is defined multiple times
+ --> $DIR/variant-namespacing.rs:34:52
+ |
+LL | type XUnit = u8;
+ | ---------------- previous definition of the type `XUnit` here
+...
+LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit};
+ | ^^^^^ `XUnit` reimported here
+ |
+ = note: `XUnit` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use variant_namespacing::XE::{XStruct, XTuple, XUnit as OtherXUnit};
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0255]: the name `Struct` is defined multiple times
+ --> $DIR/variant-namespacing.rs:38:13
+ |
+LL | type Struct = u8;
+ | ----------------- previous definition of the type `Struct` here
+...
+LL | pub use E::{Struct, Tuple, Unit};
+ | ^^^^^^ `Struct` reimported here
+ |
+ = note: `Struct` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use E::{Struct as OtherStruct, Tuple, Unit};
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0255]: the name `Tuple` is defined multiple times
+ --> $DIR/variant-namespacing.rs:38:21
+ |
+LL | type Tuple = u8;
+ | ---------------- previous definition of the type `Tuple` here
+...
+LL | pub use E::{Struct, Tuple, Unit};
+ | ^^^^^ `Tuple` reimported here
+ |
+ = note: `Tuple` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use E::{Struct, Tuple as OtherTuple, Unit};
+ | ^^^^^^^^^^^^^^^^^^^
+
+error[E0255]: the name `Unit` is defined multiple times
+ --> $DIR/variant-namespacing.rs:38:28
+ |
+LL | type Unit = u8;
+ | --------------- previous definition of the type `Unit` here
+...
+LL | pub use E::{Struct, Tuple, Unit};
+ | ^^^^ `Unit` reimported here
+ |
+ = note: `Unit` must be defined only once in the type namespace of this module
+help: You can use `as` to change the binding name of the import
+ |
+LL | pub use E::{Struct, Tuple, Unit as OtherUnit};
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0255`.
diff --git a/src/test/compile-fail/variant-size-differences.rs b/src/test/ui/variants/variant-size-differences.rs
similarity index 100%
rename from src/test/compile-fail/variant-size-differences.rs
rename to src/test/ui/variants/variant-size-differences.rs
diff --git a/src/test/ui/variants/variant-size-differences.stderr b/src/test/ui/variants/variant-size-differences.stderr
new file mode 100644
index 0000000..a41a5c1
--- /dev/null
+++ b/src/test/ui/variants/variant-size-differences.stderr
@@ -0,0 +1,14 @@
+error: enum variant is more than three times larger (1024 bytes) than the next largest
+ --> $DIR/variant-size-differences.rs:15:5
+ |
+LL | VBig([u8; 1024]), //~ ERROR variant is more than three times larger
+ | ^^^^^^^^^^^^^^^^
+ |
+note: lint level defined here
+ --> $DIR/variant-size-differences.rs:11:9
+ |
+LL | #![deny(variant_size_differences)]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/variant-used-as-type.rs b/src/test/ui/variants/variant-used-as-type.rs
similarity index 100%
rename from src/test/compile-fail/variant-used-as-type.rs
rename to src/test/ui/variants/variant-used-as-type.rs
diff --git a/src/test/ui/variants/variant-used-as-type.stderr b/src/test/ui/variants/variant-used-as-type.stderr
new file mode 100644
index 0000000..972fe8a
--- /dev/null
+++ b/src/test/ui/variants/variant-used-as-type.stderr
@@ -0,0 +1,31 @@
+error[E0573]: expected type, found variant `Ty::A`
+ --> $DIR/variant-used-as-type.rs:17:7
+ |
+LL | B(Ty::A),
+ | ^^^^^ not a type
+help: you can try using the variant's enum
+ |
+LL | B(Ty),
+ | ^^
+help: you can try using the variant's enum
+ |
+LL | B(E),
+ | ^
+
+error[E0573]: expected type, found variant `E::A`
+ --> $DIR/variant-used-as-type.rs:27:6
+ |
+LL | impl E::A {}
+ | ^^^^ not a type
+help: you can try using the variant's enum
+ |
+LL | impl Ty {}
+ | ^^
+help: you can try using the variant's enum
+ |
+LL | impl E {}
+ | ^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0573`.
diff --git a/src/test/compile-fail/vec-macro-with-comma-only.rs b/src/test/ui/vec/vec-macro-with-comma-only.rs
similarity index 100%
rename from src/test/compile-fail/vec-macro-with-comma-only.rs
rename to src/test/ui/vec/vec-macro-with-comma-only.rs
diff --git a/src/test/ui/vec/vec-macro-with-comma-only.stderr b/src/test/ui/vec/vec-macro-with-comma-only.stderr
new file mode 100644
index 0000000..f5341cc
--- /dev/null
+++ b/src/test/ui/vec/vec-macro-with-comma-only.stderr
@@ -0,0 +1,8 @@
+error: no rules expected the token `,`
+ --> $DIR/vec-macro-with-comma-only.rs:12:10
+ |
+LL | vec![,]; //~ ERROR no rules expected the token `,`
+ | ^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr
new file mode 100644
index 0000000..fd7843f
--- /dev/null
+++ b/src/test/ui/vec/vec-mut-iter-borrow.nll.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `xs` as mutable more than once at a time
+ --> $DIR/vec-mut-iter-borrow.rs:15:9
+ |
+LL | for x in &mut xs {
+ | -------
+ | |
+ | first mutable borrow occurs here
+ | borrow used here in later iteration of loop
+LL | xs.push(1) //~ ERROR cannot borrow `xs`
+ | ^^ second mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/vec-mut-iter-borrow.rs b/src/test/ui/vec/vec-mut-iter-borrow.rs
similarity index 100%
rename from src/test/compile-fail/vec-mut-iter-borrow.rs
rename to src/test/ui/vec/vec-mut-iter-borrow.rs
diff --git a/src/test/ui/vec/vec-mut-iter-borrow.stderr b/src/test/ui/vec/vec-mut-iter-borrow.stderr
new file mode 100644
index 0000000..18fdf2c
--- /dev/null
+++ b/src/test/ui/vec/vec-mut-iter-borrow.stderr
@@ -0,0 +1,14 @@
+error[E0499]: cannot borrow `xs` as mutable more than once at a time
+ --> $DIR/vec-mut-iter-borrow.rs:15:9
+ |
+LL | for x in &mut xs {
+ | --
+ | ||
+ | |first borrow ends here
+ | first mutable borrow occurs here
+LL | xs.push(1) //~ ERROR cannot borrow `xs`
+ | ^^ second mutable borrow occurs here
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0499`.
diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/ui/vec/vec-res-add.rs
similarity index 100%
rename from src/test/compile-fail/vec-res-add.rs
rename to src/test/ui/vec/vec-res-add.rs
diff --git a/src/test/ui/vec/vec-res-add.stderr b/src/test/ui/vec/vec-res-add.stderr
new file mode 100644
index 0000000..62d3f04
--- /dev/null
+++ b/src/test/ui/vec/vec-res-add.stderr
@@ -0,0 +1,11 @@
+error[E0369]: binary operation `+` cannot be applied to type `std::vec::Vec<r>`
+ --> $DIR/vec-res-add.rs:26:13
+ |
+LL | let k = i + j;
+ | ^^^^^
+ |
+ = note: an implementation of `std::ops::Add` might be missing for `std::vec::Vec<r>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0369`.
diff --git a/src/test/compile-fail/vector-cast-weirdness.rs b/src/test/ui/vector-cast-weirdness.rs
similarity index 100%
rename from src/test/compile-fail/vector-cast-weirdness.rs
rename to src/test/ui/vector-cast-weirdness.rs
diff --git a/src/test/ui/vector-cast-weirdness.stderr b/src/test/ui/vector-cast-weirdness.stderr
new file mode 100644
index 0000000..a096fee
--- /dev/null
+++ b/src/test/ui/vector-cast-weirdness.stderr
@@ -0,0 +1,9 @@
+error[E0606]: casting `&mut [u8; 2]` as `*mut u8` is invalid
+ --> $DIR/vector-cast-weirdness.rs:31:23
+ |
+LL | let p1: *mut u8 = &mut x1.y as *mut _; //~ ERROR casting
+ | ^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0606`.
diff --git a/src/test/compile-fail/vtable-res-trait-param.rs b/src/test/ui/vtable-res-trait-param.rs
similarity index 100%
rename from src/test/compile-fail/vtable-res-trait-param.rs
rename to src/test/ui/vtable-res-trait-param.rs
diff --git a/src/test/ui/vtable-res-trait-param.stderr b/src/test/ui/vtable-res-trait-param.stderr
new file mode 100644
index 0000000..0d0e820
--- /dev/null
+++ b/src/test/ui/vtable-res-trait-param.stderr
@@ -0,0 +1,9 @@
+error[E0277]: the trait bound `{integer}: TraitA` is not satisfied
+ --> $DIR/vtable-res-trait-param.rs:27:7
+ |
+LL | b.gimme_an_a(y) //~ ERROR `{integer}: TraitA` is not satisfied
+ | ^^^^^^^^^^ the trait `TraitA` is not implemented for `{integer}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/walk-struct-literal-with.nll.stderr b/src/test/ui/walk-struct-literal-with.nll.stderr
new file mode 100644
index 0000000..6684738
--- /dev/null
+++ b/src/test/ui/walk-struct-literal-with.nll.stderr
@@ -0,0 +1,13 @@
+error[E0382]: borrow of moved value: `start.test`
+ --> $DIR/walk-struct-literal-with.rs:26:20
+ |
+LL | let end = Mine{other_val:1, ..start.make_string_bar()};
+ | ----- value moved here
+LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test`
+ | ^^^^^^^^^^ value borrowed here after move
+ |
+ = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/walk-struct-literal-with.rs b/src/test/ui/walk-struct-literal-with.rs
similarity index 100%
rename from src/test/compile-fail/walk-struct-literal-with.rs
rename to src/test/ui/walk-struct-literal-with.rs
diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr
new file mode 100644
index 0000000..751e41f
--- /dev/null
+++ b/src/test/ui/walk-struct-literal-with.stderr
@@ -0,0 +1,13 @@
+error[E0382]: use of moved value: `start.test`
+ --> $DIR/walk-struct-literal-with.rs:26:20
+ |
+LL | let end = Mine{other_val:1, ..start.make_string_bar()};
+ | ----- value moved here
+LL | println!("{}", start.test); //~ ERROR use of moved value: `start.test`
+ | ^^^^^^^^^^ value used here after move
+ |
+ = note: move occurs because `start` has type `Mine`, which does not implement the `Copy` trait
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0382`.
diff --git a/src/test/compile-fail/warn-path-statement.rs b/src/test/ui/warn-path-statement.rs
similarity index 100%
rename from src/test/compile-fail/warn-path-statement.rs
rename to src/test/ui/warn-path-statement.rs
diff --git a/src/test/ui/warn-path-statement.stderr b/src/test/ui/warn-path-statement.stderr
new file mode 100644
index 0000000..44b194b
--- /dev/null
+++ b/src/test/ui/warn-path-statement.stderr
@@ -0,0 +1,10 @@
+error: path statement with no effect
+ --> $DIR/warn-path-statement.rs:15:5
+ |
+LL | x; //~ ERROR path statement with no effect
+ | ^^
+ |
+ = note: requested on the command line with `-D path-statements`
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/wf-array-elem-sized.rs b/src/test/ui/wf/wf-array-elem-sized.rs
similarity index 100%
rename from src/test/compile-fail/wf-array-elem-sized.rs
rename to src/test/ui/wf/wf-array-elem-sized.rs
diff --git a/src/test/ui/wf/wf-array-elem-sized.stderr b/src/test/ui/wf/wf-array-elem-sized.stderr
new file mode 100644
index 0000000..362b286
--- /dev/null
+++ b/src/test/ui/wf/wf-array-elem-sized.stderr
@@ -0,0 +1,13 @@
+error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
+ --> $DIR/wf-array-elem-sized.rs:17:5
+ |
+LL | foo: [[u8]], //~ ERROR E0277
+ | ^^^^^^^^^^^ doesn't have a size known at compile-time
+ |
+ = help: the trait `std::marker::Sized` is not implemented for `[u8]`
+ = note: to learn more, visit <https://doc.rust-lang.org/book/second-edition/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait>
+ = note: slice and array elements must have `Sized` type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-const-type.rs b/src/test/ui/wf/wf-const-type.rs
similarity index 100%
rename from src/test/compile-fail/wf-const-type.rs
rename to src/test/ui/wf/wf-const-type.rs
diff --git a/src/test/ui/wf/wf-const-type.stderr b/src/test/ui/wf/wf-const-type.stderr
new file mode 100644
index 0000000..1c07824
--- /dev/null
+++ b/src/test/ui/wf/wf-const-type.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied
+ --> $DIR/wf-const-type.rs:20:1
+ |
+LL | const FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy`
+ |
+ = note: required because of the requirements on the impl of `std::marker::Copy` for `std::option::Option<NotCopy>`
+note: required by `IsCopy`
+ --> $DIR/wf-const-type.rs:17:1
+ |
+LL | struct IsCopy<T:Copy> { t: T }
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-enum-bound.rs b/src/test/ui/wf/wf-enum-bound.rs
similarity index 100%
rename from src/test/compile-fail/wf-enum-bound.rs
rename to src/test/ui/wf/wf-enum-bound.rs
diff --git a/src/test/ui/wf/wf-enum-bound.stderr b/src/test/ui/wf/wf-enum-bound.stderr
new file mode 100644
index 0000000..3313eb2
--- /dev/null
+++ b/src/test/ui/wf/wf-enum-bound.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-enum-bound.rs:19:1
+ |
+LL | / enum SomeEnum<T,U> //~ ERROR E0277
+LL | | where T: ExtraCopy<U>
+LL | | {
+LL | | SomeVariant(T,U)
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-enum-bound.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-enum-fields-struct-variant.rs b/src/test/ui/wf/wf-enum-fields-struct-variant.rs
similarity index 100%
rename from src/test/compile-fail/wf-enum-fields-struct-variant.rs
rename to src/test/ui/wf/wf-enum-fields-struct-variant.rs
diff --git a/src/test/ui/wf/wf-enum-fields-struct-variant.stderr b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr
new file mode 100644
index 0000000..86a605f
--- /dev/null
+++ b/src/test/ui/wf/wf-enum-fields-struct-variant.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
+ --> $DIR/wf-enum-fields-struct-variant.rs:23:9
+ |
+LL | f: IsCopy<A> //~ ERROR E0277
+ | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
+ |
+ = help: consider adding a `where A: std::marker::Copy` bound
+note: required by `IsCopy`
+ --> $DIR/wf-enum-fields-struct-variant.rs:17:1
+ |
+LL | struct IsCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-enum-fields.rs b/src/test/ui/wf/wf-enum-fields.rs
similarity index 100%
rename from src/test/compile-fail/wf-enum-fields.rs
rename to src/test/ui/wf/wf-enum-fields.rs
diff --git a/src/test/ui/wf/wf-enum-fields.stderr b/src/test/ui/wf/wf-enum-fields.stderr
new file mode 100644
index 0000000..5aa263f
--- /dev/null
+++ b/src/test/ui/wf/wf-enum-fields.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
+ --> $DIR/wf-enum-fields.rs:22:17
+ |
+LL | SomeVariant(IsCopy<A>) //~ ERROR E0277
+ | ^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
+ |
+ = help: consider adding a `where A: std::marker::Copy` bound
+note: required by `IsCopy`
+ --> $DIR/wf-enum-fields.rs:17:1
+ |
+LL | struct IsCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-fn-where-clause.rs b/src/test/ui/wf/wf-fn-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/wf-fn-where-clause.rs
rename to src/test/ui/wf/wf-fn-where-clause.rs
diff --git a/src/test/ui/wf/wf-fn-where-clause.stderr b/src/test/ui/wf/wf-fn-where-clause.stderr
new file mode 100644
index 0000000..5f0f982
--- /dev/null
+++ b/src/test/ui/wf/wf-fn-where-clause.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-fn-where-clause.rs:19:1
+ |
+LL | / fn foo<T,U>() where T: ExtraCopy<U> //~ ERROR E0277
+LL | | {
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-fn-where-clause.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-impl-associated-type-region.rs b/src/test/ui/wf/wf-impl-associated-type-region.rs
similarity index 100%
rename from src/test/compile-fail/wf-impl-associated-type-region.rs
rename to src/test/ui/wf/wf-impl-associated-type-region.rs
diff --git a/src/test/ui/wf/wf-impl-associated-type-region.stderr b/src/test/ui/wf/wf-impl-associated-type-region.stderr
new file mode 100644
index 0000000..f238b3c
--- /dev/null
+++ b/src/test/ui/wf/wf-impl-associated-type-region.stderr
@@ -0,0 +1,17 @@
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/wf-impl-associated-type-region.rs:20:5
+ |
+LL | impl<'a, T> Foo<'a> for T {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | type Bar = &'a T; //~ ERROR E0309
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'a T` does not outlive the data it points at
+ --> $DIR/wf-impl-associated-type-region.rs:20:5
+ |
+LL | type Bar = &'a T; //~ ERROR E0309
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/wf-impl-associated-type-trait.rs b/src/test/ui/wf/wf-impl-associated-type-trait.rs
similarity index 100%
rename from src/test/compile-fail/wf-impl-associated-type-trait.rs
rename to src/test/ui/wf/wf-impl-associated-type-trait.rs
diff --git a/src/test/ui/wf/wf-impl-associated-type-trait.stderr b/src/test/ui/wf/wf-impl-associated-type-trait.stderr
new file mode 100644
index 0000000..595c5b4
--- /dev/null
+++ b/src/test/ui/wf/wf-impl-associated-type-trait.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `T: MyHash` is not satisfied
+ --> $DIR/wf-impl-associated-type-trait.rs:27:5
+ |
+LL | type Bar = MySet<T>;
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `MyHash` is not implemented for `T`
+ |
+ = help: consider adding a `where T: MyHash` bound
+note: required by `MySet`
+ --> $DIR/wf-impl-associated-type-trait.rs:18:1
+ |
+LL | pub struct MySet<T:MyHash> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-in-fn-arg.rs b/src/test/ui/wf/wf-in-fn-arg.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-fn-arg.rs
rename to src/test/ui/wf/wf-in-fn-arg.rs
diff --git a/src/test/ui/wf/wf-in-fn-arg.stderr b/src/test/ui/wf/wf-in-fn-arg.stderr
new file mode 100644
index 0000000..f82bc16
--- /dev/null
+++ b/src/test/ui/wf/wf-in-fn-arg.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-in-fn-arg.rs:20:1
+ |
+LL | / fn bar<T>(_: &MustBeCopy<T>) //~ ERROR E0277
+LL | | {
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `MustBeCopy`
+ --> $DIR/wf-in-fn-arg.rs:16:1
+ |
+LL | struct MustBeCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-in-fn-ret.rs b/src/test/ui/wf/wf-in-fn-ret.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-fn-ret.rs
rename to src/test/ui/wf/wf-in-fn-ret.rs
diff --git a/src/test/ui/wf/wf-in-fn-ret.stderr b/src/test/ui/wf/wf-in-fn-ret.stderr
new file mode 100644
index 0000000..357199c
--- /dev/null
+++ b/src/test/ui/wf/wf-in-fn-ret.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-in-fn-ret.rs:20:1
+ |
+LL | / fn bar<T>() -> MustBeCopy<T> //~ ERROR E0277
+LL | | {
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `MustBeCopy`
+ --> $DIR/wf-in-fn-ret.rs:16:1
+ |
+LL | struct MustBeCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-in-fn-type-arg.rs b/src/test/ui/wf/wf-in-fn-type-arg.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-fn-type-arg.rs
rename to src/test/ui/wf/wf-in-fn-type-arg.rs
diff --git a/src/test/ui/wf/wf-in-fn-type-arg.stderr b/src/test/ui/wf/wf-in-fn-type-arg.stderr
new file mode 100644
index 0000000..7e3d22b
--- /dev/null
+++ b/src/test/ui/wf/wf-in-fn-type-arg.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-in-fn-type-arg.rs:19:5
+ |
+LL | x: fn(MustBeCopy<T>) //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `MustBeCopy`
+ --> $DIR/wf-in-fn-type-arg.rs:13:1
+ |
+LL | struct MustBeCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-in-fn-type-ret.rs b/src/test/ui/wf/wf-in-fn-type-ret.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-fn-type-ret.rs
rename to src/test/ui/wf/wf-in-fn-type-ret.rs
diff --git a/src/test/ui/wf/wf-in-fn-type-ret.stderr b/src/test/ui/wf/wf-in-fn-type-ret.stderr
new file mode 100644
index 0000000..5d59253
--- /dev/null
+++ b/src/test/ui/wf/wf-in-fn-type-ret.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-in-fn-type-ret.rs:19:5
+ |
+LL | x: fn() -> MustBeCopy<T> //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `MustBeCopy`
+ --> $DIR/wf-in-fn-type-ret.rs:13:1
+ |
+LL | struct MustBeCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-in-fn-type-static.rs b/src/test/ui/wf/wf-in-fn-type-static.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-fn-type-static.rs
rename to src/test/ui/wf/wf-in-fn-type-static.rs
diff --git a/src/test/ui/wf/wf-in-fn-type-static.stderr b/src/test/ui/wf/wf-in-fn-type-static.stderr
new file mode 100644
index 0000000..0013331
--- /dev/null
+++ b/src/test/ui/wf/wf-in-fn-type-static.stderr
@@ -0,0 +1,33 @@
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/wf-in-fn-type-static.rs:23:5
+ |
+LL | struct Foo<T> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // needs T: 'static
+LL | x: fn() -> &'static T //~ ERROR E0310
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'static T` does not outlive the data it points at
+ --> $DIR/wf-in-fn-type-static.rs:23:5
+ |
+LL | x: fn() -> &'static T //~ ERROR E0310
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/wf-in-fn-type-static.rs:28:5
+ |
+LL | struct Bar<T> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // needs T: Copy
+LL | x: fn(&'static T) //~ ERROR E0310
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'static T` does not outlive the data it points at
+ --> $DIR/wf-in-fn-type-static.rs:28:5
+ |
+LL | x: fn(&'static T) //~ ERROR E0310
+ | ^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/wf-in-fn-where-clause.rs b/src/test/ui/wf/wf-in-fn-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-fn-where-clause.rs
rename to src/test/ui/wf/wf-in-fn-where-clause.rs
diff --git a/src/test/ui/wf/wf-in-fn-where-clause.stderr b/src/test/ui/wf/wf-in-fn-where-clause.stderr
new file mode 100644
index 0000000..76693ea
--- /dev/null
+++ b/src/test/ui/wf/wf-in-fn-where-clause.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-in-fn-where-clause.rs:19:1
+ |
+LL | / fn bar<T,U>() //~ ERROR E0277
+LL | | where T: MustBeCopy<U>
+LL | | {
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `MustBeCopy`
+ --> $DIR/wf-in-fn-where-clause.rs:16:1
+ |
+LL | trait MustBeCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-in-obj-type-static.rs b/src/test/ui/wf/wf-in-obj-type-static.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-obj-type-static.rs
rename to src/test/ui/wf/wf-in-obj-type-static.rs
diff --git a/src/test/ui/wf/wf-in-obj-type-static.stderr b/src/test/ui/wf/wf-in-obj-type-static.stderr
new file mode 100644
index 0000000..5cbb4be
--- /dev/null
+++ b/src/test/ui/wf/wf-in-obj-type-static.stderr
@@ -0,0 +1,18 @@
+error[E0310]: the parameter type `T` may not live long enough
+ --> $DIR/wf-in-obj-type-static.rs:24:5
+ |
+LL | struct Foo<T> {
+ | - help: consider adding an explicit lifetime bound `T: 'static`...
+LL | // needs T: 'static
+LL | x: Object<&'static T> //~ ERROR E0310
+ | ^^^^^^^^^^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'static T` does not outlive the data it points at
+ --> $DIR/wf-in-obj-type-static.rs:24:5
+ |
+LL | x: Object<&'static T> //~ ERROR E0310
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/src/test/compile-fail/wf-in-obj-type-trait.rs b/src/test/ui/wf/wf-in-obj-type-trait.rs
similarity index 100%
rename from src/test/compile-fail/wf-in-obj-type-trait.rs
rename to src/test/ui/wf/wf-in-obj-type-trait.rs
diff --git a/src/test/ui/wf/wf-in-obj-type-trait.stderr b/src/test/ui/wf/wf-in-obj-type-trait.stderr
new file mode 100644
index 0000000..93af991
--- /dev/null
+++ b/src/test/ui/wf/wf-in-obj-type-trait.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-in-obj-type-trait.rs:21:5
+ |
+LL | x: Object<MustBeCopy<T>> //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `MustBeCopy`
+ --> $DIR/wf-in-obj-type-trait.rs:15:1
+ |
+LL | struct MustBeCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-inherent-impl-method-where-clause.rs b/src/test/ui/wf/wf-inherent-impl-method-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/wf-inherent-impl-method-where-clause.rs
rename to src/test/ui/wf/wf-inherent-impl-method-where-clause.rs
diff --git a/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr
new file mode 100644
index 0000000..25ec419
--- /dev/null
+++ b/src/test/ui/wf/wf-inherent-impl-method-where-clause.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-inherent-impl-method-where-clause.rs:22:5
+ |
+LL | / fn foo(self) where T: ExtraCopy<U> //~ ERROR E0277
+LL | | {}
+ | |______^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-inherent-impl-method-where-clause.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-inherent-impl-where-clause.rs b/src/test/ui/wf/wf-inherent-impl-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/wf-inherent-impl-where-clause.rs
rename to src/test/ui/wf/wf-inherent-impl-where-clause.rs
diff --git a/src/test/ui/wf/wf-inherent-impl-where-clause.stderr b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr
new file mode 100644
index 0000000..3c5c557
--- /dev/null
+++ b/src/test/ui/wf/wf-inherent-impl-where-clause.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-inherent-impl-where-clause.rs:21:1
+ |
+LL | / impl<T,U> Foo<T,U> where T: ExtraCopy<U> //~ ERROR E0277
+LL | | {
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-inherent-impl-where-clause.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr
new file mode 100644
index 0000000..48a68bf
--- /dev/null
+++ b/src/test/ui/wf/wf-misc-methods-issue-28609.nll.stderr
@@ -0,0 +1,111 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:32:31
+ |
+LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough
+ | ^^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 30:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:30:1
+ |
+LL | / fn return_dangling_pointer_inherent(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error[E0597]: `four` does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:45:19
+ |
+LL | s.bomb = Some(&four); //~ ERROR does not live long enough
+ | ^^^^^ borrowed value does not live long enough
+LL | &s
+LL | }
+ | - `four` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 42:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:42:1
+ |
+LL | / fn return_dangling_pointer_coerce(s: S2) -> &u32 {
+LL | | let four = 4;
+LL | | let mut s = s;
+LL | | s.bomb = Some(&four); //~ ERROR does not live long enough
+LL | | &s
+LL | | }
+ | |_^
+
+error[E0597]: `four` does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:52:19
+ |
+LL | s.bomb = Some(&four); //~ ERROR does not live long enough
+ | ^^^^^ borrowed value does not live long enough
+LL | &*s
+LL | }
+ | - `four` dropped here while still borrowed
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 49:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:49:1
+ |
+LL | / fn return_dangling_pointer_unary_op(s: S2) -> &u32 {
+LL | | let four = 4;
+LL | | let mut s = s;
+LL | | s.bomb = Some(&four); //~ ERROR does not live long enough
+LL | | &*s
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:63:15
+ |
+LL | s << &mut 3 //~ ERROR does not live long enough
+ | ^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 61:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:61:1
+ |
+LL | / fn return_dangling_pointer_binary_op(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | s << &mut 3 //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:68:16
+ |
+LL | s.shl(&mut 3) //~ ERROR does not live long enough
+ | ^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 66:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:66:1
+ |
+LL | / fn return_dangling_pointer_method(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | s.shl(&mut 3) //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:73:21
+ |
+LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough
+ | ^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 71:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:71:1
+ |
+LL | / fn return_dangling_pointer_ufcs(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | S2::shl(s, &mut 3) //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/wf-misc-methods-issue-28609.rs b/src/test/ui/wf/wf-misc-methods-issue-28609.rs
similarity index 100%
rename from src/test/compile-fail/wf-misc-methods-issue-28609.rs
rename to src/test/ui/wf/wf-misc-methods-issue-28609.rs
diff --git a/src/test/ui/wf/wf-misc-methods-issue-28609.stderr b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr
new file mode 100644
index 0000000..352697e
--- /dev/null
+++ b/src/test/ui/wf/wf-misc-methods-issue-28609.stderr
@@ -0,0 +1,111 @@
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:32:31
+ |
+LL | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough
+ | ^^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 30:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:30:1
+ |
+LL | / fn return_dangling_pointer_inherent(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | s.transmute_inherent(&mut 42) //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error[E0597]: `four` does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:45:20
+ |
+LL | s.bomb = Some(&four); //~ ERROR does not live long enough
+ | ^^^^ borrowed value does not live long enough
+LL | &s
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 42:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:42:1
+ |
+LL | / fn return_dangling_pointer_coerce(s: S2) -> &u32 {
+LL | | let four = 4;
+LL | | let mut s = s;
+LL | | s.bomb = Some(&four); //~ ERROR does not live long enough
+LL | | &s
+LL | | }
+ | |_^
+
+error[E0597]: `four` does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:52:20
+ |
+LL | s.bomb = Some(&four); //~ ERROR does not live long enough
+ | ^^^^ borrowed value does not live long enough
+LL | &*s
+LL | }
+ | - borrowed value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 49:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:49:1
+ |
+LL | / fn return_dangling_pointer_unary_op(s: S2) -> &u32 {
+LL | | let four = 4;
+LL | | let mut s = s;
+LL | | s.bomb = Some(&four); //~ ERROR does not live long enough
+LL | | &*s
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:63:15
+ |
+LL | s << &mut 3 //~ ERROR does not live long enough
+ | ^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 61:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:61:1
+ |
+LL | / fn return_dangling_pointer_binary_op(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | s << &mut 3 //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:68:16
+ |
+LL | s.shl(&mut 3) //~ ERROR does not live long enough
+ | ^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 66:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:66:1
+ |
+LL | / fn return_dangling_pointer_method(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | s.shl(&mut 3) //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error[E0597]: borrowed value does not live long enough
+ --> $DIR/wf-misc-methods-issue-28609.rs:73:21
+ |
+LL | S2::shl(s, &mut 3) //~ ERROR does not live long enough
+ | ^ temporary value does not live long enough
+LL | }
+ | - temporary value only lives until here
+ |
+note: borrowed value must be valid for the anonymous lifetime #1 defined on the function body at 71:1...
+ --> $DIR/wf-misc-methods-issue-28609.rs:71:1
+ |
+LL | / fn return_dangling_pointer_ufcs(s: S2) -> &u32 {
+LL | | let s = s;
+LL | | S2::shl(s, &mut 3) //~ ERROR does not live long enough
+LL | | }
+ | |_^
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0597`.
diff --git a/src/test/compile-fail/wf-object-safe.rs b/src/test/ui/wf/wf-object-safe.rs
similarity index 100%
rename from src/test/compile-fail/wf-object-safe.rs
rename to src/test/ui/wf/wf-object-safe.rs
diff --git a/src/test/ui/wf/wf-object-safe.stderr b/src/test/ui/wf/wf-object-safe.stderr
new file mode 100644
index 0000000..3d42c52
--- /dev/null
+++ b/src/test/ui/wf/wf-object-safe.stderr
@@ -0,0 +1,11 @@
+error[E0038]: the trait `A` cannot be made into an object
+ --> $DIR/wf-object-safe.rs:19:13
+ |
+LL | let _x: &A; //~ ERROR E0038
+ | ^^ the trait `A` cannot be made into an object
+ |
+ = note: method `foo` references the `Self` type in its arguments or return type
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0038`.
diff --git a/src/test/compile-fail/wf-outlives-ty-in-fn-or-trait.rs b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs
similarity index 100%
rename from src/test/compile-fail/wf-outlives-ty-in-fn-or-trait.rs
rename to src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.rs
diff --git a/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
new file mode 100644
index 0000000..9a8c631
--- /dev/null
+++ b/src/test/ui/wf/wf-outlives-ty-in-fn-or-trait.stderr
@@ -0,0 +1,31 @@
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:21:5
+ |
+LL | struct Foo<'a,T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | f: &'a fn(T),
+ | ^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'a fn(T)` does not outlive the data it points at
+ --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:21:5
+ |
+LL | f: &'a fn(T),
+ | ^^^^^^^^^^^^
+
+error[E0309]: the parameter type `T` may not live long enough
+ --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:26:5
+ |
+LL | struct Bar<'a,T> {
+ | - help: consider adding an explicit lifetime bound `T: 'a`...
+LL | f: &'a Trait<T>,
+ | ^^^^^^^^^^^^^^^
+ |
+note: ...so that the reference type `&'a (dyn Trait<T> + 'a)` does not outlive the data it points at
+ --> $DIR/wf-outlives-ty-in-fn-or-trait.rs:26:5
+ |
+LL | f: &'a Trait<T>,
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/ui/wf/wf-static-method.nll.stderr b/src/test/ui/wf/wf-static-method.nll.stderr
new file mode 100644
index 0000000..e563a4f
--- /dev/null
+++ b/src/test/ui/wf/wf-static-method.nll.stderr
@@ -0,0 +1,54 @@
+warning: not reporting region error due to nll
+ --> $DIR/wf-static-method.rs:27:9
+ |
+LL | u //~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/wf-static-method.rs:36:18
+ |
+LL | let me = Self::make_me(); //~ ERROR lifetime bound not satisfied
+ | ^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/wf-static-method.rs:43:9
+ |
+LL | u //~ ERROR E0312
+ | ^
+
+warning: not reporting region error due to nll
+ --> $DIR/wf-static-method.rs:51:5
+ |
+LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^^^^^^^^
+
+warning: not reporting region error due to nll
+ --> $DIR/wf-static-method.rs:55:5
+ |
+LL | <IndirectEvil>::static_evil(b)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: unsatisfied lifetime constraints
+ --> $DIR/wf-static-method.rs:27:9
+ |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+...
+LL | u //~ ERROR E0312
+ | ^ returning this value requires that `'b` must outlive `'a`
+
+error: unsatisfied lifetime constraints
+ --> $DIR/wf-static-method.rs:43:9
+ |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+ | -- -- lifetime `'b` defined here
+ | |
+ | lifetime `'a` defined here
+LL | fn inherent_evil(u: &'b u32) -> &'a u32 {
+LL | u //~ ERROR E0312
+ | ^ returning this value requires that `'b` must outlive `'a`
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/wf-static-method.rs b/src/test/ui/wf/wf-static-method.rs
similarity index 100%
rename from src/test/compile-fail/wf-static-method.rs
rename to src/test/ui/wf/wf-static-method.rs
diff --git a/src/test/ui/wf/wf-static-method.stderr b/src/test/ui/wf/wf-static-method.stderr
new file mode 100644
index 0000000..0de2d8e
--- /dev/null
+++ b/src/test/ui/wf/wf-static-method.stderr
@@ -0,0 +1,109 @@
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/wf-static-method.rs:27:9
+ |
+LL | u //~ ERROR E0312
+ | ^
+ |
+note: ...the reference is valid for the lifetime 'a as defined on the impl at 24:6...
+ --> $DIR/wf-static-method.rs:24:6
+ |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+ | ^^
+note: ...but the borrowed content is only valid for the lifetime 'b as defined on the impl at 24:10
+ --> $DIR/wf-static-method.rs:24:10
+ |
+LL | impl<'a, 'b> Foo<'a, 'b, Evil<'a, 'b>> for () {
+ | ^^
+
+error[E0478]: lifetime bound not satisfied
+ --> $DIR/wf-static-method.rs:36:18
+ |
+LL | let me = Self::make_me(); //~ ERROR lifetime bound not satisfied
+ | ^^^^^^^^^^^^^
+ |
+note: lifetime parameter instantiated with the lifetime 'b as defined on the impl at 33:10
+ --> $DIR/wf-static-method.rs:33:10
+ |
+LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
+ | ^^
+note: but lifetime parameter must outlive the lifetime 'a as defined on the impl at 33:6
+ --> $DIR/wf-static-method.rs:33:6
+ |
+LL | impl<'a, 'b> Foo<'a, 'b, ()> for IndirectEvil<'a, 'b> {
+ | ^^
+
+error[E0312]: lifetime of reference outlives lifetime of borrowed content...
+ --> $DIR/wf-static-method.rs:43:9
+ |
+LL | u //~ ERROR E0312
+ | ^
+ |
+note: ...the reference is valid for the lifetime 'a as defined on the impl at 41:6...
+ --> $DIR/wf-static-method.rs:41:6
+ |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+ | ^^
+note: ...but the borrowed content is only valid for the lifetime 'b as defined on the impl at 41:10
+ --> $DIR/wf-static-method.rs:41:10
+ |
+LL | impl<'a, 'b> Evil<'a, 'b> {
+ | ^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
+ --> $DIR/wf-static-method.rs:51:5
+ |
+LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 50:13...
+ --> $DIR/wf-static-method.rs:50:13
+ |
+LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/wf-static-method.rs:51:23
+ |
+LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime
+ | ^
+note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 50:9...
+ --> $DIR/wf-static-method.rs:50:9
+ |
+LL | fn evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/wf-static-method.rs:51:5
+ |
+LL | <()>::static_evil(b) //~ ERROR cannot infer an appropriate lifetime
+ | ^^^^^^^^^^^^^^^^^^^^
+
+error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'b` due to conflicting requirements
+ --> $DIR/wf-static-method.rs:55:5
+ |
+LL | <IndirectEvil>::static_evil(b)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+note: first, the lifetime cannot outlive the lifetime 'b as defined on the function body at 54:22...
+ --> $DIR/wf-static-method.rs:54:22
+ |
+LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/wf-static-method.rs:55:33
+ |
+LL | <IndirectEvil>::static_evil(b)
+ | ^
+note: but, the lifetime must be valid for the lifetime 'a as defined on the function body at 54:18...
+ --> $DIR/wf-static-method.rs:54:18
+ |
+LL | fn indirect_evil<'a, 'b>(b: &'b u32) -> &'a u32 {
+ | ^^
+note: ...so that reference does not outlive borrowed content
+ --> $DIR/wf-static-method.rs:55:5
+ |
+LL | <IndirectEvil>::static_evil(b)
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 5 previous errors
+
+Some errors occurred: E0312, E0478, E0495.
+For more information about an error, try `rustc --explain E0312`.
diff --git a/src/test/compile-fail/wf-static-type.rs b/src/test/ui/wf/wf-static-type.rs
similarity index 100%
rename from src/test/compile-fail/wf-static-type.rs
rename to src/test/ui/wf/wf-static-type.rs
diff --git a/src/test/ui/wf/wf-static-type.stderr b/src/test/ui/wf/wf-static-type.stderr
new file mode 100644
index 0000000..f76444c
--- /dev/null
+++ b/src/test/ui/wf/wf-static-type.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `NotCopy: std::marker::Copy` is not satisfied
+ --> $DIR/wf-static-type.rs:20:1
+ |
+LL | static FOO: IsCopy<Option<NotCopy>> = IsCopy { t: None };
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `NotCopy`
+ |
+ = note: required because of the requirements on the impl of `std::marker::Copy` for `std::option::Option<NotCopy>`
+note: required by `IsCopy`
+ --> $DIR/wf-static-type.rs:17:1
+ |
+LL | struct IsCopy<T:Copy> { t: T }
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-struct-bound.rs b/src/test/ui/wf/wf-struct-bound.rs
similarity index 100%
rename from src/test/compile-fail/wf-struct-bound.rs
rename to src/test/ui/wf/wf-struct-bound.rs
diff --git a/src/test/ui/wf/wf-struct-bound.stderr b/src/test/ui/wf/wf-struct-bound.stderr
new file mode 100644
index 0000000..397d860
--- /dev/null
+++ b/src/test/ui/wf/wf-struct-bound.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-struct-bound.rs:19:1
+ |
+LL | / struct SomeStruct<T,U> //~ ERROR E0277
+LL | | where T: ExtraCopy<U>
+LL | | {
+LL | | data: (T,U)
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-struct-bound.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-struct-field.rs b/src/test/ui/wf/wf-struct-field.rs
similarity index 100%
rename from src/test/compile-fail/wf-struct-field.rs
rename to src/test/ui/wf/wf-struct-field.rs
diff --git a/src/test/ui/wf/wf-struct-field.stderr b/src/test/ui/wf/wf-struct-field.stderr
new file mode 100644
index 0000000..48a03c7
--- /dev/null
+++ b/src/test/ui/wf/wf-struct-field.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `A: std::marker::Copy` is not satisfied
+ --> $DIR/wf-struct-field.rs:22:5
+ |
+LL | data: IsCopy<A> //~ ERROR E0277
+ | ^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `A`
+ |
+ = help: consider adding a `where A: std::marker::Copy` bound
+note: required by `IsCopy`
+ --> $DIR/wf-struct-field.rs:17:1
+ |
+LL | struct IsCopy<T:Copy> {
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-associated-type-bound.rs b/src/test/ui/wf/wf-trait-associated-type-bound.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-associated-type-bound.rs
rename to src/test/ui/wf/wf-trait-associated-type-bound.rs
diff --git a/src/test/ui/wf/wf-trait-associated-type-bound.stderr b/src/test/ui/wf/wf-trait-associated-type-bound.stderr
new file mode 100644
index 0000000..f09ba38
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-associated-type-bound.stderr
@@ -0,0 +1,18 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-trait-associated-type-bound.rs:19:1
+ |
+LL | / trait SomeTrait<T> { //~ ERROR E0277
+LL | | type Type1: ExtraCopy<T>;
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-trait-associated-type-bound.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-associated-type-region.rs b/src/test/ui/wf/wf-trait-associated-type-region.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-associated-type-region.rs
rename to src/test/ui/wf/wf-trait-associated-type-region.rs
diff --git a/src/test/ui/wf/wf-trait-associated-type-region.stderr b/src/test/ui/wf/wf-trait-associated-type-region.stderr
new file mode 100644
index 0000000..26d56f7
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-associated-type-region.stderr
@@ -0,0 +1,16 @@
+error[E0309]: the associated type `<Self as SomeTrait<'a>>::Type1` may not live long enough
+ --> $DIR/wf-trait-associated-type-region.rs:19:5
+ |
+LL | type Type2 = &'a Self::Type1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ |
+ = help: consider adding an explicit lifetime bound `<Self as SomeTrait<'a>>::Type1: 'a`...
+note: ...so that the reference type `&'a <Self as SomeTrait<'a>>::Type1` does not outlive the data it points at
+ --> $DIR/wf-trait-associated-type-region.rs:19:5
+ |
+LL | type Type2 = &'a Self::Type1;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0309`.
diff --git a/src/test/compile-fail/wf-trait-associated-type-trait.rs b/src/test/ui/wf/wf-trait-associated-type-trait.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-associated-type-trait.rs
rename to src/test/ui/wf/wf-trait-associated-type-trait.rs
diff --git a/src/test/ui/wf/wf-trait-associated-type-trait.stderr b/src/test/ui/wf/wf-trait-associated-type-trait.stderr
new file mode 100644
index 0000000..6bfca64
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-associated-type-trait.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `<Self as SomeTrait>::Type1: std::marker::Copy` is not satisfied
+ --> $DIR/wf-trait-associated-type-trait.rs:21:5
+ |
+LL | type Type2 = IsCopy<Self::Type1>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `<Self as SomeTrait>::Type1`
+ |
+ = help: consider adding a `where <Self as SomeTrait>::Type1: std::marker::Copy` bound
+note: required by `IsCopy`
+ --> $DIR/wf-trait-associated-type-trait.rs:17:1
+ |
+LL | struct IsCopy<T:Copy> { x: T }
+ | ^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-bound.rs b/src/test/ui/wf/wf-trait-bound.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-bound.rs
rename to src/test/ui/wf/wf-trait-bound.rs
diff --git a/src/test/ui/wf/wf-trait-bound.stderr b/src/test/ui/wf/wf-trait-bound.stderr
new file mode 100644
index 0000000..4c21959
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-bound.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `U: std::marker::Copy` is not satisfied
+ --> $DIR/wf-trait-bound.rs:19:1
+ |
+LL | / trait SomeTrait<T,U> //~ ERROR E0277
+LL | | where T: ExtraCopy<U>
+LL | | {
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `U`
+ |
+ = help: consider adding a `where U: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-trait-bound.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-default-fn-arg.rs b/src/test/ui/wf/wf-trait-default-fn-arg.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-default-fn-arg.rs
rename to src/test/ui/wf/wf-trait-default-fn-arg.rs
diff --git a/src/test/ui/wf/wf-trait-default-fn-arg.stderr b/src/test/ui/wf/wf-trait-default-fn-arg.stderr
new file mode 100644
index 0000000..5754fd7
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-default-fn-arg.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
+ --> $DIR/wf-trait-default-fn-arg.rs:21:5
+ |
+LL | / fn bar(&self, x: &Bar<Self>) {
+LL | | //~^ ERROR E0277
+LL | | //
+LL | | // Here, Eq ought to be implemented.
+LL | | }
+ | |_____^ the trait `std::cmp::Eq` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: std::cmp::Eq` bound
+note: required by `Bar`
+ --> $DIR/wf-trait-default-fn-arg.rs:18:1
+ |
+LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-default-fn-ret.rs b/src/test/ui/wf/wf-trait-default-fn-ret.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-default-fn-ret.rs
rename to src/test/ui/wf/wf-trait-default-fn-ret.rs
diff --git a/src/test/ui/wf/wf-trait-default-fn-ret.stderr b/src/test/ui/wf/wf-trait-default-fn-ret.stderr
new file mode 100644
index 0000000..28d690b
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-default-fn-ret.stderr
@@ -0,0 +1,21 @@
+error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
+ --> $DIR/wf-trait-default-fn-ret.rs:21:5
+ |
+LL | / fn bar(&self) -> Bar<Self> {
+LL | | //~^ ERROR E0277
+LL | | //
+LL | | // Here, Eq ought to be implemented.
+LL | | loop { }
+LL | | }
+ | |_____^ the trait `std::cmp::Eq` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: std::cmp::Eq` bound
+note: required by `Bar`
+ --> $DIR/wf-trait-default-fn-ret.rs:18:1
+ |
+LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-default-fn-where-clause.rs b/src/test/ui/wf/wf-trait-default-fn-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-default-fn-where-clause.rs
rename to src/test/ui/wf/wf-trait-default-fn-where-clause.rs
diff --git a/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr
new file mode 100644
index 0000000..c135f19
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-default-fn-where-clause.stderr
@@ -0,0 +1,20 @@
+error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
+ --> $DIR/wf-trait-default-fn-where-clause.rs:21:5
+ |
+LL | / fn bar<A>(&self) where A: Bar<Self> {
+LL | | //~^ ERROR E0277
+LL | | //
+LL | | // Here, Eq ought to be implemented.
+LL | | }
+ | |_____^ the trait `std::cmp::Eq` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: std::cmp::Eq` bound
+note: required by `Bar`
+ --> $DIR/wf-trait-default-fn-where-clause.rs:18:1
+ |
+LL | trait Bar<T:Eq+?Sized> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-fn-arg.rs b/src/test/ui/wf/wf-trait-fn-arg.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-fn-arg.rs
rename to src/test/ui/wf/wf-trait-fn-arg.rs
diff --git a/src/test/ui/wf/wf-trait-fn-arg.stderr b/src/test/ui/wf/wf-trait-fn-arg.stderr
new file mode 100644
index 0000000..6d624fc
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-fn-arg.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
+ --> $DIR/wf-trait-fn-arg.rs:20:5
+ |
+LL | fn bar(&self, x: &Bar<Self>);
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: std::cmp::Eq` bound
+note: required by `Bar`
+ --> $DIR/wf-trait-fn-arg.rs:17:1
+ |
+LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-fn-ret.rs b/src/test/ui/wf/wf-trait-fn-ret.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-fn-ret.rs
rename to src/test/ui/wf/wf-trait-fn-ret.rs
diff --git a/src/test/ui/wf/wf-trait-fn-ret.stderr b/src/test/ui/wf/wf-trait-fn-ret.stderr
new file mode 100644
index 0000000..dca26a6
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-fn-ret.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
+ --> $DIR/wf-trait-fn-ret.rs:20:5
+ |
+LL | fn bar(&self) -> &Bar<Self>;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: std::cmp::Eq` bound
+note: required by `Bar`
+ --> $DIR/wf-trait-fn-ret.rs:17:1
+ |
+LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-fn-where-clause.rs b/src/test/ui/wf/wf-trait-fn-where-clause.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-fn-where-clause.rs
rename to src/test/ui/wf/wf-trait-fn-where-clause.rs
diff --git a/src/test/ui/wf/wf-trait-fn-where-clause.stderr b/src/test/ui/wf/wf-trait-fn-where-clause.stderr
new file mode 100644
index 0000000..887f609
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-fn-where-clause.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `Self: std::cmp::Eq` is not satisfied
+ --> $DIR/wf-trait-fn-where-clause.rs:20:5
+ |
+LL | fn bar(&self) where Self: Sized, Bar<Self>: Copy;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Self`
+ |
+ = help: consider adding a `where Self: std::cmp::Eq` bound
+note: required by `Bar`
+ --> $DIR/wf-trait-fn-where-clause.rs:17:1
+ |
+LL | struct Bar<T:Eq+?Sized> { value: Box<T> }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/wf-trait-superbound.rs b/src/test/ui/wf/wf-trait-superbound.rs
similarity index 100%
rename from src/test/compile-fail/wf-trait-superbound.rs
rename to src/test/ui/wf/wf-trait-superbound.rs
diff --git a/src/test/ui/wf/wf-trait-superbound.stderr b/src/test/ui/wf/wf-trait-superbound.stderr
new file mode 100644
index 0000000..ac58dc7
--- /dev/null
+++ b/src/test/ui/wf/wf-trait-superbound.stderr
@@ -0,0 +1,17 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/wf-trait-superbound.rs:19:1
+ |
+LL | / trait SomeTrait<T>: ExtraCopy<T> { //~ ERROR E0277
+LL | | }
+ | |_^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `ExtraCopy`
+ --> $DIR/wf-trait-superbound.rs:17:1
+ |
+LL | trait ExtraCopy<T:Copy> { }
+ | ^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs
similarity index 100%
rename from src/test/compile-fail/where-clause-constraints-are-local-for-inherent-impl.rs
rename to src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs
diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr
new file mode 100644
index 0000000..0d6906a
--- /dev/null
+++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:23:9
+ |
+LL | require_copy(self.x);
+ | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `require_copy`
+ --> $DIR/where-clause-constraints-are-local-for-inherent-impl.rs:11:1
+ |
+LL | fn require_copy<T: Copy>(x: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs
similarity index 100%
rename from src/test/compile-fail/where-clause-constraints-are-local-for-trait-impl.rs
rename to src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs
diff --git a/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr
new file mode 100644
index 0000000..976cca7
--- /dev/null
+++ b/src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.stderr
@@ -0,0 +1,16 @@
+error[E0277]: the trait bound `T: std::marker::Copy` is not satisfied
+ --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:28:9
+ |
+LL | require_copy(self.x);
+ | ^^^^^^^^^^^^ the trait `std::marker::Copy` is not implemented for `T`
+ |
+ = help: consider adding a `where T: std::marker::Copy` bound
+note: required by `require_copy`
+ --> $DIR/where-clause-constraints-are-local-for-trait-impl.rs:11:1
+ |
+LL | fn require_copy<T: Copy>(x: T) {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-clause-method-substituion.rs b/src/test/ui/where-clauses/where-clause-method-substituion.rs
similarity index 100%
rename from src/test/compile-fail/where-clause-method-substituion.rs
rename to src/test/ui/where-clauses/where-clause-method-substituion.rs
diff --git a/src/test/ui/where-clauses/where-clause-method-substituion.stderr b/src/test/ui/where-clauses/where-clause-method-substituion.stderr
new file mode 100644
index 0000000..5cd4c39
--- /dev/null
+++ b/src/test/ui/where-clauses/where-clause-method-substituion.stderr
@@ -0,0 +1,9 @@
+error[E0277]: the trait bound `X: Foo<X>` is not satisfied
+ --> $DIR/where-clause-method-substituion.rs:30:7
+ |
+LL | 1.method::<X>();
+ | ^^^^^^ the trait `Foo<X>` is not implemented for `X`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-clauses-method-unsatisfied.rs b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs
similarity index 100%
rename from src/test/compile-fail/where-clauses-method-unsatisfied.rs
rename to src/test/ui/where-clauses/where-clauses-method-unsatisfied.rs
diff --git a/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr
new file mode 100644
index 0000000..eeb0b51
--- /dev/null
+++ b/src/test/ui/where-clauses/where-clauses-method-unsatisfied.stderr
@@ -0,0 +1,9 @@
+error[E0277]: the trait bound `Bar: std::cmp::Eq` is not satisfied
+ --> $DIR/where-clauses-method-unsatisfied.rs:28:7
+ |
+LL | x.equals(&x);
+ | ^^^^^^ the trait `std::cmp::Eq` is not implemented for `Bar`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/ui/where-clauses/where-clauses-unsatisfied.rs
similarity index 100%
rename from src/test/compile-fail/where-clauses-unsatisfied.rs
rename to src/test/ui/where-clauses/where-clauses-unsatisfied.rs
diff --git a/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr b/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr
new file mode 100644
index 0000000..dd04259
--- /dev/null
+++ b/src/test/ui/where-clauses/where-clauses-unsatisfied.stderr
@@ -0,0 +1,15 @@
+error[E0277]: the trait bound `Struct: std::cmp::Eq` is not satisfied
+ --> $DIR/where-clauses-unsatisfied.rs:16:10
+ |
+LL | drop(equal(&Struct, &Struct))
+ | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Struct`
+ |
+note: required by `equal`
+ --> $DIR/where-clauses-unsatisfied.rs:11:1
+ |
+LL | fn equal<T>(a: &T, b: &T) -> bool where T : Eq { a == b }
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-equality-constraints.rs b/src/test/ui/where-clauses/where-equality-constraints.rs
similarity index 100%
rename from src/test/compile-fail/where-equality-constraints.rs
rename to src/test/ui/where-clauses/where-equality-constraints.rs
diff --git a/src/test/ui/where-clauses/where-equality-constraints.stderr b/src/test/ui/where-clauses/where-equality-constraints.stderr
new file mode 100644
index 0000000..f2bcfac
--- /dev/null
+++ b/src/test/ui/where-clauses/where-equality-constraints.stderr
@@ -0,0 +1,14 @@
+error: equality constraints are not yet supported in where clauses (#20041)
+ --> $DIR/where-equality-constraints.rs:11:14
+ |
+LL | fn f() where u8 = u16 {}
+ | ^^^^^^^^
+
+error: equality constraints are not yet supported in where clauses (#20041)
+ --> $DIR/where-equality-constraints.rs:13:14
+ |
+LL | fn g() where for<'a> &'static (u8,) == u16, {}
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/compile-fail/where-for-self-2.rs b/src/test/ui/where-clauses/where-for-self-2.rs
similarity index 100%
rename from src/test/compile-fail/where-for-self-2.rs
rename to src/test/ui/where-clauses/where-for-self-2.rs
diff --git a/src/test/ui/where-clauses/where-for-self-2.stderr b/src/test/ui/where-clauses/where-for-self-2.stderr
new file mode 100644
index 0000000..d234c71
--- /dev/null
+++ b/src/test/ui/where-clauses/where-for-self-2.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `for<'a> &'a _: Bar` is not satisfied
+ --> $DIR/where-for-self-2.rs:31:5
+ |
+LL | foo(&X);
+ | ^^^ the trait `for<'a> Bar` is not implemented for `&'a _`
+ |
+ = help: the following implementations were found:
+ <&'static u32 as Bar>
+note: required by `foo`
+ --> $DIR/where-for-self-2.rs:26:1
+ |
+LL | / fn foo<T>(x: &T)
+LL | | where for<'a> &'a T: Bar
+LL | | {}
+ | |__^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/compile-fail/where-for-self.rs b/src/test/ui/where-clauses/where-for-self.rs
similarity index 100%
rename from src/test/compile-fail/where-for-self.rs
rename to src/test/ui/where-clauses/where-for-self.rs
diff --git a/src/test/ui/where-clauses/where-for-self.stderr b/src/test/ui/where-clauses/where-for-self.stderr
new file mode 100644
index 0000000..89c0bd0
--- /dev/null
+++ b/src/test/ui/where-clauses/where-for-self.stderr
@@ -0,0 +1,9 @@
+error[E0316]: nested quantification of lifetimes
+ --> $DIR/where-for-self.rs:25:26
+ |
+LL | where for<'a> &'a T: for<'b> Bar<'b>
+ | ^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0316`.
diff --git a/src/test/compile-fail/where-lifetime-resolution.rs b/src/test/ui/where-clauses/where-lifetime-resolution.rs
similarity index 100%
rename from src/test/compile-fail/where-lifetime-resolution.rs
rename to src/test/ui/where-clauses/where-lifetime-resolution.rs
diff --git a/src/test/ui/where-clauses/where-lifetime-resolution.stderr b/src/test/ui/where-clauses/where-lifetime-resolution.stderr
new file mode 100644
index 0000000..a6fc1b2
--- /dev/null
+++ b/src/test/ui/where-clauses/where-lifetime-resolution.stderr
@@ -0,0 +1,22 @@
+error[E0261]: use of undeclared lifetime name `'a`
+ --> $DIR/where-lifetime-resolution.rs:16:34
+ |
+LL | (for<'a> Trait1<'a>): Trait1<'a>,
+ | ^^ undeclared lifetime
+
+error[E0316]: nested quantification of lifetimes
+ --> $DIR/where-lifetime-resolution.rs:18:13
+ |
+LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>,
+ | ^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0261]: use of undeclared lifetime name `'b`
+ --> $DIR/where-lifetime-resolution.rs:18:48
+ |
+LL | for<'a> for<'b> Trait2<'a, 'b>: Trait2<'a, 'b>,
+ | ^^ undeclared lifetime
+
+error: aborting due to 3 previous errors
+
+Some errors occurred: E0261, E0316.
+For more information about an error, try `rustc --explain E0261`.
diff --git a/src/test/compile-fail/while-let.rs b/src/test/ui/while-let.rs
similarity index 100%
rename from src/test/compile-fail/while-let.rs
rename to src/test/ui/while-let.rs
diff --git a/src/test/ui/while-let.stderr b/src/test/ui/while-let.stderr
new file mode 100644
index 0000000..de4d8be
--- /dev/null
+++ b/src/test/ui/while-let.stderr
@@ -0,0 +1,21 @@
+error[E0165]: irrefutable while-let pattern
+ --> $DIR/while-let.rs:23:10
+ |
+LL | foo!(a, 1, { //~ ERROR irrefutable while-let
+ | ^ irrefutable pattern
+
+error[E0165]: irrefutable while-let pattern
+ --> $DIR/while-let.rs:26:10
+ |
+LL | bar!(a, 1, { //~ ERROR irrefutable while-let
+ | ^ irrefutable pattern
+
+error[E0165]: irrefutable while-let pattern
+ --> $DIR/while-let.rs:32:15
+ |
+LL | while let a = 1 { //~ ERROR irrefutable while-let
+ | ^ irrefutable pattern
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0165`.
diff --git a/src/test/compile-fail/while-type-error.rs b/src/test/ui/while-type-error.rs
similarity index 100%
rename from src/test/compile-fail/while-type-error.rs
rename to src/test/ui/while-type-error.rs
diff --git a/src/test/ui/while-type-error.stderr b/src/test/ui/while-type-error.stderr
new file mode 100644
index 0000000..cfc3f3e
--- /dev/null
+++ b/src/test/ui/while-type-error.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+ --> $DIR/while-type-error.rs:13:19
+ |
+LL | fn main() { while main { } }
+ | ^^^^ expected bool, found fn item
+ |
+ = note: expected type `bool`
+ found type `fn() {main}`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/windows-subsystem-invalid.rs b/src/test/ui/windows-subsystem-invalid.rs
similarity index 100%
rename from src/test/compile-fail/windows-subsystem-invalid.rs
rename to src/test/ui/windows-subsystem-invalid.rs
diff --git a/src/test/ui/windows-subsystem-invalid.stderr b/src/test/ui/windows-subsystem-invalid.stderr
new file mode 100644
index 0000000..0cb843c
--- /dev/null
+++ b/src/test/ui/windows-subsystem-invalid.stderr
@@ -0,0 +1,4 @@
+error: invalid windows subsystem `wrong`, only `windows` and `console` are allowed
+
+error: aborting due to previous error
+
diff --git a/src/test/compile-fail/write-to-static-mut-in-static.rs b/src/test/ui/write-to-static-mut-in-static.rs
similarity index 100%
rename from src/test/compile-fail/write-to-static-mut-in-static.rs
rename to src/test/ui/write-to-static-mut-in-static.rs
diff --git a/src/test/ui/write-to-static-mut-in-static.stderr b/src/test/ui/write-to-static-mut-in-static.stderr
new file mode 100644
index 0000000..f07d240
--- /dev/null
+++ b/src/test/ui/write-to-static-mut-in-static.stderr
@@ -0,0 +1,19 @@
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/write-to-static-mut-in-static.rs:14:33
+ |
+LL | pub static mut B: () = unsafe { A = 1; };
+ | ^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error[E0658]: statements in statics are unstable (see issue #48821)
+ --> $DIR/write-to-static-mut-in-static.rs:17:34
+ |
+LL | pub static mut C: u32 = unsafe { C = 1; 0 };
+ | ^^^^^
+ |
+ = help: add #![feature(const_let)] to the crate attributes to enable
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/writing-to-immutable-vec.nll.stderr b/src/test/ui/writing-to-immutable-vec.nll.stderr
new file mode 100644
index 0000000..9689927
--- /dev/null
+++ b/src/test/ui/writing-to-immutable-vec.nll.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow `v` as mutable, as it is not declared as mutable
+ --> $DIR/writing-to-immutable-vec.rs:14:5
+ |
+LL | let v: Vec<isize> = vec![1, 2, 3];
+ | - help: consider changing this to be mutable: `mut v`
+LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable
+ | ^ cannot borrow as mutable
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/writing-to-immutable-vec.rs b/src/test/ui/writing-to-immutable-vec.rs
similarity index 100%
rename from src/test/compile-fail/writing-to-immutable-vec.rs
rename to src/test/ui/writing-to-immutable-vec.rs
diff --git a/src/test/ui/writing-to-immutable-vec.stderr b/src/test/ui/writing-to-immutable-vec.stderr
new file mode 100644
index 0000000..07e1779
--- /dev/null
+++ b/src/test/ui/writing-to-immutable-vec.stderr
@@ -0,0 +1,11 @@
+error[E0596]: cannot borrow immutable local variable `v` as mutable
+ --> $DIR/writing-to-immutable-vec.rs:14:5
+ |
+LL | let v: Vec<isize> = vec![1, 2, 3];
+ | - consider changing this to `mut v`
+LL | v[1] = 4; //~ ERROR cannot borrow immutable local variable `v` as mutable
+ | ^ cannot borrow mutably
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0596`.
diff --git a/src/test/compile-fail/wrong-mul-method-signature.rs b/src/test/ui/wrong-mul-method-signature.rs
similarity index 100%
rename from src/test/compile-fail/wrong-mul-method-signature.rs
rename to src/test/ui/wrong-mul-method-signature.rs
diff --git a/src/test/ui/wrong-mul-method-signature.stderr b/src/test/ui/wrong-mul-method-signature.stderr
new file mode 100644
index 0000000..7c4d22c
--- /dev/null
+++ b/src/test/ui/wrong-mul-method-signature.stderr
@@ -0,0 +1,30 @@
+error[E0053]: method `mul` has an incompatible type for trait
+ --> $DIR/wrong-mul-method-signature.rs:26:5
+ |
+LL | fn mul(self, s: &f64) -> Vec1 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected f64, found &f64
+ |
+ = note: expected type `fn(Vec1, f64) -> Vec1`
+ found type `fn(Vec1, &f64) -> Vec1`
+
+error[E0053]: method `mul` has an incompatible type for trait
+ --> $DIR/wrong-mul-method-signature.rs:43:5
+ |
+LL | fn mul(self, s: f64) -> Vec2 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected struct `Vec2`, found f64
+ |
+ = note: expected type `fn(Vec2, Vec2) -> f64`
+ found type `fn(Vec2, f64) -> Vec2`
+
+error[E0053]: method `mul` has an incompatible type for trait
+ --> $DIR/wrong-mul-method-signature.rs:62:5
+ |
+LL | fn mul(self, s: f64) -> f64 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i32, found f64
+ |
+ = note: expected type `fn(Vec3, f64) -> i32`
+ found type `fn(Vec3, f64) -> f64`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0053`.
diff --git a/src/test/compile-fail/wrong-ret-type.rs b/src/test/ui/wrong-ret-type.rs
similarity index 100%
rename from src/test/compile-fail/wrong-ret-type.rs
rename to src/test/ui/wrong-ret-type.rs
diff --git a/src/test/ui/wrong-ret-type.stderr b/src/test/ui/wrong-ret-type.stderr
new file mode 100644
index 0000000..4ff6f70
--- /dev/null
+++ b/src/test/ui/wrong-ret-type.stderr
@@ -0,0 +1,9 @@
+error[E0308]: mismatched types
+ --> $DIR/wrong-ret-type.rs:12:49
+ |
+LL | fn mk_int() -> usize { let i: isize = 3; return i; }
+ | ^ expected usize, found isize
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/compile-fail/xc-private-method.rs b/src/test/ui/xc-private-method.rs
similarity index 100%
rename from src/test/compile-fail/xc-private-method.rs
rename to src/test/ui/xc-private-method.rs
diff --git a/src/test/ui/xc-private-method.stderr b/src/test/ui/xc-private-method.stderr
new file mode 100644
index 0000000..35078e7
--- /dev/null
+++ b/src/test/ui/xc-private-method.stderr
@@ -0,0 +1,15 @@
+error[E0624]: method `static_meth_struct` is private
+ --> $DIR/xc-private-method.rs:16:13
+ |
+LL | let _ = xc_private_method_lib::Struct::static_meth_struct();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0624]: method `static_meth_enum` is private
+ --> $DIR/xc-private-method.rs:19:13
+ |
+LL | let _ = xc_private_method_lib::Enum::static_meth_enum();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/xc-private-method2.rs b/src/test/ui/xc-private-method2.rs
similarity index 100%
rename from src/test/compile-fail/xc-private-method2.rs
rename to src/test/ui/xc-private-method2.rs
diff --git a/src/test/ui/xc-private-method2.stderr b/src/test/ui/xc-private-method2.stderr
new file mode 100644
index 0000000..d671aa3
--- /dev/null
+++ b/src/test/ui/xc-private-method2.stderr
@@ -0,0 +1,15 @@
+error[E0624]: method `meth_struct` is private
+ --> $DIR/xc-private-method2.rs:16:52
+ |
+LL | let _ = xc_private_method_lib::Struct{ x: 10 }.meth_struct();
+ | ^^^^^^^^^^^
+
+error[E0624]: method `meth_enum` is private
+ --> $DIR/xc-private-method2.rs:19:55
+ |
+LL | let _ = xc_private_method_lib::Enum::Variant1(20).meth_enum();
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0624`.
diff --git a/src/test/compile-fail/auxiliary/static_priv_by_default.rs b/src/test/ui/xcrate/auxiliary/static_priv_by_default.rs
similarity index 100%
copy from src/test/compile-fail/auxiliary/static_priv_by_default.rs
copy to src/test/ui/xcrate/auxiliary/static_priv_by_default.rs
diff --git a/src/test/compile-fail/auxiliary/xcrate_unit_struct.rs b/src/test/ui/xcrate/auxiliary/xcrate_unit_struct.rs
similarity index 100%
rename from src/test/compile-fail/auxiliary/xcrate_unit_struct.rs
rename to src/test/ui/xcrate/auxiliary/xcrate_unit_struct.rs
diff --git a/src/test/compile-fail/xcrate-private-by-default.rs b/src/test/ui/xcrate/xcrate-private-by-default.rs
similarity index 100%
rename from src/test/compile-fail/xcrate-private-by-default.rs
rename to src/test/ui/xcrate/xcrate-private-by-default.rs
diff --git a/src/test/ui/xcrate/xcrate-private-by-default.stderr b/src/test/ui/xcrate/xcrate-private-by-default.stderr
new file mode 100644
index 0000000..c4560b9
--- /dev/null
+++ b/src/test/ui/xcrate/xcrate-private-by-default.stderr
@@ -0,0 +1,63 @@
+error[E0603]: static `j` is private
+ --> $DIR/xcrate-private-by-default.rs:33:5
+ |
+LL | static_priv_by_default::j;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: function `k` is private
+ --> $DIR/xcrate-private-by-default.rs:35:5
+ |
+LL | static_priv_by_default::k;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: unit struct `l` is private
+ --> $DIR/xcrate-private-by-default.rs:37:5
+ |
+LL | static_priv_by_default::l;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: enum `m` is private
+ --> $DIR/xcrate-private-by-default.rs:39:11
+ |
+LL | foo::<static_priv_by_default::m>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: type alias `n` is private
+ --> $DIR/xcrate-private-by-default.rs:41:11
+ |
+LL | foo::<static_priv_by_default::n>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/xcrate-private-by-default.rs:45:5
+ |
+LL | static_priv_by_default::foo::a;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/xcrate-private-by-default.rs:47:5
+ |
+LL | static_priv_by_default::foo::b;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/xcrate-private-by-default.rs:49:5
+ |
+LL | static_priv_by_default::foo::c;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/xcrate-private-by-default.rs:51:11
+ |
+LL | foo::<static_priv_by_default::foo::d>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error[E0603]: module `foo` is private
+ --> $DIR/xcrate-private-by-default.rs:53:11
+ |
+LL | foo::<static_priv_by_default::foo::e>();
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 10 previous errors
+
+For more information about this error, try `rustc --explain E0603`.
diff --git a/src/test/compile-fail/xcrate-unit-struct.rs b/src/test/ui/xcrate/xcrate-unit-struct.rs
similarity index 100%
rename from src/test/compile-fail/xcrate-unit-struct.rs
rename to src/test/ui/xcrate/xcrate-unit-struct.rs
diff --git a/src/test/ui/xcrate/xcrate-unit-struct.stderr b/src/test/ui/xcrate/xcrate-unit-struct.stderr
new file mode 100644
index 0000000..9ee4cb3
--- /dev/null
+++ b/src/test/ui/xcrate/xcrate-unit-struct.stderr
@@ -0,0 +1,9 @@
+error[E0423]: expected value, found struct `xcrate_unit_struct::StructWithFields`
+ --> $DIR/xcrate-unit-struct.rs:19:13
+ |
+LL | let _ = xcrate_unit_struct::StructWithFields;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ did you mean `xcrate_unit_struct::StructWithFields { /* fields */ }`?
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0423`.
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
index fd8fb54..ee1345c 100644
--- a/src/tools/build-manifest/src/main.rs
+++ b/src/tools/build-manifest/src/main.rs
@@ -189,6 +189,7 @@
clippy_release: String,
rustfmt_release: String,
llvm_tools_release: String,
+ lldb_release: String,
input: PathBuf,
output: PathBuf,
@@ -203,6 +204,7 @@
clippy_version: Option<String>,
rustfmt_version: Option<String>,
llvm_tools_version: Option<String>,
+ lldb_version: Option<String>,
rust_git_commit_hash: Option<String>,
cargo_git_commit_hash: Option<String>,
@@ -210,6 +212,7 @@
clippy_git_commit_hash: Option<String>,
rustfmt_git_commit_hash: Option<String>,
llvm_tools_git_commit_hash: Option<String>,
+ lldb_git_commit_hash: Option<String>,
}
fn main() {
@@ -223,6 +226,7 @@
let clippy_release = args.next().unwrap();
let rustfmt_release = args.next().unwrap();
let llvm_tools_release = args.next().unwrap();
+ let lldb_release = args.next().unwrap();
let s3_address = args.next().unwrap();
let mut passphrase = String::new();
t!(io::stdin().read_to_string(&mut passphrase));
@@ -234,6 +238,7 @@
clippy_release,
rustfmt_release,
llvm_tools_release,
+ lldb_release,
input,
output,
@@ -248,6 +253,7 @@
clippy_version: None,
rustfmt_version: None,
llvm_tools_version: None,
+ lldb_version: None,
rust_git_commit_hash: None,
cargo_git_commit_hash: None,
@@ -255,6 +261,7 @@
clippy_git_commit_hash: None,
rustfmt_git_commit_hash: None,
llvm_tools_git_commit_hash: None,
+ lldb_git_commit_hash: None,
}.build();
}
@@ -266,6 +273,7 @@
self.clippy_version = self.version("clippy", "x86_64-unknown-linux-gnu");
self.rustfmt_version = self.version("rustfmt", "x86_64-unknown-linux-gnu");
self.llvm_tools_version = self.version("llvm-tools", "x86_64-unknown-linux-gnu");
+ self.lldb_version = self.version("lldb", "x86_64-unknown-linux-gnu");
self.rust_git_commit_hash = self.git_commit_hash("rust", "x86_64-unknown-linux-gnu");
self.cargo_git_commit_hash = self.git_commit_hash("cargo", "x86_64-unknown-linux-gnu");
@@ -274,6 +282,7 @@
self.rustfmt_git_commit_hash = self.git_commit_hash("rustfmt", "x86_64-unknown-linux-gnu");
self.llvm_tools_git_commit_hash = self.git_commit_hash("llvm-tools",
"x86_64-unknown-linux-gnu");
+ self.lldb_git_commit_hash = self.git_commit_hash("lldb", "x86_64-unknown-linux-gnu");
self.digest_and_sign();
let manifest = self.build_manifest();
@@ -312,11 +321,13 @@
self.package("rustfmt-preview", &mut manifest.pkg, HOSTS);
self.package("rust-analysis", &mut manifest.pkg, TARGETS);
self.package("llvm-tools-preview", &mut manifest.pkg, TARGETS);
+ self.package("lldb-preview", &mut manifest.pkg, TARGETS);
let clippy_present = manifest.pkg.contains_key("clippy-preview");
let rls_present = manifest.pkg.contains_key("rls-preview");
let rustfmt_present = manifest.pkg.contains_key("rustfmt-preview");
let llvm_tools_present = manifest.pkg.contains_key("llvm-tools-preview");
+ let lldb_present = manifest.pkg.contains_key("lldb-preview");
if rls_present {
manifest.renames.insert("rls".to_owned(), Rename { to: "rls-preview".to_owned() });
@@ -383,6 +394,12 @@
target: host.to_string(),
});
}
+ if lldb_present {
+ extensions.push(Component {
+ pkg: "lldb-preview".to_string(),
+ target: host.to_string(),
+ });
+ }
extensions.push(Component {
pkg: "rust-analysis".to_string(),
target: host.to_string(),
@@ -496,6 +513,8 @@
format!("rustfmt-{}-{}.tar.gz", self.rustfmt_release, target)
} else if component == "llvm-tools" || component == "llvm-tools-preview" {
format!("llvm-tools-{}-{}.tar.gz", self.llvm_tools_release, target)
+ } else if component == "lldb" || component == "lldb-preview" {
+ format!("lldb-{}-{}.tar.gz", self.lldb_release, target)
} else {
format!("{}-{}-{}.tar.gz", component, self.rust_release, target)
}
@@ -512,6 +531,8 @@
&self.rustfmt_version
} else if component == "llvm-tools" || component == "llvm-tools-preview" {
&self.llvm_tools_version
+ } else if component == "lldb" || component == "lldb-preview" {
+ &self.lldb_version
} else {
&self.rust_version
}
@@ -528,6 +549,8 @@
&self.rustfmt_git_commit_hash
} else if component == "llvm-tools" || component == "llvm-tools-preview" {
&self.llvm_tools_git_commit_hash
+ } else if component == "lldb" || component == "lldb-preview" {
+ &self.lldb_git_commit_hash
} else {
&self.rust_git_commit_hash
}
diff --git a/src/tools/cargo b/src/tools/cargo
index b424882..6a7672e 160000
--- a/src/tools/cargo
+++ b/src/tools/cargo
@@ -1 +1 @@
-Subproject commit b42488270ed29d73445d6c81d303b6a7476f6bb1
+Subproject commit 6a7672ef5344c1bb570610f2574250fbee932355
diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs
index d04231b..3524805 100644
--- a/src/tools/cargotest/main.rs
+++ b/src/tools/cargotest/main.rs
@@ -33,7 +33,7 @@
Test {
name: "ripgrep",
repo: "https://github.com/BurntSushi/ripgrep",
- sha: "b65bb37b14655e1a89c7cd19c8b011ef3e312791",
+ sha: "ad9befbc1d3b5c695e7f6b6734ee1b8e683edd41",
lock: None,
packages: &[],
},
diff --git a/src/tools/clang b/src/tools/clang
new file mode 160000
index 0000000..2a284a7
--- /dev/null
+++ b/src/tools/clang
@@ -0,0 +1 @@
+Subproject commit 2a284a70e26997273c296afe06586ffdf3a142fd
diff --git a/src/tools/clippy b/src/tools/clippy
index 99a087b..bac76af 160000
--- a/src/tools/clippy
+++ b/src/tools/clippy
@@ -1 +1 @@
-Subproject commit 99a087bea59c8f808b5485c6113edf9ce774e94a
+Subproject commit bac76afb5a7885de19bfd9e6191fe8e2a29bd74d
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 951a72f..6679ec7 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -96,7 +96,7 @@
}
}
-#[derive(Clone, PartialEq)]
+#[derive(Clone, Debug, PartialEq)]
pub enum CompareMode {
Nll,
Polonius,
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 5f68d00..3fd6736 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -615,12 +615,14 @@
common::DebugInfoLldb => name == "lldb",
common::Pretty => name == "pretty",
_ => false,
- } || (self.target != self.host && name == "cross-compile") ||
+ } ||
+ (self.target != self.host && name == "cross-compile") ||
match self.compare_mode {
Some(CompareMode::Nll) => name == "compare-mode-nll",
Some(CompareMode::Polonius) => name == "compare-mode-polonius",
None => false,
- }
+ } ||
+ (cfg!(debug_assertions) && name == "debug")
} else {
false
}
diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs
index 201a661..58220ba 100644
--- a/src/tools/compiletest/src/json.rs
+++ b/src/tools/compiletest/src/json.rs
@@ -82,7 +82,7 @@
Err(error) => {
proc_res.fatal(Some(&format!(
"failed to decode compiler output as json: \
- `{}`\noutput: {}\nline: {}",
+ `{}`\nline: {}\noutput: {}",
error, line, output
)));
}
@@ -114,7 +114,7 @@
Err(error) => {
proc_res.fatal(Some(&format!(
"failed to decode compiler output as json: \
- `{}`\noutput: {}\nline: {}",
+ `{}`\nline: {}\noutput: {}",
error, line, output
)));
}
diff --git a/src/tools/compiletest/src/raise_fd_limit.rs b/src/tools/compiletest/src/raise_fd_limit.rs
index 2200827..d107123 100644
--- a/src/tools/compiletest/src/raise_fd_limit.rs
+++ b/src/tools/compiletest/src/raise_fd_limit.rs
@@ -57,14 +57,16 @@
panic!("raise_fd_limit: error calling getrlimit: {}", err);
}
- // Bump the soft limit to the smaller of kern.maxfilesperproc and the hard
- // limit
- rlim.rlim_cur = cmp::min(maxfiles as libc::rlim_t, rlim.rlim_max);
+ // Make sure we're only ever going to increase the rlimit.
+ if rlim.rlim_cur < maxfiles as libc::rlim_t {
+ // Bump the soft limit to the smaller of kern.maxfilesperproc and the hard limit.
+ rlim.rlim_cur = cmp::min(maxfiles as libc::rlim_t, rlim.rlim_max);
- // Set our newly-increased resource limit
- if libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) != 0 {
- let err = io::Error::last_os_error();
- panic!("raise_fd_limit: error calling setrlimit: {}", err);
+ // Set our newly-increased resource limit.
+ if libc::setrlimit(libc::RLIMIT_NOFILE, &rlim) != 0 {
+ let err = io::Error::last_os_error();
+ panic!("raise_fd_limit: error calling setrlimit: {}", err);
+ }
}
}
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index c8f3956..b136173 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1126,6 +1126,7 @@
}
fn check_error_patterns(&self, output_to_check: &str, proc_res: &ProcRes) {
+ debug!("check_error_patterns");
if self.props.error_patterns.is_empty() {
if self.props.compile_pass {
return;
@@ -1136,26 +1137,21 @@
));
}
}
- let mut next_err_idx = 0;
- let mut next_err_pat = self.props.error_patterns[next_err_idx].trim();
- let mut done = false;
- for line in output_to_check.lines() {
- if line.contains(next_err_pat) {
- debug!("found error pattern {}", next_err_pat);
- next_err_idx += 1;
- if next_err_idx == self.props.error_patterns.len() {
- debug!("found all error patterns");
- done = true;
- break;
- }
- next_err_pat = self.props.error_patterns[next_err_idx].trim();
+
+ let mut missing_patterns: Vec<String> = Vec::new();
+
+ for pattern in &self.props.error_patterns {
+ if output_to_check.contains(pattern.trim()) {
+ debug!("found error pattern {}", pattern);
+ } else {
+ missing_patterns.push(pattern.to_string());
}
}
- if done {
+
+ if missing_patterns.is_empty() {
return;
}
- let missing_patterns = &self.props.error_patterns[next_err_idx..];
if missing_patterns.len() == 1 {
self.fatal_proc_rec(
&format!("error pattern '{}' not found!", missing_patterns[0]),
@@ -1163,7 +1159,7 @@
);
} else {
for pattern in missing_patterns {
- self.error(&format!("error pattern '{}' not found!", *pattern));
+ self.error(&format!("error pattern '{}' not found!", pattern));
}
self.fatal_proc_rec("multiple error patterns not found", proc_res);
}
@@ -1186,6 +1182,8 @@
}
fn check_expected_errors(&self, expected_errors: Vec<errors::Error>, proc_res: &ProcRes) {
+ debug!("check_expected_errors: expected_errors={:?} proc_res.status={:?}",
+ expected_errors, proc_res.status);
if proc_res.status.success()
&& expected_errors
.iter()
@@ -2211,12 +2209,12 @@
.stdout
.lines()
.filter(|line| line.starts_with(PREFIX))
- .map(str_to_mono_item)
+ .map(|line| str_to_mono_item(line, true))
.collect();
let expected: Vec<MonoItem> = errors::load_errors(&self.testpaths.file, None)
.iter()
- .map(|e| str_to_mono_item(&e.msg[..]))
+ .map(|e| str_to_mono_item(&e.msg[..], false))
.collect();
let mut missing = Vec::new();
@@ -2301,14 +2299,14 @@
}
// [MONO_ITEM] name [@@ (cgu)+]
- fn str_to_mono_item(s: &str) -> MonoItem {
+ fn str_to_mono_item(s: &str, cgu_has_crate_disambiguator: bool) -> MonoItem {
let s = if s.starts_with(PREFIX) {
(&s[PREFIX.len()..]).trim()
} else {
s.trim()
};
- let full_string = format!("{}{}", PREFIX, s.trim().to_owned());
+ let full_string = format!("{}{}", PREFIX, s);
let parts: Vec<&str> = s
.split(CGU_MARKER)
@@ -2325,7 +2323,13 @@
.split(' ')
.map(str::trim)
.filter(|s| !s.is_empty())
- .map(str::to_owned)
+ .map(|s| {
+ if cgu_has_crate_disambiguator {
+ remove_crate_disambiguator_from_cgu(s)
+ } else {
+ s.to_string()
+ }
+ })
.collect()
} else {
HashSet::new()
@@ -2350,6 +2354,23 @@
string
}
+
+ fn remove_crate_disambiguator_from_cgu(cgu: &str) -> String {
+ // The first '.' is the start of the crate disambiguator
+ let disambiguator_start = cgu.find('.')
+ .expect("Could not find start of crate disambiguator in CGU spec");
+
+ // The first non-alphanumeric character is the end of the disambiguator
+ let disambiguator_end = cgu[disambiguator_start + 1 ..]
+ .find(|c| !char::is_alphanumeric(c))
+ .expect("Could not find end of crate disambiguator in CGU spec")
+ + disambiguator_start + 1;
+
+ let mut result = cgu[0 .. disambiguator_start].to_string();
+ result.push_str(&cgu[disambiguator_end ..]);
+
+ result
+ }
}
fn init_incremental_test(&self) {
@@ -2668,12 +2689,17 @@
self.fatal_proc_rec("test run failed!", &proc_res);
}
}
+
+ debug!("run_ui_test: explicit={:?} config.compare_mode={:?} expected_errors={:?} \
+ proc_res.status={:?} props.error_patterns={:?}",
+ explicit, self.config.compare_mode, expected_errors, proc_res.status,
+ self.props.error_patterns);
if !explicit && self.config.compare_mode.is_none() {
- if !expected_errors.is_empty() || !proc_res.status.success() {
- // "// error-pattern" comments
- self.check_expected_errors(expected_errors, &proc_res);
- } else if !self.props.error_patterns.is_empty() || !proc_res.status.success() {
+ if !expected_errors.is_empty() && !proc_res.status.success() {
// "//~ERROR comments"
+ self.check_expected_errors(expected_errors, &proc_res);
+ } else if !self.props.error_patterns.is_empty() && !proc_res.status.success() {
+ // "// error-pattern" comments
self.check_error_patterns(&proc_res.stderr, &proc_res);
}
}
@@ -2915,6 +2941,20 @@
};
normalized = normalized.replace(&src_dir_str, "$SRC_DIR");
+ // Paths into the build directory
+ let test_build_dir = &self.config.build_base;
+ let parent_build_dir = test_build_dir.parent().unwrap().parent().unwrap().parent().unwrap();
+
+ // eg. /home/user/rust/build/x86_64-unknown-linux-gnu/test/ui
+ normalized = normalized.replace(test_build_dir.to_str().unwrap(), "$TEST_BUILD_DIR");
+ // eg. /home/user/rust/build
+ normalized = normalized.replace(&parent_build_dir.to_str().unwrap(), "$BUILD_DIR");
+
+ // Paths into lib directory.
+ let mut lib_dir = parent_build_dir.parent().unwrap().to_path_buf();
+ lib_dir.push("lib");
+ normalized = normalized.replace(&lib_dir.to_str().unwrap(), "$LIB_DIR");
+
if json {
// escaped newlines in json strings should be readable
// in the stderr files. There's no point int being correct,
diff --git a/src/tools/lldb b/src/tools/lldb
new file mode 160000
index 0000000..3dbe998
--- /dev/null
+++ b/src/tools/lldb
@@ -0,0 +1 @@
+Subproject commit 3dbe998969d457c5cef245f61b48bdaed0f5c059
diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs
index 5116f66..9501adb 100644
--- a/src/tools/remote-test-server/src/main.rs
+++ b/src/tools/remote-test-server/src/main.rs
@@ -267,7 +267,7 @@
t!(io::copy(&mut io.take(amt),
&mut t!(File::create(&dst))));
t!(fs::set_permissions(&dst, Permissions::from_mode(0o755)));
- return dst
+ dst
}
fn my_copy(src: &mut dyn Read, which: u8, dst: &Mutex<dyn Write>) {
diff --git a/src/tools/rls b/src/tools/rls
index c51e3ff..9e4d8d5 160000
--- a/src/tools/rls
+++ b/src/tools/rls
@@ -1 +1 @@
-Subproject commit c51e3ff2f07f84f26f57fcb51808b1ec7cbe45a6
+Subproject commit 9e4d8d520390c6aeebc33260026c6ae2946c67ac
diff --git a/src/tools/rust-installer b/src/tools/rust-installer
index 89414e4..27dec6c 160000
--- a/src/tools/rust-installer
+++ b/src/tools/rust-installer
@@ -1 +1 @@
-Subproject commit 89414e44dc94844888e59c08bc31dcccb1792800
+Subproject commit 27dec6cae3a8132d8a073aad6775425c85095c99
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 42f4e46..03bcda5 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -353,12 +353,12 @@
// versions of them accidentally sneak into our dependency graph to
// ensure we keep our CI times under control
// "cargo", // FIXME(#53005)
- // "rustc-ap-syntax", // FIXME(#53006)
+ "rustc-ap-syntax",
];
- let mut name_to_id = HashMap::new();
+ let mut name_to_id: HashMap<_, Vec<_>> = HashMap::new();
for node in resolve.nodes.iter() {
name_to_id.entry(node.id.split_whitespace().next().unwrap())
- .or_insert(Vec::new())
+ .or_default()
.push(&node.id);
}
diff --git a/src/tools/tidy/src/errors.rs b/src/tools/tidy/src/errors.rs
index 5bf7c89..3dccffd 100644
--- a/src/tools/tidy/src/errors.rs
+++ b/src/tools/tidy/src/errors.rs
@@ -20,7 +20,7 @@
pub fn check(path: &Path, bad: &mut bool) {
let mut contents = String::new();
- let mut map = HashMap::new();
+ let mut map: HashMap<_, Vec<_>> = HashMap::new();
super::walk(path,
&mut |path| super::filter_dirs(path) || path.ends_with("src/test"),
&mut |file| {
@@ -61,7 +61,7 @@
Ok(n) => n,
Err(..) => continue,
};
- map.entry(code).or_insert(Vec::new())
+ map.entry(code).or_default()
.push((file.to_owned(), num + 1, line.to_owned()));
break
}
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index bb041b3..f2107f9 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -68,12 +68,14 @@
"src/vendor",
"src/rt/hoedown",
"src/tools/cargo",
+ "src/tools/clang",
"src/tools/rls",
"src/tools/clippy",
"src/tools/rust-installer",
"src/tools/rustfmt",
"src/tools/miri",
"src/tools/lld",
+ "src/tools/lldb",
"src/librustc/mir/interpret",
"src/librustc_mir/interpret",
"src/target",
@@ -89,16 +91,18 @@
}
fn walk(path: &Path, skip: &mut dyn FnMut(&Path) -> bool, f: &mut dyn FnMut(&Path)) {
- for entry in t!(fs::read_dir(path), path) {
- let entry = t!(entry);
- let kind = t!(entry.file_type());
- let path = entry.path();
- if kind.is_dir() {
- if !skip(&path) {
- walk(&path, skip, f);
+ if let Ok(dir) = fs::read_dir(path) {
+ for entry in dir {
+ let entry = t!(entry);
+ let kind = t!(entry.file_type());
+ let path = entry.path();
+ if kind.is_dir() {
+ if !skip(&path) {
+ walk(&path, skip, f);
+ }
+ } else {
+ f(&path);
}
- } else {
- f(&path);
}
}
}
diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs
index 6b57390..62296f7 100644
--- a/src/tools/tidy/src/unstable_book.rs
+++ b/src/tools/tidy/src/unstable_book.rs
@@ -60,6 +60,7 @@
.map(|entry| entry.expect("could not read directory entry"))
.filter(dir_entry_is_file)
.map(|entry| entry.file_name().into_string().unwrap())
+ .filter(|n| n.ends_with(".md"))
.map(|n| n.trim_right_matches(".md").to_owned())
.collect()
}