From: kennytm Date: Thu, 9 Aug 2018 08:58:42 +0000 (+0800) Subject: Rollup merge of #53110 - Xanewok:save-analysis-remap-path, r=nrc X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=c24ba7e4f811e4b30d6d087f020835ccdf0ca445;hp=e8bb7bf35a0d5066a081cfa9a581849e34a91e02;p=rust.git Rollup merge of #53110 - Xanewok:save-analysis-remap-path, r=nrc Account for --remap-path-prefix in save-analysis Fixes #52549. Didn't add a test since save-analysis is still unstable, only tested this locally. Should I add a test for that? If so, is run-make-fulldeps an appropriate format? Session is already created with remapped working directory, so use that instead of the actual cwd. This was the only place affected, since the rest of the paths in save-analysis are directly derived from files in spans from `sess.codemap()`, which already creates remapped ones. r? @nrc --- diff --git a/.travis.yml b/.travis.yml index a860aaa5b7e..d010a8370b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -277,6 +277,8 @@ after_success: 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/src/Cargo.lock b/src/Cargo.lock index 7c57cf32d1b..2a7dbce2ddc 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -90,7 +90,7 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -102,7 +102,7 @@ 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)", "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (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)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -113,7 +113,7 @@ version = "0.1.23" 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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -136,7 +136,7 @@ dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "petgraph 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -196,7 +196,7 @@ dependencies = [ "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "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.42 (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)", "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)", @@ -243,7 +243,7 @@ dependencies = [ "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "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.42 (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)", "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)", @@ -426,7 +426,7 @@ name = "commoncrypto-sys" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -446,7 +446,7 @@ dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (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)", "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -465,7 +465,7 @@ dependencies = [ "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (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)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", @@ -488,7 +488,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -497,7 +497,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -505,7 +505,7 @@ name = "core-foundation-sys" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -627,7 +627,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "curl-sys 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (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)", "schannel 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -641,7 +641,7 @@ version = "0.4.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)", - "libc 0.2.42 (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)", "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -790,7 +790,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -804,7 +804,7 @@ name = "flate2" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -835,7 +835,7 @@ name = "fs2" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -887,7 +887,7 @@ version = "0.7.3" 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.42 (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)", "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)", @@ -1035,7 +1035,7 @@ name = "isatty" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1058,7 +1058,7 @@ name = "jobserver" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1129,7 +1129,7 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.42" +version = "0.2.43" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1140,7 +1140,7 @@ dependencies = [ "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", "cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "curl-sys 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "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)", @@ -1153,7 +1153,7 @@ version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (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)", "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1166,7 +1166,7 @@ version = "1.0.18" 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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (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)", ] @@ -1206,7 +1206,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)", "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1273,7 +1273,7 @@ name = "memchr" version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1281,7 +1281,7 @@ name = "memmap" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1304,7 +1304,7 @@ version = "0.1.10" 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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1372,7 +1372,7 @@ name = "num_cpus" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1389,7 +1389,7 @@ dependencies = [ "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "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.42 (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)", ] @@ -1404,7 +1404,7 @@ version = "0.9.33" 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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (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)", ] @@ -1461,7 +1461,7 @@ name = "parking_lot_core" version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1636,7 +1636,7 @@ dependencies = [ [[package]] name = "racer" -version = "2.1.2" +version = "2.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1648,7 +1648,7 @@ dependencies = [ "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1657,7 +1657,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1668,7 +1668,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1694,7 +1694,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1770,7 +1770,7 @@ dependencies = [ [[package]] name = "rls" -version = "0.130.2" +version = "0.130.4" dependencies = [ "cargo 0.30.0", "cargo_metadata 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1785,7 +1785,7 @@ dependencies = [ "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "ordslice 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "racer 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "racer 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rls-analysis 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1795,7 +1795,7 @@ dependencies = [ "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0", - "rustfmt-nightly 0.99.1", + "rustfmt-nightly 0.99.2", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1897,32 +1897,15 @@ dependencies = [ [[package]] name = "rustc-ap-arena" -version = "209.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-ap-rustc_data_structures 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-arena" -version = "211.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "rustc-ap-rustc_data_structures 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_cratesio_shim" -version = "209.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-rustc_cratesio_shim" -version = "211.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1931,25 +1914,7 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_data_structures" -version = "209.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "ena 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "stable_deref_trait 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_data_structures" -version = "211.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1957,8 +1922,8 @@ dependencies = [ "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-rayon-core 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1967,114 +1932,57 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_errors" -version = "209.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_errors" -version = "211.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-rustc_target" -version = "209.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-rustc_target" -version = "211.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-serialize" -version = "209.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-ap-serialize" -version = "211.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-ap-syntax" -version = "209.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "rustc-ap-syntax" -version = "211.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rustc-ap-syntax_pos" -version = "209.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-arena 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-syntax_pos" -version = "211.0.0" +version = "218.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-arena 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-arena 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2116,7 +2024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (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.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2184,30 +2092,10 @@ dependencies = [ name = "rustc_codegen_llvm" version = "0.0.0" dependencies = [ - "bitflags 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.18 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)", - "flate2 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "jobserver 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc 0.0.0", "rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc_allocator 0.0.0", - "rustc_apfloat 0.0.0", - "rustc_codegen_utils 0.0.0", - "rustc_data_structures 0.0.0", - "rustc_errors 0.0.0", - "rustc_incremental 0.0.0", "rustc_llvm 0.0.0", - "rustc_mir 0.0.0", - "rustc_platform_intrinsics 0.0.0", - "rustc_target 0.0.0", - "serialize 0.0.0", - "syntax 0.0.0", - "syntax_pos 0.0.0", - "tempfile 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2566,7 +2454,7 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "0.99.1" +version = "0.99.2" dependencies = [ "assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "cargo_metadata 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2580,9 +2468,9 @@ dependencies = [ "lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.70 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2698,7 +2586,7 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2876,7 +2764,7 @@ version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2886,7 +2774,7 @@ name = "tempfile" version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2937,7 +2825,7 @@ name = "termion" version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2981,7 +2869,7 @@ name = "time" version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -3181,7 +3069,7 @@ name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3293,7 +3181,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum lazy_static 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fb497c35d362b6a331cfd94956a07fc2c78a4604cdbee844a81170386b996dd3" "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.42 (registry+https://github.com/rust-lang/crates.io-index)" = "b685088df2b950fccadf07a7187c8ef846a959c142338a48f9dc0b94517eb5f1" +"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 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" @@ -3347,7 +3235,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" "checksum quote 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e44651a0dc4cdd99f71c83b561e221f714912d11af1a4dff0631f923d53af035" -"checksum racer 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c20890fccfc19a28835ee4ffab6af13d300a60a33be29162cfdf8db981811f25" +"checksum racer 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dcbc5ababaffee8d8f34910f925287c8f716b1ead48561c4278a152d08264f7c" "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5" "checksum rand 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "12397506224b2f93e6664ffc4f664b29be8208e5157d3d90b44f09b5fae470ea" "checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" @@ -3366,22 +3254,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9dba7390427aefa953608429701e3665192ca810ba8ae09301e001b7c7bed0" "checksum rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5d7c7046dc6a92f2ae02ed302746db4382e75131b9ce20ce967259f6b5867a6a" "checksum rls-vfs 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ecbc8541b4c341d6271eae10f869dd9d36db871afe184f5b6f9bffbd6ed0373f" -"checksum rustc-ap-arena 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b098827864368459cbc7a79fbc54eafb92df7e00a46c0cda352b5a21583ee436" -"checksum rustc-ap-arena 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eec75ed880706dd9a05bc770c327ed142fa7d4b648d9757fbc71d821d68448a5" -"checksum rustc-ap-rustc_cratesio_shim 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef4d923dea14fb085bca743fb982f6a3bc11c0d5d30b822bcf6fa16e9464a56c" -"checksum rustc-ap-rustc_cratesio_shim 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0f5d54615bedbae65a976e0835edf0de90dd962ec818c0149fe181d5cd81da9e" -"checksum rustc-ap-rustc_data_structures 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "18c6a5c9edc6b4ae035cdc03af7d8662d39fad7879c5501d103e7087dfaebc80" -"checksum rustc-ap-rustc_data_structures 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e7c51cc6e79eab25c7ea84a7e104e81e6f44cca32709df54c2cdb4e7059d7843" -"checksum rustc-ap-rustc_errors 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9a1e9bdc597abd95cebce0c14c1da58943a9e5b8255530a0fec30659d144eb0b" -"checksum rustc-ap-rustc_errors 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff050095b7afb254506591ee7d3a5d0fb9c03c16f8c2741b588178085e563d49" -"checksum rustc-ap-rustc_target 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "142ddef3dc12dda2bcd3412f0d96d3745413a8fbc2f224f0cc97afa04c071d89" -"checksum rustc-ap-rustc_target 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "53c7a8c21c3b05f24998fa6ab9ded6269810a2f3ae12ff301c432c1e9fa8e111" -"checksum rustc-ap-serialize 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8b08f8f175b038a82caa7e51fc52b72ff96cfe8c1429755da30380dbd4199c7f" -"checksum rustc-ap-serialize 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4713c2c0c26a45ead8fb16fee88e16fecf999588ae6920847cbaeb19565b7f" -"checksum rustc-ap-syntax 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c802e0e1fbc64eddc21e0798527eb1f5fdbd5781d119bd2c44b6130afdc81cc" -"checksum rustc-ap-syntax 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "768e2698f912913be2ccd355b2dea62c978efc356f75db1400605f3642905d53" -"checksum rustc-ap-syntax_pos 209.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "008d47cc54ed12a2784217b9e6630a7fa1c8dc3591a283f65ad4b7fa307d49d5" -"checksum rustc-ap-syntax_pos 211.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a280dc8919aa7f684832ba3eeab2f6c96dbe2e2e4f6a922f7f0bdb3a9dd9e641" +"checksum rustc-ap-arena 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e905467184ce31ccdbd33ac33b9ba377f8cc7aefb340a733ab7e5efe34cddda" +"checksum rustc-ap-rustc_cratesio_shim 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c2a1a45817e78d0c1e2800fb933c526747ef2c5ee4b2dc0946e0c2d901329b88" +"checksum rustc-ap-rustc_data_structures 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4e9e5588883318e0e58bb7ea7cde2a66eaca55b25e32908f0982365988657" +"checksum rustc-ap-rustc_errors 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d233c0d9beda42a52d329a5df865c8f20c64773d2ab7aa6b4ae4248bacf3188" +"checksum rustc-ap-rustc_target 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "eec0bc13feecf9e88e39439b24b4b3ca54db8caf12fb7172d0c430451c8b377c" +"checksum rustc-ap-serialize 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ffcfb1102cd7cbf5f25c008a00f7253427af9dfac8989ede48c19bd47f556893" +"checksum rustc-ap-syntax 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a2ca0ef078a735c81a0d33589e04148dcf41f80ee7ebe30e72904a631b7c669" +"checksum rustc-ap-syntax_pos 218.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b1bbd31d1bbc7210983c3bbbcb9ee35bac443c6c899f979b8114e58bb7101c28" "checksum rustc-demangle 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "76d7ba1feafada44f2d38eed812bd2489a03c0f5abb975799251518b68848649" "checksum rustc-hash 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7540fc8b0c49f096ee9c961cda096467dce8084bec6bdca2fc83895fd9b28cb8" "checksum rustc-rayon 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c6d5a683c6ba4ed37959097e88d71c9e8e26659a3cb5be8b389078e7ad45306" diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 2f0ae7d9d2c..133e5aa37a7 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -137,8 +137,10 @@ fn run(self, builder: &Builder) { let target = self.target; let backend = self.backend; + let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); + builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target)); + let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "check"); - let features = builder.rustc_features().to_string(); cargo.arg("--manifest-path").arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml")); rustc_cargo_env(builder, &mut cargo); @@ -146,7 +148,7 @@ fn run(self, builder: &Builder) { let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); run_cargo(builder, - cargo.arg("--features").arg(features), + &mut cargo, &codegen_backend_stamp(builder, compiler, target, backend), true); } diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 8c4f2df60fe..2f8816d111a 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -670,16 +670,17 @@ fn run(self, builder: &Builder) { return; } + let out_dir = builder.cargo_out(compiler, Mode::Codegen, target); + builder.clear_if_dirty(&out_dir, &librustc_stamp(builder, compiler, target)); + let mut cargo = builder.cargo(compiler, Mode::Codegen, target, "build"); - let mut features = builder.rustc_features().to_string(); cargo.arg("--manifest-path") .arg(builder.src.join("src/librustc_codegen_llvm/Cargo.toml")); rustc_cargo_env(builder, &mut cargo); - features += &build_codegen_backend(&builder, &mut cargo, &compiler, target, backend); + let features = build_codegen_backend(&builder, &mut cargo, &compiler, target, backend); - let tmp_stamp = builder.cargo_out(compiler, Mode::Codegen, target) - .join(".tmp.stamp"); + let tmp_stamp = out_dir.join(".tmp.stamp"); let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage)); let files = run_cargo(builder, diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 1efff19dfb9..38965949bf2 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -555,8 +555,8 @@ fn stage_out(&self, compiler: Compiler, mode: Mode) -> PathBuf { let suffix = match mode { Mode::Std => "-std", Mode::Test => "-test", - Mode::Codegen => "-rustc", Mode::Rustc => "-rustc", + Mode::Codegen => "-codegen", Mode::ToolBootstrap => "-bootstrap-tools", Mode::ToolStd => "-tools", Mode::ToolRustc => "-tools", diff --git a/src/etc/test-float-parse/many-digits.rs b/src/etc/test-float-parse/many-digits.rs index 674c30ad84e..469a38da2b8 100644 --- a/src/etc/test-float-parse/many-digits.rs +++ b/src/etc/test-float-parse/many-digits.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rand)] - extern crate rand; mod _common; diff --git a/src/etc/test-float-parse/rand-f64.rs b/src/etc/test-float-parse/rand-f64.rs index 1d82912054e..2994dd9d5e6 100644 --- a/src/etc/test-float-parse/rand-f64.rs +++ b/src/etc/test-float-parse/rand-f64.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rand)] - extern crate rand; mod _common; diff --git a/src/liballoc/benches/lib.rs b/src/liballoc/benches/lib.rs index 4f69aa6670b..b4f4fd74f3a 100644 --- a/src/liballoc/benches/lib.rs +++ b/src/liballoc/benches/lib.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rand)] #![feature(repr_simd)] #![feature(slice_sort_by_cached_key)] #![feature(test)] diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 2cf9b13a67a..08db5136d04 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -67,7 +67,7 @@ use core::mem::{self, PinMut}; use core::ops::{CoerceUnsized, Deref, DerefMut, Generator, GeneratorState}; use core::ptr::{self, NonNull, Unique}; -use core::task::{Context, Poll, Executor, SpawnErrorKind, SpawnObjError}; +use core::task::{Context, Poll, Spawn, SpawnErrorKind, SpawnObjError}; use raw_vec::RawVec; use str::from_boxed_utf8_unchecked; @@ -973,11 +973,14 @@ unsafe fn drop(ptr: *mut ()) { } #[unstable(feature = "futures_api", issue = "50547")] -impl Executor for Box - where E: Executor + ?Sized +impl Spawn for Box + where Sp: Spawn + ?Sized { - fn spawn_obj(&mut self, task: FutureObj<'static, ()>) -> Result<(), SpawnObjError> { - (**self).spawn_obj(task) + fn spawn_obj( + &mut self, + future: FutureObj<'static, ()>, + ) -> Result<(), SpawnObjError> { + (**self).spawn_obj(future) } fn status(&self) -> Result<(), SpawnErrorKind> { diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index ba92b886138..7787102ba82 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -2370,7 +2370,7 @@ macro_rules! __impl_slice_eq1 { __impl_slice_eq1! { $Lhs, $Rhs, Sized } }; ($Lhs: ty, $Rhs: ty, $Bound: ident) => { - #[stable(feature = "vec-deque-partial-eq-slice", since = "1.17.0")] + #[stable(feature = "vec_deque_partial_eq_slice", since = "1.17.0")] impl<'a, 'b, A: $Bound, B> PartialEq<$Rhs> for $Lhs where A: PartialEq { fn eq(&self, other: &$Rhs) -> bool { if self.len() != other.len() { diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index ca1b7507b5e..d1b607bbe9b 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -74,27 +74,24 @@ #![needs_allocator] #![deny(missing_debug_implementations)] -#![cfg_attr(test, allow(deprecated))] // rand -#![cfg_attr(not(test), feature(exact_size_is_empty))] +#![cfg_attr(not(test), feature(fn_traits))] #![cfg_attr(not(test), feature(generator_trait))] -#![cfg_attr(test, feature(rand, test))] +#![cfg_attr(test, feature(test))] + #![feature(allocator_api)] #![feature(allow_internal_unstable)] #![feature(arbitrary_self_types)] -#![feature(ascii_ctype)] #![feature(box_into_raw_non_null)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(cfg_target_has_atomic)] #![feature(coerce_unsized)] -#![feature(collections_range)] #![feature(const_fn)] #![feature(core_intrinsics)] #![feature(custom_attribute)] #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(fmt_internals)] -#![feature(from_ref)] #![feature(fundamental)] #![feature(futures_api)] #![feature(lang_items)] @@ -118,14 +115,9 @@ #![feature(allocator_internals)] #![feature(on_unimplemented)] #![feature(exact_chunks)] -#![feature(pointer_methods)] -#![feature(inclusive_range_methods)] #![feature(rustc_const_unstable)] #![feature(const_vec_new)] -#![cfg_attr(not(test), feature(fn_traits, i128))] -#![cfg_attr(test, feature(test))] - // Allow testing this library #[cfg(test)] diff --git a/src/liballoc/tests/lib.rs b/src/liballoc/tests/lib.rs index 618aff963f2..c12c7a81f79 100644 --- a/src/liballoc/tests/lib.rs +++ b/src/liballoc/tests/lib.rs @@ -16,11 +16,8 @@ #![feature(drain_filter)] #![feature(exact_size_is_empty)] #![feature(pattern)] -#![feature(rand)] #![feature(slice_sort_by_cached_key)] -#![feature(splice)] #![feature(str_escape)] -#![feature(string_retain)] #![feature(try_reserve)] #![feature(unboxed_closures)] #![feature(exact_chunks)] diff --git a/src/libcore/char/methods.rs b/src/libcore/char/methods.rs index 33fd6947c1e..64a17786b0a 100644 --- a/src/libcore/char/methods.rs +++ b/src/libcore/char/methods.rs @@ -1050,8 +1050,6 @@ pub fn make_ascii_lowercase(&mut self) { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1084,8 +1082,6 @@ pub fn is_ascii_alphabetic(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1118,8 +1114,6 @@ pub fn is_ascii_uppercase(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1155,8 +1149,6 @@ pub fn is_ascii_lowercase(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1189,8 +1181,6 @@ pub fn is_ascii_alphanumeric(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1226,8 +1216,6 @@ pub fn is_ascii_digit(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1264,8 +1252,6 @@ pub fn is_ascii_hexdigit(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1298,8 +1284,6 @@ pub fn is_ascii_punctuation(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1349,8 +1333,6 @@ pub fn is_ascii_graphic(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; @@ -1385,8 +1367,6 @@ pub fn is_ascii_whitespace(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = 'A'; /// let uppercase_g = 'G'; /// let a = 'a'; diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 72074e1dbce..dc4a2d7c0d7 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -82,7 +82,7 @@ #![feature(concat_idents)] #![feature(const_fn)] #![feature(const_int_ops)] -#![feature(core_float)] +#![feature(const_fn_union)] #![feature(custom_attribute)] #![feature(doc_cfg)] #![feature(doc_spotlight)] @@ -102,8 +102,6 @@ #![feature(rustc_attrs)] #![feature(rustc_const_unstable)] #![feature(simd_ffi)] -#![feature(core_slice_ext)] -#![feature(core_str_ext)] #![feature(specialization)] #![feature(staged_api)] #![feature(stmt_expr_attributes)] @@ -111,7 +109,6 @@ #![feature(untagged_unions)] #![feature(unwind_attributes)] #![feature(doc_alias)] -#![feature(inclusive_range_methods)] #![feature(mmx_target_feature)] #![feature(tbm_target_feature)] #![feature(sse4a_target_feature)] diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6e2fbf6f84f..44a3b310ebe 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -3761,8 +3761,6 @@ pub fn make_ascii_lowercase(&mut self) { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -3799,8 +3797,6 @@ pub fn is_ascii_alphabetic(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -3837,8 +3833,6 @@ pub fn is_ascii_uppercase(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -3878,8 +3872,6 @@ pub fn is_ascii_lowercase(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -3916,8 +3908,6 @@ pub fn is_ascii_alphanumeric(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -3957,8 +3947,6 @@ pub fn is_ascii_digit(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -3999,8 +3987,6 @@ pub fn is_ascii_hexdigit(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -4037,8 +4023,6 @@ pub fn is_ascii_punctuation(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -4092,8 +4076,6 @@ pub fn is_ascii_graphic(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; @@ -4132,8 +4114,6 @@ pub fn is_ascii_whitespace(&self) -> bool { /// # Examples /// /// ``` - /// #![feature(ascii_ctype)] - /// /// let uppercase_a = b'A'; /// let uppercase_g = b'G'; /// let a = b'a'; diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index dfebe460ff8..187ac3c7a7f 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2007,7 +2007,7 @@ pub trait SliceIndex: private_slice_index::Sealed { fn index_mut(self, slice: &mut T) -> &mut Self::Output; } -#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] +#[stable(feature = "slice_get_slice_impls", since = "1.15.0")] impl SliceIndex<[T]> for usize { type Output = T; @@ -2056,7 +2056,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut T { } } -#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] +#[stable(feature = "slice_get_slice_impls", since = "1.15.0")] impl SliceIndex<[T]> for ops::Range { type Output = [T]; @@ -2117,7 +2117,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] { } } -#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] +#[stable(feature = "slice_get_slice_impls", since = "1.15.0")] impl SliceIndex<[T]> for ops::RangeTo { type Output = [T]; @@ -2152,7 +2152,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] { } } -#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] +#[stable(feature = "slice_get_slice_impls", since = "1.15.0")] impl SliceIndex<[T]> for ops::RangeFrom { type Output = [T]; @@ -2187,7 +2187,7 @@ fn index_mut(self, slice: &mut [T]) -> &mut [T] { } } -#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] +#[stable(feature = "slice_get_slice_impls", since = "1.15.0")] impl SliceIndex<[T]> for ops::RangeFull { type Output = [T]; diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 86b8349fa3c..356534a9187 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2117,8 +2117,6 @@ impl str { /// This length is in bytes, not [`char`]s or graphemes. In other words, /// it may not be what a human considers the length of the string. /// - /// [`char`]: primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -2590,8 +2588,6 @@ pub fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str) { /// Value, and may not match your idea of what a 'character' is. Iteration /// over grapheme clusters may be what you actually want. /// - /// [`char`]: primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -2643,8 +2639,6 @@ pub fn chars(&self) -> Chars { /// The iterator yields tuples. The position is first, the [`char`] is /// second. /// - /// [`char`]: primitive.char.html - /// /// # Examples /// /// Basic usage: @@ -2946,7 +2940,6 @@ pub fn ends_with<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool /// The pattern can be a `&str`, [`char`], or a closure that determines if /// a character matches. /// - /// [`char`]: primitive.char.html /// [`None`]: option/enum.Option.html#variant.None /// /// # Examples @@ -2994,7 +2987,6 @@ pub fn find<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option { /// The pattern can be a `&str`, [`char`], or a closure that determines if /// a character matches. /// - /// [`char`]: primitive.char.html /// [`None`]: option/enum.Option.html#variant.None /// /// # Examples @@ -3050,7 +3042,6 @@ pub fn rfind<'a, P: Pattern<'a>>(&'a self, pat: P) -> Option /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rsplit`] method can be used. /// - /// [`char`]: primitive.char.html /// [`rsplit`]: #method.rsplit /// /// # Examples @@ -3157,8 +3148,6 @@ pub fn split<'a, P: Pattern<'a>>(&'a self, pat: P) -> Split<'a, P> { /// The pattern can be a `&str`, [`char`], or a closure that determines the /// split. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator requires that the pattern supports a reverse @@ -3224,7 +3213,6 @@ pub fn rsplit<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplit<'a, P> /// elements. This is true for, eg, [`char`] but not for `&str`. /// /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// [`char`]: primitive.char.html /// /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rsplit_terminator`] method can be used. @@ -3259,8 +3247,6 @@ pub fn split_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> SplitTerminator /// Additional libraries might provide more complex patterns like /// regular expressions. /// - /// [`char`]: primitive.char.html - /// /// Equivalent to [`split`], except that the trailing substring is /// skipped if empty. /// @@ -3306,8 +3292,6 @@ pub fn rsplit_terminator<'a, P: Pattern<'a>>(&'a self, pat: P) -> RSplitTerminat /// The pattern can be a `&str`, [`char`], or a closure that determines the /// split. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator will not be double ended, because it is @@ -3361,8 +3345,6 @@ pub fn splitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> SplitN<'a, P> { /// The pattern can be a `&str`, [`char`], or a closure that /// determines the split. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator will not be double ended, because it is not @@ -3407,8 +3389,6 @@ pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> RSplitN<'a, P> /// The pattern can be a `&str`, [`char`], or a closure that /// determines if a character matches. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator will be a [`DoubleEndedIterator`] if the pattern @@ -3416,7 +3396,6 @@ pub fn rsplitn<'a, P: Pattern<'a>>(&'a self, n: usize, pat: P) -> RSplitN<'a, P> /// elements. This is true for, eg, [`char`] but not for `&str`. /// /// [`DoubleEndedIterator`]: iter/trait.DoubleEndedIterator.html - /// [`char`]: primitive.char.html /// /// If the pattern allows a reverse search but its results might differ /// from a forward search, the [`rmatches`] method can be used. @@ -3446,8 +3425,6 @@ pub fn matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> Matches<'a, P> { /// The pattern can be a `&str`, [`char`], or a closure that determines if /// a character matches. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator requires that the pattern supports a reverse @@ -3488,8 +3465,6 @@ pub fn rmatches<'a, P: Pattern<'a>>(&'a self, pat: P) -> RMatches<'a, P> /// The pattern can be a `&str`, [`char`], or a closure that determines /// if a character matches. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator will be a [`DoubleEndedIterator`] if the pattern @@ -3532,8 +3507,6 @@ pub fn match_indices<'a, P: Pattern<'a>>(&'a self, pat: P) -> MatchIndices<'a, P /// The pattern can be a `&str`, [`char`], or a closure that determines if a /// character matches. /// - /// [`char`]: primitive.char.html - /// /// # Iterator behavior /// /// The returned iterator requires that the pattern supports a reverse @@ -3665,8 +3638,6 @@ pub fn trim_right(&self) -> &str { /// The pattern can be a [`char`] or a closure that determines if a /// character matches. /// - /// [`char`]: primitive.char.html - /// /// # Examples /// /// Simple patterns: @@ -3711,8 +3682,6 @@ pub fn trim_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str /// The pattern can be a `&str`, [`char`], or a closure that determines if /// a character matches. /// - /// [`char`]: primitive.char.html - /// /// # Text directionality /// /// A string is a sequence of bytes. 'Left' in this context means the first @@ -3750,8 +3719,6 @@ pub fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str { /// The pattern can be a `&str`, [`char`], or a closure that /// determines if a character matches. /// - /// [`char`]: primitive.char.html - /// /// # Text directionality /// /// A string is a sequence of bytes. 'Right' in this context means the last diff --git a/src/libcore/task/context.rs b/src/libcore/task/context.rs index 121f93b666b..5a29c8528ef 100644 --- a/src/libcore/task/context.rs +++ b/src/libcore/task/context.rs @@ -13,7 +13,7 @@ issue = "50547")] use fmt; -use super::{Executor, Waker, LocalWaker}; +use super::{Spawn, Waker, LocalWaker}; /// Information about the currently-running task. /// @@ -21,7 +21,7 @@ /// when performing a single `poll` step on a task. pub struct Context<'a> { local_waker: &'a LocalWaker, - executor: &'a mut dyn Executor, + spawner: &'a mut dyn Spawn, } impl<'a> fmt::Debug for Context<'a> { @@ -32,13 +32,14 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { } impl<'a> Context<'a> { - /// Create a new task `Context` with the provided `local_waker`, `waker`, and `executor`. + /// Create a new task `Context` with the provided `local_waker`, `waker`, + /// and `spawner`. #[inline] - pub fn new(local_waker: &'a LocalWaker, executor: &'a mut dyn Executor) -> Context<'a> { - Context { - local_waker, - executor, - } + pub fn new( + local_waker: &'a LocalWaker, + spawner: &'a mut dyn Spawn, + ) -> Context<'a> { + Context { local_waker, spawner } } /// Get the `LocalWaker` associated with the current task. @@ -53,40 +54,45 @@ pub fn waker(&self) -> &'a Waker { unsafe { &*(self.local_waker as *const LocalWaker as *const Waker) } } - /// Get the default executor associated with this task. + /// Get the spawner associated with this task. /// /// This method is useful primarily if you want to explicitly handle /// spawn failures. #[inline] - pub fn executor(&mut self) -> &mut dyn Executor { - self.executor + pub fn spawner(&mut self) -> &mut dyn Spawn { + self.spawner } - /// Produce a context like the current one, but using the given waker instead. + /// Produce a context like the current one, but using the given waker + /// instead. /// /// This advanced method is primarily used when building "internal /// schedulers" within a task, where you want to provide some customized /// wakeup logic. #[inline] - pub fn with_waker<'b>(&'b mut self, local_waker: &'b LocalWaker) -> Context<'b> { + pub fn with_waker<'b>( + &'b mut self, + local_waker: &'b LocalWaker, + ) -> Context<'b> { Context { local_waker, - executor: self.executor, + spawner: self.spawner, } } - /// Produce a context like the current one, but using the given executor + /// Produce a context like the current one, but using the given spawner /// instead. /// /// This advanced method is primarily used when building "internal /// schedulers" within a task. #[inline] - pub fn with_executor<'b, E>(&'b mut self, executor: &'b mut E) -> Context<'b> - where E: Executor - { + pub fn with_spawner<'b, Sp: Spawn>( + &'b mut self, + spawner: &'b mut Sp, + ) -> Context<'b> { Context { local_waker: self.local_waker, - executor, + spawner, } } } diff --git a/src/libcore/task/executor.rs b/src/libcore/task/executor.rs deleted file mode 100644 index affcbf464da..00000000000 --- a/src/libcore/task/executor.rs +++ /dev/null @@ -1,96 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![unstable(feature = "futures_api", - reason = "futures in libcore are unstable", - issue = "50547")] - -use fmt; -use future::{FutureObj, LocalFutureObj}; - -/// A task executor. -/// -/// Futures are polled until completion by tasks, a kind of lightweight -/// "thread". A *task executor* is responsible for the creation of these tasks -/// and the coordination of their execution on real operating system threads. In -/// particular, whenever a task signals that it can make further progress via a -/// wake-up notification, it is the responsibility of the task executor to put -/// the task into a queue to continue executing it, i.e. polling the future in -/// it, later. -pub trait Executor { - /// Spawns a new task with the given future. The future will be polled until - /// completion. - /// - /// # Errors - /// - /// The executor may be unable to spawn tasks, either because it has - /// been shut down or is resource-constrained. - fn spawn_obj( - &mut self, - future: FutureObj<'static, ()>, - ) -> Result<(), SpawnObjError>; - - /// Determines whether the executor is able to spawn new tasks. - /// - /// # Returns - /// - /// An `Ok` return means the executor is *likely* (but not guaranteed) - /// to accept a subsequent spawn attempt. Likewise, an `Err` return - /// means that `spawn` is likely, but not guaranteed, to yield an error. - #[inline] - fn status(&self) -> Result<(), SpawnErrorKind> { - Ok(()) - } -} - -/// Provides the reason that an executor was unable to spawn. -pub struct SpawnErrorKind { - _hidden: (), -} - -impl fmt::Debug for SpawnErrorKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.debug_tuple("SpawnErrorKind") - .field(&"shutdown") - .finish() - } -} - -impl SpawnErrorKind { - /// Spawning is failing because the executor has been shut down. - pub fn shutdown() -> SpawnErrorKind { - SpawnErrorKind { _hidden: () } - } - - /// Check whether this error is the `shutdown` error. - pub fn is_shutdown(&self) -> bool { - true - } -} - -/// The result of a failed spawn -#[derive(Debug)] -pub struct SpawnObjError { - /// The kind of error - pub kind: SpawnErrorKind, - - /// The future for which spawning inside a task was attempted - pub future: FutureObj<'static, ()>, -} - -/// The result of a failed spawn -#[derive(Debug)] -pub struct SpawnLocalObjError { - /// The kind of error - pub kind: SpawnErrorKind, - - /// The future for which spawning inside a task was attempted - pub future: LocalFutureObj<'static, ()>, -} diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index c4f07536164..f51e5f7ce0e 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -17,10 +17,8 @@ mod context; pub use self::context::Context; -mod executor; -pub use self::executor::{ - Executor, SpawnErrorKind, SpawnObjError, SpawnLocalObjError -}; +mod spawn; +pub use self::spawn::{Spawn, SpawnErrorKind, SpawnObjError, SpawnLocalObjError}; mod poll; pub use self::poll::Poll; diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs new file mode 100644 index 00000000000..58ee85d232b --- /dev/null +++ b/src/libcore/task/spawn.rs @@ -0,0 +1,93 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![unstable(feature = "futures_api", + reason = "futures in libcore are unstable", + issue = "50547")] + +use fmt; +use future::{FutureObj, LocalFutureObj}; + +/// Spawns tasks that poll futures to completion onto its associated task +/// executor. +/// +/// The term "task" refers to a kind of lightweight "thread". Task executors +/// are responsible for scheduling the execution of tasks on operating system +/// threads. +pub trait Spawn { + /// Spawns a new task with the given future. The future will be polled until + /// completion. + /// + /// # Errors + /// + /// The executor may be unable to spawn tasks, either because it has + /// been shut down or is resource-constrained. + fn spawn_obj( + &mut self, + future: FutureObj<'static, ()>, + ) -> Result<(), SpawnObjError>; + + /// Determines whether the executor is able to spawn new tasks. + /// + /// # Returns + /// + /// An `Ok` return means the executor is *likely* (but not guaranteed) + /// to accept a subsequent spawn attempt. Likewise, an `Err` return + /// means that `spawn` is likely, but not guaranteed, to yield an error. + #[inline] + fn status(&self) -> Result<(), SpawnErrorKind> { + Ok(()) + } +} + +/// Provides the reason that an executor was unable to spawn. +pub struct SpawnErrorKind { + _hidden: (), +} + +impl fmt::Debug for SpawnErrorKind { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.debug_tuple("SpawnErrorKind") + .field(&"shutdown") + .finish() + } +} + +impl SpawnErrorKind { + /// Spawning is failing because the executor has been shut down. + pub fn shutdown() -> SpawnErrorKind { + SpawnErrorKind { _hidden: () } + } + + /// Check whether this error is the `shutdown` error. + pub fn is_shutdown(&self) -> bool { + true + } +} + +/// The result of a failed spawn +#[derive(Debug)] +pub struct SpawnObjError { + /// The kind of error + pub kind: SpawnErrorKind, + + /// The future for which spawning inside a task was attempted + pub future: FutureObj<'static, ()>, +} + +/// The result of a failed spawn +#[derive(Debug)] +pub struct SpawnLocalObjError { + /// The kind of error + pub kind: SpawnErrorKind, + + /// The future for which spawning inside a task was attempted + pub future: LocalFutureObj<'static, ()>, +} diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 2323b30a010..fc92a5a2225 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -8,18 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(ascii_ctype)] #![feature(box_syntax)] #![feature(cell_update)] -#![feature(core_float)] #![feature(core_private_bignum)] #![feature(core_private_diy_float)] #![feature(dec2flt)] -#![feature(decode_utf8)] #![feature(euclidean_division)] #![feature(exact_size_is_empty)] #![feature(fixed_size_array)] -#![feature(float_internals)] #![feature(flt2dec)] #![feature(fmt_internals)] #![feature(hashmap_internals)] @@ -29,7 +25,6 @@ #![feature(refcell_map_split)] #![feature(refcell_replace_swap)] #![feature(slice_patterns)] -#![feature(slice_rotate)] #![feature(sort_internals)] #![feature(specialization)] #![feature(step_trait)] diff --git a/src/liblibc b/src/liblibc index b6d23ed45d7..6bdbf5dc937 160000 --- a/src/liblibc +++ b/src/liblibc @@ -1 +1 @@ -Subproject commit b6d23ed45d72918239c0bfac11dc547895e59b81 +Subproject commit 6bdbf5dc937459bd10e6bc4dc52b0adbd8cf4358 diff --git a/src/libpanic_unwind/lib.rs b/src/libpanic_unwind/lib.rs index 5c320bb369e..2abdf7cee63 100644 --- a/src/libpanic_unwind/lib.rs +++ b/src/libpanic_unwind/lib.rs @@ -39,7 +39,6 @@ #![feature(staged_api)] #![feature(std_internals)] #![feature(unwind_attributes)] -#![cfg_attr(target_env = "msvc", feature(raw))] #![panic_runtime] #![feature(panic_runtime)] diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 14a818ddafb..b7281cf0445 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -615,7 +615,9 @@ pub fn fingerprint_needed_for_crate_hash(self) -> bool { [input] CrateName(CrateNum), [] ItemChildren(DefId), [] ExternModStmtCnum(DefId), - [input] GetLangItems, + [eval_always] GetLibFeatures, + [] DefinedLibFeatures(CrateNum), + [eval_always] GetLangItems, [] DefinedLangItems(CrateNum), [] MissingLangItems(CrateNum), [] VisibleParentMap, diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 5ace8397d9f..a3c0688dcc8 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1918,6 +1918,30 @@ fn foo<'a>(x: &'a i32, y: &i32) -> &'a i32 { ``` "##, +E0635: r##" +The `#![feature]` attribute specified an unknown feature. + +Erroneous code example: + +```compile_fail,E0635 +#![feature(nonexistent_rust_feature)] // error: unknown feature +``` + +"##, + +E0636: r##" +A `#![feature]` attribute was declared multiple times. + +Erroneous code example: + +```compile_fail,E0636 +#![allow(stable_features)] +#![feature(rust1)] +#![feature(rust1)] // error: the feature `rust1` has already been declared +``` + +"##, + E0644: r##" A closure or generator was constructed that references its own type. @@ -2138,4 +2162,5 @@ trait Foo { } E0708, // `async` non-`move` closures with arguments are not currently supported E0709, // multiple different lifetimes used in arguments of `async fn` E0710, // an unknown tool name found in scoped lint + E0711, // a feature has been declared with conflicting stability attributes } diff --git a/src/librustc/hir/def.rs b/src/librustc/hir/def.rs index cb5e1e600d3..4a14223eb88 100644 --- a/src/librustc/hir/def.rs +++ b/src/librustc/hir/def.rs @@ -28,6 +28,18 @@ pub enum CtorKind { Fictive, } +#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] +pub enum NonMacroAttrKind { + /// Single-segment attribute defined by the language (`#[inline]`) + Builtin, + /// Multi-segment custom attribute living in a "tool module" (`#[rustfmt::skip]`). + Tool, + /// Single-segment custom attribute registered by a derive macro (`#[serde(default)]`). + DeriveHelper, + /// Single-segment custom attribute not registered in any way (`#[my_attr]`). + Custom, +} + #[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum Def { // Type namespace @@ -68,9 +80,7 @@ pub enum Def { // Macro namespace Macro(DefId, MacroKind), - NonMacroAttr, // e.g. `#[inline]` or `#[rustfmt::skip]` - - GlobalAsm(DefId), + NonMacroAttr(NonMacroAttrKind), // e.g. `#[inline]` or `#[rustfmt::skip]` // Both namespaces Err, @@ -242,6 +252,17 @@ pub fn from_hir(vdata: &hir::VariantData) -> CtorKind { } } +impl NonMacroAttrKind { + fn descr(self) -> &'static str { + match self { + NonMacroAttrKind::Builtin => "built-in attribute", + NonMacroAttrKind::Tool => "tool attribute", + NonMacroAttrKind::DeriveHelper => "derive helper attribute", + NonMacroAttrKind::Custom => "custom attribute", + } + } +} + impl Def { pub fn def_id(&self) -> DefId { match *self { @@ -251,8 +272,7 @@ pub fn def_id(&self) -> DefId { Def::AssociatedTy(id) | Def::TyParam(id) | Def::Struct(id) | Def::StructCtor(id, ..) | Def::Union(id) | Def::Trait(id) | Def::Method(id) | Def::Const(id) | Def::AssociatedConst(id) | Def::Macro(id, ..) | - Def::Existential(id) | Def::AssociatedExistential(id) | - Def::GlobalAsm(id) | Def::TyForeign(id) => { + Def::Existential(id) | Def::AssociatedExistential(id) | Def::TyForeign(id) => { id } @@ -262,7 +282,7 @@ pub fn def_id(&self) -> DefId { Def::PrimTy(..) | Def::SelfTy(..) | Def::ToolMod | - Def::NonMacroAttr | + Def::NonMacroAttr(..) | Def::Err => { bug!("attempted .def_id() on invalid def: {:?}", self) } @@ -302,9 +322,8 @@ pub fn kind_name(&self) -> &'static str { Def::Label(..) => "label", Def::SelfTy(..) => "self type", Def::Macro(.., macro_kind) => macro_kind.descr(), - Def::GlobalAsm(..) => "global asm", Def::ToolMod => "tool module", - Def::NonMacroAttr => "non-macro attribute", + Def::NonMacroAttr(attr_kind) => attr_kind.descr(), Def::Err => "unresolved item", } } diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 4274cd3a0a6..d853d3d9a7f 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -353,10 +353,10 @@ fn visit_generic_arg(&mut self, generic_arg: &'v GenericArg) { fn visit_lifetime(&mut self, lifetime: &'v Lifetime) { walk_lifetime(self, lifetime) } - fn visit_qpath(&mut self, qpath: &'v QPath, id: NodeId, span: Span) { + fn visit_qpath(&mut self, qpath: &'v QPath, id: HirId, span: Span) { walk_qpath(self, qpath, id, span) } - fn visit_path(&mut self, path: &'v Path, _id: NodeId) { + fn visit_path(&mut self, path: &'v Path, _id: HirId) { walk_path(self, path) } fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v PathSegment) { @@ -456,7 +456,7 @@ pub fn walk_trait_ref<'v, V>(visitor: &mut V, trait_ref: &'v TraitRef) where V: Visitor<'v> { visitor.visit_id(trait_ref.ref_id); - visitor.visit_path(&trait_ref.path, trait_ref.ref_id) + visitor.visit_path(&trait_ref.path, trait_ref.hir_ref_id) } pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { @@ -471,7 +471,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item) { } ItemKind::Use(ref path, _) => { visitor.visit_id(item.id); - visitor.visit_path(path, item.id); + visitor.visit_path(path, item.hir_id); } ItemKind::Static(ref typ, _, body) | ItemKind::Const(ref typ, body) => { @@ -602,7 +602,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { visitor.visit_fn_decl(&function_declaration.decl); } TyKind::Path(ref qpath) => { - visitor.visit_qpath(qpath, typ.id, typ.span); + visitor.visit_qpath(qpath, typ.hir_id, typ.span); } TyKind::Array(ref ty, ref length) => { visitor.visit_ty(ty); @@ -621,7 +621,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) { } } -pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath, id: NodeId, span: Span) { +pub fn walk_qpath<'v, V: Visitor<'v>>(visitor: &mut V, qpath: &'v QPath, id: HirId, span: Span) { match *qpath { QPath::Resolved(ref maybe_qself, ref path) => { if let Some(ref qself) = *maybe_qself { @@ -670,14 +670,14 @@ pub fn walk_pat<'v, V: Visitor<'v>>(visitor: &mut V, pattern: &'v Pat) { visitor.visit_id(pattern.id); match pattern.node { PatKind::TupleStruct(ref qpath, ref children, _) => { - visitor.visit_qpath(qpath, pattern.id, pattern.span); + visitor.visit_qpath(qpath, pattern.hir_id, pattern.span); walk_list!(visitor, visit_pat, children); } PatKind::Path(ref qpath) => { - visitor.visit_qpath(qpath, pattern.id, pattern.span); + visitor.visit_qpath(qpath, pattern.hir_id, pattern.span); } PatKind::Struct(ref qpath, ref fields, _) => { - visitor.visit_qpath(qpath, pattern.id, pattern.span); + visitor.visit_qpath(qpath, pattern.hir_id, pattern.span); for field in fields { visitor.visit_id(field.node.id); visitor.visit_ident(field.node.ident); @@ -985,7 +985,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { visitor.visit_anon_const(count) } ExprKind::Struct(ref qpath, ref fields, ref optional_base) => { - visitor.visit_qpath(qpath, expression.id, expression.span); + visitor.visit_qpath(qpath, expression.hir_id, expression.span); for field in fields { visitor.visit_id(field.id); visitor.visit_ident(field.ident); @@ -1062,7 +1062,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr) { visitor.visit_expr(index_expression) } ExprKind::Path(ref qpath) => { - visitor.visit_qpath(qpath, expression.id, expression.span); + visitor.visit_qpath(qpath, expression.hir_id, expression.span); } ExprKind::Break(ref destination, ref opt_expr) => { if let Some(ref label) = destination.label { @@ -1108,9 +1108,9 @@ pub fn walk_arm<'v, V: Visitor<'v>>(visitor: &mut V, arm: &'v Arm) { } pub fn walk_vis<'v, V: Visitor<'v>>(visitor: &mut V, vis: &'v Visibility) { - if let VisibilityKind::Restricted { ref path, id } = vis.node { + if let VisibilityKind::Restricted { ref path, id, hir_id } = vis.node { visitor.visit_id(id); - visitor.visit_path(path, id) + visitor.visit_path(path, hir_id) } } diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 4b69e3b6bc7..6b66fd8a2b2 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -123,8 +123,8 @@ pub struct LoweringContext<'a> { // Whether or not in-band lifetimes are being collected. This is used to // indicate whether or not we're in a place where new lifetimes will result // in in-band lifetime definitions, such a function or an impl header. - // This will always be false unless the `in_band_lifetimes` feature is - // enabled. + // This will always be false unless the `in_band_lifetimes` or + // `impl_header_lifetime_elision` feature is enabled. is_collecting_in_band_lifetimes: bool, // Currently in-scope lifetimes defined in impl headers, fn headers, or HRTB. @@ -658,9 +658,11 @@ fn collect_in_band_defs( assert!(self.lifetimes_to_define.is_empty()); let old_anonymous_lifetime_mode = self.anonymous_lifetime_mode; - self.is_collecting_in_band_lifetimes = self.sess.features_untracked().in_band_lifetimes; - if self.is_collecting_in_band_lifetimes { + if self.sess.features_untracked().impl_header_lifetime_elision { self.anonymous_lifetime_mode = anonymous_lifetime_mode; + self.is_collecting_in_band_lifetimes = true; + } else if self.sess.features_untracked().in_band_lifetimes { + self.is_collecting_in_band_lifetimes = true; } let (in_band_ty_params, res) = f(self); @@ -718,6 +720,10 @@ fn maybe_collect_in_band_lifetime(&mut self, ident: Ident) { return; } + if !self.sess.features_untracked().in_band_lifetimes { + return; + } + if self.in_scope_lifetimes.contains(&ident.modern()) { return; } @@ -2149,12 +2155,14 @@ fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { let future_path = this.std_path(span, &["future", "Future"], Some(future_params), false); + let LoweredNodeId { node_id, hir_id } = this.next_id(); let mut bounds = vec![ hir::GenericBound::Trait( hir::PolyTraitRef { trait_ref: hir::TraitRef { path: future_path, - ref_id: this.next_id().node_id, + ref_id: node_id, + hir_ref_id: hir_id, }, bound_generic_params: hir_vec![], span, @@ -2476,9 +2484,11 @@ fn lower_trait_ref(&mut self, p: &TraitRef, itctx: ImplTraitContext) -> hir::Tra hir::QPath::Resolved(None, path) => path.and_then(|path| path), qpath => bug!("lower_trait_ref: unexpected QPath `{:?}`", qpath), }; + let LoweredNodeId { node_id, hir_id } = self.lower_node_id(p.ref_id); hir::TraitRef { path, - ref_id: self.lower_node_id(p.ref_id).node_id, + ref_id: node_id, + hir_ref_id: hir_id, } } @@ -2837,11 +2847,13 @@ fn lower_use_tree( hir::VisibilityKind::Public => hir::VisibilityKind::Public, hir::VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, - hir::VisibilityKind::Restricted { ref path, id: _ } => { + hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { + let id = this.next_id(); hir::VisibilityKind::Restricted { path: path.clone(), // We are allocating a new NodeId here - id: this.next_id().node_id, + id: id.node_id, + hir_id: id.hir_id, } } }; @@ -2910,11 +2922,13 @@ fn lower_use_tree( hir::VisibilityKind::Public => hir::VisibilityKind::Public, hir::VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), hir::VisibilityKind::Inherited => hir::VisibilityKind::Inherited, - hir::VisibilityKind::Restricted { ref path, id: _ } => { + hir::VisibilityKind::Restricted { ref path, id: _, hir_id: _ } => { + let id = this.next_id(); hir::VisibilityKind::Restricted { path: path.clone(), // We are allocating a new NodeId here - id: this.next_id().node_id, + id: id.node_id, + hir_id: id.hir_id, } } }; @@ -4344,13 +4358,17 @@ fn lower_visibility( let node = match v.node { VisibilityKind::Public => hir::VisibilityKind::Public, VisibilityKind::Crate(sugar) => hir::VisibilityKind::Crate(sugar), - VisibilityKind::Restricted { ref path, id } => hir::VisibilityKind::Restricted { - path: P(self.lower_path(id, path, ParamMode::Explicit)), - id: if let Some(owner) = explicit_owner { - self.lower_node_id_with_owner(id, owner).node_id + VisibilityKind::Restricted { ref path, id } => { + let lowered_id = if let Some(owner) = explicit_owner { + self.lower_node_id_with_owner(id, owner) } else { - self.lower_node_id(id).node_id - }, + self.lower_node_id(id) + }; + hir::VisibilityKind::Restricted { + path: P(self.lower_path(id, path, ParamMode::Explicit)), + id: lowered_id.node_id, + hir_id: lowered_id.hir_id, + } }, VisibilityKind::Inherited => hir::VisibilityKind::Inherited, }; @@ -4669,6 +4687,7 @@ fn ty_path(&mut self, id: LoweredNodeId, span: Span, qpath: hir::QPath) -> hir:: trait_ref: hir::TraitRef { path: path.and_then(|path| path), ref_id: id.node_id, + hir_ref_id: id.hir_id, }, span, }; diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index 49231e58cf0..b05bcadf826 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -432,7 +432,6 @@ pub fn describe_def(&self, node_id: NodeId) -> Option { ItemKind::Const(..) => Some(Def::Const(def_id())), ItemKind::Fn(..) => Some(Def::Fn(def_id())), ItemKind::Mod(..) => Some(Def::Mod(def_id())), - ItemKind::GlobalAsm(..) => Some(Def::GlobalAsm(def_id())), ItemKind::Existential(..) => Some(Def::Existential(def_id())), ItemKind::Ty(..) => Some(Def::TyAlias(def_id())), ItemKind::Enum(..) => Some(Def::Enum(def_id())), @@ -445,6 +444,7 @@ pub fn describe_def(&self, node_id: NodeId) -> Option { ItemKind::ExternCrate(_) | ItemKind::Use(..) | ItemKind::ForeignMod(..) | + ItemKind::GlobalAsm(..) | ItemKind::Impl(..) => None, } } diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index 610add90b85..0003790e6d5 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -1912,6 +1912,7 @@ pub enum UseKind { pub struct TraitRef { pub path: Path, pub ref_id: NodeId, + pub hir_ref_id: HirId, } #[derive(Clone, RustcEncodable, RustcDecodable, Debug)] @@ -1931,7 +1932,7 @@ pub struct PolyTraitRef { pub enum VisibilityKind { Public, Crate(CrateSugar), - Restricted { path: P, id: NodeId }, + Restricted { path: P, id: NodeId, hir_id: HirId }, Inherited, } diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index cac0d182d3a..76e57558bfe 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -360,6 +360,7 @@ fn hash_stable(&self, impl_stable_hash_for!(struct hir::TraitRef { // Don't hash the ref_id. It is tracked via the thing it is used to access ref_id -> _, + hir_ref_id -> _, path, }); @@ -723,9 +724,10 @@ fn hash_stable(&self, hir::VisibilityKind::Crate(sugar) => { sugar.hash_stable(hcx, hasher); } - hir::VisibilityKind::Restricted { ref path, id } => { + hir::VisibilityKind::Restricted { ref path, id, hir_id } => { hcx.with_node_id_hashing_mode(NodeIdHashingMode::HashDefPath, |hcx| { id.hash_stable(hcx, hasher); + hir_id.hash_stable(hcx, hasher); }); path.hash_stable(hcx, hasher); } @@ -988,6 +990,13 @@ fn to_stable_hash_key(&self, Fictive }); +impl_stable_hash_for!(enum hir::def::NonMacroAttrKind { + Builtin, + Tool, + DeriveHelper, + Custom, +}); + impl_stable_hash_for!(enum hir::def::Def { Mod(def_id), Struct(def_id), @@ -1015,9 +1024,8 @@ fn to_stable_hash_key(&self, Upvar(def_id, index, expr_id), Label(node_id), Macro(def_id, macro_kind), - GlobalAsm(def_id), ToolMod, - NonMacroAttr, + NonMacroAttr(attr_kind), Err }); @@ -1072,6 +1080,11 @@ fn to_stable_hash_key(&self, hcx: &StableHashingContext<'a>) -> DefPathHash { span }); +impl_stable_hash_for!(struct ::middle::lib_features::LibFeatures { + stable, + unstable +}); + impl<'a> HashStable> for ::middle::lang_items::LangItem { fn hash_stable(&self, _: &mut StableHashingContext<'a>, diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 2ab0124397b..d086d3bd28d 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -511,7 +511,7 @@ fn hash_stable(&self, hasher: &mut StableHasher) { // Unfortunately we cannot exhaustively list fields here, since the // struct is macro generated. - self.declared_stable_lang_features.hash_stable(hcx, hasher); + self.declared_lang_features.hash_stable(hcx, hasher); self.declared_lib_features.hash_stable(hcx, hasher); self.walk_feature_fields(|feature_name, value| { diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 90248e89fa7..212821cac2e 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -303,7 +303,14 @@ pub fn report_region_errors( ) { debug!("report_region_errors(): {} errors to start", errors.len()); - if will_later_be_reported_by_nll && self.tcx.use_mir_borrowck() { + if will_later_be_reported_by_nll && + // FIXME: `use_mir_borrowck` seems wrong here... + self.tcx.use_mir_borrowck() && + // ... this is a band-aid; may be better to explicitly + // match on every borrowck_mode variant to guide decision + // here. + !self.tcx.migrate_borrowck() { + // With `#![feature(nll)]`, we want to present a nice user // experience, so don't even mention the errors from the // AST checker. 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 f50c23b0aa7..ddeb291a13a 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -64,6 +64,12 @@ pub fn new_from_span( Self { tcx, error: None, regions: Some((span, sub, sup)), tables } } + pub fn try_report_from_nll(&self) -> Option { + // Due to the improved diagnostics returned by the MIR borrow checker, only a subset of + // the nice region errors are required when running under the MIR borrow checker. + self.try_report_named_anon_conflict() + } + pub fn try_report(&self) -> Option { self.try_report_named_anon_conflict() .or_else(|| self.try_report_anon_anon_conflict()) 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 51abfa2505a..ca71b0aeed9 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 @@ -65,9 +65,10 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option { region_info ); - let (arg, new_ty, br, is_first, scope_def_id, is_impl_item) = ( + let (arg, new_ty, new_ty_span, br, is_first, scope_def_id, is_impl_item) = ( anon_arg_info.arg, anon_arg_info.arg_ty, + anon_arg_info.arg_ty_span, anon_arg_info.bound_region, anon_arg_info.is_first, region_info.def_id, @@ -110,9 +111,10 @@ pub(super) fn try_report_named_anon_conflict(&self) -> Option { E0621, "explicit lifetime required in {}", error_var - ).span_label( - arg.pat.span, - format!("consider changing {} to `{}`", span_label_var, new_ty), + ).span_suggestion( + new_ty_span, + &format!("add explicit lifetime `{}` to {}", named, span_label_var), + new_ty.to_string() ) .span_label(span, format!("lifetime `{}` required", named)) .emit(); diff --git a/src/librustc/infer/error_reporting/nice_region_error/util.rs b/src/librustc/infer/error_reporting/nice_region_error/util.rs index 1cc2b9d50b9..28320ce3ad1 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/util.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/util.rs @@ -27,6 +27,8 @@ pub(super) struct AnonymousArgInfo<'tcx> { pub arg_ty: Ty<'tcx>, // the ty::BoundRegion corresponding to the anonymous region pub bound_region: ty::BoundRegion, + // arg_ty_span contains span of argument type + pub arg_ty_span : Span, // corresponds to id the argument is the first parameter // in the declaration pub is_first: bool, @@ -74,12 +76,16 @@ pub(super) fn find_arg_with_region( if let Some(node_id) = hir.as_local_node_id(id) { if let Some(body_id) = hir.maybe_body_owned_by(node_id) { let body = hir.body(body_id); + let owner_id = hir.body_owner(body_id); + let fn_decl = hir.fn_decl(owner_id).unwrap(); if let Some(tables) = self.tables { body.arguments .iter() .enumerate() .filter_map(|(index, arg)| { // May return None; sometimes the tables are not yet populated. + let ty_hir_id = fn_decl.inputs[index].hir_id; + let arg_ty_span = hir.span(hir.hir_to_node_id(ty_hir_id)); let ty = tables.node_id_to_type_opt(arg.hir_id)?; let mut found_anon_region = false; let new_arg_ty = self.tcx.fold_regions(&ty, &mut false, |r, _| { @@ -95,6 +101,7 @@ pub(super) fn find_arg_with_region( Some(AnonymousArgInfo { arg: arg, arg_ty: new_arg_ty, + arg_ty_span : arg_ty_span, bound_region: bound_region, is_first: is_first, }) diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs index bac511aac1f..804481846af 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -45,8 +45,6 @@ #![feature(const_fn)] #![feature(core_intrinsics)] #![feature(drain_filter)] -#![feature(from_ref)] -#![feature(fs_read_write)] #![feature(iterator_find_map)] #![cfg_attr(windows, feature(libc))] #![feature(macro_vis_matcher)] @@ -70,9 +68,9 @@ #![feature(step_trait)] #![feature(integer_atomics)] #![feature(test)] +#![cfg_attr(not(stage0), feature(impl_header_lifetime_elision))] #![feature(in_band_lifetimes)] #![feature(macro_at_most_once_rep)] -#![feature(inclusive_range_methods)] #![feature(crate_in_paths)] #![recursion_limit="512"] @@ -141,6 +139,7 @@ pub mod middle { pub mod exported_symbols; pub mod free_region; pub mod intrinsicck; + pub mod lib_features; pub mod lang_items; pub mod liveness; pub mod mem_categorization; diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 47f7c759d94..590b59568c4 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -102,7 +102,7 @@ declare_lint! { pub UNUSED_FEATURES, Warn, - "unused or unknown features found in crate-level #[feature] directives" + "unused features found in crate-level #[feature] directives" } declare_lint! { diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 15630157722..315ed38ad07 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -869,7 +869,7 @@ fn visit_lifetime(&mut self, lt: &'tcx hir::Lifetime) { hir_visit::walk_lifetime(self, lt); } - fn visit_path(&mut self, p: &'tcx hir::Path, id: ast::NodeId) { + fn visit_path(&mut self, p: &'tcx hir::Path, id: hir::HirId) { run_lints!(self, check_path, p, id); hir_visit::walk_path(self, p); } diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index d267c181277..231a70f873f 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -242,7 +242,7 @@ fn check_struct_def_post( fn check_variant(a: &$hir hir::Variant, b: &$hir hir::Generics); fn check_variant_post(a: &$hir hir::Variant, b: &$hir hir::Generics); fn check_lifetime(a: &$hir hir::Lifetime); - fn check_path(a: &$hir hir::Path, b: ast::NodeId); + fn check_path(a: &$hir hir::Path, b: hir::HirId); fn check_attribute(a: &$hir ast::Attribute); /// Called when entering a syntax node that can have lint attributes such diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 0f889549b58..d0e3ae2b9fc 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -279,7 +279,7 @@ fn visit_pat(&mut self, pat: &'tcx hir::Pat) { self.in_pat = false; } - fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) { + fn visit_path(&mut self, path: &'tcx hir::Path, _: hir::HirId) { self.handle_definition(path.def); intravisit::walk_path(self, path); } diff --git a/src/librustc/middle/lib_features.rs b/src/librustc/middle/lib_features.rs new file mode 100644 index 00000000000..47c6bfbe694 --- /dev/null +++ b/src/librustc/middle/lib_features.rs @@ -0,0 +1,178 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Detecting lib features (i.e. features that are not lang features). +// +// These are declared using stability attributes (e.g. `#[stable (..)]` +// and `#[unstable (..)]`), but are not declared in one single location +// (unlike lang features), which means we need to collect them instead. + +use ty::TyCtxt; +use syntax::symbol::Symbol; +use syntax::ast::{Attribute, MetaItem, MetaItemKind}; +use syntax_pos::{Span, DUMMY_SP}; +use hir; +use hir::itemlikevisit::ItemLikeVisitor; +use rustc_data_structures::fx::{FxHashSet, FxHashMap}; +use errors::DiagnosticId; + +pub struct LibFeatures { + // A map from feature to stabilisation version. + pub stable: FxHashMap, + pub unstable: FxHashSet, +} + +impl LibFeatures { + fn new() -> LibFeatures { + LibFeatures { + stable: FxHashMap(), + unstable: FxHashSet(), + } + } + + pub fn to_vec(&self) -> Vec<(Symbol, Option)> { + let mut all_features: Vec<_> = self.stable.iter().map(|(f, s)| (*f, Some(*s))) + .chain(self.unstable.iter().map(|f| (*f, None))) + .collect(); + all_features.sort_unstable_by_key(|f| f.0.as_str()); + all_features + } +} + +pub struct LibFeatureCollector<'a, 'tcx: 'a> { + tcx: TyCtxt<'a, 'tcx, 'tcx>, + lib_features: LibFeatures, +} + +impl<'a, 'tcx> LibFeatureCollector<'a, 'tcx> { + fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatureCollector<'a, 'tcx> { + LibFeatureCollector { + tcx, + lib_features: LibFeatures::new(), + } + } + + fn extract(&self, attrs: &[Attribute]) -> Vec<(Symbol, Option, 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, + _ => {} + } + } + } + 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. + } + } + } + + features + } + + fn collect_feature(&mut self, feature: Symbol, since: Option, span: Span) { + let already_in_stable = self.lib_features.stable.contains_key(&feature); + let already_in_unstable = self.lib_features.unstable.contains(&feature); + + match (since, already_in_stable, already_in_unstable) { + (Some(since), _, false) => { + if let Some(prev_since) = self.lib_features.stable.get(&feature) { + if *prev_since != since { + let msg = format!( + "feature `{}` is declared stable since {}, \ + but was previously declared stable since {}", + feature, + since, + prev_since, + ); + self.tcx.sess.struct_span_err_with_code(span, &msg, + DiagnosticId::Error("E0711".into())).emit(); + return; + } + } + + self.lib_features.stable.insert(feature, since); + } + (None, false, _) => { + self.lib_features.unstable.insert(feature); + } + (Some(_), _, true) | (None, true, _) => { + let msg = format!( + "feature `{}` is declared {}, but was previously declared {}", + feature, + if since.is_some() { "stable"} else { "unstable" }, + if since.is_none() { "stable"} else { "unstable" }, + ); + self.tcx.sess.struct_span_err_with_code(span, &msg, + DiagnosticId::Error("E0711".into())).emit(); + } + } + } + + 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); + } + + 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); + } +} + +pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatures { + let mut collector = LibFeatureCollector::new(tcx); + for &cnum in tcx.crates().iter() { + for &(feature, since) in tcx.defined_lib_features(cnum).iter() { + 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); + } + collector.lib_features +} diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 94246db3706..a09942258e2 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -15,7 +15,7 @@ // makes all other generics or inline functions that it references // reachable as well. -use hir::CodegenFnAttrs; +use hir::{CodegenFnAttrs, CodegenFnAttrFlags}; use hir::map as hir_map; use hir::def::Def; use hir::def_id::{DefId, CrateNum}; @@ -28,7 +28,6 @@ use rustc_target::spec::abi::Abi; use syntax::ast; -use syntax::attr; use hir; use hir::def_id::LOCAL_CRATE; use hir::intravisit::{Visitor, NestedVisitorMap}; @@ -359,8 +358,12 @@ struct CollectPrivateImplItemsVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, 'tcx> { fn visit_item(&mut self, item: &hir::Item) { // Anything which has custom linkage gets thrown on the worklist no - // matter where it is in the crate. - if attr::contains_name(&item.attrs, "linkage") { + // matter where it is in the crate, along with "special std symbols" + // which are currently akin to allocator symbols. + let def_id = self.tcx.hir.local_def_id(item.id); + let codegen_attrs = self.tcx.codegen_fn_attrs(def_id); + if codegen_attrs.linkage.is_some() || + codegen_attrs.flags.contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL) { self.worklist.push(item.id); } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index ca8fe463119..f2d39a905ee 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -903,7 +903,7 @@ fn visit_lifetime(&mut self, lifetime_ref: &'tcx hir::Lifetime) { self.resolve_lifetime_ref(lifetime_ref); } - fn visit_path(&mut self, path: &'tcx hir::Path, _: ast::NodeId) { + fn visit_path(&mut self, path: &'tcx hir::Path, _: hir::HirId) { for (i, segment) in path.segments.iter().enumerate() { let depth = path.segments.len() - i - 1; if let Some(ref args) = segment.args { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index 262a617cb69..8af8d463b11 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -18,12 +18,12 @@ use hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefId, LOCAL_CRATE}; use ty::{self, TyCtxt}; use middle::privacy::AccessLevels; -use session::DiagnosticMessageId; +use session::{DiagnosticMessageId, Session}; use syntax::symbol::Symbol; use syntax_pos::{Span, MultiSpan}; use syntax::ast; use syntax::ast::{NodeId, Attribute}; -use syntax::feature_gate::{GateIssue, emit_feature_err, find_lang_feature_accepted_version}; +use syntax::feature_gate::{GateIssue, emit_feature_err}; use syntax::attr::{self, Stability, Deprecation}; use util::nodemap::{FxHashSet, FxHashMap}; @@ -780,7 +780,8 @@ fn visit_item(&mut self, item: &'tcx hir::Item) { intravisit::walk_item(self, item); } - fn visit_path(&mut self, path: &'tcx hir::Path, id: ast::NodeId) { + fn visit_path(&mut self, path: &'tcx hir::Path, id: hir::HirId) { + let id = self.tcx.hir.hir_to_node_id(id); match path.def { Def::Local(..) | Def::Upvar(..) | Def::PrimTy(..) | Def::SelfTy(..) | Def::Err => {} @@ -813,37 +814,70 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { krate.visit_all_item_likes(&mut missing.as_deep_visitor()); } - let ref declared_lib_features = tcx.features().declared_lib_features; - let mut remaining_lib_features: FxHashMap - = declared_lib_features.clone().into_iter().collect(); - remaining_lib_features.remove(&Symbol::intern("proc_macro")); - - for &(ref stable_lang_feature, span) in &tcx.features().declared_stable_lang_features { - let version = find_lang_feature_accepted_version(&stable_lang_feature.as_str()) - .expect("unexpectedly couldn't find version feature was stabilized"); - tcx.lint_node(lint::builtin::STABLE_FEATURES, - ast::CRATE_NODE_ID, - span, - &format_stable_since_msg(version)); - } - - // FIXME(#44232) the `used_features` table no longer exists, so we don't - // lint about unknown or unused features. We should reenable - // this one day! - // - // let index = tcx.stability(); - // for (used_lib_feature, level) in &index.used_features { - // remaining_lib_features.remove(used_lib_feature); - // } - // - // for &span in remaining_lib_features.values() { - // tcx.lint_node(lint::builtin::UNUSED_FEATURES, - // ast::CRATE_NODE_ID, - // span, - // "unused or unknown feature"); - // } + let declared_lang_features = &tcx.features().declared_lang_features; + let mut lang_features = FxHashSet(); + for &(feature, span, since) in declared_lang_features { + if let Some(since) = since { + // Warn if the user has enabled an already-stable lang feature. + unnecessary_stable_feature_lint(tcx, span, feature, since); + } + if lang_features.contains(&feature) { + // Warn if the user enables a lang feature multiple times. + duplicate_feature_err(tcx.sess, span, feature); + } + lang_features.insert(feature); + } + + let declared_lib_features = &tcx.features().declared_lib_features; + let mut remaining_lib_features = FxHashMap(); + for (feature, span) in declared_lib_features { + if remaining_lib_features.contains_key(&feature) { + // Warn if the user enables a lib feature multiple times. + duplicate_feature_err(tcx.sess, *span, *feature); + } + remaining_lib_features.insert(feature, span.clone()); + } + // `stdbuild` has special handling for `libc`, so we need to + // recognise the feature when building std. + // Likewise, libtest is handled specially, so `test` isn't + // available as we'd like it to be. + // FIXME: only remove `libc` when `stdbuild` is active. + // FIXME: remove special casing for `test`. + remaining_lib_features.remove(&Symbol::intern("libc")); + remaining_lib_features.remove(&Symbol::intern("test")); + + for (feature, stable) in tcx.lib_features().to_vec() { + if let Some(since) = stable { + if let Some(span) = remaining_lib_features.get(&feature) { + // Warn if the user has enabled an already-stable lib feature. + unnecessary_stable_feature_lint(tcx, *span, feature, since); + } + } + remaining_lib_features.remove(&feature); + } + + for (feature, span) in remaining_lib_features { + struct_span_err!(tcx.sess, span, E0635, "unknown feature `{}`", feature).emit(); + } + + // FIXME(#44232): the `used_features` table no longer exists, so we + // don't lint about unused features. We should reenable this one day! +} + +fn unnecessary_stable_feature_lint<'a, 'tcx>( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + span: Span, + feature: Symbol, + since: Symbol +) { + tcx.lint_node(lint::builtin::STABLE_FEATURES, + ast::CRATE_NODE_ID, + span, + &format!("the feature `{}` has been stable since {} and no longer requires \ + an attribute to enable", feature, since)); } -fn format_stable_since_msg(version: &str) -> String { - format!("this feature has been stable since {}. Attribute no longer needed", version) +fn duplicate_feature_err(sess: &Session, span: Span, feature: Symbol) { + struct_span_err!(sess, span, E0636, "the feature `{}` has already been declared", feature) + .emit(); } diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index f4873979920..1ffe8157a0f 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -358,7 +358,8 @@ pub fn evaluate_predicates<'b, 'gcx, 'c>( &Err(SelectionError::Unimplemented) => { if self.is_of_param(pred.skip_binder().trait_ref.substs) { already_visited.remove(&pred); - user_computed_preds.insert(ty::Predicate::Trait(pred.clone())); + self.add_user_pred(&mut user_computed_preds, + ty::Predicate::Trait(pred.clone())); predicates.push_back(pred); } else { debug!( @@ -393,6 +394,92 @@ pub fn evaluate_predicates<'b, 'gcx, 'c>( return Some((new_env, final_user_env)); } + // This method is designed to work around the following issue: + // When we compute auto trait bounds, we repeatedly call SelectionContext.select, + // progressively building a ParamEnv based on the results we get. + // However, our usage of SelectionContext differs from its normal use within the compiler, + // in that we capture and re-reprocess predicates from Unimplemented errors. + // + // This can lead to a corner case when dealing with region parameters. + // During our selection loop in evaluate_predicates, we might end up with + // two trait predicates that differ only in their region parameters: + // one containing a HRTB lifetime parameter, and one containing a 'normal' + // lifetime parameter. For example: + // + // T as MyTrait<'a> + // T as MyTrait<'static> + // + // If we put both of these predicates in our computed ParamEnv, we'll + // confuse SelectionContext, since it will (correctly) view both as being applicable. + // + // To solve this, we pick the 'more strict' lifetime bound - i.e. the HRTB + // Our end goal is to generate a user-visible description of the conditions + // under which a type implements an auto trait. A trait predicate involving + // a HRTB means that the type needs to work with any choice of lifetime, + // not just one specific lifetime (e.g. 'static). + fn add_user_pred<'c>(&self, user_computed_preds: &mut FxHashSet>, + new_pred: ty::Predicate<'c>) { + let mut should_add_new = true; + user_computed_preds.retain(|&old_pred| { + match (&new_pred, old_pred) { + (&ty::Predicate::Trait(new_trait), ty::Predicate::Trait(old_trait)) => { + if new_trait.def_id() == old_trait.def_id() { + let new_substs = new_trait.skip_binder().trait_ref.substs; + let old_substs = old_trait.skip_binder().trait_ref.substs; + if !new_substs.types().eq(old_substs.types()) { + // We can't compare lifetimes if the types are different, + // so skip checking old_pred + return true + } + + for (new_region, old_region) in new_substs + .regions() + .zip(old_substs.regions()) { + + match (new_region, old_region) { + // If both predicates have an 'ReLateBound' (a HRTB) in the + // same spot, we do nothing + ( + ty::RegionKind::ReLateBound(_, _), + ty::RegionKind::ReLateBound(_, _) + ) => {}, + + (ty::RegionKind::ReLateBound(_, _), _) => { + // The new predicate has a HRTB in a spot where the old + // predicate does not (if they both had a HRTB, the previous + // match arm would have executed). + // + // The means we want to remove the older predicate from + // user_computed_preds, since having both it and the new + // predicate in a ParamEnv would confuse SelectionContext + // We're currently in the predicate passed to 'retain', + // so we return 'false' to remove the old predicate from + // user_computed_preds + return false; + }, + (_, ty::RegionKind::ReLateBound(_, _)) => { + // This is the opposite situation as the previous arm - the + // old predicate has a HRTB lifetime in a place where the + // new predicate does not. We want to leave the old + // predicate in user_computed_preds, and skip adding + // new_pred to user_computed_params. + should_add_new = false + } + _ => {} + } + } + } + }, + _ => {} + } + return true + }); + + if should_add_new { + user_computed_preds.insert(new_pred); + } + } + pub fn region_name(&self, region: Region) -> Option { match region { &ty::ReEarlyBound(r) => Some(r.name.to_string()), @@ -555,7 +642,7 @@ pub fn evaluate_nested_obligations< let substs = &p.skip_binder().trait_ref.substs; if self.is_of_param(substs) && !only_projections && is_new_pred { - computed_preds.insert(predicate); + self.add_user_pred(computed_preds, predicate); } predicates.push_back(p.clone()); } @@ -563,7 +650,7 @@ pub fn evaluate_nested_obligations< // If the projection isn't all type vars, then // we don't want to add it as a bound if self.is_of_param(p.skip_binder().projection_ty.substs) && is_new_pred { - computed_preds.insert(predicate); + self.add_user_pred(computed_preds, predicate); } else { match poly_project_and_unify_type(select, &obligation.with(p.clone())) { Err(e) => { @@ -594,10 +681,7 @@ pub fn evaluate_nested_obligations< } } &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 c04785aac20..a02b63755dc 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -143,7 +143,7 @@ fn error_implies(&self, // 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 } diff --git a/src/librustc/traits/query/outlives_bounds.rs b/src/librustc/traits/query/outlives_bounds.rs index f79ce73ad92..0127ae423da 100644 --- a/src/librustc/traits/query/outlives_bounds.rs +++ b/src/librustc/traits/query/outlives_bounds.rs @@ -137,7 +137,7 @@ pub fn implied_outlives_bounds( // 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/select.rs b/src/librustc/traits/select.rs index 35184ca6a25..1e3fe70535b 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -1587,8 +1587,8 @@ fn match_projection(&mut self, -> 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) { + if self.infcx.at(&obligation.cause, obligation.param_env) + .sup(ty::Binder::dummy(skol_trait_ref), trait_bound).is_err() { return false; } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 0cfdea68e88..bb14af29a7a 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1192,6 +1192,10 @@ pub fn consider_optimizing String>(&self, msg: T) -> bool { self.sess.consider_optimizing(&cname, msg) } + pub fn lib_features(self) -> Lrc { + self.get_lib_features(LOCAL_CRATE) + } + pub fn lang_items(self) -> Lrc { self.get_lang_items(LOCAL_CRATE) } @@ -2840,17 +2844,13 @@ pub fn provide(providers: &mut ty::query::Providers) { assert_eq!(id, LOCAL_CRATE); tcx.crate_name }; + providers.get_lib_features = |tcx, id| { + assert_eq!(id, LOCAL_CRATE); + Lrc::new(middle::lib_features::collect(tcx)) + }; providers.get_lang_items = |tcx, id| { assert_eq!(id, LOCAL_CRATE); - // FIXME(#42293) Right now we insert a `with_ignore` node in the dep - // graph here to ignore the fact that `get_lang_items` below depends on - // the entire crate. For now this'll prevent false positives of - // recompiling too much when anything changes. - // - // Once red/green incremental compilation lands we should be able to - // remove this because while the crate changes often the lint level map - // will change rarely. - tcx.dep_graph.with_ignore(|| Lrc::new(middle::lang_items::collect(tcx))) + Lrc::new(middle::lang_items::collect(tcx)) }; providers.freevars = |tcx, id| tcx.gcx.freevars.get(&id).cloned(); providers.maybe_unused_trait_import = |tcx, id| { diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 66edbeff749..7329f4832f2 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -294,7 +294,7 @@ fn resolve_associated_item<'a, 'tcx>( }) } 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/query/config.rs b/src/librustc/ty/query/config.rs index d2648cad55e..ecf35c1b0da 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -626,6 +626,18 @@ fn describe(_tcx: TyCtxt, _: CrateNum) -> String { } } +impl<'tcx> QueryDescription<'tcx> for queries::get_lib_features<'tcx> { + fn describe(_tcx: TyCtxt, _: CrateNum) -> String { + format!("calculating the lib features map") + } +} + +impl<'tcx> QueryDescription<'tcx> for queries::defined_lib_features<'tcx> { + fn describe(_tcx: TyCtxt, _: CrateNum) -> String { + format!("calculating the lib features defined in a crate") + } +} + impl<'tcx> QueryDescription<'tcx> for queries::get_lang_items<'tcx> { fn describe(_tcx: TyCtxt, _: CrateNum) -> String { "calculating the lang items map".to_string() diff --git a/src/librustc/ty/query/mod.rs b/src/librustc/ty/query/mod.rs index ab9bdd82e01..35080123d3e 100644 --- a/src/librustc/ty/query/mod.rs +++ b/src/librustc/ty/query/mod.rs @@ -24,6 +24,7 @@ use middle::region; use middle::resolve_lifetime::{ResolveLifetimes, Region, ObjectLifetimeDefault}; use middle::stability::{self, DeprecationEntry}; +use middle::lib_features::LibFeatures; use middle::lang_items::{LanguageItems, LangItem}; use middle::exported_symbols::{SymbolExportLevel, ExportedSymbol}; use mir::interpret::ConstEvalResult; @@ -492,6 +493,9 @@ [] fn item_children: ItemChildren(DefId) -> Lrc>, [] fn extern_mod_stmt_cnum: ExternModStmtCnum(DefId) -> Option, + [] fn get_lib_features: get_lib_features_node(CrateNum) -> Lrc, + [] fn defined_lib_features: DefinedLibFeatures(CrateNum) + -> Lrc)>>, [] fn get_lang_items: get_lang_items_node(CrateNum) -> Lrc, [] fn defined_lang_items: DefinedLangItems(CrateNum) -> Lrc>, [] fn missing_lang_items: MissingLangItems(CrateNum) -> Lrc>, @@ -800,6 +804,10 @@ fn link_args_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { DepConstructor::LinkArgs } +fn get_lib_features_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { + DepConstructor::GetLibFeatures +} + fn get_lang_items_node<'tcx>(_: CrateNum) -> DepConstructor<'tcx> { DepConstructor::GetLangItems } diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 0fa643d796e..f59e48cb351 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -1218,6 +1218,8 @@ macro_rules! force { DepKind::CrateName => { force!(crate_name, krate!()); } DepKind::ItemChildren => { force!(item_children, def_id!()); } DepKind::ExternModStmtCnum => { force!(extern_mod_stmt_cnum, def_id!()); } + DepKind::GetLibFeatures => { force!(get_lib_features, LOCAL_CRATE); } + DepKind::DefinedLibFeatures => { force!(defined_lib_features, krate!()); } DepKind::GetLangItems => { force!(get_lang_items, LOCAL_CRATE); } DepKind::DefinedLangItems => { force!(defined_lang_items, krate!()); } DepKind::MissingLangItems => { force!(missing_lang_items, krate!()); } diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs index ffbbd8a33a1..05843852ee0 100644 --- a/src/librustc_allocator/expand.rs +++ b/src/librustc_allocator/expand.rs @@ -13,7 +13,7 @@ use syntax::{ ast::{ self, Arg, Attribute, Crate, Expr, FnHeader, Generics, Ident, Item, ItemKind, - LitKind, Mac, Mod, Mutability, StrStyle, Ty, TyKind, Unsafety, VisibilityKind, + Mac, Mod, Mutability, Ty, TyKind, Unsafety, VisibilityKind, }, attr, codemap::{ @@ -236,17 +236,12 @@ fn call_allocator(&self, method: &str, mut args: Vec>) -> P { } fn attrs(&self) -> Vec { - let key = Symbol::intern("linkage"); - let value = LitKind::Str(Symbol::intern("external"), StrStyle::Cooked); - let linkage = self.cx.meta_name_value(self.span, key, value); - let no_mangle = Symbol::intern("no_mangle"); let no_mangle = self.cx.meta_word(self.span, no_mangle); let special = Symbol::intern("rustc_std_internal_symbol"); let special = self.cx.meta_word(self.span, special); vec![ - self.cx.attribute(self.span, linkage), self.cx.attribute(self.span, no_mangle), self.cx.attribute(self.span, special), ] diff --git a/src/librustc_borrowck/lib.rs b/src/librustc_borrowck/lib.rs index a5a20af0e4e..c7e7465a353 100644 --- a/src/librustc_borrowck/lib.rs +++ b/src/librustc_borrowck/lib.rs @@ -14,7 +14,6 @@ #![allow(non_camel_case_types)] -#![feature(from_ref)] #![feature(quote)] #![recursion_limit="256"] diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index 6ddae57e336..28fa49846b7 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -10,39 +10,12 @@ crate-type = ["dylib"] test = false [dependencies] -bitflags = "1.0.1" cc = "1.0.1" -flate2 = "1.0" -jobserver = "0.1.5" -libc = "0.2" -log = "0.4" num_cpus = "1.0" -rustc = { path = "../librustc" } rustc-demangle = "0.1.4" -rustc_allocator = { path = "../librustc_allocator" } -rustc_apfloat = { path = "../librustc_apfloat" } -rustc_target = { path = "../librustc_target" } -rustc_data_structures = { path = "../librustc_data_structures" } -rustc_errors = { path = "../librustc_errors" } -rustc_incremental = { path = "../librustc_incremental" } rustc_llvm = { path = "../librustc_llvm" } -rustc_platform_intrinsics = { path = "../librustc_platform_intrinsics" } -rustc_codegen_utils = { path = "../librustc_codegen_utils" } -rustc_mir = { path = "../librustc_mir" } -serialize = { path = "../libserialize" } -syntax = { path = "../libsyntax" } -syntax_pos = { path = "../libsyntax_pos" } -tempfile = "3.0" - -# not actually used but needed to make sure we enable the same feature set as -# winapi used in librustc -env_logger = { version = "0.5", default-features = false } [features] -# Used to communicate the feature to `rustc_target` in the same manner that the -# `rustc` driver script communicate this. -jemalloc = ["rustc_target/jemalloc"] - # This is used to convince Cargo to separately cache builds of `rustc_codegen_llvm` # when this option is enabled or not. That way we can build two, cache two # artifacts, and have nice speedy rebuilds. diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 2d401da958b..0beb8a8844c 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -67,14 +67,15 @@ pub(crate) unsafe fn codegen(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind if tcx.sess.target.target.options.default_hidden_visibility { llvm::LLVMRustSetVisibility(llfn, llvm::Visibility::Hidden); } - if tcx.sess.target.target.options.requires_uwtable { - attributes::emit_uwtable(llfn, true); - } + if tcx.sess.target.target.options.requires_uwtable { + attributes::emit_uwtable(llfn, true); + } let callee = CString::new(kind.fn_name(method.name)).unwrap(); let callee = llvm::LLVMRustGetOrInsertFunction(llmod, callee.as_ptr(), ty); + llvm::LLVMRustSetVisibility(callee, llvm::Visibility::Hidden); let llbb = llvm::LLVMAppendBasicBlockInContext(llcx, llfn, diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index a5c6a0d5cd6..5e23c6e868f 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -541,11 +541,23 @@ unsafe fn optimize(cgcx: &CodegenContext, }; if config.verify_llvm_ir { assert!(addpass("verify")); } + + // Some options cause LLVM bitcode to be emitted, which uses ThinLTOBuffers, so we need + // to make sure we run LLVM's NameAnonGlobals pass when emitting bitcode; otherwise + // we'll get errors in LLVM. + let using_thin_buffers = llvm::LLVMRustThinLTOAvailable() && (config.emit_bc + || config.obj_is_bitcode || config.emit_bc_compressed || config.embed_bitcode); + let mut have_name_anon_globals_pass = false; if !config.no_prepopulate_passes { llvm::LLVMRustAddAnalysisPasses(tm, fpm, llmod); llvm::LLVMRustAddAnalysisPasses(tm, mpm, llmod); let opt_level = config.opt_level.unwrap_or(llvm::CodeGenOptLevel::None); let prepare_for_thin_lto = cgcx.lto == Lto::Thin || cgcx.lto == Lto::ThinLocal; + have_name_anon_globals_pass = have_name_anon_globals_pass || prepare_for_thin_lto; + if using_thin_buffers && !prepare_for_thin_lto { + assert!(addpass("name-anon-globals")); + have_name_anon_globals_pass = true; + } with_llvm_pmb(llmod, &config, opt_level, prepare_for_thin_lto, &mut |b| { llvm::LLVMPassManagerBuilderPopulateFunctionPassManager(b, fpm); llvm::LLVMPassManagerBuilderPopulateModulePassManager(b, mpm); @@ -557,6 +569,9 @@ unsafe fn optimize(cgcx: &CodegenContext, diag_handler.warn(&format!("unknown pass `{}`, ignoring", pass)); } + if pass == "name-anon-globals" { + have_name_anon_globals_pass = true; + } } for pass in &cgcx.plugin_passes { @@ -565,6 +580,22 @@ unsafe fn optimize(cgcx: &CodegenContext, `{}` but LLVM does not \ recognize it", pass)); } + if pass == "name-anon-globals" { + have_name_anon_globals_pass = true; + } + } + + if using_thin_buffers && !have_name_anon_globals_pass { + // As described above, this will probably cause an error in LLVM + if config.no_prepopulate_passes { + diag_handler.err("The current compilation is going to use thin LTO buffers \ + without running LLVM's NameAnonGlobals pass. \ + This will likely cause errors in LLVM. Consider adding \ + -C passes=name-anon-globals to the compiler command line."); + } else { + bug!("We are using thin LTO buffers without running the NameAnonGlobals pass. \ + This will likely cause errors in LLVM and shoud never happen."); + } } } diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 41336165684..0a8bc03d8d4 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -809,8 +809,28 @@ pub fn codegen_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, rx, codegen_units.len()); - // Codegen an allocator shim, if any - let allocator_module = if let Some(kind) = *tcx.sess.allocator_kind.get() { + // Codegen an allocator shim, if necessary. + // + // If the crate doesn't have an `allocator_kind` set then there's definitely + // no shim to generate. Otherwise we also check our dependency graph for all + // our output crate types. If anything there looks like its a `Dynamic` + // linkage, then it's already got an allocator shim and we'll be using that + // one instead. If nothing exists then it's our job to generate the + // allocator! + let any_dynamic_crate = tcx.sess.dependency_formats.borrow() + .iter() + .any(|(_, list)| { + use rustc::middle::dependency_format::Linkage; + list.iter().any(|linkage| { + match linkage { + Linkage::Dynamic => true, + _ => false, + } + }) + }); + 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); diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index 72ff65361ca..21bf490beb0 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -66,16 +66,22 @@ pub fn addr_of_mut( cx: &CodegenCx<'ll, '_>, cv: &'ll Value, align: Align, - kind: &str, + kind: Option<&str>, ) -> &'ll Value { unsafe { - let name = cx.generate_local_symbol_name(kind); - let gv = declare::define_global(cx, &name[..], val_ty(cv)).unwrap_or_else(||{ - bug!("symbol `{}` is already defined", name); - }); + let gv = match kind { + Some(kind) if !cx.tcx.sess.fewer_names() => { + let name = cx.generate_local_symbol_name(kind); + let gv = declare::define_global(cx, &name[..], val_ty(cv)).unwrap_or_else(||{ + bug!("symbol `{}` is already defined", name); + }); + llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage); + gv + }, + _ => declare::define_private_global(cx, val_ty(cv)), + }; llvm::LLVMSetInitializer(gv, cv); set_global_alignment(cx, gv, align); - llvm::LLVMRustSetLinkage(gv, llvm::Linkage::PrivateLinkage); SetUnnamedAddr(gv, true); gv } @@ -85,7 +91,7 @@ pub fn addr_of( cx: &CodegenCx<'ll, '_>, cv: &'ll Value, align: Align, - kind: &str, + kind: Option<&str>, ) -> &'ll Value { if let Some(&gv) = cx.const_globals.borrow().get(&cv) { unsafe { diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs index 9812d7f9a41..a0310eecd59 100644 --- a/src/librustc_codegen_llvm/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -35,7 +35,6 @@ use std::ffi::CString; - /// Declare a global value. /// /// If there’s a value with the same name already declared, the function will @@ -170,6 +169,15 @@ pub fn define_global(cx: &CodegenCx<'ll, '_>, name: &str, ty: &'ll Type) -> Opti } } +/// Declare a private global +/// +/// Use this function when you intend to define a global without a name. +pub fn define_private_global(cx: &CodegenCx<'ll, '_>, ty: &'ll Type) -> &'ll Value { + unsafe { + llvm::LLVMRustInsertPrivateGlobal(cx.llmod, ty) + } +} + /// Declare a Rust function with an intention to define it. /// /// Use this function when you intend to define a function. This function will diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index c01ef37d1b8..9599ccfe979 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -23,7 +23,6 @@ #![feature(crate_visibility_modifier)] #![feature(custom_attribute)] #![feature(extern_types)] -#![feature(fs_read_write)] #![feature(in_band_lifetimes)] #![allow(unused_attributes)] #![feature(libc)] diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 989498ea92b..a894f8e2fdb 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -623,6 +623,7 @@ pub fn LLVMConstExtractValue(AggConstant: &Value, pub fn LLVMAddGlobal(M: &'a Module, Ty: &'a Type, Name: *const c_char) -> &'a Value; pub fn LLVMGetNamedGlobal(M: &Module, Name: *const c_char) -> Option<&Value>; pub fn LLVMRustGetOrInsertGlobal(M: &'a Module, Name: *const c_char, T: &'a Type) -> &'a Value; + pub fn LLVMRustInsertPrivateGlobal(M: &'a Module, T: &'a Type) -> &'a Value; pub fn LLVMGetFirstGlobal(M: &Module) -> Option<&Value>; pub fn LLVMGetNextGlobal(GlobalVar: &Value) -> Option<&Value>; pub fn LLVMDeleteGlobal(GlobalVar: &Value); diff --git a/src/librustc_codegen_llvm/meth.rs b/src/librustc_codegen_llvm/meth.rs index 9c0dd0dc3d8..8a1159bc477 100644 --- a/src/librustc_codegen_llvm/meth.rs +++ b/src/librustc_codegen_llvm/meth.rs @@ -106,7 +106,7 @@ pub fn get_vtable( let vtable_const = C_struct(cx, &components, false); let align = cx.data_layout().pointer_align; - let vtable = consts::addr_of(cx, vtable_const, align, "vtable"); + let vtable = consts::addr_of(cx, vtable_const, align, Some("vtable")); debuginfo::create_vtable_metadata(cx, ty, vtable); diff --git a/src/librustc_codegen_llvm/mir/block.rs b/src/librustc_codegen_llvm/mir/block.rs index 684ecfaeec8..4e389c3b915 100644 --- a/src/librustc_codegen_llvm/mir/block.rs +++ b/src/librustc_codegen_llvm/mir/block.rs @@ -377,7 +377,7 @@ fn codegen_terminator(&mut self, let file_line_col = consts::addr_of(bx.cx, file_line_col, align, - "panic_bounds_check_loc"); + Some("panic_bounds_check_loc")); (lang_items::PanicBoundsCheckFnLangItem, vec![file_line_col, index, len]) } @@ -391,7 +391,7 @@ fn codegen_terminator(&mut self, let msg_file_line_col = consts::addr_of(bx.cx, msg_file_line_col, align, - "panic_loc"); + Some("panic_loc")); (lang_items::PanicFnLangItem, vec![msg_file_line_col]) } diff --git a/src/librustc_codegen_llvm/mir/constant.rs b/src/librustc_codegen_llvm/mir/constant.rs index 267db4467c2..a6e14a99f3c 100644 --- a/src/librustc_codegen_llvm/mir/constant.rs +++ b/src/librustc_codegen_llvm/mir/constant.rs @@ -58,9 +58,9 @@ pub fn scalar_to_llvm( Some(AllocType::Memory(alloc)) => { let init = const_alloc_to_llvm(cx, alloc); if alloc.runtime_mutability == Mutability::Mutable { - consts::addr_of_mut(cx, init, alloc.align, "byte_str") + consts::addr_of_mut(cx, init, alloc.align, None) } else { - consts::addr_of(cx, init, alloc.align, "byte_str") + consts::addr_of(cx, init, alloc.align, None) } } Some(AllocType::Function(fn_instance)) => { diff --git a/src/librustc_codegen_llvm/mir/place.rs b/src/librustc_codegen_llvm/mir/place.rs index abc3dbdab2f..6fa0845dd0c 100644 --- a/src/librustc_codegen_llvm/mir/place.rs +++ b/src/librustc_codegen_llvm/mir/place.rs @@ -63,7 +63,7 @@ pub fn from_const_alloc( offset: Size, ) -> PlaceRef<'ll, 'tcx> { let init = const_alloc_to_llvm(bx.cx, alloc); - let base_addr = consts::addr_of(bx.cx, init, layout.align, "byte_str"); + let base_addr = consts::addr_of(bx.cx, init, layout.align, None); let llval = unsafe { LLVMConstInBoundsGEP( consts::bitcast(base_addr, Type::i8p(bx.cx)), diff --git a/src/librustc_data_structures/lib.rs b/src/librustc_data_structures/lib.rs index a9e582e510e..dd90cf7ae19 100644 --- a/src/librustc_data_structures/lib.rs +++ b/src/librustc_data_structures/lib.rs @@ -20,7 +20,6 @@ html_favicon_url = "https://www.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] -#![feature(collections_range)] #![feature(unboxed_closures)] #![feature(fn_traits)] #![feature(unsize)] diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 09295e2c7ff..6b1298750fb 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -1295,7 +1295,7 @@ fn emit_suggestion_default(&mut self, } // 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_incremental/lib.rs b/src/librustc_incremental/lib.rs index 3839c133a6e..73886e5e281 100644 --- a/src/librustc_incremental/lib.rs +++ b/src/librustc_incremental/lib.rs @@ -14,7 +14,6 @@ html_favicon_url = "https://doc.rust-lang.org/favicon.ico", html_root_url = "https://doc.rust-lang.org/nightly/")] -#![feature(fs_read_write)] #![feature(specialization)] #![recursion_limit="256"] diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 4ef4397d974..3a449b6a68e 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -1526,7 +1526,6 @@ fn suggest_changing_assoc_types(ty: &hir::Ty, err: &mut DiagnosticBuilder) { // We use a HIR visitor to walk the type. use rustc::hir::intravisit::{self, Visitor}; - use syntax::ast::NodeId; struct WalkAssocTypes<'a, 'db> where 'db: 'a { err: &'a mut DiagnosticBuilder<'db> } @@ -1536,7 +1535,7 @@ fn nested_visit_map<'this>(&'this mut self) -> intravisit::NestedVisitorMap<'thi intravisit::NestedVisitorMap::None } - fn visit_qpath(&mut self, qpath: &'v hir::QPath, id: NodeId, span: Span) { + fn visit_qpath(&mut self, qpath: &'v hir::QPath, id: hir::HirId, span: Span) { if TypeAliasBounds::is_type_variable_assoc(qpath) { self.err.span_help(span, "use fully disambiguated paths (i.e., `::Assoc`) to refer to \ diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index b92ac0ff57b..75d16232a37 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -342,7 +342,7 @@ macro_rules! add_lint_group { store.register_renamed("bare_trait_object", "bare_trait_objects"); store.register_renamed("unstable_name_collision", "unstable_name_collisions"); store.register_renamed("unused_doc_comment", "unused_doc_comments"); - store.register_renamed("unknown_features", "unused_features"); + store.register_removed("unknown_features", "replaced by an error"); store.register_removed("unsigned_negation", "replaced by negate_unsigned feature gate"); store.register_removed("negate_unsigned", "cast a signed value instead"); store.register_removed("raw_pointer_derive", "using derive with raw pointers is ok"); diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 4dc66fb8121..f1636c4dcb0 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -790,21 +790,18 @@ fn get_lints(&self) -> LintArray { } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImproperCTypes { - fn check_item(&mut self, cx: &LateContext, it: &hir::Item) { + fn check_foreign_item(&mut self, cx: &LateContext, it: &hir::ForeignItem) { let mut vis = ImproperCTypesVisitor { cx: cx }; - if let hir::ItemKind::ForeignMod(ref nmod) = it.node { - if nmod.abi != Abi::RustIntrinsic && nmod.abi != Abi::PlatformIntrinsic { - for ni in &nmod.items { - match ni.node { - hir::ForeignItemKind::Fn(ref decl, _, _) => { - vis.check_foreign_fn(ni.id, decl); - } - hir::ForeignItemKind::Static(ref ty, _) => { - vis.check_foreign_static(ni.id, ty.span); - } - hir::ForeignItemKind::Type => () - } + let abi = cx.tcx.hir.get_foreign_abi(it.id); + if abi != Abi::RustIntrinsic && abi != Abi::PlatformIntrinsic { + match it.node { + hir::ForeignItemKind::Fn(ref decl, _, _) => { + vis.check_foreign_fn(it.id, decl); + } + hir::ForeignItemKind::Static(ref ty, _) => { + vis.check_foreign_static(it.id, ty.span); } + hir::ForeignItemKind::Type => () } } } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 916c0920e0b..060dddd5343 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -240,6 +240,7 @@ fn into_args(self) -> (DefId, DefId) { (self.0.as_def_id(), self.1) } cdata.each_child_of_item(def_id.index, |child| result.push(child), tcx.sess); Lrc::new(result) } + defined_lib_features => { Lrc::new(cdata.get_lib_features()) } defined_lang_items => { Lrc::new(cdata.get_lang_items()) } missing_lang_items => { Lrc::new(cdata.get_missing_lang_items()) } diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index ab566654c38..5121b682d36 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -427,10 +427,10 @@ fn to_def(&self, did: DefId) -> Option { EntryKind::Trait(_) => Def::Trait(did), EntryKind::Enum(..) => Def::Enum(did), EntryKind::MacroDef(_) => Def::Macro(did, MacroKind::Bang), - EntryKind::GlobalAsm => Def::GlobalAsm(did), EntryKind::ForeignType => Def::TyForeign(did), EntryKind::ForeignMod | + EntryKind::GlobalAsm | EntryKind::Impl(_) | EntryKind::Field | EntryKind::Generator(_) | @@ -645,6 +645,14 @@ pub fn get_impl_trait(&self, self.get_impl_data(id).trait_ref.map(|tr| tr.decode((self, tcx))) } + /// Iterates over all the stability attributes in the given crate. + pub fn get_lib_features(&self) -> Vec<(ast::Name, Option)> { + self.root + .lib_features + .decode(self) + .collect() + } + /// Iterates over the language items in the given crate. pub fn get_lang_items(&self) -> Vec<(DefId, usize)> { self.root diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 4a02a278bc1..96d6c5b75f4 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -394,6 +394,11 @@ fn encode_crate_root(&mut self) -> Lazy { ()); let dep_bytes = self.position() - i; + // Encode the lib features. + i = self.position(); + let lib_features = self.tracked(IsolatedEncoder::encode_lib_features, ()); + let lib_feature_bytes = self.position() - i; + // Encode the language items. i = self.position(); let lang_items = self.tracked(IsolatedEncoder::encode_lang_items, ()); @@ -513,6 +518,7 @@ fn encode_crate_root(&mut self) -> Lazy { crate_deps, dylib_dependency_formats, + lib_features, lang_items, lang_items_missing, native_libraries, @@ -537,6 +543,7 @@ fn encode_crate_root(&mut self) -> Lazy { println!("metadata stats:"); println!(" dep bytes: {}", dep_bytes); + 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); @@ -1456,6 +1463,12 @@ fn encode_crate_deps(&mut self, _: ()) -> LazySeq { self.lazy_seq_ref(deps.iter().map(|&(_, ref dep)| dep)) } + fn encode_lib_features(&mut self, _: ()) -> LazySeq<(ast::Name, Option)> { + let tcx = self.tcx; + let lib_features = tcx.lib_features(); + self.lazy_seq(lib_features.to_vec()) + } + fn encode_lang_items(&mut self, _: ()) -> LazySeq<(DefIndex, usize)> { let tcx = self.tcx; let lang_items = tcx.lang_items(); diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 798b631989b..98946ad6081 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -13,7 +13,6 @@ html_root_url = "https://doc.rust-lang.org/nightly/")] #![feature(box_patterns)] -#![feature(fs_read_write)] #![feature(libc)] #![feature(macro_at_most_once_rep)] #![feature(proc_macro_internals)] diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index d7c54cbc81d..894c7cbf683 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -198,6 +198,7 @@ pub struct CrateRoot { pub crate_deps: LazySeq, pub dylib_dependency_formats: LazySeq>, + pub lib_features: LazySeq<(Symbol, Option)>, pub lang_items: LazySeq<(DefIndex, usize)>, pub lang_items_missing: LazySeq, pub native_libraries: LazySeq, diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs index aabed668685..67b92d92a34 100644 --- a/src/librustc_mir/borrow_check/error_reporting.rs +++ b/src/librustc_mir/borrow_check/error_reporting.rs @@ -138,7 +138,7 @@ pub(super) fn report_use_of_moved_or_uninitialized( 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 @@ -735,7 +735,7 @@ fn append_place_to_string( &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("]"); diff --git a/src/librustc_mir/borrow_check/nll/escaping_locals.rs b/src/librustc_mir/borrow_check/nll/escaping_locals.rs deleted file mode 100644 index 7e39f3d3b08..00000000000 --- a/src/librustc_mir/borrow_check/nll/escaping_locals.rs +++ /dev/null @@ -1,229 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! Identify those variables whose entire value will eventually be -//! returned from the fn via the RETURN_PLACE. As an optimization, we -//! can skip computing liveness results for those variables. The idea -//! is that the return type of the fn only ever contains free -//! regions. Therefore, the types of those variables are going to -//! ultimately be contrained to outlive those free regions -- since -//! free regions are always live for the entire body, this implies -//! that the liveness results are not important for those regions. -//! This is most important in the "fns" that we create to represent static -//! values, since those are often really quite large, and all regions in them -//! will ultimately be constrained to be `'static`. Two examples: -//! -//! ``` -//! fn foo() -> &'static [u32] { &[] } -//! static FOO: &[u32] = &[]; -//! ``` -//! -//! In both these cases, the return value will only have static lifetime. -//! -//! NB: The simple logic here relies on the fact that outlives -//! relations in our analysis don't have locations. Otherwise, we -//! would have to restrict ourselves to values that are -//! *unconditionally* returned (which would still cover the "big -//! static value" case). -//! -//! The way that this code works is to use union-find -- we iterate -//! over the MIR and union together two variables X and Y if all -//! regions in the value of Y are going to be stored into X -- that -//! is, if `typeof(X): 'a` requires that `typeof(Y): 'a`. This means -//! that e.g. we can union together `x` and `y` if we have something -//! like `x = (y, 22)`, but not something like `x = y.f` (since there -//! may be regions in the type of `y` that do not appear in the field -//! `f`). - -use rustc::mir::visit::Visitor; -use rustc::mir::*; - -use rustc_data_structures::indexed_vec::Idx; -use rustc_data_structures::unify as ut; - -crate struct EscapingLocals { - unification_table: ut::UnificationTable>, -} - -impl EscapingLocals { - crate fn compute(mir: &Mir<'tcx>) -> Self { - let mut visitor = GatherAssignedLocalsVisitor::new(); - visitor.visit_mir(mir); - - EscapingLocals { - unification_table: visitor.unification_table, - } - } - - /// True if `local` is known to escape into static - /// memory. - crate fn escapes_into_return(&mut self, local: Local) -> bool { - let return_place = AssignedLocal::from(RETURN_PLACE); - let other_place = AssignedLocal::from(local); - self.unification_table.unioned(return_place, other_place) - } -} - -/// The MIR visitor gathering the union-find of the locals used in -/// assignments. -struct GatherAssignedLocalsVisitor { - unification_table: ut::UnificationTable>, -} - -#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)] -struct AssignedLocal(u32); - -impl ut::UnifyKey for AssignedLocal { - type Value = (); - - fn index(&self) -> u32 { - self.0 - } - - fn from_index(i: u32) -> AssignedLocal { - AssignedLocal(i) - } - - fn tag() -> &'static str { - "AssignedLocal" - } -} - -impl From for AssignedLocal { - fn from(item: Local) -> Self { - // newtype_indexes use usize but are u32s. - assert!(item.index() < ::std::u32::MAX as usize); - AssignedLocal(item.index() as u32) - } -} - -impl GatherAssignedLocalsVisitor { - fn new() -> Self { - Self { - unification_table: ut::UnificationTable::new(), - } - } - - fn union_locals_if_needed(&mut self, lvalue: Option, rvalue: Option) { - if let Some(lvalue) = lvalue { - if let Some(rvalue) = rvalue { - if lvalue != rvalue { - debug!("EscapingLocals: union {:?} and {:?}", lvalue, rvalue); - self.unification_table - .union(AssignedLocal::from(lvalue), AssignedLocal::from(rvalue)); - } - } - } - } -} - -// Returns the potential `Local` associated to this `Place` or `PlaceProjection` -fn find_local_in_place(place: &Place) -> Option { - match place { - Place::Local(local) => Some(*local), - - // If you do e.g. `x = a.f` then only *part* of the type of - // `a` escapes into `x` (the part contained in `f`); if `a`'s - // type has regions that don't appear in `f`, those might not - // escape. - Place::Projection(..) => None, - - Place::Static { .. } | Place::Promoted { .. } => None, - } -} - -// Returns the potential `Local` in this `Operand`. -fn find_local_in_operand(op: &Operand) -> Option { - // Conservatively check a subset of `Operand`s we know our - // benchmarks track, for example `html5ever`. - match op { - Operand::Copy(place) | Operand::Move(place) => find_local_in_place(place), - Operand::Constant(_) => None, - } -} - -impl Visitor<'tcx> for GatherAssignedLocalsVisitor { - fn visit_mir(&mut self, mir: &Mir<'tcx>) { - // We need as many union-find keys as there are locals - for _ in 0..mir.local_decls.len() { - self.unification_table.new_key(()); - } - - self.super_mir(mir); - } - - fn visit_assign( - &mut self, - block: BasicBlock, - place: &Place<'tcx>, - rvalue: &Rvalue<'tcx>, - location: Location, - ) { - let local = find_local_in_place(place); - - // Find those cases where there is a `Place` consumed by - // `rvalue` and we know that all regions in its type will be - // incorporated into `place`, the `Place` we are assigning to. - match rvalue { - // `x = y` is the simplest possible case. - Rvalue::Use(op) => self.union_locals_if_needed(local, find_local_in_operand(op)), - - // `X = &'r P` -- the type of `X` will be `&'r T_P`, where - // `T_P` is the type of `P`. - Rvalue::Ref(_, _, place) => { - // Special case: if you have `X = &*Y` (or `X = &**Y` - // etc), then the outlives relationships will ensure - // that all regions in `Y` are constrained by regions - // in `X` -- this is because the lifetimes of the - // references we deref through are required to outlive - // the borrow lifetime `'r` (which appears in `X`). - // - // (We don't actually need to check the type of `Y`: - // since `ProjectionElem::Deref` represents a built-in - // deref and not an overloaded deref, if the thing we - // deref through is not a reference, then it must be a - // `Box` or `*const`, in which case it contains no - // references.) - let mut place_ref = place; - while let Place::Projection(proj) = place_ref { - if let ProjectionElem::Deref = proj.elem { - place_ref = &proj.base; - } else { - break; - } - } - - self.union_locals_if_needed(local, find_local_in_place(place_ref)) - } - - Rvalue::Cast(kind, op, _) => match kind { - CastKind::Unsize => { - // Casting a `&[T; N]` to `&[T]` or `&Foo` to `&Trait` -- - // in both cases, no regions are "lost". - self.union_locals_if_needed(local, find_local_in_operand(op)) - } - _ => (), - }, - - // Constructing an aggregate like `(x,)` or `Foo { x }` - // includes the full type of `x`. - Rvalue::Aggregate(_, ops) => { - for rvalue in ops.iter().map(find_local_in_operand) { - self.union_locals_if_needed(local, rvalue); - } - } - - // For other things, be conservative and do not union. - _ => (), - }; - - self.super_assign(block, place, rvalue, location); - } -} diff --git a/src/librustc_mir/borrow_check/nll/liveness_map.rs b/src/librustc_mir/borrow_check/nll/liveness_map.rs index d018a9277d8..cbd9c9a4e1a 100644 --- a/src/librustc_mir/borrow_check/nll/liveness_map.rs +++ b/src/librustc_mir/borrow_check/nll/liveness_map.rs @@ -16,10 +16,9 @@ //! liveness code so that it only operates over variables with regions in their //! types, instead of all variables. -use borrow_check::nll::escaping_locals::EscapingLocals; -use rustc::mir::{Local, Mir}; 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; @@ -30,13 +29,14 @@ crate struct NllLivenessMap { /// For each local variable, contains either None (if the type has no regions) /// or Some(i) with a suitable index. - from_local: IndexVec>, - + pub from_local: IndexVec>, /// For each LocalWithRegion, maps back to the original Local index. - to_local: IndexVec, + pub to_local: IndexVec, + } impl LiveVariableMap for NllLivenessMap { + fn from_local(&self, local: Local) -> Option { self.from_local[local] } @@ -55,43 +55,21 @@ fn num_variables(&self) -> usize { 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. - crate fn compute(mir: &Mir<'tcx>) -> Self { - let mut escaping_locals = EscapingLocals::compute(mir); - + pub fn compute(mir: &Mir) -> Self { let mut to_local = IndexVec::default(); - let mut escapes_into_return = 0; - let mut no_regions = 0; - let from_local: IndexVec> = mir + let from_local: IndexVec> = mir .local_decls .iter_enumerated() .map(|(local, local_decl)| { - if escaping_locals.escapes_into_return(local) { - // If the local escapes into the return value, - // then the return value will force all of the - // regions in its type to outlive free regions - // (e.g., `'static`) and hence liveness is not - // needed. This is particularly important for big - // statics. - escapes_into_return += 1; - None - } else if local_decl.ty.has_free_regions() { - let l = to_local.push(local); - debug!("liveness_map: {:?} = {:?}", local, l); - Some(l) - } else { - no_regions += 1; - None + if local_decl.ty.has_free_regions() { + Some(to_local.push(local)) } + else { + None + } }).collect(); - debug!("liveness_map: {} variables need liveness", to_local.len()); - debug!("liveness_map: {} escapes into return", escapes_into_return); - debug!("liveness_map: {} no regions", no_regions); - - Self { - from_local, - to_local, - } + Self { from_local, to_local } } } diff --git a/src/librustc_mir/borrow_check/nll/mod.rs b/src/librustc_mir/borrow_check/nll/mod.rs index 44ed6b7676c..973568a67f0 100644 --- a/src/librustc_mir/borrow_check/nll/mod.rs +++ b/src/librustc_mir/borrow_check/nll/mod.rs @@ -39,9 +39,7 @@ use util as mir_util; use util::pretty::{self, ALIGN}; -mod constraints; mod constraint_generation; -mod escaping_locals; pub mod explain_borrow; mod facts; mod invalidation; @@ -51,6 +49,8 @@ mod universal_regions; crate mod liveness_map; +mod constraints; + use self::facts::AllFacts; use self::region_infer::RegionInferenceContext; use self::universal_regions::UniversalRegions; @@ -120,7 +120,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( location_table, borrow_set, &liveness, - &liveness_map, &mut all_facts, flow_inits, move_data, @@ -206,7 +205,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( dump_mir_results( infcx, &liveness, - &liveness_map, MirSource::item(def_id), &mir, ®ioncx, @@ -223,7 +221,6 @@ pub(in borrow_check) fn compute_regions<'cx, 'gcx, 'tcx>( fn dump_mir_results<'a, 'gcx, 'tcx>( infcx: &InferCtxt<'a, 'gcx, 'tcx>, liveness: &LivenessResults, - liveness_map: &NllLivenessMap, source: MirSource, mir: &Mir<'tcx>, regioncx: &RegionInferenceContext, @@ -233,6 +230,8 @@ fn dump_mir_results<'a, 'gcx, 'tcx>( return; } + let map = &NllLivenessMap::compute(mir); + let regular_liveness_per_location: FxHashMap<_, _> = mir .basic_blocks() .indices() @@ -240,7 +239,7 @@ fn dump_mir_results<'a, 'gcx, 'tcx>( let mut results = vec![]; liveness .regular - .simulate_block(&mir, bb, liveness_map, |location, local_set| { + .simulate_block(&mir, bb, map, |location, local_set| { results.push((location, local_set.clone())); }); results @@ -254,7 +253,7 @@ fn dump_mir_results<'a, 'gcx, 'tcx>( let mut results = vec![]; liveness .drop - .simulate_block(&mir, bb, liveness_map, |location, local_set| { + .simulate_block(&mir, bb, 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 8fbb4aafc1f..c2670389e2d 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 @@ -310,7 +310,7 @@ pub(super) fn report_error( if let (Some(f), Some(o)) = (self.to_error_region(fr), self.to_error_region(outlived_fr)) { let tables = infcx.tcx.typeck_tables_of(mir_def_id); let nice = NiceRegionError::new_from_span(infcx.tcx, span, o, f, Some(tables)); - if let Some(_error_reported) = nice.try_report() { + if let Some(_error_reported) = nice.try_report_from_nll() { return; } } 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 79165276430..8c2a5f19038 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 @@ -10,6 +10,7 @@ use borrow_check::nll::region_infer::RegionInferenceContext; use borrow_check::nll::ToRegionVid; +use borrow_check::nll::universal_regions::DefiningTy; use rustc::hir; use rustc::hir::def_id::DefId; use rustc::infer::InferCtxt; @@ -72,7 +73,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { }) .or_else(|| { self.give_name_if_anonymous_region_appears_in_output( - infcx.tcx, mir, fr, counter, diag) + infcx, mir, mir_def_id, fr, counter, diag) }) .unwrap_or_else(|| span_bug!(mir.span, "can't make a name for free region {:?}", fr)) } @@ -107,13 +108,46 @@ fn give_name_from_error_region( }, ty::BoundRegion::BrEnv => { - let closure_span = tcx.hir.span_if_local(mir_def_id).unwrap(); - let region_name = self.synthesize_region_name(counter); - diag.span_label( - closure_span, - format!("lifetime `{}` represents the closure body", region_name), - ); - Some(region_name) + let mir_node_id = tcx.hir.as_local_node_id(mir_def_id).expect("non-local mir"); + let def_ty = self.universal_regions.defining_ty; + + if let DefiningTy::Closure(def_id, substs) = def_ty { + let args_span = if let hir::ExprKind::Closure(_, _, _, span, _) + = tcx.hir.expect_expr(mir_node_id).node + { + span + } else { + bug!("Closure is not defined by a closure expr"); + }; + let region_name = self.synthesize_region_name(counter); + diag.span_label( + args_span, + format!("lifetime `{}` represents this closure's body", region_name), + ); + + let closure_kind_ty = substs.closure_kind_ty(def_id, tcx); + let note = match closure_kind_ty.to_opt_closure_kind() { + Some(ty::ClosureKind::Fn) => { + "closure implements `Fn`, so references to captured variables \ + can't escape the closure" + } + Some(ty::ClosureKind::FnMut) => { + "closure implements `FnMut`, so references to captured variables \ + can't escape the closure" + } + Some(ty::ClosureKind::FnOnce) => { + bug!("BrEnv in a `FnOnce` closure"); + } + None => bug!("Closure kind not inferred in borrow check"), + }; + + diag.note(note); + + Some(region_name) + } else { + // Can't have BrEnv in functions, constants or generators. + bug!("BrEnv outside of closure."); + } } ty::BoundRegion::BrAnon(_) | ty::BoundRegion::BrFresh(_) => None, @@ -543,28 +577,51 @@ fn give_name_if_anonymous_region_appears_in_upvars( /// or be early bound (named, not in argument). fn give_name_if_anonymous_region_appears_in_output( &self, - tcx: TyCtxt<'_, '_, 'tcx>, + infcx: &InferCtxt<'_, '_, 'tcx>, mir: &Mir<'tcx>, + mir_def_id: DefId, fr: RegionVid, counter: &mut usize, diag: &mut DiagnosticBuilder<'_>, ) -> Option { + let tcx = infcx.tcx; + let return_ty = self.universal_regions.unnormalized_output_ty; debug!( "give_name_if_anonymous_region_appears_in_output: return_ty = {:?}", return_ty ); - if !tcx.any_free_region_meets(&return_ty, |r| r.to_region_vid() == fr) { + if !infcx.tcx.any_free_region_meets(&return_ty, |r| r.to_region_vid() == fr) { return None; } - let region_name = self.synthesize_region_name(counter); + let type_name = with_highlight_region(fr, *counter, || { + infcx.extract_type_name(&return_ty) + }); + + 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), + if gen_move.is_some() { " of generator" } else { " of closure" } + ) + } else { + // unreachable? + (mir.span, "") + }; + diag.span_label( - mir.span, - format!("lifetime `{}` appears in return type", region_name), + return_span, + format!("return type{} is {}", mir_description, type_name), ); - Some(region_name) + // This counter value will already have been used, so this function will increment it + // so the next value will be used next and return the region name that would have been + // used. + Some(self.synthesize_region_name(counter)) } /// Create a synthetic region named `'1`, incrementing the 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 afd4e2859ac..0798a45b3be 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -645,6 +645,30 @@ pub fn to_error_region(&self, r: RegionVid) -> Option> { } } + /// Invoked when we have some type-test (e.g., `T: 'X`) that we cannot + /// prove to be satisfied. If this is a closure, we will attempt to + /// "promote" this type-test into our `ClosureRegionRequirements` and + /// hence pass it up the creator. To do this, we have to phrase the + /// type-test in terms of external free regions, as local free + /// regions are not nameable by the closure's creator. + /// + /// Promotion works as follows: we first check that the type `T` + /// contains only regions that the creator knows about. If this is + /// true, then -- as a consequence -- we know that all regions in + /// the type `T` are free regions that outlive the closure body. If + /// false, then promotion fails. + /// + /// Once we've promoted T, we have to "promote" `'X` to some region + /// that is "external" to the closure. Generally speaking, a region + /// may be the union of some points in the closure body as well as + /// various free lifetimes. We can ignore the points in the closure + /// body: if the type T can be expressed in terms of external regions, + /// we know it outlives the points in the closure body. That + /// just leaves the free regions. + /// + /// The idea then is to lower the `T: 'X` constraint into multiple + /// bounds -- e.g., if `'X` is the union of two free lifetimes, + /// `'1` and `'2`, then we would create `T: '1` and `T: '2`. fn try_promote_type_test<'gcx>( &self, infcx: &InferCtxt<'_, 'gcx, 'tcx>, @@ -661,28 +685,33 @@ fn try_promote_type_test<'gcx>( test: _, } = type_test; + let generic_ty = generic_kind.to_ty(tcx); let subject = match self.try_promote_type_test_subject(infcx, generic_ty) { Some(s) => s, None => return false, }; - // Find some bounding subject-region R+ that is a super-region - // of the existing subject-region R. This should be a non-local, universal - // region, which ensures it can be encoded in a `ClosureOutlivesRequirement`. - let lower_bound_plus = self.non_local_universal_upper_bound(*lower_bound); - assert!(self.universal_regions.is_universal_region(lower_bound_plus)); - assert!( - !self + // For each region outlived by lower_bound find a non-local, + // universal region (it may be the same region) and add it to + // `ClosureOutlivesRequirement`. + let r_scc = self.constraint_sccs.scc(*lower_bound); + for ur in self.scc_values.universal_regions_outlived_by(r_scc) { + let non_local_ub = self.universal_region_relations.non_local_upper_bound(ur); + + assert!(self.universal_regions.is_universal_region(non_local_ub)); + assert!( + !self .universal_regions - .is_local_free_region(lower_bound_plus) - ); + .is_local_free_region(non_local_ub) + ); - propagated_outlives_requirements.push(ClosureOutlivesRequirement { - subject, - outlived_free_region: lower_bound_plus, - blame_span: locations.span(mir), - }); + propagated_outlives_requirements.push(ClosureOutlivesRequirement { + subject, + outlived_free_region: non_local_ub, + blame_span: locations.span(mir), + }); + } true } diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs index d02f54dc4b8..2b9307db59a 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness.rs @@ -37,7 +37,6 @@ pub(super) fn generate<'gcx, 'tcx>( cx: &mut TypeChecker<'_, 'gcx, 'tcx>, mir: &Mir<'tcx>, liveness: &LivenessResults, - liveness_map: &NllLivenessMap, flow_inits: &mut FlowAtLocation>, move_data: &MoveData<'tcx>, ) { @@ -45,10 +44,10 @@ pub(super) fn generate<'gcx, 'tcx>( cx, mir, liveness, - liveness_map, flow_inits, move_data, drop_data: FxHashMap(), + map: &NllLivenessMap::compute(mir), }; for bb in mir.basic_blocks().indices() { @@ -66,10 +65,10 @@ struct TypeLivenessGenerator<'gen, 'typeck, 'flow, 'gcx, 'tcx> cx: &'gen mut TypeChecker<'typeck, 'gcx, 'tcx>, mir: &'gen Mir<'tcx>, liveness: &'gen LivenessResults, - liveness_map: &'gen NllLivenessMap, flow_inits: &'gen mut FlowAtLocation>, move_data: &'gen MoveData<'tcx>, drop_data: FxHashMap, DropData<'tcx>>, + map: &'gen NllLivenessMap, } struct DropData<'tcx> { @@ -87,9 +86,9 @@ fn add_liveness_constraints(&mut self, bb: BasicBlock) { self.liveness .regular - .simulate_block(self.mir, bb, self.liveness_map, |location, live_locals| { + .simulate_block(self.mir, bb, self.map, |location, live_locals| { for live_local in live_locals.iter() { - let local = self.liveness_map.from_live_var(live_local); + 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); } @@ -98,7 +97,7 @@ fn add_liveness_constraints(&mut self, bb: BasicBlock) { let mut all_live_locals: Vec<(Location, Vec)> = vec![]; self.liveness .drop - .simulate_block(self.mir, bb, self.liveness_map, |location, live_locals| { + .simulate_block(self.mir, bb, self.map, |location, live_locals| { all_live_locals.push((location, live_locals.iter().collect())); }); debug!( @@ -125,7 +124,7 @@ fn add_liveness_constraints(&mut self, bb: BasicBlock) { }); } - let local = self.liveness_map.from_live_var(live_local); + 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!( @@ -134,7 +133,7 @@ fn add_liveness_constraints(&mut self, bb: BasicBlock) { self.move_data.move_paths[initialized_child] ); - let local = self.liveness_map.from_live_var(live_local); + 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); } 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 15afc6c52bf..a18e2368bf7 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -15,12 +15,9 @@ use borrow_check::location::LocationTable; use borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint}; use borrow_check::nll::facts::AllFacts; -use borrow_check::nll::liveness_map::NllLivenessMap; -use borrow_check::nll::region_infer::values::{LivenessValues, RegionValueElements}; +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::free_region_relations::{CreateResult, UniversalRegionRelations}; use borrow_check::nll::universal_regions::UniversalRegions; use borrow_check::nll::LocalWithRegion; use borrow_check::nll::ToRegionVid; @@ -119,7 +116,6 @@ pub(crate) fn type_check<'gcx, 'tcx>( location_table: &LocationTable, borrow_set: &BorrowSet<'tcx>, liveness: &LivenessResults, - liveness_map: &NllLivenessMap, all_facts: &mut Option, flow_inits: &mut FlowAtLocation>, move_data: &MoveData<'tcx>, @@ -170,7 +166,7 @@ pub(crate) fn type_check<'gcx, 'tcx>( Some(&mut borrowck_context), Some(errors_buffer), |cx| { - liveness::generate(cx, mir, liveness, liveness_map, flow_inits, move_data); + liveness::generate(cx, mir, liveness, flow_inits, move_data); cx.equate_inputs_and_outputs( mir, mir_def_id, diff --git a/src/librustc_mir/diagnostics.rs b/src/librustc_mir/diagnostics.rs index 3c751d52b06..79b7d042dd6 100644 --- a/src/librustc_mir/diagnostics.rs +++ b/src/librustc_mir/diagnostics.rs @@ -619,38 +619,6 @@ struct Bar {x: u8} `UnsafeCell`. "##, -E0018: r##" - -The value of static and constant integers must be known at compile time. You -can't cast a pointer to an integer because the address of a pointer can -vary. - -For example, if you write: - -```compile_fail,E0018 -static MY_STATIC: u32 = 42; -static MY_STATIC_ADDR: usize = &MY_STATIC as *const _ as usize; -static WHAT: usize = (MY_STATIC_ADDR^17) + MY_STATIC_ADDR; -``` - -Then `MY_STATIC_ADDR` would contain the address of `MY_STATIC`. However, -the address can change when the program is linked, as well as change -between different executions due to ASLR, and many linkers would -not be able to calculate the value of `WHAT`. - -On the other hand, static and constant pointers can point either to -a known numeric address or to the address of a symbol. - -``` -static MY_STATIC: u32 = 42; -static MY_STATIC_ADDR: &'static u32 = &MY_STATIC; -const CONST_ADDR: *const u8 = 0x5f3759df as *const u8; -``` - -This does not pose a problem by itself because they can't be -accessed directly. -"##, - E0019: r##" A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time. Erroneous code @@ -1145,36 +1113,6 @@ fn main() { ``` "##, -E0395: r##" -The value assigned to a constant scalar must be known at compile time, -which is not the case when comparing raw pointers. - -Erroneous code example: - -```compile_fail,E0395 -static FOO: i32 = 42; -static BAR: i32 = 42; - -static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; -// error: raw pointers cannot be compared in statics! -``` - -The address assigned by the linker to `FOO` and `BAR` may or may not -be identical, so the value of `BAZ` can't be determined. - -If you want to do the comparison, please do it at run-time. - -For example: - -``` -static FOO: i32 = 42; -static BAR: i32 = 42; - -let baz: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; -// baz isn't a constant expression so it's ok -``` -"##, - E0161: r##" A value was moved. However, its size was not known at compile time, and only values of a known size can be moved. @@ -1208,29 +1146,6 @@ fn main() { ``` "##, -E0396: r##" -The value behind a raw pointer can't be determined at compile-time -(or even link-time), which means it can't be used in a constant -expression. Erroneous code example: - -```compile_fail,E0396 -const REG_ADDR: *const u8 = 0x5f3759df as *const u8; - -const VALUE: u8 = unsafe { *REG_ADDR }; -// error: raw pointers cannot be dereferenced in constants -``` - -A possible fix is to dereference your pointer at some point in run-time. - -For example: - -``` -const REG_ADDR: *const u8 = 0x5f3759df as *const u8; - -let reg_value = unsafe { *REG_ADDR }; -``` -"##, - E0492: r##" A borrow of a constant containing interior mutability was attempted. Erroneous code example: @@ -1281,9 +1196,7 @@ struct C { a: Cell } ``` This is because cell types do operations that are not thread-safe. Due to this, -they don't implement Sync and thus can't be placed in statics. In this -case, `StaticMutex` would work just fine, but it isn't stable yet: -https://doc.rust-lang.org/nightly/std/sync/struct.StaticMutex.html +they don't implement Sync and thus can't be placed in statics. However, if you still wish to use these types, you can achieve this by an unsafe wrapper: diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs index 3f32d307409..05c843096d2 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -18,7 +18,6 @@ #![feature(in_band_lifetimes)] #![feature(slice_patterns)] #![feature(slice_sort_by_cached_key)] -#![feature(from_ref)] #![feature(box_patterns)] #![feature(box_syntax)] #![feature(catch_expr)] @@ -26,13 +25,10 @@ #![feature(const_fn)] #![feature(core_intrinsics)] #![feature(decl_macro)] -#![feature(fs_read_write)] -#![feature(in_band_lifetimes)] #![feature(macro_vis_matcher)] #![feature(exhaustive_patterns)] #![feature(range_contains)] #![feature(rustc_diagnostic_macros)] -#![feature(crate_visibility_modifier)] #![feature(never_type)] #![feature(specialization)] #![feature(try_trait)] diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 8d6d01633a1..4e32ca483a1 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -104,6 +104,7 @@ use monomorphize::collector::InliningMap; use rustc::dep_graph::WorkProductId; +use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::DefId; use rustc::hir::map::DefPathData; use rustc::mir::mono::{Linkage, Visibility}; @@ -322,146 +323,16 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, None => fallback_cgu_name(tcx), }; - let make_codegen_unit = || { - CodegenUnit::new(codegen_unit_name.clone()) - }; - let codegen_unit = codegen_units.entry(codegen_unit_name.clone()) - .or_insert_with(make_codegen_unit); + .or_insert_with(|| CodegenUnit::new(codegen_unit_name.clone())); let mut can_be_internalized = true; - let default_visibility = |id: DefId, is_generic: bool| { - if !tcx.sess.target.target.options.default_hidden_visibility { - return Visibility::Default - } - - // Generic functions never have export level C - if is_generic { - return Visibility::Hidden - } - - // Things with export level C don't get instantiated in downstream - // crates - if !id.is_local() { - return Visibility::Hidden - } - - if let Some(&SymbolExportLevel::C) = tcx.reachable_non_generics(id.krate) - .get(&id) { - Visibility::Default - } else { - Visibility::Hidden - } - }; - let (linkage, visibility) = match mono_item.explicit_linkage(tcx) { - Some(explicit_linkage) => (explicit_linkage, Visibility::Default), - None => { - match mono_item { - MonoItem::Fn(ref instance) => { - let visibility = match instance.def { - InstanceDef::Item(def_id) => { - let is_generic = instance.substs - .types() - .next() - .is_some(); - - // The `start_fn` lang item is actually a - // monomorphized instance of a function in the - // standard library, used for the `main` - // function. We don't want to export it so we - // tag it with `Hidden` visibility but this - // symbol is only referenced from the actual - // `main` symbol which we unfortunately don't - // know anything about during - // partitioning/collection. As a result we - // forcibly keep this symbol out of the - // `internalization_candidates` set. - // - // FIXME: eventually we don't want to always - // force this symbol to have hidden - // visibility, it should indeed be a candidate - // for internalization, but we have to - // understand that it's referenced from the - // `main` symbol we'll generate later. - if tcx.lang_items().start_fn() == Some(def_id) { - can_be_internalized = false; - Visibility::Hidden - } else if def_id.is_local() { - if is_generic { - if export_generics { - if tcx.is_unreachable_local_definition(def_id) { - // This instance cannot be used - // from another crate. - Visibility::Hidden - } else { - // This instance might be useful in - // a downstream crate. - can_be_internalized = false; - default_visibility(def_id, true) - } - } else { - // We are not exporting generics or - // the definition is not reachable - // for downstream crates, we can - // internalize its instantiations. - Visibility::Hidden - } - } else { - // This isn't a generic function. - if tcx.is_reachable_non_generic(def_id) { - can_be_internalized = false; - debug_assert!(!is_generic); - default_visibility(def_id, false) - } else { - Visibility::Hidden - } - } - } else { - // This is an upstream DefId. - if export_generics && is_generic { - // If it is a upstream monomorphization - // and we export generics, we must make - // it available to downstream crates. - can_be_internalized = false; - default_visibility(def_id, true) - } else { - Visibility::Hidden - } - } - } - InstanceDef::FnPtrShim(..) | - InstanceDef::Virtual(..) | - InstanceDef::Intrinsic(..) | - InstanceDef::ClosureOnceShim { .. } | - InstanceDef::DropGlue(..) | - InstanceDef::CloneShim(..) => { - Visibility::Hidden - } - }; - (Linkage::External, visibility) - } - MonoItem::Static(def_id) => { - let visibility = if tcx.is_reachable_non_generic(def_id) { - can_be_internalized = false; - default_visibility(def_id, false) - } else { - Visibility::Hidden - }; - (Linkage::External, visibility) - } - MonoItem::GlobalAsm(node_id) => { - let def_id = tcx.hir.local_def_id(node_id); - let visibility = if tcx.is_reachable_non_generic(def_id) { - can_be_internalized = false; - default_visibility(def_id, false) - } else { - Visibility::Hidden - }; - (Linkage::External, visibility) - } - } - } - }; + let (linkage, visibility) = mono_item_linkage_and_visibility( + tcx, + &mono_item, + &mut can_be_internalized, + export_generics, + ); if visibility == Visibility::Hidden && can_be_internalized { internalization_candidates.insert(mono_item); } @@ -487,6 +358,200 @@ fn place_root_mono_items<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } +fn mono_item_linkage_and_visibility( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + mono_item: &MonoItem<'tcx>, + can_be_internalized: &mut bool, + export_generics: bool, +) -> (Linkage, Visibility) { + if let Some(explicit_linkage) = mono_item.explicit_linkage(tcx) { + return (explicit_linkage, Visibility::Default) + } + let vis = mono_item_visibility( + tcx, + mono_item, + can_be_internalized, + export_generics, + ); + (Linkage::External, vis) +} + +fn mono_item_visibility( + tcx: TyCtxt<'a, 'tcx, 'tcx>, + mono_item: &MonoItem<'tcx>, + can_be_internalized: &mut bool, + export_generics: bool, +) -> Visibility { + let instance = match mono_item { + // This is pretty complicated, go below + MonoItem::Fn(instance) => instance, + + // Misc handling for generics and such, but otherwise + MonoItem::Static(def_id) => { + return if tcx.is_reachable_non_generic(*def_id) { + *can_be_internalized = false; + default_visibility(tcx, *def_id, false) + } else { + Visibility::Hidden + }; + } + MonoItem::GlobalAsm(node_id) => { + let def_id = tcx.hir.local_def_id(*node_id); + return if tcx.is_reachable_non_generic(def_id) { + *can_be_internalized = false; + default_visibility(tcx, def_id, false) + } else { + Visibility::Hidden + }; + } + }; + + let def_id = match instance.def { + InstanceDef::Item(def_id) => def_id, + + // These are all compiler glue and such, never exported, always hidden. + InstanceDef::FnPtrShim(..) | + InstanceDef::Virtual(..) | + InstanceDef::Intrinsic(..) | + InstanceDef::ClosureOnceShim { .. } | + InstanceDef::DropGlue(..) | + InstanceDef::CloneShim(..) => { + return Visibility::Hidden + } + }; + + // The `start_fn` lang item is actually a monomorphized instance of a + // function in the standard library, used for the `main` function. We don't + // want to export it so we tag it with `Hidden` visibility but this symbol + // is only referenced from the actual `main` symbol which we unfortunately + // don't know anything about during partitioning/collection. As a result we + // forcibly keep this symbol out of the `internalization_candidates` set. + // + // FIXME: eventually we don't want to always force this symbol to have + // hidden visibility, it should indeed be a candidate for + // internalization, but we have to understand that it's referenced + // from the `main` symbol we'll generate later. + // + // This may be fixable with a new `InstanceDef` perhaps? Unsure! + if tcx.lang_items().start_fn() == Some(def_id) { + *can_be_internalized = false; + return Visibility::Hidden + } + + let is_generic = instance.substs.types().next().is_some(); + + // Upstream `DefId` instances get different handling than local ones + if !def_id.is_local() { + return if export_generics && is_generic { + // If it is a upstream monomorphization + // and we export generics, we must make + // it available to downstream crates. + *can_be_internalized = false; + default_visibility(tcx, def_id, true) + } else { + Visibility::Hidden + } + } + + if is_generic { + if export_generics { + if tcx.is_unreachable_local_definition(def_id) { + // This instance cannot be used + // from another crate. + Visibility::Hidden + } else { + // This instance might be useful in + // a downstream crate. + *can_be_internalized = false; + default_visibility(tcx, def_id, true) + } + } else { + // We are not exporting generics or + // the definition is not reachable + // for downstream crates, we can + // internalize its instantiations. + Visibility::Hidden + } + } else { + + // If this isn't a generic function then we mark this a `Default` if + // this is a reachable item, meaning that it's a symbol other crates may + // access when they link to us. + if tcx.is_reachable_non_generic(def_id) { + *can_be_internalized = false; + debug_assert!(!is_generic); + return default_visibility(tcx, def_id, false) + } + + // If this isn't reachable then we're gonna tag this with `Hidden` + // visibility. In some situations though we'll want to prevent this + // symbol from being internalized. + // + // There's two categories of items here: + // + // * First is weak lang items. These are basically mechanisms for + // libcore to forward-reference symbols defined later in crates like + // the standard library or `#[panic_implementation]` definitions. The + // definition of these weak lang items needs to be referenceable by + // libcore, so we're no longer a candidate for internalization. + // Removal of these functions can't be done by LLVM but rather must be + // done by the linker as it's a non-local decision. + // + // * Second is "std internal symbols". Currently this is primarily used + // for allocator symbols. Allocators are a little weird in their + // implementation, but the idea is that the compiler, at the last + // minute, defines an allocator with an injected object file. The + // `alloc` crate references these symbols (`__rust_alloc`) and the + // definition doesn't get hooked up until a linked crate artifact is + // generated. + // + // The symbols synthesized by the compiler (`__rust_alloc`) are thin + // veneers around the actual implementation, some other symbol which + // implements the same ABI. These symbols (things like `__rg_alloc`, + // `__rdl_alloc`, `__rde_alloc`, etc), are all tagged with "std + // internal symbols". + // + // The std-internal symbols here **should not show up in a dll as an + // exported interface**, so they return `false` from + // `is_reachable_non_generic` above and we'll give them `Hidden` + // visibility below. Like the weak lang items, though, we can't let + // LLVM internalize them as this decision is left up to the linker to + // omit them, so prevent them from being internalized. + let codegen_fn_attrs = tcx.codegen_fn_attrs(def_id); + let std_internal_symbol = codegen_fn_attrs.flags + .contains(CodegenFnAttrFlags::RUSTC_STD_INTERNAL_SYMBOL); + if tcx.is_weak_lang_item(def_id) || std_internal_symbol { + *can_be_internalized = false; + } + + Visibility::Hidden + } +} + +fn default_visibility(tcx: TyCtxt, id: DefId, is_generic: bool) -> Visibility { + if !tcx.sess.target.target.options.default_hidden_visibility { + return Visibility::Default + } + + // Generic functions never have export level C + if is_generic { + return Visibility::Hidden + } + + // Things with export level C don't get instantiated in + // downstream crates + if !id.is_local() { + return Visibility::Hidden + } + + // C-export level items remain at `Default`, all other internal + // items become `Hidden` + match tcx.reachable_non_generics(id.krate).get(&id) { + Some(SymbolExportLevel::C) => Visibility::Default, + _ => Visibility::Hidden, + } +} + fn merge_codegen_units<'tcx>(initial_partitioning: &mut PreInliningPartitioning<'tcx>, target_cgu_count: usize, crate_name: &str) { diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 05e51c5430d..5912eee758d 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -333,11 +333,6 @@ fn const_prop( ) -> Option> { let span = source_info.span; match *rvalue { - // This branch exists for the sanity type check - Rvalue::Use(Operand::Constant(ref c)) => { - assert_eq!(c.ty, place_layout.ty); - self.eval_constant(c, source_info) - }, Rvalue::Use(ref op) => { self.eval_operand(op, source_info) }, diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 208679d2aa0..d876ee77e76 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -491,41 +491,46 @@ fn visit_place(&mut self, this.super_place(place, context, location); match proj.elem { ProjectionElem::Deref => { - this.add(Qualif::NOT_CONST); - - let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); - if let ty::TyRawPtr(_) = base_ty.sty { - if this.mode != Mode::Fn { - let mut err = struct_span_err!( - this.tcx.sess, - this.span, - E0396, - "raw pointers cannot be dereferenced in {}s", - this.mode - ); - err.span_label(this.span, - "dereference of raw pointer in constant"); - if this.tcx.sess.teach(&err.get_code().unwrap()) { - err.note( - "The value behind a raw pointer can't be determined \ - at compile-time (or even link-time), which means it \ - can't be used in a constant expression." + if let Mode::Fn = this.mode { + this.add(Qualif::NOT_CONST); + } else { + let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); + if let ty::TyRawPtr(_) = base_ty.sty { + if !this.tcx.sess.features_untracked().const_raw_ptr_deref { + emit_feature_err( + &this.tcx.sess.parse_sess, "const_raw_ptr_deref", + this.span, GateIssue::Language, + &format!( + "dereferencing raw pointers in {}s is unstable", + this.mode, + ), ); - err.help("A possible fix is to dereference your pointer \ - at some point in run-time."); } - err.emit(); } } } ProjectionElem::Field(..) | ProjectionElem::Index(_) => { - if this.mode == Mode::Fn { - let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); - if let Some(def) = base_ty.ty_adt_def() { - if def.is_union() { - this.not_const(); + let base_ty = proj.base.ty(this.mir, this.tcx).to_ty(this.tcx); + if let Some(def) = base_ty.ty_adt_def() { + if def.is_union() { + match this.mode { + Mode::Fn => this.not_const(), + Mode::ConstFn => { + if !this.tcx.sess.features_untracked().const_fn_union { + emit_feature_err( + &this.tcx.sess.parse_sess, "const_fn_union", + this.span, GateIssue::Language, + "unions in const fn are unstable", + ); + } + }, + + | Mode::Static + | Mode::StaticMut + | Mode::Const + => {}, } } } @@ -722,44 +727,17 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) { match (cast_in, cast_out) { (CastTy::Ptr(_), CastTy::Int(_)) | (CastTy::FnPtr, CastTy::Int(_)) => { - self.add(Qualif::NOT_CONST); - if self.mode != Mode::Fn { - let mut err = struct_span_err!( - self.tcx.sess, - self.span, - E0018, - "raw pointers cannot be cast to integers in {}s", - self.mode + if let Mode::Fn = self.mode { + self.add(Qualif::NOT_CONST); + } else if !self.tcx.sess.features_untracked().const_raw_ptr_to_usize_cast { + emit_feature_err( + &self.tcx.sess.parse_sess, "const_raw_ptr_to_usize_cast", + self.span, GateIssue::Language, + &format!( + "casting pointers to integers in {}s is unstable", + self.mode, + ), ); - if self.tcx.sess.teach(&err.get_code().unwrap()) { - err.note("\ -The value of static and constant integers must be known at compile time. You can't cast a pointer \ -to an integer because the address of a pointer can vary. - -For example, if you write: - -``` -static MY_STATIC: u32 = 42; -static MY_STATIC_ADDR: usize = &MY_STATIC as *const _ as usize; -static WHAT: usize = (MY_STATIC_ADDR^17) + MY_STATIC_ADDR; -``` - -Then `MY_STATIC_ADDR` would contain the address of `MY_STATIC`. However, the address can change \ -when the program is linked, as well as change between different executions due to ASLR, and many \ -linkers would not be able to calculate the value of `WHAT`. - -On the other hand, static and constant pointers can point either to a known numeric address or to \ -the address of a symbol. - -``` -static MY_STATIC: u32 = 42; -static MY_STATIC_ADDR: &'static u32 = &MY_STATIC; -const CONST_ADDR: *const u8 = 0x5f3759df as *const u8; -``` - -This does not pose a problem by itself because they can't be accessed directly."); - } - err.emit(); } } _ => {} @@ -773,16 +751,16 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) { op == BinOp::Ge || op == BinOp::Gt || op == BinOp::Offset); - self.add(Qualif::NOT_CONST); - if self.mode != Mode::Fn { - struct_span_err!( - self.tcx.sess, self.span, E0395, - "raw pointers cannot be compared in {}s", - self.mode) - .span_label( + if let Mode::Fn = self.mode { + self.add(Qualif::NOT_CONST); + } else if !self.tcx.sess.features_untracked().const_compare_raw_pointers { + emit_feature_err( + &self.tcx.sess.parse_sess, + "const_compare_raw_pointers", self.span, - "comparing raw pointers in static") - .emit(); + GateIssue::Language, + &format!("comparing raw pointers inside {}", self.mode), + ); } } } diff --git a/src/librustc_passes/hir_stats.rs b/src/librustc_passes/hir_stats.rs index e7b2869dfe6..3c5a0590c20 100644 --- a/src/librustc_passes/hir_stats.rs +++ b/src/librustc_passes/hir_stats.rs @@ -224,11 +224,11 @@ fn visit_lifetime(&mut self, lifetime: &'v hir::Lifetime) { self.record("Lifetime", Id::Node(lifetime.id), lifetime); hir_visit::walk_lifetime(self, lifetime) } - fn visit_qpath(&mut self, qpath: &'v hir::QPath, id: NodeId, span: Span) { + fn visit_qpath(&mut self, qpath: &'v hir::QPath, id: hir::HirId, span: Span) { self.record("QPath", Id::None, qpath); hir_visit::walk_qpath(self, qpath, id, span) } - fn visit_path(&mut self, path: &'v hir::Path, _id: NodeId) { + fn visit_path(&mut self, path: &'v hir::Path, _id: hir::HirId) { self.record("Path", Id::None, path); hir_visit::walk_path(self, path) } diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 5c3a016a82b..b6dd0e8b9b2 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -815,7 +815,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) { // we prohibit access to private statics from other crates, this allows to give // more code internal visibility at link time. (Access to private functions // is already prohibited by type privacy for function types.) - fn visit_qpath(&mut self, qpath: &'tcx hir::QPath, id: ast::NodeId, span: Span) { + fn visit_qpath(&mut self, qpath: &'tcx hir::QPath, id: hir::HirId, span: Span) { let def = match *qpath { hir::QPath::Resolved(_, ref path) => match path.def { Def::Method(..) | Def::AssociatedConst(..) | @@ -823,8 +823,7 @@ fn visit_qpath(&mut self, qpath: &'tcx hir::QPath, id: ast::NodeId, span: Span) _ => None, } hir::QPath::TypeRelative(..) => { - let hir_id = self.tcx.hir.node_to_hir_id(id); - self.tables.type_dependent_defs().get(hir_id).cloned() + self.tables.type_dependent_defs().get(id).cloned() } }; if let Some(def) = def { diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index c782f2072b9..0be1bf3011e 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -630,8 +630,10 @@ pub fn macro_def_scope(&mut self, expansion: Mark) -> Module<'a> { pub fn get_macro(&mut self, def: Def) -> Lrc { let def_id = match def { Def::Macro(def_id, ..) => def_id, - Def::NonMacroAttr => return Lrc::new(SyntaxExtension::NonMacroAttr), - _ => panic!("Expected Def::Macro(..) or Def::NonMacroAttr"), + Def::NonMacroAttr(attr_kind) => return Lrc::new(SyntaxExtension::NonMacroAttr { + mark_used: attr_kind == NonMacroAttrKind::Tool, + }), + _ => panic!("expected `Def::Macro` or `Def::NonMacroAttr`"), }; if let Some(ext) = self.macro_map.get(&def_id) { return ext.clone(); diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index a7fcc89f6b9..7e54f176e10 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -2698,7 +2698,7 @@ fn resolve_block(&mut self, block: &Block) { 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"); @@ -3485,8 +3485,9 @@ fn resolve_path( let binding = if let Some(module) = module { self.resolve_ident_in_module(module, ident, ns, record_used, path_span) } else if opt_ns == Some(MacroNS) { - self.resolve_lexical_macro_path_segment(ident, ns, record_used, path_span) - .map(MacroBinding::binding) + assert!(ns == TypeNS); + self.resolve_lexical_macro_path_segment(ident, ns, record_used, record_used, + false, path_span).map(MacroBinding::binding) } else { let record_used_id = if record_used { crate_lint.node_id().or(Some(CRATE_NODE_ID)) } else { None }; @@ -3514,7 +3515,8 @@ fn resolve_path( if let Some(next_module) = binding.module() { module = Some(next_module); } else if def == Def::ToolMod && i + 1 != path.len() { - return PathResult::NonModule(PathResolution::new(Def::NonMacroAttr)) + let def = Def::NonMacroAttr(NonMacroAttrKind::Tool); + return PathResult::NonModule(PathResolution::new(def)); } else if def == Def::Err { return PathResult::NonModule(err_path_resolution()); } else if opt_ns.is_some() && (is_last || maybe_assoc) { @@ -4254,7 +4256,7 @@ fn find_module(&mut self, 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); @@ -4548,6 +4550,8 @@ fn check_proc_macro_attrs(&mut self, attrs: &[ast::Attribute]) { 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) { diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 993874d7c0b..d680b2d9f7d 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -15,18 +15,17 @@ use resolve_imports::ImportResolver; use rustc::hir::def_id::{DefId, BUILTIN_MACROS_CRATE, CRATE_DEF_INDEX, DefIndex, DefIndexAddressSpace}; -use rustc::hir::def::{Def, Export}; +use rustc::hir::def::{Def, Export, NonMacroAttrKind}; use rustc::hir::map::{self, DefCollector}; use rustc::{ty, lint}; use rustc::middle::cstore::CrateStore; use syntax::ast::{self, Name, Ident}; -use syntax::attr::{self, HasAttrs}; +use syntax::attr; use syntax::errors::DiagnosticBuilder; -use syntax::ext::base::{self, Annotatable, Determinacy, MultiModifier, MultiDecorator}; +use syntax::ext::base::{self, Determinacy, MultiModifier, MultiDecorator}; use syntax::ext::base::{MacroKind, SyntaxExtension, Resolver as SyntaxResolver}; -use syntax::ext::expand::{self, AstFragment, AstFragmentKind, Invocation, InvocationKind}; +use syntax::ext::expand::{AstFragment, Invocation, InvocationKind}; use syntax::ext::hygiene::{self, Mark}; -use syntax::ext::placeholders::placeholder; use syntax::ext::tt::macro_rules; use syntax::feature_gate::{self, feature_err, emit_feature_err, is_builtin_attr_name, GateIssue}; use syntax::fold::{self, Folder}; @@ -320,7 +319,7 @@ fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec, allow_deri None } - fn resolve_invoc(&mut self, invoc: &mut Invocation, scope: Mark, force: bool) + fn resolve_invoc(&mut self, invoc: &Invocation, scope: Mark, force: bool) -> Result>, Determinacy> { let def = match invoc.kind { InvocationKind::Attr { attr: None, .. } => return Ok(None), @@ -329,17 +328,37 @@ fn resolve_invoc(&mut self, invoc: &mut Invocation, scope: Mark, force: bool) if let Def::Macro(_, MacroKind::ProcMacroStub) = def { self.report_proc_macro_stub(invoc.span()); return Err(Determinacy::Determined); - } else if let Def::NonMacroAttr = def { - if let InvocationKind::Attr { .. } = invoc.kind { - if !self.session.features_untracked().tool_attributes { - feature_err(&self.session.parse_sess, "tool_attributes", - invoc.span(), GateIssue::Language, - "tool attributes are unstable").emit(); + } else if let Def::NonMacroAttr(attr_kind) = def { + // Note that not only attributes, but anything in macro namespace can result in a + // `Def::NonMacroAttr` definition (e.g. `inline!()`), so we must report the error + // below for these cases. + let is_attr_invoc = + if let InvocationKind::Attr { .. } = invoc.kind { true } else { false }; + let path = invoc.path().expect("no path for non-macro attr"); + match attr_kind { + NonMacroAttrKind::Tool | NonMacroAttrKind::DeriveHelper | + NonMacroAttrKind::Custom if is_attr_invoc => { + if attr_kind == NonMacroAttrKind::Tool && + !self.session.features_untracked().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(); + } + return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr { + mark_used: attr_kind == NonMacroAttrKind::Tool, + }))); + } + _ => { + self.report_non_macro_attr(path.span, def); + return Err(Determinacy::Determined); } - return Ok(Some(Lrc::new(SyntaxExtension::NonMacroAttr))); - } else { - self.report_non_macro_attr(invoc.path_span()); - return Err(Determinacy::Determined); } } let def_id = def.def_id(); @@ -363,8 +382,8 @@ fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, forc if let Def::Macro(_, MacroKind::ProcMacroStub) = def { self.report_proc_macro_stub(path.span); return Err(Determinacy::Determined); - } else if let Def::NonMacroAttr = def { - self.report_non_macro_attr(path.span); + } else if let Def::NonMacroAttr(..) = def { + self.report_non_macro_attr(path.span, def); return Err(Determinacy::Determined); } self.unused_macros.remove(&def.def_id()); @@ -396,15 +415,14 @@ fn report_proc_macro_stub(&self, span: Span) { "can't use a procedural macro from the same crate that defines it"); } - fn report_non_macro_attr(&self, span: Span) { - self.session.span_err(span, - "expected a macro, found non-macro attribute"); + fn report_non_macro_attr(&self, span: Span, def: Def) { + self.session.span_err(span, &format!("expected a macro, found {}", def.kind_name())); } - fn resolve_invoc_to_def(&mut self, invoc: &mut Invocation, scope: Mark, force: bool) + fn resolve_invoc_to_def(&mut self, invoc: &Invocation, scope: Mark, force: bool) -> Result { - let (attr, traits, item) = match invoc.kind { - InvocationKind::Attr { ref mut attr, ref traits, ref mut item } => (attr, traits, item), + let (attr, traits) = match invoc.kind { + InvocationKind::Attr { ref attr, ref traits, .. } => (attr, traits), InvocationKind::Bang { ref mac, .. } => { return self.resolve_macro_to_def(scope, &mac.node.path, MacroKind::Bang, force); } @@ -413,62 +431,43 @@ fn resolve_invoc_to_def(&mut self, invoc: &mut Invocation, scope: Mark, force: b } }; - let path = attr.as_ref().unwrap().path.clone(); - let mut determinacy = Determinacy::Determined; - match self.resolve_macro_to_def(scope, &path, MacroKind::Attr, force) { - Ok(def) => return Ok(def), - Err(Determinacy::Undetermined) => determinacy = Determinacy::Undetermined, - Err(Determinacy::Determined) if force => return Err(Determinacy::Determined), - Err(Determinacy::Determined) => {} + let def = self.resolve_macro_to_def(scope, &path, MacroKind::Attr, force); + if let Ok(Def::NonMacroAttr(NonMacroAttrKind::Custom)) = def {} else { + return def; } - // Ok at this point we've determined that the `attr` above doesn't - // actually resolve at this time, so we may want to report an error. - // It could be the case, though, that `attr` won't ever resolve! If - // there's a custom derive that could be used it might declare `attr` as - // a custom attribute accepted by the derive. In this case we don't want - // to report this particular invocation as unresolved, but rather we'd - // want to move on to the next invocation. + // At this point we've found that the `attr` is determinately unresolved and thus can be + // interpreted as a custom attribute. Normally custom attributes are feature gated, but + // it may be a custom attribute whitelisted by a derive macro and they do not require + // a feature gate. // - // This loop here looks through all of the derive annotations in scope - // and tries to resolve them. If they themselves successfully resolve - // *and* the resolve mentions that this attribute's name is a registered - // custom attribute then we flag this attribute as known and update - // `invoc` above to point to the next invocation. - // - // By then returning `Undetermined` we should continue resolution to - // resolve the next attribute. - let attr_name = match path.segments.len() { - 1 => path.segments[0].ident.name, - _ => return Err(determinacy), - }; + // So here we look through all of the derive annotations in scope and try to resolve them. + // If they themselves successfully resolve *and* one of the resolved derive macros + // whitelists this attribute's name, then this is a registered attribute and we can convert + // it from a "generic custom attrite" into a "known derive helper attribute". + enum ConvertToDeriveHelper { Yes, No, DontKnow } + let mut convert_to_derive_helper = ConvertToDeriveHelper::No; + let attr_name = path.segments[0].ident.name; for path in traits { match self.resolve_macro(scope, path, MacroKind::Derive, force) { Ok(ext) => if let SyntaxExtension::ProcMacroDerive(_, ref inert_attrs, _) = *ext { if inert_attrs.contains(&attr_name) { - // FIXME(jseyfried) Avoid `mem::replace` here. - let dummy_item = placeholder(AstFragmentKind::Items, ast::DUMMY_NODE_ID) - .make_items().pop().unwrap(); - let dummy_item = Annotatable::Item(dummy_item); - *item = mem::replace(item, dummy_item).map_attrs(|mut attrs| { - let inert_attr = attr.take().unwrap(); - attr::mark_known(&inert_attr); - if self.use_extern_macros { - *attr = expand::find_attr_invoc(&mut attrs); - } - attrs.push(inert_attr); - attrs - }); - return Err(Determinacy::Undetermined) + convert_to_derive_helper = ConvertToDeriveHelper::Yes; + break } }, - Err(Determinacy::Undetermined) => determinacy = Determinacy::Undetermined, + Err(Determinacy::Undetermined) => + convert_to_derive_helper = ConvertToDeriveHelper::DontKnow, Err(Determinacy::Determined) => {} } } - Err(determinacy) + match convert_to_derive_helper { + ConvertToDeriveHelper::Yes => Ok(Def::NonMacroAttr(NonMacroAttrKind::DeriveHelper)), + ConvertToDeriveHelper::No => def, + ConvertToDeriveHelper::DontKnow => Err(Determinacy::determined(force)), + } } fn resolve_macro_to_def(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool) @@ -481,7 +480,8 @@ fn resolve_macro_to_def(&mut self, scope: Mark, path: &ast::Path, kind: MacroKin "generic arguments in macro path"); }); } - if kind != MacroKind::Bang && path.segments.len() > 1 && def != Ok(Def::NonMacroAttr) { + if kind != MacroKind::Bang && path.segments.len() > 1 && + def != Ok(Def::NonMacroAttr(NonMacroAttrKind::Tool)) { if !self.session.features_untracked().proc_macro_path_invoc { emit_feature_err( &self.session.parse_sess, @@ -550,10 +550,11 @@ pub fn resolve_macro_to_def_inner(&mut self, scope: Mark, path: &ast::Path, let result = if let Some(MacroBinding::Legacy(binding)) = legacy_resolution { Ok(Def::Macro(binding.def_id, MacroKind::Bang)) } else { - match self.resolve_lexical_macro_path_segment(path[0], MacroNS, false, span) { + match self.resolve_lexical_macro_path_segment(path[0], MacroNS, false, force, + kind == MacroKind::Attr, span) { Ok(binding) => Ok(binding.binding().def_ignoring_ambiguity()), - Err(Determinacy::Undetermined) if !force => return Err(Determinacy::Undetermined), - Err(_) => { + Err(Determinacy::Undetermined) => return Err(Determinacy::Undetermined), + Err(Determinacy::Determined) => { self.found_unresolved_macro = true; Err(Determinacy::Determined) } @@ -574,6 +575,8 @@ pub fn resolve_lexical_macro_path_segment(&mut self, mut ident: Ident, ns: Namespace, record_used: bool, + force: bool, + is_attr: bool, path_span: Span) -> Result, Determinacy> { // General principles: @@ -604,6 +607,7 @@ pub fn resolve_lexical_macro_path_segment(&mut self, // 3. Builtin attributes (closed, controlled). assert!(ns == TypeNS || ns == MacroNS); + assert!(force || !record_used); // `record_used` implies `force` ident = ident.modern(); // Names from inner scope that can't shadow names from outer scopes, e.g. @@ -647,8 +651,9 @@ enum WhereToResolve<'a> { } WhereToResolve::BuiltinAttrs => { if is_builtin_attr_name(ident.name) { - let binding = (Def::NonMacroAttr, ty::Visibility::Public, - ident.span, Mark::root()).to_name_binding(self.arenas); + let binding = (Def::NonMacroAttr(NonMacroAttrKind::Builtin), + ty::Visibility::Public, ident.span, Mark::root()) + .to_name_binding(self.arenas); Ok(MacroBinding::Global(binding)) } else { Err(Determinacy::Determined) @@ -776,7 +781,7 @@ macro_rules! continue_search { () => { Err(Determinacy::Determined) => { continue_search!(); } - Err(Determinacy::Undetermined) => return Err(Determinacy::Undetermined), + Err(Determinacy::Undetermined) => return Err(Determinacy::determined(force)), } } @@ -785,7 +790,19 @@ macro_rules! continue_search { () => { return Ok(previous_result); } - if record_used { Err(Determinacy::Determined) } else { Err(Determinacy::Undetermined) } + let determinacy = Determinacy::determined(force); + if determinacy == Determinacy::Determined && is_attr { + // For single-segment attributes interpret determinate "no resolution" as a custom + // attribute. (Lexical resolution implies the first segment and is_attr should imply + // the last segment, so we are certainly working with a single-segment attribute here.) + assert!(ns == MacroNS); + let binding = (Def::NonMacroAttr(NonMacroAttrKind::Custom), + ty::Visibility::Public, ident.span, Mark::root()) + .to_name_binding(self.arenas); + Ok(MacroBinding::Global(binding)) + } else { + Err(determinacy) + } } pub fn resolve_legacy_scope(&mut self, @@ -869,7 +886,8 @@ pub fn finalize_current_module_macro_resolutions(&mut self) { let span = ident.span; let legacy_scope = &self.invocations[&mark].legacy_scope; let legacy_resolution = self.resolve_legacy_scope(legacy_scope, ident, true); - let resolution = self.resolve_lexical_macro_path_segment(ident, MacroNS, true, span); + let resolution = self.resolve_lexical_macro_path_segment(ident, MacroNS, true, true, + kind == MacroKind::Attr, span); let check_consistency = |this: &Self, binding: MacroBinding| { if let Some(def) = def { diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs index 2fe7d73de8a..d2e52f98238 100644 --- a/src/librustc_save_analysis/json_dumper.rs +++ b/src/librustc_save_analysis/json_dumper.rs @@ -39,7 +39,7 @@ pub struct WriteOutput<'b, W: Write + 'b> { 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 431147e0829..e256f1761f1 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -810,9 +810,8 @@ fn fn_type(path: &ast::Path) -> bool { HirDef::SelfTy(..) | HirDef::Label(..) | HirDef::Macro(..) | - HirDef::GlobalAsm(..) | HirDef::ToolMod | - HirDef::NonMacroAttr | + HirDef::NonMacroAttr(..) | HirDef::Err => None, } } diff --git a/src/librustc_target/lib.rs b/src/librustc_target/lib.rs index a50a5a2d1cb..af2697f62f7 100644 --- a/src/librustc_target/lib.rs +++ b/src/librustc_target/lib.rs @@ -23,8 +23,6 @@ #![feature(box_syntax)] #![feature(const_fn)] -#![feature(fs_read_write)] -#![feature(inclusive_range)] #![feature(slice_patterns)] #[macro_use] diff --git a/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs b/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs index cfd73e371dd..f8cd1b5b812 100644 --- a/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs +++ b/src/librustc_target/spec/riscv32imac_unknown_none_elf.rs @@ -33,6 +33,7 @@ pub fn target() -> TargetResult { executables: true, panic_strategy: PanicStrategy::Abort, relocation_model: "static".to_string(), + emit_debug_gdb_scripts: false, abi_blacklist: vec![ Abi::Cdecl, Abi::Stdcall, diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 0ca92d724b5..546553ac245 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -68,9 +68,7 @@ pub fn compare_impl_method<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, if let Err(ErrorReported) = compare_synthetic_generics(tcx, impl_m, - impl_m_span, - trait_m, - trait_item_span) { + trait_m) { return; } @@ -729,14 +727,11 @@ trait `{}` has {}", fn compare_synthetic_generics<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_m: &ty::AssociatedItem, - _impl_m_span: Span, // FIXME necessary? - trait_m: &ty::AssociatedItem, - _trait_item_span: Option) // FIXME necessary? + trait_m: &ty::AssociatedItem) -> Result<(), ErrorReported> { // FIXME(chrisvittal) Clean up this function, list of FIXME items: // 1. Better messages for the span labels // 2. Explanation as to what is going on - // 3. Correct the function signature for what we actually use // If we get here, we already have the same number of generics, so the zip will // be okay. let mut error_found = false; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 8d8482208b9..68e851446dc 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -758,8 +758,9 @@ pub fn matches_return_type(&self, 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/mod.rs b/src/librustc_typeck/check/mod.rs index 8c47df8b042..9b6772e2dbb 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3915,7 +3915,7 @@ fn check_expr_kind(&self, } 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 diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 4d9a4a03a6b..ba65d0606b3 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -41,21 +41,19 @@ struct Checker<'a, 'tcx: 'a> { impl<'a, 'tcx> Checker<'a, 'tcx> { fn check(&self, trait_def_id: Option, mut f: F) -> &Self - where F: FnMut(TyCtxt<'a, 'tcx, 'tcx>, DefId, DefId) + where F: FnMut(TyCtxt<'a, 'tcx, 'tcx>, DefId) { if Some(self.trait_def_id) == trait_def_id { for &impl_id in self.tcx.hir.trait_impls(self.trait_def_id) { let impl_def_id = self.tcx.hir.local_def_id(impl_id); - f(self.tcx, self.trait_def_id, impl_def_id); + f(self.tcx, impl_def_id); } } self } } -fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - _drop_did: DefId, - impl_did: DefId) { +fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { match tcx.type_of(impl_did).sty { ty::TyAdt(..) => {} _ => { @@ -87,9 +85,7 @@ fn visit_implementation_of_drop<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - _copy_did: DefId, - impl_did: DefId) { +fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); let impl_node_id = if let Some(n) = tcx.hir.as_local_node_id(impl_did) { @@ -157,9 +153,7 @@ fn visit_implementation_of_copy<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } } -fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - _: DefId, - impl_did: DefId) { +fn visit_implementation_of_coerce_unsized<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did); diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 9fd5db16fb1..ecc167d5a19 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -74,7 +74,6 @@ #![feature(box_patterns)] #![feature(box_syntax)] #![feature(crate_visibility_modifier)] -#![feature(from_ref)] #![feature(exhaustive_patterns)] #![feature(iterator_find_map)] #![feature(quote)] diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 507aff0c3c7..5fd0b888707 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -126,6 +126,7 @@ fn get_auto_trait_impl_for( let trait_ = hir::TraitRef { path: get_path_for_type(self.cx.tcx, trait_def_id, hir::def::Def::Trait), ref_id: ast::DUMMY_NODE_ID, + hir_ref_id: hir::DUMMY_HIR_ID, }; let polarity; @@ -418,8 +419,8 @@ fn extract_for_generics<'b, 'c, 'd>( name: name.to_string(), kind: GenericParamDefKind::Lifetime, }) - } - &ty::ReVar(_) | &ty::ReEarlyBound(_) => None, + }, + &ty::ReVar(_) | &ty::ReEarlyBound(_) | &ty::ReStatic => None, _ => panic!("Unexpected region type {:?}", r), } }) diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs index 5b352ffb725..83e0827340d 100644 --- a/src/librustdoc/clean/blanket_impl.rs +++ b/src/librustdoc/clean/blanket_impl.rs @@ -119,6 +119,7 @@ pub fn get_blanket_impls( trait_def_id, hir::def::Def::Trait), ref_id: ast::DUMMY_NODE_ID, + hir_ref_id: hir::DUMMY_HIR_ID, }; let provided_trait_methods = infcx.tcx.provided_trait_methods(trait_def_id) diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 86e5bbeab70..68e46183280 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -486,7 +486,7 @@ pub fn run_core(search_paths: SearchPaths, &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/html/highlight.rs b/src/librustdoc/html/highlight.rs index 73d7a9ab859..ff2cc35fce8 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -44,7 +44,7 @@ pub fn render_with_highlighting(src: &str, class: Option<&str>, 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) { + if classifier.write_source(&mut out).is_err() { return format!("
{}
", src); } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index b22e239e20a..c104b883340 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -625,7 +625,7 @@ fn parse(string: &str, allow_error_code_check: ErrorCodes) -> LangString { data.no_run = true; } x if allow_error_code_check && x.starts_with("E") && x.len() == 5 => { - if let Ok(_) = x[1..].parse::() { + if x[1..].parse::().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 c2978a62489..470aa2c10e9 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1613,7 +1613,6 @@ impl fmt::Display for AllTypes { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "

\ - List of all items\ \ \ \ @@ -1621,6 +1620,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { \ + List of all items\

")?; print_entries(f, &self.structs, "Structs", "structs")?; print_entries(f, &self.enums, "Enums", "enums")?; @@ -2068,7 +2068,34 @@ impl<'a> fmt::Display for Item<'a> { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { debug_assert!(!self.item.is_stripped()); // Write the breadcrumb trail header for the top - write!(fmt, "

")?; + write!(fmt, "

")?; + if let Some(version) = self.item.stable_since() { + write!(fmt, "{0}", + version)?; + } + write!(fmt, + "\ + \ + []\ + \ + ")?; + + // Write `src` tag + // + // When this item is part of a `pub use` in a downstream crate, the + // [src] link in the downstream documentation will actually come back to + // this page, and this link will be auto-clicked. The `id` attribute is + // used to find the link to auto-click. + if self.cx.shared.include_sources && !self.item.is_primitive() { + if let Some(l) = self.src_href() { + write!(fmt, "[src]", + l, "goto source code")?; + } + } + + write!(fmt, "")?; // out-of-band + write!(fmt, "")?; match self.item.inner { clean::ModuleItem(ref m) => if m.is_crate { write!(fmt, "Crate ")?; @@ -2105,34 +2132,7 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { write!(fmt, "{}", self.item.type_(), self.item.name.as_ref().unwrap())?; - write!(fmt, "")?; // in-band - write!(fmt, "")?; - if let Some(version) = self.item.stable_since() { - write!(fmt, "{0}", - version)?; - } - write!(fmt, - "\ - \ - []\ - \ - ")?; - - // Write `src` tag - // - // When this item is part of a `pub use` in a downstream crate, the - // [src] link in the downstream documentation will actually come back to - // this page, and this link will be auto-clicked. The `id` attribute is - // used to find the link to auto-click. - if self.cx.shared.include_sources && !self.item.is_primitive() { - if let Some(l) = self.src_href() { - write!(fmt, "[src]", - l, "goto source code")?; - } - } - - write!(fmt, "

")?; // out-of-band + write!(fmt, "

")?; // in-band match self.item.inner { clean::ModuleItem(ref m) => diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 62ef5626ee5..07507047dc2 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -2208,6 +2208,25 @@ }; 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) { + console.log(elem, elem.parentNode); + 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/rustdoc.css b/src/librustdoc/html/static/rustdoc.css index 496029e33fc..57a111daa89 100644 --- a/src/librustdoc/html/static/rustdoc.css +++ b/src/librustdoc/html/static/rustdoc.css @@ -97,7 +97,7 @@ h1, h2, h3:not(.impl):not(.method):not(.type):not(.tymethod):not(.important), h4 h1.fqn { border-bottom: 1px dashed; margin-top: 0; - position: relative; + overflow: auto; } h2, h3:not(.impl):not(.method):not(.type):not(.tymethod), h4:not(.method):not(.type):not(.tymethod):not(.associatedconstant) { border-bottom: 1px solid; @@ -352,14 +352,11 @@ nav.sub { } .content .out-of-band { + float: right; font-size: 23px; margin: 0px; padding: 0px; - text-align: right; - display: inline-block; font-weight: normal; - position: absolute; - right: 0; } h3.impl > .out-of-band { diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index bd7f7386fd1..78ecfd13e2f 100644 --- a/src/librustdoc/lib.rs +++ b/src/librustdoc/lib.rs @@ -13,17 +13,14 @@ html_root_url = "https://doc.rust-lang.org/nightly/", html_playground_url = "https://play.rust-lang.org/")] -#![feature(ascii_ctype)] #![feature(rustc_private)] #![feature(box_patterns)] #![feature(box_syntax)] -#![feature(fs_read_write)] #![feature(iterator_find_map)] #![feature(set_stdio)] #![feature(slice_sort_by_cached_key)] #![feature(test)] #![feature(vec_remove_item)] -#![feature(entry_and_modify)] #![feature(ptr_offset_from)] #![feature(crate_visibility_modifier)] #![feature(const_fn)] diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 3c01de2e997..0bc968b6c5c 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -232,6 +232,7 @@ // std is implemented with unstable features, many of which are internal // compiler details that will never be stable +#![cfg_attr(test, feature(test, update_panic_count))] #![feature(alloc)] #![feature(alloc_error_handler)] #![feature(alloc_system)] @@ -242,7 +243,6 @@ #![feature(align_offset)] #![feature(arbitrary_self_types)] #![feature(array_error_internals)] -#![feature(ascii_ctype)] #![feature(asm)] #![feature(attr_literals)] #![feature(box_syntax)] @@ -250,17 +250,15 @@ #![feature(cfg_target_thread_local)] #![feature(cfg_target_vendor)] #![feature(char_error_internals)] -#![feature(char_internals)] -#![feature(collections_range)] #![feature(compiler_builtins_lib)] #![feature(const_fn)] +#![feature(const_int_ops)] +#![feature(const_ip)] #![feature(core_intrinsics)] #![feature(dropck_eyepatch)] #![feature(exact_size_is_empty)] #![feature(external_doc)] -#![feature(fs_read_write)] #![feature(fixed_size_array)] -#![feature(float_from_str_radix)] #![feature(fn_traits)] #![feature(fnbox)] #![feature(futures_api)] @@ -268,7 +266,6 @@ #![feature(hashmap_internals)] #![feature(int_error_internals)] #![feature(integer_atomics)] -#![feature(into_cow)] #![feature(lang_items)] #![feature(libc)] #![feature(link_args)] @@ -277,34 +274,26 @@ #![feature(needs_panic_runtime)] #![feature(never_type)] #![feature(exhaustive_patterns)] -#![feature(num_bits_bytes)] -#![feature(old_wrapping)] #![feature(on_unimplemented)] -#![feature(oom)] #![feature(optin_builtin_traits)] #![feature(panic_internals)] #![feature(panic_unwind)] -#![feature(peek)] #![feature(pin)] -#![feature(placement_new_protocol)] #![feature(prelude_import)] #![feature(ptr_internals)] -#![feature(rand)] #![feature(raw)] #![feature(rustc_attrs)] +#![feature(rustc_const_unstable)] #![feature(std_internals)] #![feature(stdsimd)] #![feature(shrink_to)] -#![feature(slice_bytes)] #![feature(slice_concat_ext)] #![feature(slice_internals)] #![feature(slice_patterns)] #![feature(staged_api)] #![feature(stmt_expr_attributes)] -#![feature(str_char)] #![feature(str_internals)] -#![feature(str_utf16)] -#![feature(test, rustc_private)] +#![feature(rustc_private)] #![feature(thread_local)] #![feature(toowned_clone_into)] #![feature(try_from)] @@ -313,15 +302,12 @@ #![feature(untagged_unions)] #![feature(unwind_attributes)] #![feature(use_extern_macros)] -#![feature(vec_push_all)] #![feature(doc_cfg)] #![feature(doc_masked)] #![feature(doc_spotlight)] -#![cfg_attr(test, feature(update_panic_count))] #![cfg_attr(windows, feature(used))] #![feature(doc_alias)] #![feature(doc_keyword)] -#![feature(float_internals)] #![feature(panic_info_message)] #![feature(panic_implementation)] diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index fcec8d06853..d601a0c42e9 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -16,8 +16,6 @@ use cmp::Ordering; use fmt; use hash; -use mem; -use net::{hton, ntoh}; use sys::net::netc as c; use sys_common::{AsInner, FromInner}; @@ -340,18 +338,21 @@ impl Ipv4Addr { /// let addr = Ipv4Addr::new(127, 0, 0, 1); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr { + #[rustc_const_unstable(feature = "const_ip")] + pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr { Ipv4Addr { inner: c::in_addr { - s_addr: hton(((a as u32) << 24) | - ((b as u32) << 16) | - ((c as u32) << 8) | - (d as u32)), + s_addr: u32::to_be( + ((a as u32) << 24) | + ((b as u32) << 16) | + ((c as u32) << 8) | + (d as u32) + ), } } } - /// Creates a new IPv4 address with the address pointing to localhost: 127.0.0.1. + /// An IPv4 address with the address pointing to localhost: 127.0.0.1. /// /// # Examples /// @@ -359,17 +360,15 @@ pub fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr { /// #![feature(ip_constructors)] /// use std::net::Ipv4Addr; /// - /// let addr = Ipv4Addr::localhost(); + /// let addr = Ipv4Addr::LOCALHOST; /// assert_eq!(addr, Ipv4Addr::new(127, 0, 0, 1)); /// ``` #[unstable(feature = "ip_constructors", reason = "requires greater scrutiny before stabilization", issue = "44582")] - pub fn localhost() -> Ipv4Addr { - Ipv4Addr::new(127, 0, 0, 1) - } + pub const LOCALHOST: Self = Ipv4Addr::new(127, 0, 0, 1); - /// Creates a new IPv4 address representing an unspecified address: 0.0.0.0 + /// An IPv4 address representing an unspecified address: 0.0.0.0 /// /// # Examples /// @@ -377,15 +376,29 @@ pub fn localhost() -> Ipv4Addr { /// #![feature(ip_constructors)] /// use std::net::Ipv4Addr; /// - /// let addr = Ipv4Addr::unspecified(); + /// let addr = Ipv4Addr::UNSPECIFIED; /// assert_eq!(addr, Ipv4Addr::new(0, 0, 0, 0)); /// ``` #[unstable(feature = "ip_constructors", reason = "requires greater scrutiny before stabilization", issue = "44582")] - pub fn unspecified() -> Ipv4Addr { - Ipv4Addr::new(0, 0, 0, 0) - } + pub const UNSPECIFIED: Self = Ipv4Addr::new(0, 0, 0, 0); + + /// An IPv4 address representing the broadcast address: 255.255.255.255 + /// + /// # Examples + /// + /// ``` + /// #![feature(ip_constructors)] + /// use std::net::Ipv4Addr; + /// + /// let addr = Ipv4Addr::BROADCAST; + /// assert_eq!(addr, Ipv4Addr::new(255, 255, 255, 255)); + /// ``` + #[unstable(feature = "ip_constructors", + reason = "requires greater scrutiny before stabilization", + issue = "44582")] + pub const BROADCAST: Self = Ipv4Addr::new(255, 255, 255, 255); /// Returns the four eight-bit integers that make up this address. /// @@ -399,7 +412,7 @@ pub fn unspecified() -> Ipv4Addr { /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn octets(&self) -> [u8; 4] { - let bits = ntoh(self.inner.s_addr); + let bits = u32::from_be(self.inner.s_addr); [(bits >> 24) as u8, (bits >> 16) as u8, (bits >> 8) as u8, bits as u8] } @@ -573,8 +586,7 @@ pub fn is_multicast(&self) -> bool { /// ``` #[stable(since = "1.7.0", feature = "ip_17")] pub fn is_broadcast(&self) -> bool { - self.octets()[0] == 255 && self.octets()[1] == 255 && - self.octets()[2] == 255 && self.octets()[3] == 255 + self == &Self::BROADCAST } /// Returns [`true`] if this address is in a range designated for documentation. @@ -763,7 +775,7 @@ fn partial_cmp(&self, other: &IpAddr) -> Option { #[stable(feature = "rust1", since = "1.0.0")] impl Ord for Ipv4Addr { fn cmp(&self, other: &Ipv4Addr) -> Ordering { - ntoh(self.inner.s_addr).cmp(&ntoh(other.inner.s_addr)) + u32::from_be(self.inner.s_addr).cmp(&u32::from_be(other.inner.s_addr)) } } @@ -856,21 +868,27 @@ impl Ipv6Addr { /// let addr = Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff, 0xc00a, 0x2ff); /// ``` #[stable(feature = "rust1", since = "1.0.0")] - pub fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, - h: u16) -> Ipv6Addr { - let mut addr: c::in6_addr = unsafe { mem::zeroed() }; - addr.s6_addr = [(a >> 8) as u8, a as u8, - (b >> 8) as u8, b as u8, - (c >> 8) as u8, c as u8, - (d >> 8) as u8, d as u8, - (e >> 8) as u8, e as u8, - (f >> 8) as u8, f as u8, - (g >> 8) as u8, g as u8, - (h >> 8) as u8, h as u8]; - Ipv6Addr { inner: addr } + #[rustc_const_unstable(feature = "const_ip")] + pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, + g: u16, h: u16) -> Ipv6Addr { + Ipv6Addr { + inner: c::in6_addr { + s6_addr: [ + (a >> 8) as u8, a as u8, + (b >> 8) as u8, b as u8, + (c >> 8) as u8, c as u8, + (d >> 8) as u8, d as u8, + (e >> 8) as u8, e as u8, + (f >> 8) as u8, f as u8, + (g >> 8) as u8, g as u8, + (h >> 8) as u8, h as u8 + ], + } + } + } - /// Creates a new IPv6 address representing localhost: `::1`. + /// An IPv6 address representing localhost: `::1`. /// /// # Examples /// @@ -878,17 +896,15 @@ pub fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, /// #![feature(ip_constructors)] /// use std::net::Ipv6Addr; /// - /// let addr = Ipv6Addr::localhost(); + /// let addr = Ipv6Addr::LOCALHOST; /// assert_eq!(addr, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); /// ``` #[unstable(feature = "ip_constructors", reason = "requires greater scrutiny before stabilization", issue = "44582")] - pub fn localhost() -> Ipv6Addr { - Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1) - } + pub const LOCALHOST: Self = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1); - /// Creates a new IPv6 address representing the unspecified address: `::` + /// An IPv6 address representing the unspecified address: `::` /// /// # Examples /// @@ -896,15 +912,13 @@ pub fn localhost() -> Ipv6Addr { /// #![feature(ip_constructors)] /// use std::net::Ipv6Addr; /// - /// let addr = Ipv6Addr::unspecified(); + /// let addr = Ipv6Addr::UNSPECIFIED; /// assert_eq!(addr, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)); /// ``` #[unstable(feature = "ip_constructors", reason = "requires greater scrutiny before stabilization", issue = "44582")] - pub fn unspecified() -> Ipv6Addr { - Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0) - } + pub const UNSPECIFIED: Self = Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0); /// Returns the eight 16-bit segments that make up this address. /// @@ -1414,8 +1428,7 @@ fn from(ip: u128) -> Ipv6Addr { #[stable(feature = "ipv6_from_octets", since = "1.9.0")] impl From<[u8; 16]> for Ipv6Addr { fn from(octets: [u8; 16]) -> Ipv6Addr { - let mut inner: c::in6_addr = unsafe { mem::zeroed() }; - inner.s6_addr = octets; + let inner = c::in6_addr { s6_addr: octets }; Ipv6Addr::from_inner(inner) } } @@ -1846,18 +1859,20 @@ fn test_int_to_ipv6() { #[test] fn ipv4_from_constructors() { - assert_eq!(Ipv4Addr::localhost(), Ipv4Addr::new(127, 0, 0, 1)); - assert!(Ipv4Addr::localhost().is_loopback()); - assert_eq!(Ipv4Addr::unspecified(), Ipv4Addr::new(0, 0, 0, 0)); - assert!(Ipv4Addr::unspecified().is_unspecified()); + assert_eq!(Ipv4Addr::LOCALHOST, Ipv4Addr::new(127, 0, 0, 1)); + assert!(Ipv4Addr::LOCALHOST.is_loopback()); + assert_eq!(Ipv4Addr::UNSPECIFIED, Ipv4Addr::new(0, 0, 0, 0)); + assert!(Ipv4Addr::UNSPECIFIED.is_unspecified()); + assert_eq!(Ipv4Addr::BROADCAST, Ipv4Addr::new(255, 255, 255, 255)); + assert!(Ipv4Addr::BROADCAST.is_broadcast()); } #[test] fn ipv6_from_contructors() { - assert_eq!(Ipv6Addr::localhost(), Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); - assert!(Ipv6Addr::localhost().is_loopback()); - assert_eq!(Ipv6Addr::unspecified(), Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)); - assert!(Ipv6Addr::unspecified().is_unspecified()); + assert_eq!(Ipv6Addr::LOCALHOST, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + assert!(Ipv6Addr::LOCALHOST.is_loopback()); + assert_eq!(Ipv6Addr::UNSPECIFIED, Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 0)); + assert!(Ipv6Addr::UNSPECIFIED.is_unspecified()); } #[test] diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs index 3abc260b458..f6cb8beae84 100644 --- a/src/libstd/sync/once.rs +++ b/src/libstd/sync/once.rs @@ -31,12 +31,10 @@ // initialization closure panics, the Once enters a "poisoned" state which means // that all future calls will immediately panic as well. // -// So to implement this, one might first reach for a `StaticMutex`, but those -// unfortunately need to be deallocated (e.g. call `destroy()`) to free memory -// on all OSes (some of the BSDs allocate memory for mutexes). It also gets a -// lot harder with poisoning to figure out when the mutex needs to be -// deallocated because it's not after the closure finishes, but after the first -// successful closure finishes. +// So to implement this, one might first reach for a `Mutex`, but those cannot +// be put into a `static`. It also gets a lot harder with poisoning to figure +// out when the mutex needs to be deallocated because it's not after the closure +// finishes, but after the first successful closure finishes. // // All in all, this is instead implemented with atomics and lock-free // operations! Whee! Each `Once` has one word of atomic state, and this state is diff --git a/src/libstd/sys/redox/net/netc.rs b/src/libstd/sys/redox/net/netc.rs index d443a4d68a1..b6d9f456295 100644 --- a/src/libstd/sys/redox/net/netc.rs +++ b/src/libstd/sys/redox/net/netc.rs @@ -24,10 +24,10 @@ pub struct in_addr { } #[derive(Copy, Clone)] +#[repr(align(4))] #[repr(C)] pub struct in6_addr { pub s6_addr: [u8; 16], - __align: [u32; 0], } #[derive(Copy, Clone)] diff --git a/src/libstd/sys/unix/mutex.rs b/src/libstd/sys/unix/mutex.rs index 52cf3f97c5c..60b03cdbeb0 100644 --- a/src/libstd/sys/unix/mutex.rs +++ b/src/libstd/sys/unix/mutex.rs @@ -49,9 +49,6 @@ pub unsafe fn init(&mut self) { // references, we instead create the mutex with type // PTHREAD_MUTEX_NORMAL which is guaranteed to deadlock if we try to // re-lock it from the same thread, thus avoiding undefined behavior. - // - // We can't do anything for StaticMutex, but that type is deprecated - // anyways. let mut attr: libc::pthread_mutexattr_t = mem::uninitialized(); let r = libc::pthread_mutexattr_init(&mut attr); debug_assert_eq!(r, 0); diff --git a/src/libsyntax/diagnostic_list.rs b/src/libsyntax/diagnostic_list.rs index 8534969c623..15abad555f4 100644 --- a/src/libsyntax/diagnostic_list.rs +++ b/src/libsyntax/diagnostic_list.rs @@ -374,6 +374,20 @@ fn main() {} "##, +E0705: r##" +A `#![feature]` attribute was declared for a feature that is stable in +the current edition. + +Erroneous code example: + +```ignore (limited to a warning during 2018 edition development) +#![feature(rust_2018_preview)] +#![feature(raw_identifiers)] // error: the feature `raw_identifiers` is + // included in the Rust 2018 edition +``` + +"##, + } register_diagnostics! { diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 8450daa3f7c..de391ee4219 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -589,7 +589,7 @@ pub fn descr(self) -> &'static str { /// An enum representing the different kinds of syntax extensions. pub enum SyntaxExtension { /// A trivial "extension" that does nothing, only keeps the attribute and marks it as known. - NonMacroAttr, + NonMacroAttr { mark_used: bool }, /// A syntax extension that is attached to an item and creates new items /// based upon it. @@ -670,7 +670,7 @@ pub fn kind(&self) -> MacroKind { SyntaxExtension::IdentTT(..) | SyntaxExtension::ProcMacro { .. } => MacroKind::Bang, - SyntaxExtension::NonMacroAttr | + SyntaxExtension::NonMacroAttr { .. } | SyntaxExtension::MultiDecorator(..) | SyntaxExtension::MultiModifier(..) | SyntaxExtension::AttrProcMacro(..) => @@ -700,7 +700,7 @@ pub fn edition(&self) -> Edition { SyntaxExtension::AttrProcMacro(.., edition) | SyntaxExtension::ProcMacroDerive(.., edition) => edition, // Unstable legacy stuff - SyntaxExtension::NonMacroAttr | + SyntaxExtension::NonMacroAttr { .. } | SyntaxExtension::IdentTT(..) | SyntaxExtension::MultiDecorator(..) | SyntaxExtension::MultiModifier(..) | @@ -726,7 +726,7 @@ fn visit_ast_fragment_with_placeholders(&mut self, mark: Mark, fragment: &AstFra fn find_legacy_attr_invoc(&mut self, attrs: &mut Vec, allow_derive: bool) -> Option; - fn resolve_invoc(&mut self, invoc: &mut Invocation, scope: Mark, force: bool) + fn resolve_invoc(&mut self, invoc: &Invocation, scope: Mark, force: bool) -> Result>, Determinacy>; fn resolve_macro(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool) -> Result, Determinacy>; @@ -739,6 +739,12 @@ pub enum Determinacy { Undetermined, } +impl Determinacy { + pub fn determined(determined: bool) -> Determinacy { + if determined { Determinacy::Determined } else { Determinacy::Undetermined } + } +} + pub struct DummyResolver; impl Resolver for DummyResolver { @@ -754,7 +760,7 @@ fn add_builtin(&mut self, _ident: ast::Ident, _ext: Lrc) {} fn resolve_imports(&mut self) {} fn find_legacy_attr_invoc(&mut self, _attrs: &mut Vec, _allow_derive: bool) -> Option { None } - fn resolve_invoc(&mut self, _invoc: &mut Invocation, _scope: Mark, _force: bool) + fn resolve_invoc(&mut self, _invoc: &Invocation, _scope: Mark, _force: bool) -> Result>, Determinacy> { Err(Determinacy::Determined) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 8bd30e43476..12941a85669 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -244,19 +244,12 @@ pub fn span(&self) -> Span { } } - pub fn path_span(&self) -> Span { + pub fn path(&self) -> Option<&Path> { match self.kind { - InvocationKind::Bang { ref mac, .. } => mac.node.path.span, - InvocationKind::Attr { attr: Some(ref attr), .. } => attr.path.span, - InvocationKind::Attr { attr: None, .. } => DUMMY_SP, - InvocationKind::Derive { ref path, .. } => path.span, - } - } - - pub fn attr_id(&self) -> Option { - match self.kind { - InvocationKind::Attr { attr: Some(ref attr), .. } => Some(attr.id), - _ => None, + InvocationKind::Bang { ref mac, .. } => Some(&mac.node.path), + InvocationKind::Attr { attr: Some(ref attr), .. } => Some(&attr.path), + InvocationKind::Attr { attr: None, .. } => None, + InvocationKind::Derive { ref path, .. } => Some(path), } } } @@ -338,7 +331,7 @@ fn expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment { let mut undetermined_invocations = Vec::new(); let (mut progress, mut force) = (false, !self.monotonic); loop { - let mut invoc = if let Some(invoc) = invocations.pop() { + let invoc = if let Some(invoc) = invocations.pop() { invoc } else { self.resolve_imports(); @@ -350,20 +343,10 @@ fn expand_fragment(&mut self, input_fragment: AstFragment) -> AstFragment { let scope = if self.monotonic { invoc.expansion_data.mark } else { orig_expansion_data.mark }; - let attr_id_before = invoc.attr_id(); - let ext = match self.cx.resolver.resolve_invoc(&mut invoc, scope, force) { + let ext = match self.cx.resolver.resolve_invoc(&invoc, scope, force) { Ok(ext) => Some(ext), Err(Determinacy::Determined) => None, Err(Determinacy::Undetermined) => { - // Sometimes attributes which we thought were invocations - // end up being custom attributes for custom derives. If - // that's the case our `invoc` will have changed out from - // under us. If this is the case we're making progress so we - // want to flag it as such, and we test this by looking if - // the `attr_id()` method has been changing over time. - if invoc.attr_id() != attr_id_before { - progress = true; - } undetermined_invocations.push(invoc); continue } @@ -533,6 +516,15 @@ fn fully_configure(&mut self, item: Annotatable) -> Annotatable { } fn expand_invoc(&mut self, invoc: Invocation, ext: &SyntaxExtension) -> Option { + if invoc.fragment_kind == AstFragmentKind::ForeignItems && + !self.cx.ecfg.macros_in_extern_enabled() { + if let SyntaxExtension::NonMacroAttr { .. } = *ext {} else { + emit_feature_err(&self.cx.parse_sess, "macros_in_extern", + invoc.span(), GateIssue::Language, + "macro invocations in `extern {}` blocks are experimental"); + } + } + let result = match invoc.kind { InvocationKind::Bang { .. } => self.expand_bang_invoc(invoc, ext)?, InvocationKind::Attr { .. } => self.expand_attr_invoc(invoc, ext)?, @@ -565,7 +557,11 @@ fn expand_attr_invoc(&mut self, _ => unreachable!(), }; - attr::mark_used(&attr); + if let NonMacroAttr { mark_used: false } = *ext {} else { + // Macro attrs are always used when expanded, + // non-macro attrs are considered used when the field says so. + attr::mark_used(&attr); + } invoc.expansion_data.mark.set_expn_info(ExpnInfo { call_site: attr.span, def_site: None, @@ -577,7 +573,7 @@ fn expand_attr_invoc(&mut self, }); match *ext { - NonMacroAttr => { + NonMacroAttr { .. } => { attr::mark_known(&attr); let item = item.map_attrs(|mut attrs| { attrs.push(attr); attrs }); Some(invoc.fragment_kind.expect_from_annotatables(iter::once(item))) @@ -827,7 +823,7 @@ fn expand_bang_invoc(&mut self, } MultiDecorator(..) | MultiModifier(..) | - AttrProcMacro(..) | SyntaxExtension::NonMacroAttr => { + AttrProcMacro(..) | SyntaxExtension::NonMacroAttr { .. } => { self.cx.span_err(path.span, &format!("`{}` can only be used in attributes", path)); self.cx.trace_macros_diag(); @@ -1497,20 +1493,7 @@ fn fold_foreign_item(&mut self, foreign_item: ast::ForeignItem) -> SmallVector { let (attr, traits, foreign_item) = self.classify_item(foreign_item); - let explain = if self.cx.ecfg.use_extern_macros_enabled() { - feature_gate::EXPLAIN_PROC_MACROS_IN_EXTERN - } else { - feature_gate::EXPLAIN_MACROS_IN_EXTERN - }; - - if attr.is_some() || !traits.is_empty() { - if !self.cx.ecfg.macros_in_extern_enabled() { - if let Some(ref attr) = attr { - emit_feature_err(&self.cx.parse_sess, "macros_in_extern", attr.span, - GateIssue::Language, explain); - } - } - + if attr.is_some() || !traits.is_empty() { let item = Annotatable::ForeignItem(P(foreign_item)); return self.collect_attr(attr, traits, item, AstFragmentKind::ForeignItems) .make_foreign_items(); @@ -1518,12 +1501,6 @@ fn fold_foreign_item(&mut self, if let ast::ForeignItemKind::Macro(mac) = foreign_item.node { self.check_attributes(&foreign_item.attrs); - - if !self.cx.ecfg.macros_in_extern_enabled() { - emit_feature_err(&self.cx.parse_sess, "macros_in_extern", foreign_item.span, - GateIssue::Language, explain); - } - return self.collect_bang(mac, foreign_item.span, AstFragmentKind::ForeignItems) .make_foreign_items(); } diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index c9ec2c7d1e8..e7e94614ac8 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -174,7 +174,32 @@ fn generic_extension<'cx>(cx: &'cx mut ExtCtxt, } let best_fail_msg = parse_failure_msg(best_fail_tok.expect("ran no matchers")); - cx.span_err(best_fail_spot.substitute_dummy(sp), &best_fail_msg); + let mut err = cx.struct_span_err(best_fail_spot.substitute_dummy(sp), &best_fail_msg); + + // Check whether there's a missing comma in this macro call, like `println!("{}" a);` + if let Some((arg, comma_span)) = arg.add_comma() { + 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") + }; + match TokenTree::parse(cx, lhs_tt, arg.clone()) { + Success(_) => { + if comma_span == DUMMY_SP { + err.note("you might be missing a comma"); + } else { + err.span_suggestion_short( + comma_span, + "missing comma here", + ",".to_string(), + ); + } + } + _ => {} + } + } + } + err.emit(); cx.trace_macros_diag(); DummyResult::any(sp) } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 77e3faa5b1f..65eeaff3f10 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -25,13 +25,14 @@ use self::AttributeType::*; use self::AttributeGate::*; +use rustc_data_structures::fx::FxHashMap; use rustc_target::spec::abi::Abi; use ast::{self, NodeId, PatKind, RangeEnd}; use attr; use codemap::Spanned; use edition::{ALL_EDITIONS, Edition}; use syntax_pos::{Span, DUMMY_SP}; -use errors::{DiagnosticBuilder, Handler, FatalError}; +use errors::{DiagnosticBuilder, Handler}; use visit::{self, FnKind, Visitor}; use parse::ParseSess; use symbol::{keywords, Symbol}; @@ -59,8 +60,8 @@ macro_rules! declare_features { /// A set of features to be used by later passes. #[derive(Clone)] pub struct Features { - /// `#![feature]` attrs for stable language features, for error reporting - pub declared_stable_lang_features: Vec<(Symbol, Span)>, + /// `#![feature]` attrs for language features, for error reporting + pub declared_lang_features: Vec<(Symbol, Span, Option)>, /// `#![feature]` attrs for non-language (library) features pub declared_lib_features: Vec<(Symbol, Span)>, $(pub $feature: bool),+ @@ -69,7 +70,7 @@ pub struct Features { impl Features { pub fn new() -> Features { Features { - declared_stable_lang_features: Vec::new(), + declared_lang_features: Vec::new(), declared_lib_features: Vec::new(), $($feature: false),+ } @@ -82,8 +83,14 @@ pub fn walk_feature_fields(&self, mut f: F) } pub fn use_extern_macros(&self) -> bool { - // The `decl_macro` and `tool_attributes` features imply `use_extern_macros`. - self.use_extern_macros || self.decl_macro || self.tool_attributes + // 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 } } }; @@ -140,7 +147,6 @@ pub fn use_extern_macros(&self) -> bool { (active, linkage, "1.0.0", Some(29603), None), (active, quote, "1.0.0", Some(29601), None), - // rustc internal (active, rustc_diagnostic_macros, "1.0.0", None, None), (active, rustc_const_unstable, "1.0.0", None, None), @@ -216,6 +222,18 @@ pub fn use_extern_macros(&self) -> bool { // Allows let bindings and destructuring in `const fn` functions and constants. (active, const_let, "1.22.1", Some(48821), None), + // Allows accessing fields of unions inside const fn + (active, const_fn_union, "1.27.0", Some(51909), None), + + // Allows casting raw pointers to `usize` during const eval + (active, const_raw_ptr_to_usize_cast, "1.27.0", Some(51910), None), + + // Allows dereferencing raw pointers during const eval + (active, const_raw_ptr_deref, "1.27.0", Some(51911), None), + + // Allows comparing raw pointers during const eval + (active, const_compare_raw_pointers, "1.27.0", Some(53020), None), + // Allows using #[prelude_import] on glob `use` items. // // rustc internal @@ -322,9 +340,8 @@ pub fn use_extern_macros(&self) -> bool { // `extern "x86-interrupt" fn()` (active, abi_x86_interrupt, "1.17.0", Some(40180), None), - // Allows the `catch {...}` expression - (active, catch_expr, "1.17.0", Some(31436), Some(Edition::Edition2018)), + (active, catch_expr, "1.17.0", Some(31436), None), // Used to preserve symbols (see llvm.used) (active, used, "1.18.0", Some(40289), None), @@ -381,7 +398,7 @@ pub fn use_extern_macros(&self) -> bool { (active, crate_in_paths, "1.23.0", Some(45477), Some(Edition::Edition2018)), // In-band lifetime bindings (e.g. `fn foo(x: &'a u8) -> &'a u8`) - (active, in_band_lifetimes, "1.23.0", Some(44524), Some(Edition::Edition2018)), + (active, in_band_lifetimes, "1.23.0", Some(44524), None), // generic associated types (RFC 1598) (active, generic_associated_types, "1.23.0", Some(44265), None), @@ -482,6 +499,10 @@ pub fn use_extern_macros(&self) -> bool { (active, alloc_error_handler, "1.29.0", Some(51540), None), (active, abi_amdgpu_kernel, "1.29.0", Some(51575), None), + + // impl Iterator for &mut Iterator + // impl Debug for Foo<'_> + (active, impl_header_lifetime_elision, "1.30.0", Some(15872), Some(Edition::Edition2018)), ); declare_features! ( @@ -699,7 +720,7 @@ pub fn is_builtin_attr_name(name: ast::Name) -> bool { } pub fn is_builtin_attr(attr: &ast::Attribute) -> bool { - BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.check_name(builtin_name)) || + BUILTIN_ATTRIBUTES.iter().any(|&(builtin_name, _, _)| attr.path == builtin_name) || attr.name().as_str().starts_with("rustc_") } @@ -1220,10 +1241,6 @@ pub fn check_attribute(attr: &ast::Attribute, parse_sess: &ParseSess, features: cx.check_attribute(attr, true); } -pub fn find_lang_feature_accepted_version(feature: &str) -> Option<&'static str> { - ACCEPTED_FEATURES.iter().find(|t| t.0 == feature).map(|t| t.1) -} - fn find_lang_feature_issue(feature: &str) -> Option { if let Some(info) = ACTIVE_FEATURES.iter().find(|t| t.0 == feature) { let issue = info.2; @@ -1353,13 +1370,6 @@ fn leveled_feature_err<'a>(sess: &'a ParseSess, feature: &str, span: Span, issue pub const EXPLAIN_MACRO_AT_MOST_ONCE_REP: &'static str = "using the `?` macro Kleene operator for \"at most one\" repetition is unstable"; -pub const EXPLAIN_MACROS_IN_EXTERN: &'static str = - "macro invocations in `extern {}` blocks are experimental."; - -// mention proc-macros when enabled -pub const EXPLAIN_PROC_MACROS_IN_EXTERN: &'static str = - "macro and proc-macro invocations in `extern {}` blocks are experimental."; - struct PostExpansionVisitor<'a> { context: &'a Context<'a>, } @@ -1903,13 +1913,13 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { } let mut features = Features::new(); + let mut edition_enabled_features = FxHashMap(); - let mut feature_checker = FeatureChecker::default(); - - for &(.., f_edition, set) in ACTIVE_FEATURES.iter() { + for &(name, .., f_edition, set) in ACTIVE_FEATURES.iter() { if let Some(f_edition) = f_edition { if f_edition <= crate_edition { set(&mut features, DUMMY_SP); + edition_enabled_features.insert(Symbol::intern(name), crate_edition); } } } @@ -1937,35 +1947,18 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { continue }; - if let Some((.., set)) = ACTIVE_FEATURES.iter().find(|f| name == f.0) { - set(&mut features, mi.span); - feature_checker.collect(&features, mi.span); - continue - } - - let removed = REMOVED_FEATURES.iter().find(|f| name == f.0); - let stable_removed = STABLE_REMOVED_FEATURES.iter().find(|f| name == f.0); - if let Some((.., reason)) = removed.or(stable_removed) { - feature_removed(span_handler, mi.span, *reason); - continue - } - - if ACCEPTED_FEATURES.iter().any(|f| name == f.0) { - features.declared_stable_lang_features.push((name, mi.span)); - continue - } - if let Some(edition) = ALL_EDITIONS.iter().find(|e| name == e.feature_name()) { if *edition <= crate_edition { continue } - for &(.., f_edition, set) in ACTIVE_FEATURES.iter() { + for &(name, .., f_edition, set) in ACTIVE_FEATURES.iter() { if let Some(f_edition) = f_edition { - if *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); } } } @@ -1973,47 +1966,41 @@ fn feature_removed(span_handler: &Handler, span: Span, reason: Option<&str>) { continue } - features.declared_lib_features.push((name, mi.span)); - } - } - - feature_checker.check(span_handler); - - features -} + 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)); + } + continue + } -/// A collector for mutually exclusive and interdependent features and their flag spans. -#[derive(Default)] -struct FeatureChecker { - use_extern_macros: Option, - custom_attribute: Option, -} + let removed = REMOVED_FEATURES.iter().find(|f| name == f.0); + let stable_removed = STABLE_REMOVED_FEATURES.iter().find(|f| name == f.0); + if let Some((.., reason)) = removed.or(stable_removed) { + feature_removed(span_handler, mi.span, *reason); + continue + } -impl FeatureChecker { - // If this method turns out to be a hotspot due to branching, - // the branching can be eliminated by modifying `set!()` to set these spans - // only for the features that need to be checked for mutual exclusion. - fn collect(&mut self, features: &Features, span: Span) { - if features.use_extern_macros() { - // If self.use_extern_macros is None, set to Some(span) - self.use_extern_macros = self.use_extern_macros.or(Some(span)); - } + if let Some((_, since, ..)) = ACCEPTED_FEATURES.iter().find(|f| name == f.0) { + let since = Some(Symbol::intern(since)); + features.declared_lang_features.push((name, mi.span, since)); + continue + } - if features.custom_attribute { - self.custom_attribute = self.custom_attribute.or(Some(span)); + features.declared_lib_features.push((name, mi.span)); } } - fn check(self, handler: &Handler) { - if let (Some(pm_span), Some(ca_span)) = (self.use_extern_macros, self.custom_attribute) { - handler.struct_span_err(pm_span, "Cannot use `#![feature(use_extern_macros)]` and \ - `#![feature(custom_attribute)] at the same time") - .span_note(ca_span, "`#![feature(custom_attribute)]` declared here") - .emit(); - - FatalError.raise(); - } - } + features } pub fn check_crate(krate: &ast::Crate, diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 0c105865e0c..c8e60620248 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -19,7 +19,6 @@ html_root_url = "https://doc.rust-lang.org/nightly/", test(attr(deny(warnings))))] -#![feature(const_atomic_usize_new)] #![feature(crate_visibility_modifier)] #![feature(macro_at_most_once_rep)] #![feature(rustc_attrs)] diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index c449cc0a652..1d0c6b5317a 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -302,6 +302,10 @@ pub fn from_ast_ident(ident: ast::Ident) -> Token { BinOp(Minus) => true, Ident(ident, false) if ident.name == keywords::True.name() => true, Ident(ident, false) if ident.name == keywords::False.name() => true, + Interpolated(ref nt) => match nt.0 { + NtLiteral(..) => true, + _ => false, + }, _ => false, } } diff --git a/src/libsyntax/test.rs b/src/libsyntax/test.rs index d8b8d13a38c..62dd00387d3 100644 --- a/src/libsyntax/test.rs +++ b/src/libsyntax/test.rs @@ -631,7 +631,7 @@ fn path_name_i(idents: &[Ident]) -> String { 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("::") } } diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs index 1a4236b280b..f84b5307a11 100644 --- a/src/libsyntax/tokenstream.rs +++ b/src/libsyntax/tokenstream.rs @@ -182,6 +182,31 @@ pub struct TokenStream { kind: TokenStreamKind, } +impl TokenStream { + /// 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);` + 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() + } + _ => 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)); + } + } + None + } +} + #[derive(Clone, Debug)] enum TokenStreamKind { Empty, diff --git a/src/libsyntax_ext/env.rs b/src/libsyntax_ext/env.rs index 3c34bf496da..8f26b2402aa 100644 --- a/src/libsyntax_ext/env.rs +++ b/src/libsyntax_ext/env.rs @@ -81,7 +81,7 @@ pub fn expand_env<'cx>(cx: &'cx mut ExtCtxt, } }; - 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 46c85497ee7..53f8fe2b0c2 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -147,7 +147,7 @@ fn parse_args(ecx: &mut ExtCtxt, let mut named = false; while p.token != token::Eof { if !p.eat(&token::Comma) { - ecx.span_err(sp, "expected token: `,`"); + ecx.span_err(p.span, "expected token: `,`"); return None; } if p.token == token::Eof { diff --git a/src/rustc/libc_shim/Cargo.toml b/src/rustc/libc_shim/Cargo.toml index e77897d6433..ee037ac68c5 100644 --- a/src/rustc/libc_shim/Cargo.toml +++ b/src/rustc/libc_shim/Cargo.toml @@ -36,4 +36,5 @@ compiler_builtins = { path = "../compiler_builtins_shim" } # Certain parts of libc are conditionally compiled differently than when used # outside rustc. See https://github.com/rust-lang/libc/search?l=Rust&q=stdbuild&type=&utf8=%E2%9C%93. stdbuild = [] -default = ["stdbuild"] +default = ["stdbuild", "align"] +align = [] diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp index 4bcb4fd7ad3..9b9c908ea52 100644 --- a/src/rustllvm/RustWrapper.cpp +++ b/src/rustllvm/RustWrapper.cpp @@ -12,6 +12,7 @@ #include "llvm/IR/DebugInfoMetadata.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/DiagnosticPrinter.h" +#include "llvm/IR/GlobalVariable.h" #include "llvm/IR/Instructions.h" #include "llvm/Object/Archive.h" #include "llvm/Object/ObjectFile.h" @@ -116,6 +117,15 @@ LLVMRustGetOrInsertGlobal(LLVMModuleRef M, const char *Name, LLVMTypeRef Ty) { return wrap(unwrap(M)->getOrInsertGlobal(Name, unwrap(Ty))); } +extern "C" LLVMValueRef +LLVMRustInsertPrivateGlobal(LLVMModuleRef M, LLVMTypeRef Ty) { + return wrap(new GlobalVariable(*unwrap(M), + unwrap(Ty), + false, + GlobalValue::PrivateLinkage, + nullptr)); +} + extern "C" LLVMTypeRef LLVMRustMetadataTypeInContext(LLVMContextRef C) { return wrap(Type::getMetadataTy(*unwrap(C))); } diff --git a/src/test/codegen/consts.rs b/src/test/codegen/consts.rs index 30fffbb769b..301f5544486 100644 --- a/src/test/codegen/consts.rs +++ b/src/test/codegen/consts.rs @@ -21,11 +21,11 @@ // CHECK: @STATIC = {{.*}}, align 4 // This checks the constants from inline_enum_const -// CHECK: @byte_str.{{[0-9]+}} = {{.*}}, align 2 +// CHECK: @{{[0-9]+}} = {{.*}}, align 2 // This checks the constants from {low,high}_align_const, they share the same // constant, but the alignment differs, so the higher one should be used -// CHECK: [[LOW_HIGH:@byte_str.[0-9]+]] = {{.*}}, align 4 +// CHECK: [[LOW_HIGH:@[0-9]+]] = {{.*}}, align 4 #[derive(Copy, Clone)] diff --git a/src/test/codegen/remap_path_prefix/main.rs b/src/test/codegen/remap_path_prefix/main.rs index 4fb8c37558d..dd0f89c931d 100644 --- a/src/test/codegen/remap_path_prefix/main.rs +++ b/src/test/codegen/remap_path_prefix/main.rs @@ -22,7 +22,7 @@ include!("aux_mod.rs"); // Here we check that the expansion of the file!() macro is mapped. -// CHECK: @byte_str.1 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1 +// CHECK: @0 = private unnamed_addr constant <{ [34 x i8] }> <{ [34 x i8] c"/the/src/remap_path_prefix/main.rs" }>, align 1 pub static FILE_PATH: &'static str = file!(); fn main() { diff --git a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs b/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs index dfbe35dfd56..eedc1e745e2 100644 --- a/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs +++ b/src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs @@ -36,16 +36,16 @@ #![feature(staged_api)] -#![stable(feature = "unit_test", since = "0.0.0")] +#![stable(feature = "unit_test", since = "1.0.0")] -#[stable(feature = "unit_test", since = "0.0.0")] +#[stable(feature = "unit_test", since = "1.0.0")] pub use m::{Record, Trait, Tuple}; mod m { #[derive(Default)] - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] pub struct Record { - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] pub a_stable_pub: i32, #[unstable(feature = "unstable_declared", issue = "38412")] pub a_unstable_declared_pub: i32, @@ -55,14 +55,14 @@ pub struct Record { pub(crate) b_crate: i32, #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY pub(in m) c_mod: i32, - #[stable(feature = "unit_test", since = "0.0.0")] // SILLY + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY d_priv: i32 } #[derive(Default)] #[stable(feature = "unit_test", since = "1.0.0")] pub struct Tuple( - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] pub i32, #[unstable(feature = "unstable_declared", issue = "38412")] pub i32, @@ -84,11 +84,11 @@ pub fn new() -> Self { Default::default() } } - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] pub trait Trait { - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] type Type; - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] fn stable_trait_method(&self) -> Self::Type; #[unstable(feature = "unstable_undeclared", issue = "38412")] fn unstable_undeclared_trait_method(&self) -> Self::Type; @@ -96,7 +96,7 @@ pub trait Trait { fn unstable_declared_trait_method(&self) -> Self::Type; } - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] impl Trait for Record { type Type = i32; fn stable_trait_method(&self) -> i32 { self.d_priv } @@ -104,7 +104,7 @@ fn unstable_undeclared_trait_method(&self) -> i32 { self.d_priv } fn unstable_declared_trait_method(&self) -> i32 { self.d_priv } } - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] impl Trait for Tuple { type Type = i32; fn stable_trait_method(&self) -> i32 { self.3 } @@ -117,14 +117,14 @@ impl Record { pub fn unstable_undeclared(&self) -> i32 { self.d_priv } #[unstable(feature = "unstable_declared", issue = "38412")] pub fn unstable_declared(&self) -> i32 { self.d_priv } - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] pub fn stable(&self) -> i32 { self.d_priv } #[unstable(feature = "unstable_undeclared", issue = "38412")] // SILLY pub(crate) fn pub_crate(&self) -> i32 { self.d_priv } #[unstable(feature = "unstable_declared", issue = "38412")] // SILLY pub(in m) fn pub_mod(&self) -> i32 { self.d_priv } - #[stable(feature = "unit_test", since = "0.0.0")] // SILLY + #[stable(feature = "unit_test", since = "1.0.0")] // SILLY fn private(&self) -> i32 { self.d_priv } } @@ -133,7 +133,7 @@ impl Tuple { pub fn unstable_undeclared(&self) -> i32 { self.0 } #[unstable(feature = "unstable_declared", issue = "38412")] pub fn unstable_declared(&self) -> i32 { self.0 } - #[stable(feature = "unit_test", since = "0.0.0")] + #[stable(feature = "unit_test", since = "1.0.0")] pub fn stable(&self) -> i32 { self.0 } pub(crate) fn pub_crate(&self) -> i32 { self.0 } diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs index 64af21dbe10..91b72510e3e 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attr-invalid-exprs.rs @@ -13,7 +13,7 @@ //! Attributes producing expressions in invalid locations -#![feature(use_extern_macros, stmt_expr_attributes, proc_macro_expr)] +#![feature(stmt_expr_attributes, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{duplicate, no_output}; diff --git a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs index 05b5c918ef0..52b2a473ecd 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/attr-stmt-expr.rs @@ -11,7 +11,7 @@ // aux-build:attr-stmt-expr.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_expr)] +#![feature(proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr}; 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 8fced7d8c70..f71d4b86f1e 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/issue-41211.rs @@ -15,7 +15,7 @@ #![feature(use_extern_macros)] #![emit_unchanged] -//~^ ERROR: cannot find attribute macro `emit_unchanged` in this scope +//~^ ERROR attribute `emit_unchanged` is currently unknown to the compiler extern crate issue_41211; use issue_41211::emit_unchanged; diff --git a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs b/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs index 51112f202c8..eaa64c6ba36 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/issue-50493.rs @@ -11,8 +11,6 @@ // aux-build:issue_50493.rs // ignore-stage1 -#![feature(proc_macro)] - #[macro_use] extern crate issue_50493; diff --git a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs index 6473b69b459..6e9d231ea99 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/lints_in_proc_macros.rs @@ -11,7 +11,7 @@ // aux-build:bang_proc_macro2.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] #![allow(unused_macros)] extern crate bang_proc_macro2; 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 9a35dc0edc4..e418ecc114c 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 @@ -26,13 +26,13 @@ fn main() { #[link(name = "rust_test_helpers", kind = "static")] extern { #[no_output] - //~^ ERROR macro and proc-macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental fn some_definitely_unknown_symbol_which_should_be_removed(); #[nop_attr] - //~^ ERROR macro and proc-macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental fn rust_get_test_int() -> isize; emit_input!(fn rust_dbg_extern_identity_u32(arg: u32) -> u32;); - //~^ ERROR macro and proc-macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental } diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-custom-attr-mutex.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-custom-attr-mutex.rs deleted file mode 100644 index 9ed665b6e68..00000000000 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-custom-attr-mutex.rs +++ /dev/null @@ -1,25 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:attr_proc_macro.rs -// ignore-tidy-linelength - -#![feature(use_extern_macros, custom_attribute)] -//~^ ERROR Cannot use `#![feature(use_extern_macros)]` and `#![feature(custom_attribute)] at the same time - -extern crate attr_proc_macro; -use attr_proc_macro::attr_proc_macro; - -#[attr_proc_macro] -fn foo() {} - -fn main() { - foo(); -} 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 51b1bfca294..9a0171c2ae5 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 @@ -16,7 +16,7 @@ // gate-test-proc_macro_mod // gate-test-proc_macro_gen -#![feature(use_extern_macros, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] extern crate proc_macro_gates as foo; diff --git a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs index ef6d4557f4c..dc182414a1d 100644 --- a/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs +++ b/src/test/compile-fail-fulldeps/proc-macro/proc-macro-gates2.rs @@ -10,7 +10,7 @@ // aux-build:proc-macro-gates.rs -#![feature(use_extern_macros, stmt_expr_attributes)] +#![feature(stmt_expr_attributes)] extern crate proc_macro_gates as foo; diff --git a/src/test/compile-fail/auxiliary/inherited_stability.rs b/src/test/compile-fail/auxiliary/inherited_stability.rs index 0b1aee68f44..f690cbd029d 100644 --- a/src/test/compile-fail/auxiliary/inherited_stability.rs +++ b/src/test/compile-fail/auxiliary/inherited_stability.rs @@ -9,7 +9,7 @@ // except according to those terms. #![crate_name="inherited_stability"] #![crate_type = "lib"] -#![unstable(feature = "test_feature", issue = "0")] +#![unstable(feature = "unstable_test_feature", issue = "0")] #![feature(staged_api)] pub fn unstable() {} @@ -19,16 +19,16 @@ pub fn stable() {} #[stable(feature = "rust1", since = "1.0.0")] pub mod stable_mod { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn unstable() {} #[stable(feature = "rust1", since = "1.0.0")] pub fn stable() {} } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub mod unstable_mod { - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated() {} @@ -37,7 +37,7 @@ pub fn unstable() {} #[stable(feature = "rust1", since = "1.0.0")] pub trait Stable { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] fn unstable(&self); #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/test/compile-fail/auxiliary/lint_output_format.rs b/src/test/compile-fail/auxiliary/lint_output_format.rs index 0553b4a49b7..6ba66f3e45f 100644 --- a/src/test/compile-fail/auxiliary/lint_output_format.rs +++ b/src/test/compile-fail/auxiliary/lint_output_format.rs @@ -11,20 +11,20 @@ #![crate_name="lint_output_format"] #![crate_type = "lib"] #![feature(staged_api)] -#![unstable(feature = "test_feature", issue = "0")] +#![unstable(feature = "unstable_test_feature", issue = "0")] -#[stable(feature = "test_feature", since = "1.0.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 = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub fn bar() -> usize { 40 } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub fn baz() -> usize { 30 } diff --git a/src/test/compile-fail/auxiliary/lint_stability.rs b/src/test/compile-fail/auxiliary/lint_stability.rs index 07e80b61cd0..5547458abbe 100644 --- a/src/test/compile-fail/auxiliary/lint_stability.rs +++ b/src/test/compile-fail/auxiliary/lint_stability.rs @@ -14,27 +14,27 @@ #![feature(associated_type_defaults)] #![stable(feature = "lint_stability", since = "1.0.0")] -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated() {} -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_text() {} -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "99.99.99", reason = "text")] pub fn deprecated_future() {} -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_unstable() {} -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_unstable_text() {} -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub fn unstable() {} -#[unstable(feature = "test_feature", reason = "text", issue = "0")] +#[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn unstable_text() {} #[stable(feature = "rust1", since = "1.0.0")] @@ -46,23 +46,23 @@ pub fn stable_text() {} pub struct MethodTester; impl MethodTester { - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated(&self) {} - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_unstable(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_unstable_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn method_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn method_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -71,25 +71,25 @@ pub fn method_stable(&self) {} pub fn method_stable_text(&self) {} } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] pub trait Trait { - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated(&self) {} - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_unstable(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_unstable_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] fn trait_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] fn trait_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -98,100 +98,100 @@ fn trait_stable(&self) {} fn trait_stable_text(&self) {} } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] pub trait TraitWithAssociatedTypes { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] type TypeUnstable = u8; - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] type TypeDeprecated = u8; } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] impl Trait for MethodTester {} -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub trait UnstableTrait { fn dummy(&self) { } } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub trait DeprecatedTrait { - #[stable(feature = "test_feature", since = "1.0.0")] fn dummy(&self) { } + #[stable(feature = "stable_test_feature", since = "1.0.0")] fn dummy(&self) { } } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedStruct { - #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnstableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize } #[stable(feature = "rust1", since = "1.0.0")] pub struct StableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] pub i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] pub i: isize } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub enum UnstableEnum {} #[stable(feature = "rust1", since = "1.0.0")] pub enum StableEnum {} -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnitStruct; -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnstableUnitStruct; -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableUnitStruct; #[stable(feature = "rust1", since = "1.0.0")] pub struct StableUnitStruct; -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] pub enum Enum { - #[stable(feature = "test_feature", since = "1.0.0")] + #[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] DeprecatedVariant, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] DeprecatedUnstableVariant, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] UnstableVariant, #[stable(feature = "rust1", since = "1.0.0")] StableVariant, } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); #[stable(feature = "rust1", since = "1.0.0")] pub struct StableTupleStruct(#[stable(feature = "rust1", since = "1.0.0")] pub isize); -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[macro_export] macro_rules! macro_test { () => (deprecated()); } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[macro_export] macro_rules! macro_test_arg { ($func:expr) => ($func); } -#[stable(feature = "test_feature", since = "1.0.0")] +#[stable(feature = "stable_test_feature", since = "1.0.0")] #[macro_export] macro_rules! macro_test_arg_nested { ($func:ident) => (macro_test_arg!($func())); diff --git a/src/test/compile-fail/auxiliary/lint_stability_fields.rs b/src/test/compile-fail/auxiliary/lint_stability_fields.rs index 8c6b98ab510..6b79c36fc05 100644 --- a/src/test/compile-fail/auxiliary/lint_stability_fields.rs +++ b/src/test/compile-fail/auxiliary/lint_stability_fields.rs @@ -15,47 +15,47 @@ pub struct Stable { #[stable(feature = "rust1", since = "1.0.0")] pub inherit: u8, // it's a lie (stable doesn't inherit) - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub override1: u8, #[rustc_deprecated(since = "1.0.0", reason = "text")] - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub override2: u8, } #[stable(feature = "rust1", since = "1.0.0")] pub struct Stable2(#[stable(feature = "rust1", since = "1.0.0")] pub u8, - #[unstable(feature = "test_feature", issue = "0")] pub u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub u8, + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8); -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub struct Unstable { pub inherit: u8, #[stable(feature = "rust1", since = "1.0.0")] pub override1: u8, #[rustc_deprecated(since = "1.0.0", reason = "text")] - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub override2: u8, } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub struct Unstable2(pub u8, #[stable(feature = "rust1", since = "1.0.0")] pub u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub u8); -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct Deprecated { pub inherit: u8, #[stable(feature = "rust1", since = "1.0.0")] pub override1: u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub override2: u8, } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct Deprecated2(pub u8, #[stable(feature = "rust1", since = "1.0.0")] pub u8, - #[unstable(feature = "test_feature", issue = "0")] pub u8); + #[unstable(feature = "unstable_test_feature", issue = "0")] pub u8); diff --git a/src/test/compile-fail/auxiliary/stability_attribute_issue.rs b/src/test/compile-fail/auxiliary/stability_attribute_issue.rs index 22c13f69af9..1ee623c34fb 100644 --- a/src/test/compile-fail/auxiliary/stability_attribute_issue.rs +++ b/src/test/compile-fail/auxiliary/stability_attribute_issue.rs @@ -9,11 +9,11 @@ // except according to those terms. #![feature(staged_api)] -#![stable(feature = "foo", since = "1.2.0")] +#![stable(feature = "stable_test_feature", since = "1.2.0")] -#[unstable(feature = "foo", issue = "1")] +#[unstable(feature = "unstable_test_feature", issue = "1")] pub fn unstable() {} -#[unstable(feature = "foo", reason = "message", issue = "2")] +#[unstable(feature = "unstable_test_feature", reason = "message", issue = "2")] pub fn unstable_msg() {} diff --git a/src/test/compile-fail/auxiliary/stability_cfg2.rs b/src/test/compile-fail/auxiliary/stability_cfg2.rs index c1e2b1d1bfe..a59f4b4e8f4 100644 --- a/src/test/compile-fail/auxiliary/stability_cfg2.rs +++ b/src/test/compile-fail/auxiliary/stability_cfg2.rs @@ -10,6 +10,6 @@ // compile-flags:--cfg foo -#![cfg_attr(foo, unstable(feature = "test_feature", issue = "0"))] +#![cfg_attr(foo, unstable(feature = "unstable_test_feature", issue = "0"))] #![cfg_attr(not(foo), stable(feature = "test_feature", since = "1.0.0"))] #![feature(staged_api)] diff --git a/src/test/compile-fail/auxiliary/unstable-macros.rs b/src/test/compile-fail/auxiliary/unstable-macros.rs index 6462c11af48..836164a721a 100644 --- a/src/test/compile-fail/auxiliary/unstable-macros.rs +++ b/src/test/compile-fail/auxiliary/unstable-macros.rs @@ -9,7 +9,7 @@ // except according to those terms. #![feature(staged_api)] -#![stable(feature = "unit_test", since = "0.0.0")] +#![stable(feature = "unit_test", since = "1.0.0")] #[unstable(feature = "unstable_macros", issue = "0")] #[macro_export] diff --git a/src/test/compile-fail/cast-ptr-to-int-const.rs b/src/test/compile-fail/cast-ptr-to-int-const.rs index 7c32e31d23b..8764cb72b8c 100644 --- a/src/test/compile-fail/cast-ptr-to-int-const.rs +++ b/src/test/compile-fail/cast-ptr-to-int-const.rs @@ -8,8 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// gate-test-const_raw_ptr_to_usize_cast + fn main() { - const X: u32 = main as u32; //~ ERROR E0018 + const X: u32 = main as u32; //~ ERROR casting pointers to integers in constants is unstable const Y: u32 = 0; - const Z: u32 = &Y as *const u32 as u32; //~ ERROR E0018 + const Z: u32 = &Y as *const u32 as u32; //~ ERROR is unstable } diff --git a/src/test/compile-fail/deprecation-in-staged-api.rs b/src/test/compile-fail/deprecation-in-staged-api.rs index 8170c9fd8f1..5c6facbf014 100644 --- a/src/test/compile-fail/deprecation-in-staged-api.rs +++ b/src/test/compile-fail/deprecation-in-staged-api.rs @@ -12,7 +12,7 @@ #![feature(staged_api)] -#![stable(feature = "test_feature", since = "1.0.0")] +#![stable(feature = "stable_test_feature", since = "1.0.0")] #[deprecated] fn main() { } //~ERROR `#[deprecated]` cannot be used in staged api diff --git a/src/test/compile-fail/enable-unstable-lib-feature.rs b/src/test/compile-fail/enable-unstable-lib-feature.rs index bc9e2345f0e..b10a0a60f14 100644 --- a/src/test/compile-fail/enable-unstable-lib-feature.rs +++ b/src/test/compile-fail/enable-unstable-lib-feature.rs @@ -12,7 +12,7 @@ // aux-build:stability_cfg2.rs -#![feature(test_feature)] +#![feature(unstable_test_feature)] #![deny(non_snake_case)] // To trigger a hard error // Shouldn't generate a warning about unstable features diff --git a/src/test/compile-fail/issue-28075.rs b/src/test/compile-fail/issue-28075.rs index 057c99f9305..0f6b9d1b5dc 100644 --- a/src/test/compile-fail/issue-28075.rs +++ b/src/test/compile-fail/issue-28075.rs @@ -16,7 +16,8 @@ extern crate lint_stability; -use lint_stability::{unstable, deprecated}; //~ ERROR use of unstable library feature 'test_feature' +use lint_stability::{unstable, deprecated}; +//~^ ERROR use of unstable library feature 'unstable_test_feature' fn main() { } diff --git a/src/test/compile-fail/issue-28388-3.rs b/src/test/compile-fail/issue-28388-3.rs index 12357779b51..12e3457ef9e 100644 --- a/src/test/compile-fail/issue-28388-3.rs +++ b/src/test/compile-fail/issue-28388-3.rs @@ -14,7 +14,8 @@ extern crate lint_stability; -use lint_stability::UnstableEnum::{}; //~ ERROR use of unstable library feature 'test_feature' +use lint_stability::UnstableEnum::{}; +//~^ ERROR use of unstable library feature 'unstable_test_feature' use lint_stability::StableEnum::{}; // OK fn main() {} diff --git a/src/test/compile-fail/lint-renamed-allow.rs b/src/test/compile-fail/lint-renamed-allow.rs index ae010b64bfd..f6b94e89826 100644 --- a/src/test/compile-fail/lint-renamed-allow.rs +++ b/src/test/compile-fail/lint-renamed-allow.rs @@ -13,6 +13,6 @@ #![allow(renamed_and_removed_lints)] -#[deny(unknown_features)] +#[deny(single_use_lifetime)] #[deny(unused)] fn main() { let unused = (); } //~ ERROR unused diff --git a/src/test/compile-fail/lint-renamed-cmdline.rs b/src/test/compile-fail/lint-renamed-cmdline.rs index a5246206d95..f5abf2733b9 100644 --- a/src/test/compile-fail/lint-renamed-cmdline.rs +++ b/src/test/compile-fail/lint-renamed-cmdline.rs @@ -8,10 +8,10 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags:-D unknown_features +// compile-flags:-D bare_trait_object -// error-pattern:lint `unknown_features` has been renamed to `unused_features` -// error-pattern:requested on the command line with `-D unknown_features` +// error-pattern:lint `bare_trait_object` has been renamed to `bare_trait_objects` +// error-pattern:requested on the command line with `-D bare_trait_object` // error-pattern:unused #[deny(unused)] diff --git a/src/test/compile-fail/lint-renamed.rs b/src/test/compile-fail/lint-renamed.rs index afe4aee7a1d..c147ec5cf95 100644 --- a/src/test/compile-fail/lint-renamed.rs +++ b/src/test/compile-fail/lint-renamed.rs @@ -8,6 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deny(unknown_features)] //~ WARN lint `unknown_features` has been renamed to `unused_features` +#[deny(bare_trait_object)] +//~^ WARN lint `bare_trait_object` has been renamed to `bare_trait_objects` #[deny(unused)] fn main() { let unused = (); } //~ ERROR unused diff --git a/src/test/compile-fail/lint-stability-2.rs b/src/test/compile-fail/lint-stability-2.rs index 77917ff3cd3..1f2fa077caf 100644 --- a/src/test/compile-fail/lint-stability-2.rs +++ b/src/test/compile-fail/lint-stability-2.rs @@ -76,15 +76,15 @@ fn test() { ::trait_unstable(&foo); //~ ERROR use of unstable library feature foo.method_unstable_text(); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text Foo::method_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text ::method_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text foo.trait_unstable_text(); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text ::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text stable(); foo.method_stable(); @@ -149,9 +149,9 @@ fn test_method_param(foo: Foo) { foo.trait_unstable(); //~ ERROR use of unstable library feature ::trait_unstable(&foo); //~ ERROR use of unstable library feature foo.trait_unstable_text(); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text ::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text foo.trait_stable(); Trait::trait_stable(&foo); ::trait_stable(&foo); @@ -167,7 +167,7 @@ fn test_method_object(foo: &Trait) { //~^ ERROR use of unstable library feature foo.trait_unstable(); //~ ERROR use of unstable library feature foo.trait_unstable_text(); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text foo.trait_stable(); } @@ -178,16 +178,16 @@ trait LocalTrait2 : DeprecatedTrait { } } mod this_crate { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated() {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_text() {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn unstable() {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn unstable_text() {} #[stable(feature = "rust1", since = "1.0.0")] @@ -199,16 +199,16 @@ pub fn stable_text() {} pub struct MethodTester; impl MethodTester { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn method_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn method_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -218,16 +218,16 @@ pub fn method_stable_text(&self) {} } pub trait Trait { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] fn trait_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] fn trait_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -238,43 +238,43 @@ fn trait_stable_text(&self) {} impl Trait for MethodTester {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } #[stable(feature = "rust1", since = "1.0.0")] pub struct StableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnitStruct; - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableUnitStruct; #[stable(feature = "rust1", since = "1.0.0")] pub struct StableUnitStruct; pub enum Enum { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] DeprecatedVariant, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] UnstableVariant, #[stable(feature = "rust1", since = "1.0.0")] StableVariant, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedTupleStruct(isize); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableTupleStruct(isize); #[stable(feature = "rust1", since = "1.0.0")] pub struct StableTupleStruct(isize); @@ -391,7 +391,7 @@ fn test_method_object(foo: &Trait) { foo.trait_stable(); } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn test_fn_body() { fn fn_in_body() {} @@ -399,7 +399,7 @@ fn fn_in_body() {} } impl MethodTester { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn test_method_body(&self) { fn fn_in_body() {} @@ -407,7 +407,7 @@ fn fn_in_body() {} } } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub trait DeprecatedTrait { fn dummy(&self) { } diff --git a/src/test/compile-fail/lint-stability-deprecated.rs b/src/test/compile-fail/lint-stability-deprecated.rs index f2defc1d421..de2c27bdcbc 100644 --- a/src/test/compile-fail/lint-stability-deprecated.rs +++ b/src/test/compile-fail/lint-stability-deprecated.rs @@ -16,7 +16,7 @@ #![warn(deprecated)] #![allow(dead_code, unused_extern_crates)] -#![feature(staged_api, test_feature, rustc_attrs)] +#![feature(staged_api, unstable_test_feature, rustc_attrs)] #![stable(feature = "rust1", since = "1.0.0")] @@ -227,16 +227,16 @@ fn test_inheritance() { } mod this_crate { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated() {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_text() {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn unstable() {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn unstable_text() {} #[stable(feature = "rust1", since = "1.0.0")] @@ -248,16 +248,16 @@ pub fn stable_text() {} pub struct MethodTester; impl MethodTester { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn method_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn method_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -267,16 +267,16 @@ pub fn method_stable_text(&self) {} } pub trait Trait { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] fn trait_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] fn trait_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -287,43 +287,43 @@ fn trait_stable_text(&self) {} impl Trait for MethodTester {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } #[stable(feature = "rust1", since = "1.0.0")] pub struct StableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnitStruct; - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableUnitStruct; #[stable(feature = "rust1", since = "1.0.0")] pub struct StableUnitStruct; pub enum Enum { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] DeprecatedVariant, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] UnstableVariant, #[stable(feature = "rust1", since = "1.0.0")] StableVariant, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedTupleStruct(isize); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableTupleStruct(isize); #[stable(feature = "rust1", since = "1.0.0")] pub struct StableTupleStruct(isize); @@ -441,7 +441,7 @@ fn test_method_object(foo: &Trait) { foo.trait_stable(); } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn test_fn_body() { fn fn_in_body() {} @@ -449,7 +449,7 @@ fn fn_in_body() {} } impl MethodTester { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn test_method_body(&self) { fn fn_in_body() {} @@ -457,7 +457,7 @@ fn fn_in_body() {} } } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub trait DeprecatedTrait { fn dummy(&self) { } diff --git a/src/test/compile-fail/lint-stability-fields-deprecated.rs b/src/test/compile-fail/lint-stability-fields-deprecated.rs index 5da3e1a930d..0ad4466d0e2 100644 --- a/src/test/compile-fail/lint-stability-fields-deprecated.rs +++ b/src/test/compile-fail/lint-stability-fields-deprecated.rs @@ -9,9 +9,10 @@ // except according to those terms. // aux-build:lint_stability_fields.rs + #![deny(deprecated)] #![allow(dead_code)] -#![feature(staged_api, test_feature)] +#![feature(staged_api, unstable_test_feature)] #![stable(feature = "rust1", since = "1.0.0")] @@ -162,50 +163,50 @@ mod this_crate { #[stable(feature = "rust1", since = "1.0.0")] struct Stable { inherit: u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override1: u8, #[rustc_deprecated(since = "1.0.0", reason = "text")] - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override2: u8, } #[stable(feature = "rust1", since = "1.0.0")] struct Stable2(u8, #[stable(feature = "rust1", since = "1.0.0")] u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] u8); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] struct Unstable { inherit: u8, #[stable(feature = "rust1", since = "1.0.0")] override1: u8, #[rustc_deprecated(since = "1.0.0", reason = "text")] - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override2: u8, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] struct Unstable2(u8, #[stable(feature = "rust1", since = "1.0.0")] u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] u8); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] struct Deprecated { inherit: u8, #[stable(feature = "rust1", since = "1.0.0")] override1: u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override2: u8, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] struct Deprecated2(u8, #[stable(feature = "rust1", since = "1.0.0")] u8, - #[unstable(feature = "test_feature", issue = "0")] u8); + #[unstable(feature = "unstable_test_feature", issue = "0")] u8); pub fn foo() { let x = Stable { diff --git a/src/test/compile-fail/lint-stability-fields.rs b/src/test/compile-fail/lint-stability-fields.rs index b1b1a9a1fbf..db6b64dabfe 100644 --- a/src/test/compile-fail/lint-stability-fields.rs +++ b/src/test/compile-fail/lint-stability-fields.rs @@ -138,50 +138,50 @@ mod this_crate { #[stable(feature = "rust1", since = "1.0.0")] struct Stable { inherit: u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override1: u8, #[rustc_deprecated(since = "1.0.0", reason = "text")] - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override2: u8, } #[stable(feature = "rust1", since = "1.0.0")] struct Stable2(u8, #[stable(feature = "rust1", since = "1.0.0")] u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] u8); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] struct Unstable { inherit: u8, #[stable(feature = "rust1", since = "1.0.0")] override1: u8, #[rustc_deprecated(since = "1.0.0", reason = "text")] - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override2: u8, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] struct Unstable2(u8, #[stable(feature = "rust1", since = "1.0.0")] u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] u8); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] struct Deprecated { inherit: u8, #[stable(feature = "rust1", since = "1.0.0")] override1: u8, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] override2: u8, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] struct Deprecated2(u8, #[stable(feature = "rust1", since = "1.0.0")] u8, - #[unstable(feature = "test_feature", issue = "0")] u8); + #[unstable(feature = "unstable_test_feature", issue = "0")] u8); pub fn foo() { let x = Stable { diff --git a/src/test/compile-fail/lint-stability.rs b/src/test/compile-fail/lint-stability.rs index bd390108bd8..720b1235d47 100644 --- a/src/test/compile-fail/lint-stability.rs +++ b/src/test/compile-fail/lint-stability.rs @@ -71,11 +71,11 @@ fn test() { ::trait_unstable(&foo); //~ ERROR use of unstable library feature unstable_text(); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text Trait::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text ::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text stable(); foo.method_stable(); @@ -162,9 +162,9 @@ fn test_method_param(foo: Foo) { Trait::trait_unstable(&foo); //~ ERROR use of unstable library feature ::trait_unstable(&foo); //~ ERROR use of unstable library feature Trait::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text ::trait_unstable_text(&foo); - //~^ ERROR use of unstable library feature 'test_feature': text + //~^ ERROR use of unstable library feature 'unstable_test_feature': text foo.trait_stable(); Trait::trait_stable(&foo); ::trait_stable(&foo); @@ -213,10 +213,10 @@ fn test_inheritance() { } mod this_crate { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated() {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn deprecated_text() {} @@ -224,9 +224,9 @@ pub fn deprecated_text() {} #[rustc_deprecated(since = "99.99.99", reason = "text")] pub fn deprecated_future() {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn unstable() {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn unstable_text() {} #[stable(feature = "rust1", since = "1.0.0")] @@ -238,16 +238,16 @@ pub fn stable_text() {} pub struct MethodTester; impl MethodTester { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub fn method_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub fn method_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] pub fn method_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -257,16 +257,16 @@ pub fn method_stable_text(&self) {} } pub trait Trait { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn trait_deprecated_text(&self) {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] fn trait_unstable(&self) {} - #[unstable(feature = "test_feature", reason = "text", issue = "0")] + #[unstable(feature = "unstable_test_feature", reason = "text", issue = "0")] fn trait_unstable_text(&self) {} #[stable(feature = "rust1", since = "1.0.0")] @@ -277,43 +277,43 @@ fn trait_stable_text(&self) {} impl Trait for MethodTester {} - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } #[stable(feature = "rust1", since = "1.0.0")] pub struct StableStruct { - #[stable(feature = "test_feature", since = "1.0.0")] i: isize + #[stable(feature = "stable_test_feature", since = "1.0.0")] i: isize } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedUnitStruct; - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableUnitStruct; #[stable(feature = "rust1", since = "1.0.0")] pub struct StableUnitStruct; pub enum Enum { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] DeprecatedVariant, - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] UnstableVariant, #[stable(feature = "rust1", since = "1.0.0")] StableVariant, } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub struct DeprecatedTupleStruct(isize); - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] pub struct UnstableTupleStruct(isize); #[stable(feature = "rust1", since = "1.0.0")] pub struct StableTupleStruct(isize); @@ -432,7 +432,7 @@ fn test_method_object(foo: &Trait) { foo.trait_stable(); } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn test_fn_body() { fn fn_in_body() {} @@ -440,7 +440,7 @@ fn fn_in_body() {} } impl MethodTester { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn test_method_body(&self) { fn fn_in_body() {} @@ -448,7 +448,7 @@ fn fn_in_body() {} } } - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] pub trait DeprecatedTrait { fn dummy(&self) { } diff --git a/src/test/compile-fail/lint-unknown-feature-default.rs b/src/test/compile-fail/lint-unknown-feature-default.rs index 79ba3ea45e1..5a0568f05e6 100644 --- a/src/test/compile-fail/lint-unknown-feature-default.rs +++ b/src/test/compile-fail/lint-unknown-feature-default.rs @@ -10,8 +10,9 @@ // Tests the default for the unused_features lint +#![allow(stable_features)] // FIXME(#44232) we should warn that this isn't used. -#![feature(this_is_not_a_feature)] +#![feature(rust1)] #![feature(rustc_attrs)] diff --git a/src/test/compile-fail/lint-unknown-feature.rs b/src/test/compile-fail/lint-unknown-feature.rs index d230297aaba..81f99f99492 100644 --- a/src/test/compile-fail/lint-unknown-feature.rs +++ b/src/test/compile-fail/lint-unknown-feature.rs @@ -10,8 +10,9 @@ #![warn(unused_features)] +#![allow(stable_features)] // FIXME(#44232) we should warn that this isn't used. -#![feature(this_is_not_a_feature)] +#![feature(rust1)] #![feature(rustc_attrs)] diff --git a/src/test/compile-fail/macro-with-seps-err-msg.rs b/src/test/compile-fail/macro-with-seps-err-msg.rs index 6567a100d8c..1281adce5c5 100644 --- a/src/test/compile-fail/macro-with-seps-err-msg.rs +++ b/src/test/compile-fail/macro-with-seps-err-msg.rs @@ -10,10 +10,6 @@ // gate-test-use_extern_macros -#![feature(proc_macro_path_invoc)] - fn main() { globnar::brotz!(); //~ ERROR non-ident macro paths are experimental - #[derive(foo::Bar)] struct T; //~ ERROR non-ident macro paths are experimental - ::foo!(); //~ ERROR non-ident macro paths are experimental } diff --git a/src/test/compile-fail/macros-in-extern.rs b/src/test/compile-fail/macros-in-extern.rs index b6e273881cc..40053853b15 100644 --- a/src/test/compile-fail/macros-in-extern.rs +++ b/src/test/compile-fail/macros-in-extern.rs @@ -34,9 +34,9 @@ fn main() { #[link(name = "rust_test_helpers", kind = "static")] extern { returns_isize!(rust_get_test_int); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental takes_u32_returns_u32!(rust_dbg_extern_identity_u32); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental emits_nothing!(); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental } diff --git a/src/test/compile-fail/missing-stability.rs b/src/test/compile-fail/missing-stability.rs index a727ecc76b7..1922efb5e19 100644 --- a/src/test/compile-fail/missing-stability.rs +++ b/src/test/compile-fail/missing-stability.rs @@ -13,20 +13,20 @@ #![crate_type="lib"] #![feature(staged_api)] -#![stable(feature = "test_feature", since = "1.0.0")] +#![stable(feature = "stable_test_feature", since = "1.0.0")] pub fn unmarked() { //~^ ERROR This node does not have a stability attribute () } -#[unstable(feature = "foo", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub mod foo { // #[unstable] is inherited pub fn unmarked() {} } -#[stable(feature = "bar", since="1.0.0")] +#[stable(feature = "stable_test_feature", since="1.0.0")] pub mod bar { // #[stable] is not inherited pub fn unmarked() {} diff --git a/src/test/compile-fail/nll/where_clauses_in_functions.rs b/src/test/compile-fail/nll/where_clauses_in_functions.rs index 1a3dc76005d..0efdd19df3c 100644 --- a/src/test/compile-fail/nll/where_clauses_in_functions.rs +++ b/src/test/compile-fail/nll/where_clauses_in_functions.rs @@ -21,7 +21,7 @@ fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) fn bar<'a, 'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) { foo(x, y) - //~^ ERROR lifetime mismatch [E0623] + //~^ ERROR unsatisfied lifetime constraints //~| WARNING not reporting region error due to nll } diff --git a/src/test/compile-fail/nll/where_clauses_in_structs.rs b/src/test/compile-fail/nll/where_clauses_in_structs.rs index 69f0f43af13..92e7db86173 100644 --- a/src/test/compile-fail/nll/where_clauses_in_structs.rs +++ b/src/test/compile-fail/nll/where_clauses_in_structs.rs @@ -21,7 +21,7 @@ struct Foo<'a: 'b, 'b> { fn bar<'a, 'b>(x: Cell<&'a u32>, y: Cell<&'b u32>) { Foo { x, y }; - //~^ ERROR lifetime mismatch [E0623] + //~^ ERROR unsatisfied lifetime constraints //~| WARNING not reporting region error due to nll } diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs index e04bb27f435..826bf675bd6 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-1.rs @@ -10,8 +10,6 @@ // edition:2018 -#![feature(extern_absolute_paths)] - use xcrate::S; //~ ERROR can't find crate for `xcrate` fn main() {} diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs index bebf0236bb4..053bf92f4d1 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-2.rs @@ -10,8 +10,6 @@ // edition:2018 -#![feature(extern_absolute_paths)] - fn main() { let s = ::xcrate::S; //~ ERROR can't find crate for `xcrate` } diff --git a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs index 5906a0719c8..1b9e5a75e83 100644 --- a/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs +++ b/src/test/compile-fail/rfc-2126-extern-absolute-paths/non-existent-3.rs @@ -10,8 +10,6 @@ // edition:2018 -#![feature(extern_absolute_paths)] - use ycrate; //~ ERROR can't find crate for `ycrate` fn main() {} 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 index 7111176dbd9..e9de0f01b30 100644 --- 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 @@ -11,9 +11,6 @@ // aux-build:xcrate.rs // edition:2018 -#![feature(crate_in_paths)] -#![feature(extern_absolute_paths)] - use crate; //~ ERROR unresolved import `crate` //~^ NOTE crate root imports need to be explicitly named: `use crate as name;` use *; //~ ERROR unresolved import `*` diff --git a/src/test/compile-fail/stability-attribute-issue.rs b/src/test/compile-fail/stability-attribute-issue.rs index c473bdd23b5..754c6f792f9 100644 --- a/src/test/compile-fail/stability-attribute-issue.rs +++ b/src/test/compile-fail/stability-attribute-issue.rs @@ -9,6 +9,7 @@ // except according to those terms. // aux-build:stability_attribute_issue.rs +// ignore-tidy-linelength #![deny(deprecated)] @@ -16,6 +17,8 @@ use stability_attribute_issue::*; fn main() { - unstable(); //~ ERROR use of unstable library feature 'foo' (see issue #1) - unstable_msg(); //~ ERROR use of unstable library feature 'foo': message (see issue #2) + unstable(); + //~^ ERROR use of unstable library feature 'unstable_test_feature' (see issue #1) + unstable_msg(); + //~^ ERROR use of unstable library feature 'unstable_test_feature': message (see issue #2) } diff --git a/src/test/compile-fail/stability-attribute-sanity-2.rs b/src/test/compile-fail/stability-attribute-sanity-2.rs index 0ddc3a8dceb..9c54315bfd0 100644 --- a/src/test/compile-fail/stability-attribute-sanity-2.rs +++ b/src/test/compile-fail/stability-attribute-sanity-2.rs @@ -12,7 +12,7 @@ #![feature(staged_api)] -#![stable(feature = "test_feature", since = "1.0.0")] +#![stable(feature = "stable_test_feature", since = "1.0.0")] #[stable(feature = "a", feature = "b", since = "1.0.0")] //~ ERROR multiple 'feature' items fn f1() { } diff --git a/src/test/compile-fail/stability-attribute-sanity-3.rs b/src/test/compile-fail/stability-attribute-sanity-3.rs index ddefd24b92f..d4821e009f2 100644 --- a/src/test/compile-fail/stability-attribute-sanity-3.rs +++ b/src/test/compile-fail/stability-attribute-sanity-3.rs @@ -12,7 +12,7 @@ #![feature(staged_api)] -#![stable(feature = "test_feature", since = "1.0.0")] +#![stable(feature = "stable_test_feature", since = "1.0.0")] #[macro_export] macro_rules! mac { //~ ERROR This node does not have a stability attribute diff --git a/src/test/compile-fail/stability-attribute-sanity.rs b/src/test/compile-fail/stability-attribute-sanity.rs index 263ac427b76..794ae1ca087 100644 --- a/src/test/compile-fail/stability-attribute-sanity.rs +++ b/src/test/compile-fail/stability-attribute-sanity.rs @@ -15,7 +15,7 @@ #![stable(feature = "rust1", since = "1.0.0")] mod bogus_attribute_types_1 { - #[stable(feature = "a", since = "a", reason)] //~ ERROR unknown meta item 'reason' [E0541] + #[stable(feature = "a", since = "b", reason)] //~ ERROR unknown meta item 'reason' [E0541] fn f1() { } #[stable(feature = "a", since)] //~ ERROR incorrect meta item [E0539] @@ -35,7 +35,7 @@ mod bogus_attribute_types_2 { #[unstable] //~ ERROR incorrect stability attribute type [E0548] fn f1() { } - #[unstable = "a"] //~ ERROR incorrect stability attribute type [E0548] + #[unstable = "b"] //~ ERROR incorrect stability attribute type [E0548] fn f2() { } #[stable] //~ ERROR incorrect stability attribute type [E0548] @@ -57,7 +57,7 @@ mod missing_feature_names { #[unstable(issue = "0")] //~ ERROR missing 'feature' [E0546] fn f1() { } - #[unstable(feature = "a")] //~ ERROR missing 'issue' [E0547] + #[unstable(feature = "b")] //~ ERROR missing 'issue' [E0547] fn f2() { } #[stable(since = "a")] //~ ERROR missing 'feature' [E0546] @@ -73,12 +73,12 @@ fn f1() { } fn f2() { } } -#[unstable(feature = "a", issue = "0")] +#[unstable(feature = "b", issue = "0")] #[stable(feature = "a", since = "b")] //~ ERROR multiple stability levels [E0544] fn multiple1() { } -#[unstable(feature = "a", issue = "0")] -#[unstable(feature = "a", issue = "0")] //~ ERROR multiple stability levels [E0544] +#[unstable(feature = "b", issue = "0")] +#[unstable(feature = "b", issue = "0")] //~ ERROR multiple stability levels [E0544] fn multiple2() { } #[stable(feature = "a", since = "b")] @@ -88,8 +88,8 @@ fn multiple3() { } #[stable(feature = "a", since = "b")] #[rustc_deprecated(since = "b", reason = "text")] #[rustc_deprecated(since = "b", reason = "text")] -#[rustc_const_unstable(feature = "a")] -#[rustc_const_unstable(feature = "b")] +#[rustc_const_unstable(feature = "c")] +#[rustc_const_unstable(feature = "d")] pub const fn multiple4() { } //~ ERROR multiple rustc_deprecated attributes [E0540] //~^ ERROR Invalid stability or deprecation version found //~| ERROR multiple rustc_const_unstable attributes diff --git a/src/test/compile-fail/stable-features.rs b/src/test/compile-fail/stable-features.rs index 5993f4b5a09..32991dd6499 100644 --- a/src/test/compile-fail/stable-features.rs +++ b/src/test/compile-fail/stable-features.rs @@ -13,10 +13,11 @@ #![deny(stable_features)] -#![feature(test_accepted_feature)] //~ ERROR this feature has been stable since 1.0.0 +#![feature(test_accepted_feature)] +//~^ ERROR the feature `test_accepted_feature` has been stable since 1.0.0 -// FIXME(#44232) we should error that this isn't used. #![feature(rust1)] +//~^ ERROR the feature `rust1` has been stable since 1.0.0 fn main() { let _foo: Vec<()> = Vec::new(); diff --git a/src/test/compile-fail/stmt_expr_attrs_no_feature.rs b/src/test/compile-fail/stmt_expr_attrs_no_feature.rs index d8626dfd39e..896817bb858 100644 --- a/src/test/compile-fail/stmt_expr_attrs_no_feature.rs +++ b/src/test/compile-fail/stmt_expr_attrs_no_feature.rs @@ -20,7 +20,7 @@ fn main() { #[attr] fn a() {} - #[attr] + #[attr] //~ ERROR attributes on expressions are experimental { } diff --git a/src/test/compile-fail/unknown-tool-name.rs b/src/test/compile-fail/unknown-tool-name.rs index c4d22e6d392..99c336c28cd 100644 --- a/src/test/compile-fail/unknown-tool-name.rs +++ b/src/test/compile-fail/unknown-tool-name.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(use_extern_macros, proc_macro_path_invoc)] +#![feature(proc_macro_path_invoc)] #[foo::bar] //~ ERROR failed to resolve. Use of undeclared type or module `foo` fn main() {} diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs index 8fc910d8a6d..f5dab5a55b4 100644 --- a/src/test/debuginfo/constant-debug-locs.rs +++ b/src/test/debuginfo/constant-debug-locs.rs @@ -15,7 +15,6 @@ #![allow(dead_code, unused_variables)] #![feature(omit_gdb_pretty_printer_section)] #![omit_gdb_pretty_printer_section] -#![feature(static_mutex)] // This test makes sure that the compiler doesn't crash when trying to assign // debug locations to const-expressions. diff --git a/src/test/pretty/attr-literals.rs b/src/test/pretty/attr-literals.rs index ba8c580cb0a..ce157e3632c 100644 --- a/src/test/pretty/attr-literals.rs +++ b/src/test/pretty/attr-literals.rs @@ -18,6 +18,6 @@ fn main() { #[align = 8] fn f() { } - #[vec(1, 2, 3)] + #[vector(1, 2, 3)] fn g() { } } diff --git a/src/test/run-fail/args-panic.rs b/src/test/run-fail/args-panic.rs index b8fb03faf08..3eca89fbed3 100644 --- a/src/test/run-fail/args-panic.rs +++ b/src/test/run-fail/args-panic.rs @@ -11,7 +11,6 @@ // error-pattern:meep -#![allow(unknown_features)] #![feature(box_syntax)] fn f(_a: isize, _b: isize, _c: Box) { diff --git a/src/test/run-fail/panic-macro-any.rs b/src/test/run-fail/panic-macro-any.rs index 7ca45565d85..c8f851be556 100644 --- a/src/test/run-fail/panic-macro-any.rs +++ b/src/test/run-fail/panic-macro-any.rs @@ -10,7 +10,6 @@ // error-pattern:panicked at 'Box' -#![allow(unknown_features)] #![feature(box_syntax)] fn main() { diff --git a/src/test/run-fail/panic-set-handler.rs b/src/test/run-fail/panic-set-handler.rs index 68f1c4ed0bc..2d430be07ef 100644 --- a/src/test/run-fail/panic-set-handler.rs +++ b/src/test/run-fail/panic-set-handler.rs @@ -10,8 +10,6 @@ // error-pattern:greetings from the panic handler -#![feature(panic_handler)] - use std::panic; fn main() { diff --git a/src/test/run-fail/panic-set-unset-handler.rs b/src/test/run-fail/panic-set-unset-handler.rs index 072139a8c9b..e7659d0bd88 100644 --- a/src/test/run-fail/panic-set-unset-handler.rs +++ b/src/test/run-fail/panic-set-unset-handler.rs @@ -10,8 +10,6 @@ // error-pattern:thread 'main' panicked at 'foobar' -#![feature(panic_handler)] - use std::panic; fn main() { diff --git a/src/test/run-fail/panic-take-handler-nop.rs b/src/test/run-fail/panic-take-handler-nop.rs index 0add63c6d64..46e937c5d9b 100644 --- a/src/test/run-fail/panic-take-handler-nop.rs +++ b/src/test/run-fail/panic-take-handler-nop.rs @@ -10,8 +10,6 @@ // error-pattern:thread 'main' panicked at 'foobar' -#![feature(panic_handler)] - use std::panic; fn main() { diff --git a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs index fed1405b7f4..1dad2ed9052 100644 --- a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs +++ b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/bar.rs @@ -10,6 +10,6 @@ #![crate_type = "lib"] #![feature(staged_api)] -#![unstable(feature = "test_feature", issue = "0")] +#![unstable(feature = "unstable_test_feature", issue = "0")] -pub fn baz() { } +pub fn baz() {} diff --git a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs index a36cc474c2b..b728136a89e 100644 --- a/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs +++ b/src/test/run-make-fulldeps/allow-warnings-cmdline-stability/foo.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(test_feature)] +#![feature(unstable_test_feature)] extern crate bar; diff --git a/src/test/run-make-fulldeps/link-path-order/main.rs b/src/test/run-make-fulldeps/link-path-order/main.rs index aaac3927f1c..f3502e8bcd4 100644 --- a/src/test/run-make-fulldeps/link-path-order/main.rs +++ b/src/test/run-make-fulldeps/link-path-order/main.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc, exit_status)] +#![feature(libc)] extern crate libc; diff --git a/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs b/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs index b1fe535766d..7e5343df841 100644 --- a/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs +++ b/src/test/run-make-fulldeps/save-analysis-rfc2126/extern_absolute_paths.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(extern_absolute_paths)] - use krate2::hello; fn main() { diff --git a/src/test/run-make-fulldeps/symbols-are-reasonable/Makefile b/src/test/run-make-fulldeps/symbols-are-reasonable/Makefile deleted file mode 100644 index a6d294d2a1c..00000000000 --- a/src/test/run-make-fulldeps/symbols-are-reasonable/Makefile +++ /dev/null @@ -1,13 +0,0 @@ --include ../tools.mk - -# check that the compile generated symbols for strings, binaries, -# vtables, etc. have semisane names (e.g. `str.1234`); it's relatively -# easy to accidentally modify the compiler internals to make them -# become things like `str"str"(1234)`. - -OUT=$(TMPDIR)/lib.s - -all: - $(RUSTC) lib.rs --emit=asm --crate-type=staticlib - # just check for symbol declarations with the names we're expecting. - $(CGREP) -e 'str\.[0-9]+:' 'byte_str\.[0-9]+:' 'vtable\.[0-9]+' < $(OUT) diff --git a/src/test/run-make-fulldeps/symbols-are-reasonable/lib.rs b/src/test/run-make-fulldeps/symbols-are-reasonable/lib.rs deleted file mode 100644 index b9285b24cd6..00000000000 --- a/src/test/run-make-fulldeps/symbols-are-reasonable/lib.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub static X: &'static str = "foobarbaz"; -pub static Y: &'static [u8] = include_bytes!("lib.rs"); - -trait Foo { fn dummy(&self) { } } -impl Foo for usize {} - -#[no_mangle] -pub extern "C" fn dummy() { - // force the vtable to be created - let _x = &1usize as &Foo; -} diff --git a/src/test/run-make/wasm-custom-section/bar.rs b/src/test/run-make/wasm-custom-section/bar.rs index ed537280e6c..6b165f1f700 100644 --- a/src/test/run-make/wasm-custom-section/bar.rs +++ b/src/test/run-make/wasm-custom-section/bar.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_type = "cdylib"] -#![feature(wasm_custom_section)] #![deny(warnings)] extern crate foo; diff --git a/src/test/run-make/wasm-custom-section/foo.rs b/src/test/run-make/wasm-custom-section/foo.rs index fb3bec31ada..6a35d743710 100644 --- a/src/test/run-make/wasm-custom-section/foo.rs +++ b/src/test/run-make/wasm-custom-section/foo.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_type = "rlib"] -#![feature(wasm_custom_section)] #![deny(warnings)] #[link_section = "foo"] diff --git a/src/test/run-make/wasm-symbols-not-exported/Makefile b/src/test/run-make/wasm-symbols-not-exported/Makefile new file mode 100644 index 00000000000..872825113a8 --- /dev/null +++ b/src/test/run-make/wasm-symbols-not-exported/Makefile @@ -0,0 +1,16 @@ +-include ../../run-make-fulldeps/tools.mk + +ifeq ($(TARGET),wasm32-unknown-unknown) +all: + $(RUSTC) foo.rs --target wasm32-unknown-unknown + $(NODE) verify-exported-symbols.js $(TMPDIR)/foo.wasm + $(RUSTC) foo.rs --target wasm32-unknown-unknown -O + $(NODE) verify-exported-symbols.js $(TMPDIR)/foo.wasm + $(RUSTC) bar.rs --target wasm32-unknown-unknown + $(NODE) verify-exported-symbols.js $(TMPDIR)/bar.wasm + $(RUSTC) bar.rs --target wasm32-unknown-unknown -O + $(NODE) verify-exported-symbols.js $(TMPDIR)/bar.wasm +else +all: +endif + diff --git a/src/test/run-make/wasm-symbols-not-exported/bar.rs b/src/test/run-make/wasm-symbols-not-exported/bar.rs new file mode 100644 index 00000000000..979ec44b040 --- /dev/null +++ b/src/test/run-make/wasm-symbols-not-exported/bar.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(panic_implementation, alloc_error_handler)] +#![crate_type = "cdylib"] +#![no_std] + +use core::alloc::*; + +struct B; + +unsafe impl GlobalAlloc for B { + unsafe fn alloc(&self, x: Layout) -> *mut u8 { + 1 as *mut u8 + } + + unsafe fn dealloc(&self, ptr: *mut u8, x: Layout) { + } +} + +#[global_allocator] +static A: B = B; + +#[no_mangle] +pub extern fn foo(a: u32) -> u32 { + assert_eq!(a, 3); + a * 2 +} + +#[alloc_error_handler] +fn a(_: core::alloc::Layout) -> ! { + loop {} +} + +#[panic_implementation] +fn b(_: &core::panic::PanicInfo) -> ! { + loop {} +} diff --git a/src/test/run-make/wasm-symbols-not-exported/foo.rs b/src/test/run-make/wasm-symbols-not-exported/foo.rs new file mode 100644 index 00000000000..cd8c7cb205d --- /dev/null +++ b/src/test/run-make/wasm-symbols-not-exported/foo.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "cdylib"] + +#[no_mangle] +pub extern fn foo() { + println!("foo"); + panic!("test"); +} diff --git a/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js b/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js new file mode 100644 index 00000000000..060830eb01a --- /dev/null +++ b/src/test/run-make/wasm-symbols-not-exported/verify-exported-symbols.js @@ -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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +const fs = require('fs'); +const process = require('process'); +const assert = require('assert'); +const buffer = fs.readFileSync(process.argv[2]); + +let m = new WebAssembly.Module(buffer); +let list = WebAssembly.Module.exports(m); +console.log('exports', list); + +let bad = false; +for (let i = 0; i < list.length; i++) { + const e = list[i]; + if (e.name == "foo" || e.kind != "function") + continue; + + console.log('unexpected exported symbol:', e.name); + bad = true; +} + +if (bad) + process.exit(1); diff --git a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs index ec6f54fb137..94c5b208a37 100644 --- a/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/cond_plugin.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs index 545eabe00ff..b54543c73fb 100644 --- a/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs +++ b/src/test/run-pass-fulldeps/auxiliary/hello_macro.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(use_extern_macros, proc_macro_non_items, proc_macro_quote)] +#![feature(proc_macro_non_items, proc_macro_quote)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs index 9a5bffb92a4..9faa7366ec5 100644 --- a/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs +++ b/src/test/run-pass-fulldeps/auxiliary/proc_macro_def.rs @@ -11,7 +11,7 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/compiler-calls.rs b/src/test/run-pass-fulldeps/compiler-calls.rs index cc2b6c641e9..baf9e0d5dc5 100644 --- a/src/test/run-pass-fulldeps/compiler-calls.rs +++ b/src/test/run-pass-fulldeps/compiler-calls.rs @@ -12,8 +12,7 @@ // ignore-cross-compile -#![feature(rustc_private, path)] -#![feature(core)] +#![feature(rustc_private)] extern crate getopts; extern crate rustc; diff --git a/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs b/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs index 1573b080717..4c5b3259902 100644 --- a/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs +++ b/src/test/run-pass-fulldeps/deriving-encodable-decodable-box.rs @@ -9,7 +9,6 @@ // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] #![feature(rustc_private)] diff --git a/src/test/run-pass-fulldeps/deriving-global.rs b/src/test/run-pass-fulldeps/deriving-global.rs index 10e8ddc41f3..e9678732804 100644 --- a/src/test/run-pass-fulldeps/deriving-global.rs +++ b/src/test/run-pass-fulldeps/deriving-global.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(rand, rustc_private)] +#![feature(rustc_private)] extern crate serialize; diff --git a/src/test/run-pass-fulldeps/macro-quote-cond.rs b/src/test/run-pass-fulldeps/macro-quote-cond.rs index f1dcec8af69..3eb7e8cc9a4 100644 --- a/src/test/run-pass-fulldeps/macro-quote-cond.rs +++ b/src/test/run-pass-fulldeps/macro-quote-cond.rs @@ -11,7 +11,7 @@ // aux-build:cond_plugin.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate cond_plugin; diff --git a/src/test/run-pass-fulldeps/macro-quote-test.rs b/src/test/run-pass-fulldeps/macro-quote-test.rs index 2349fa68c65..1005a6bfc50 100644 --- a/src/test/run-pass-fulldeps/macro-quote-test.rs +++ b/src/test/run-pass-fulldeps/macro-quote-test.rs @@ -13,7 +13,7 @@ // aux-build:hello_macro.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items, proc_macro_gen)] +#![feature(proc_macro_non_items, proc_macro_gen)] extern crate hello_macro; diff --git a/src/test/run-pass-fulldeps/myriad-closures.rs b/src/test/run-pass-fulldeps/myriad-closures.rs index a946ec635b2..baf27d6f57c 100644 --- a/src/test/run-pass-fulldeps/myriad-closures.rs +++ b/src/test/run-pass-fulldeps/myriad-closures.rs @@ -14,7 +14,7 @@ // See https://github.com/rust-lang/rust/issues/34793 for more information. // Make sure we don't optimize anything away: -// compile-flags: -C no-prepopulate-passes +// compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals // Expand something exponentially macro_rules! go_bacterial { diff --git a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs index 021b10e033f..b5272e6608b 100644 --- a/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs +++ b/src/test/run-pass-fulldeps/proc-macro/attr-stmt-expr.rs @@ -11,7 +11,7 @@ // aux-build:attr-stmt-expr.rs // ignore-stage1 -#![feature(use_extern_macros, stmt_expr_attributes, proc_macro_stmt, proc_macro_expr)] +#![feature(stmt_expr_attributes, proc_macro_expr)] extern crate attr_stmt_expr; use attr_stmt_expr::{expect_let, expect_print_stmt, expect_expr, expect_print_expr, diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs index c6bcc37ac4a..a84e029f9d8 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/count_compound_ops.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(proc_macro_non_items, proc_macro_quote, use_extern_macros)] +#![feature(proc_macro_non_items, proc_macro_quote)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs index 8f95bdd9c39..43c1d5fcc8d 100644 --- a/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs +++ b/src/test/run-pass-fulldeps/proc-macro/auxiliary/hygiene_example_codegen.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(use_extern_macros, proc_macro_quote, proc_macro_non_items)] +#![feature(proc_macro_quote, proc_macro_non_items)] #![crate_type = "proc-macro"] extern crate proc_macro as proc_macro_renamed; // This does not break `quote!` diff --git a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs index f9d17a9decb..955b6ab986d 100644 --- a/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs +++ b/src/test/run-pass-fulldeps/proc-macro/bang-macro.rs @@ -11,7 +11,7 @@ // aux-build:bang-macro.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate bang_macro; use bang_macro::rewrite; diff --git a/src/test/run-pass-fulldeps/proc-macro/call-site.rs b/src/test/run-pass-fulldeps/proc-macro/call-site.rs index 505994f66e7..dfe97eb587c 100644 --- a/src/test/run-pass-fulldeps/proc-macro/call-site.rs +++ b/src/test/run-pass-fulldeps/proc-macro/call-site.rs @@ -11,7 +11,7 @@ // aux-build:call-site.rs // ignore-stage1 -#![feature(proc_macro_non_items, use_extern_macros)] +#![feature(proc_macro_non_items)] extern crate call_site; use call_site::*; diff --git a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs index f4a51d0624a..6601d66e586 100644 --- a/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs +++ b/src/test/run-pass-fulldeps/proc-macro/count_compound_ops.rs @@ -11,7 +11,7 @@ // aux-build:count_compound_ops.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate count_compound_ops; use count_compound_ops::count_compound_ops; 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 35d5084d9f6..4a7c8f3e834 100644 --- a/src/test/run-pass-fulldeps/proc-macro/derive-b.rs +++ b/src/test/run-pass-fulldeps/proc-macro/derive-b.rs @@ -11,7 +11,7 @@ // aux-build:derive-b.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_path_invoc)] +#![feature(proc_macro_path_invoc)] extern crate derive_b; diff --git a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs index 5ee164415a1..579e8c33773 100644 --- a/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs +++ b/src/test/run-pass-fulldeps/proc-macro/hygiene_example.rs @@ -12,7 +12,7 @@ // aux-build:hygiene_example.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate hygiene_example; use hygiene_example::hello; diff --git a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs b/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs index e5f8c844b6b..bd76cc38054 100644 --- a/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs +++ b/src/test/run-pass-fulldeps/proc-macro/macros-in-extern.rs @@ -12,7 +12,7 @@ // ignore-stage1 // ignore-wasm32 -#![feature(use_extern_macros, macros_in_extern)] +#![feature(macros_in_extern)] extern crate test_macros; diff --git a/src/test/run-pass-fulldeps/proc_macro.rs b/src/test/run-pass-fulldeps/proc_macro.rs index 46b62d7e34a..c9d7b0423ec 100644 --- a/src/test/run-pass-fulldeps/proc_macro.rs +++ b/src/test/run-pass-fulldeps/proc_macro.rs @@ -12,7 +12,7 @@ // ignore-stage1 // ignore-cross-compile -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate proc_macro_def; diff --git a/src/test/run-pass-valgrind/coerce-match.rs b/src/test/run-pass-valgrind/coerce-match.rs index 6bf5c4d596f..360e8c9cc4f 100644 --- a/src/test/run-pass-valgrind/coerce-match.rs +++ b/src/test/run-pass-valgrind/coerce-match.rs @@ -12,7 +12,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/alignment-gep-tup-like-1.rs b/src/test/run-pass/alignment-gep-tup-like-1.rs index 72a79e188b3..c1f75d5ee74 100644 --- a/src/test/run-pass/alignment-gep-tup-like-1.rs +++ b/src/test/run-pass/alignment-gep-tup-like-1.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] struct pair { diff --git a/src/test/run-pass/allocator/auxiliary/custom.rs b/src/test/run-pass/allocator/auxiliary/custom.rs index 02e86fa19f8..b17464e0419 100644 --- a/src/test/run-pass/allocator/auxiliary/custom.rs +++ b/src/test/run-pass/allocator/auxiliary/custom.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(heap_api, allocator_api)] +#![feature(allocator_api)] #![crate_type = "rlib"] use std::alloc::{GlobalAlloc, System, Layout}; diff --git a/src/test/run-pass/allocator/xcrate-use2.rs b/src/test/run-pass/allocator/xcrate-use2.rs index fbde7e855c2..7a45fd28bdb 100644 --- a/src/test/run-pass/allocator/xcrate-use2.rs +++ b/src/test/run-pass/allocator/xcrate-use2.rs @@ -13,7 +13,7 @@ // aux-build:helper.rs // no-prefer-dynamic -#![feature(heap_api, allocator_api)] +#![feature(allocator_api)] extern crate custom; extern crate custom_as_global; diff --git a/src/test/run-pass/associated-types-doubleendediterator-object.rs b/src/test/run-pass/associated-types-doubleendediterator-object.rs index 0a6135080bb..de83e4edd85 100644 --- a/src/test/run-pass/associated-types-doubleendediterator-object.rs +++ b/src/test/run-pass/associated-types-doubleendediterator-object.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn pairwise_sub(mut t: Box>) -> isize { diff --git a/src/test/run-pass/associated-types-nested-projections.rs b/src/test/run-pass/associated-types-nested-projections.rs index 83f0d360e61..62fa07e20b6 100644 --- a/src/test/run-pass/associated-types-nested-projections.rs +++ b/src/test/run-pass/associated-types-nested-projections.rs @@ -12,8 +12,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - use std::slice; trait Bound {} diff --git a/src/test/run-pass/async-await.rs b/src/test/run-pass/async-await.rs index 0ac37485d3d..99b8ad83bf6 100644 --- a/src/test/run-pass/async-await.rs +++ b/src/test/run-pass/async-await.rs @@ -22,7 +22,7 @@ use std::future::FutureObj; use std::task::{ Context, Poll, Wake, - Executor, SpawnObjError, + Spawn, SpawnObjError, local_waker_from_nonlocal, }; @@ -36,8 +36,8 @@ fn wake(this: &Arc) { } } -struct NoopExecutor; -impl Executor for NoopExecutor { +struct NoopSpawner; +impl Spawn for NoopSpawner { fn spawn_obj(&mut self, _: FutureObj<'static, ()>) -> Result<(), SpawnObjError> { Ok(()) } @@ -127,8 +127,8 @@ fn test_future_yields_once_then_returns(f: F) let mut fut = PinBox::new(f(9)); let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) }); let waker = local_waker_from_nonlocal(counter.clone()); - let executor = &mut NoopExecutor; - let cx = &mut Context::new(&waker, executor); + let spawner = &mut NoopSpawner; + let cx = &mut Context::new(&waker, spawner); assert_eq!(0, counter.wakes.load(atomic::Ordering::SeqCst)); assert_eq!(Poll::Pending, fut.as_pin_mut().poll(cx)); diff --git a/src/test/run-pass/attr-shebang.rs b/src/test/run-pass/attr-shebang.rs index 95f3ea61dd8..73f10410828 100644 --- a/src/test/run-pass/attr-shebang.rs +++ b/src/test/run-pass/attr-shebang.rs @@ -1,4 +1,4 @@ -#![allow(unknown_features)] -#![feature(bogus)] +#![allow(stable_features)] +#![feature(rust1)] pub fn main() { } // ignore-license diff --git a/src/test/run-pass/autoderef-method-on-trait.rs b/src/test/run-pass/autoderef-method-on-trait.rs index 5c5364de6a8..f6ff9a31fa1 100644 --- a/src/test/run-pass/autoderef-method-on-trait.rs +++ b/src/test/run-pass/autoderef-method-on-trait.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait double { diff --git a/src/test/run-pass/autoderef-method-priority.rs b/src/test/run-pass/autoderef-method-priority.rs index c80a92a185a..234af92610a 100644 --- a/src/test/run-pass/autoderef-method-priority.rs +++ b/src/test/run-pass/autoderef-method-priority.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait double { diff --git a/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs b/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs index 2a782cfa176..5890fe44166 100644 --- a/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs +++ b/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait double { diff --git a/src/test/run-pass/autoderef-method-twice.rs b/src/test/run-pass/autoderef-method-twice.rs index a1bcf65ab75..2598ec17d2a 100644 --- a/src/test/run-pass/autoderef-method-twice.rs +++ b/src/test/run-pass/autoderef-method-twice.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait double { diff --git a/src/test/run-pass/autoderef-method.rs b/src/test/run-pass/autoderef-method.rs index 326218674ae..7c83b9c982f 100644 --- a/src/test/run-pass/autoderef-method.rs +++ b/src/test/run-pass/autoderef-method.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait double { diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index 05f12fd089a..4096d45d8df 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - -#![allow(unknown_features)] #![feature(box_syntax)] trait Foo { diff --git a/src/test/run-pass/auxiliary/cci_nested_lib.rs b/src/test/run-pass/auxiliary/cci_nested_lib.rs index 8c1a283a72d..91de734ec3a 100644 --- a/src/test/run-pass/auxiliary/cci_nested_lib.rs +++ b/src/test/run-pass/auxiliary/cci_nested_lib.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::cell::RefCell; diff --git a/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs b/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs index 415988586a0..36562fd0049 100644 --- a/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs +++ b/src/test/run-pass/auxiliary/edition-kw-macro-2018.rs @@ -10,8 +10,6 @@ // edition:2018 -#![feature(raw_identifiers)] - #[macro_export] macro_rules! produces_async { () => (pub fn async() {}) diff --git a/src/test/run-pass/auxiliary/issue-2380.rs b/src/test/run-pass/auxiliary/issue-2380.rs index cfebc4abaaa..b3e0f061485 100644 --- a/src/test/run-pass/auxiliary/issue-2380.rs +++ b/src/test/run-pass/auxiliary/issue-2380.rs @@ -11,7 +11,6 @@ #![crate_name="a"] #![crate_type = "lib"] -#![allow(unknown_features)] #![feature(box_syntax)] pub trait i diff --git a/src/test/run-pass/auxiliary/issue13507.rs b/src/test/run-pass/auxiliary/issue13507.rs index ee7d45b77bf..dee40b2fc57 100644 --- a/src/test/run-pass/auxiliary/issue13507.rs +++ b/src/test/run-pass/auxiliary/issue13507.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] - pub mod testtypes { use std::any::TypeId; diff --git a/src/test/run-pass/auxiliary/method_self_arg1.rs b/src/test/run-pass/auxiliary/method_self_arg1.rs index 348b71faf0c..785a8b05664 100644 --- a/src/test/run-pass/auxiliary/method_self_arg1.rs +++ b/src/test/run-pass/auxiliary/method_self_arg1.rs @@ -10,7 +10,6 @@ #![crate_type = "lib"] -#![allow(unknown_features)] #![feature(box_syntax)] static mut COUNT: u64 = 1; diff --git a/src/test/run-pass/auxiliary/method_self_arg2.rs b/src/test/run-pass/auxiliary/method_self_arg2.rs index b67ec1b9bfc..3761d58087e 100644 --- a/src/test/run-pass/auxiliary/method_self_arg2.rs +++ b/src/test/run-pass/auxiliary/method_self_arg2.rs @@ -10,7 +10,6 @@ #![crate_type = "lib"] -#![allow(unknown_features)] #![feature(box_syntax)] static mut COUNT: u64 = 1; diff --git a/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs b/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs index 10e315f269f..0d0f1b3a482 100644 --- a/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs +++ b/src/test/run-pass/auxiliary/typeid-intrinsic-aux1.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] - use std::any::{Any, TypeId}; pub struct A; diff --git a/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs b/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs index 10e315f269f..0d0f1b3a482 100644 --- a/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs +++ b/src/test/run-pass/auxiliary/typeid-intrinsic-aux2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] - use std::any::{Any, TypeId}; pub struct A; diff --git a/src/test/run-pass/auxiliary/unstable-macros.rs b/src/test/run-pass/auxiliary/unstable-macros.rs index 6462c11af48..836164a721a 100644 --- a/src/test/run-pass/auxiliary/unstable-macros.rs +++ b/src/test/run-pass/auxiliary/unstable-macros.rs @@ -9,7 +9,7 @@ // except according to those terms. #![feature(staged_api)] -#![stable(feature = "unit_test", since = "0.0.0")] +#![stable(feature = "unit_test", since = "1.0.0")] #[unstable(feature = "unstable_macros", issue = "0")] #[macro_export] diff --git a/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs index 7fdc65a96e2..1d7230510df 100644 --- a/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn borrow(x: &isize, f: F) where F: FnOnce(&isize) { diff --git a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs index d97564a2914..a465c9cf811 100644 --- a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs +++ b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] struct A { a: isize, b: Box } diff --git a/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs index 158594df8ca..c3645867117 100644 --- a/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/borrowck/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck/borrowck-mut-uniq.rs index f535c5fcfc9..ec868bc5c85 100644 --- a/src/test/run-pass/borrowck/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck/borrowck-mut-uniq.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::mem::swap; diff --git a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs index 7ad81b6be6e..8c94df6dbf4 100644 --- a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs +++ b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] struct A { a: isize, b: Box } diff --git a/src/test/run-pass/c-stack-returning-int64.rs b/src/test/run-pass/c-stack-returning-int64.rs index 46b3fd1f1e7..56a0437146b 100644 --- a/src/test/run-pass/c-stack-returning-int64.rs +++ b/src/test/run-pass/c-stack-returning-int64.rs @@ -10,7 +10,7 @@ // ignore-wasm32-bare no libc to test with -#![feature(libc, std_misc)] +#![feature(libc)] extern crate libc; diff --git a/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs b/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs index d2eb5c33eae..ac309216250 100644 --- a/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs +++ b/src/test/run-pass/cancel-clean-via-immediate-rvalue-ref.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] fn foo(x: &mut Box) { diff --git a/src/test/run-pass/cci_borrow.rs b/src/test/run-pass/cci_borrow.rs index cd8f783a2e5..1535ddfb4de 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -10,7 +10,6 @@ // aux-build:cci_borrow_lib.rs -#![allow(unknown_features)] #![feature(box_syntax)] extern crate cci_borrow_lib; diff --git a/src/test/run-pass/child-outlives-parent.rs b/src/test/run-pass/child-outlives-parent.rs index e45f7c2bba6..03c80e49741 100644 --- a/src/test/run-pass/child-outlives-parent.rs +++ b/src/test/run-pass/child-outlives-parent.rs @@ -13,8 +13,6 @@ // pretty-expanded FIXME #23616 // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; fn child2(_s: String) { } diff --git a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs index da51ad761c7..04c4b2cb377 100644 --- a/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs +++ b/src/test/run-pass/class-cast-to-trait-cross-crate-2.rs @@ -10,7 +10,6 @@ // aux-build:cci_class_cast.rs -#![allow(unknown_features)] #![feature(box_syntax)] extern crate cci_class_cast; diff --git a/src/test/run-pass/class-separate-impl.rs b/src/test/run-pass/class-separate-impl.rs index 52853658c82..343d414758c 100644 --- a/src/test/run-pass/class-separate-impl.rs +++ b/src/test/run-pass/class-separate-impl.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::fmt; diff --git a/src/test/run-pass/cleanup-arm-conditional.rs b/src/test/run-pass/cleanup-arm-conditional.rs index 58d7c1df19c..dd900c56b40 100644 --- a/src/test/run-pass/cleanup-arm-conditional.rs +++ b/src/test/run-pass/cleanup-arm-conditional.rs @@ -13,7 +13,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax, os)] use std::os; diff --git a/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs b/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs index d813a6d8102..b117f4abd95 100644 --- a/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs +++ b/src/test/run-pass/cleanup-rvalue-during-if-and-while.rs @@ -8,12 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - // This test verifies that temporaries created for `while`'s and `if` // conditions are dropped after the condition is evaluated. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Temporary; diff --git a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs index c401b529c30..ae455d916b6 100644 --- a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -26,7 +26,6 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] #![feature(box_syntax)] use std::thread; diff --git a/src/test/run-pass/clone-with-exterior.rs b/src/test/run-pass/clone-with-exterior.rs index 384fb92954d..6ac7acd2a6b 100644 --- a/src/test/run-pass/clone-with-exterior.rs +++ b/src/test/run-pass/clone-with-exterior.rs @@ -10,8 +10,7 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] -#![feature(box_syntax, std_misc)] +#![feature(box_syntax)] use std::thread; diff --git a/src/test/run-pass/close-over-big-then-small-data.rs b/src/test/run-pass/close-over-big-then-small-data.rs index 99fdc346026..ba700e4e326 100644 --- a/src/test/run-pass/close-over-big-then-small-data.rs +++ b/src/test/run-pass/close-over-big-then-small-data.rs @@ -12,7 +12,6 @@ // storing closure data (as we used to do), the u64 would // overwrite the u16. -#![allow(unknown_features)] #![feature(box_syntax)] struct Pair { diff --git a/src/test/run-pass/coerce-expect-unsized.rs b/src/test/run-pass/coerce-expect-unsized.rs index a074aea9caa..5a1953b563a 100644 --- a/src/test/run-pass/coerce-expect-unsized.rs +++ b/src/test/run-pass/coerce-expect-unsized.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::cell::RefCell; diff --git a/src/test/run-pass/comm.rs b/src/test/run-pass/comm.rs index d7cb8bc991a..7c78cbdce08 100644 --- a/src/test/run-pass/comm.rs +++ b/src/test/run-pass/comm.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/core-run-destroy.rs b/src/test/run-pass/core-run-destroy.rs index 13118c48d6e..eaec9b1926a 100644 --- a/src/test/run-pass/core-run-destroy.rs +++ b/src/test/run-pass/core-run-destroy.rs @@ -16,7 +16,7 @@ // memory, which makes for some *confusing* logs. That's why these are here // instead of in std. -#![feature(libc, std_misc, duration)] +#![feature(libc, duration)] extern crate libc; diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index 028b3f43e2a..c0bc97b1f65 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] // This is a regression test that the metadata for the diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index fc97b22a4a9..0e65e5b43b7 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::cell::Cell; diff --git a/src/test/run-pass/deref.rs b/src/test/run-pass/deref.rs index 4722ddd64c8..0e6b3d87d34 100644 --- a/src/test/run-pass/deref.rs +++ b/src/test/run-pass/deref.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/deriving-associated-types.rs b/src/test/run-pass/deriving-associated-types.rs index 632ef5e0c8a..d3aaa3ded69 100644 --- a/src/test/run-pass/deriving-associated-types.rs +++ b/src/test/run-pass/deriving-associated-types.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] - pub trait DeclaredTrait { type Type; } diff --git a/src/test/run-pass/deriving-default-box.rs b/src/test/run-pass/deriving-default-box.rs index c9e5b014da3..70ac284cd30 100644 --- a/src/test/run-pass/deriving-default-box.rs +++ b/src/test/run-pass/deriving-default-box.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] use std::default::Default; diff --git a/src/test/run-pass/deriving-hash.rs b/src/test/run-pass/deriving-hash.rs index 18b2fbe015b..ceeb4266396 100644 --- a/src/test/run-pass/deriving-hash.rs +++ b/src/test/run-pass/deriving-hash.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(hash_default)] - use std::hash::{Hash, SipHasher, Hasher}; use std::mem::size_of; diff --git a/src/test/run-pass/drop-on-empty-block-exit.rs b/src/test/run-pass/drop-on-empty-block-exit.rs index 268de8ec55c..8dea648508d 100644 --- a/src/test/run-pass/drop-on-empty-block-exit.rs +++ b/src/test/run-pass/drop-on-empty-block-exit.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] enum t { foo(Box), } diff --git a/src/test/run-pass/drop-struct-as-object.rs b/src/test/run-pass/drop-struct-as-object.rs index 33d5c72772c..17603e11ddd 100644 --- a/src/test/run-pass/drop-struct-as-object.rs +++ b/src/test/run-pass/drop-struct-as-object.rs @@ -11,8 +11,6 @@ // Test that destructor on a struct runs successfully after the struct // is boxed and converted to an object. - -#![allow(unknown_features)] #![feature(box_syntax)] static mut value: usize = 0; diff --git a/src/test/run-pass/drop-trait-enum.rs b/src/test/run-pass/drop-trait-enum.rs index 912cb4c5e87..a6027615adb 100644 --- a/src/test/run-pass/drop-trait-enum.rs +++ b/src/test/run-pass/drop-trait-enum.rs @@ -10,7 +10,6 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] #![feature(box_syntax)] use std::thread; diff --git a/src/test/run-pass/dst-index.rs b/src/test/run-pass/dst-index.rs index 34a187fa6f2..6bda400a7cd 100644 --- a/src/test/run-pass/dst-index.rs +++ b/src/test/run-pass/dst-index.rs @@ -11,9 +11,6 @@ // Test that overloaded index expressions with DST result types // work and don't ICE. - -#![feature(core)] - use std::ops::Index; use std::fmt::Debug; diff --git a/src/test/run-pass/dst-struct.rs b/src/test/run-pass/dst-struct.rs index 56199c1aa61..40ca8472787 100644 --- a/src/test/run-pass/dst-struct.rs +++ b/src/test/run-pass/dst-struct.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Fat { diff --git a/src/test/run-pass/dst-trait.rs b/src/test/run-pass/dst-trait.rs index d8d7d9a28bf..a412306b966 100644 --- a/src/test/run-pass/dst-trait.rs +++ b/src/test/run-pass/dst-trait.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Fat { diff --git a/src/test/run-pass/dst-tuple.rs b/src/test/run-pass/dst-tuple.rs index 2f5b28495b8..7c2125d00f9 100644 --- a/src/test/run-pass/dst-tuple.rs +++ b/src/test/run-pass/dst-tuple.rs @@ -9,7 +9,6 @@ // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] #![feature(unsized_tuple_coercion)] diff --git a/src/test/run-pass/edition-keywords-2018-2015.rs b/src/test/run-pass/edition-keywords-2018-2015.rs index 4c22667d0bf..7d5de00cdb8 100644 --- a/src/test/run-pass/edition-keywords-2018-2015.rs +++ b/src/test/run-pass/edition-keywords-2018-2015.rs @@ -11,8 +11,6 @@ // edition:2018 // aux-build:edition-kw-macro-2015.rs -#![feature(raw_identifiers)] - #[macro_use] extern crate edition_kw_macro_2015; diff --git a/src/test/run-pass/edition-keywords-2018-2018.rs b/src/test/run-pass/edition-keywords-2018-2018.rs index 2a98b904da5..6462fc4da60 100644 --- a/src/test/run-pass/edition-keywords-2018-2018.rs +++ b/src/test/run-pass/edition-keywords-2018-2018.rs @@ -11,8 +11,6 @@ // edition:2018 // aux-build:edition-kw-macro-2018.rs -#![feature(raw_identifiers)] - #[macro_use] extern crate edition_kw_macro_2018; diff --git a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs index c8a1047cfa8..b5db8d91320 100644 --- a/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs +++ b/src/test/run-pass/enum-nullable-simplifycfg-misopt.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] /*! diff --git a/src/test/run-pass/env-home-dir.rs b/src/test/run-pass/env-home-dir.rs index 9bbff1eeb81..e92f24a2751 100644 --- a/src/test/run-pass/env-home-dir.rs +++ b/src/test/run-pass/env-home-dir.rs @@ -11,8 +11,6 @@ // ignore-cloudabi no environment variables present // ignore-emscripten env vars don't work? -#![feature(path)] - use std::env::*; use std::path::PathBuf; diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs index 1b50d3028b1..d2274ced556 100644 --- a/src/test/run-pass/explicit-self-generic.rs +++ b/src/test/run-pass/explicit-self-generic.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/explicit-self-objects-uniq.rs b/src/test/run-pass/explicit-self-objects-uniq.rs index 4021ae89e36..bb7e612a9f2 100644 --- a/src/test/run-pass/explicit-self-objects-uniq.rs +++ b/src/test/run-pass/explicit-self-objects-uniq.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait Foo { diff --git a/src/test/run-pass/explicit-self.rs b/src/test/run-pass/explicit-self.rs index d2a0d60eb66..11711e6ab74 100644 --- a/src/test/run-pass/explicit-self.rs +++ b/src/test/run-pass/explicit-self.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] static tau: f64 = 2.0*3.14159265358979323; diff --git a/src/test/run-pass/expr-block-generic-unique1.rs b/src/test/run-pass/expr-block-generic-unique1.rs index 1654c87c6a4..304f1c7a2ea 100644 --- a/src/test/run-pass/expr-block-generic-unique1.rs +++ b/src/test/run-pass/expr-block-generic-unique1.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { diff --git a/src/test/run-pass/expr-block-generic-unique2.rs b/src/test/run-pass/expr-block-generic-unique2.rs index 5477a9227aa..af3f5547867 100644 --- a/src/test/run-pass/expr-block-generic-unique2.rs +++ b/src/test/run-pass/expr-block-generic-unique2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn test_generic(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool { diff --git a/src/test/run-pass/expr-block-unique.rs b/src/test/run-pass/expr-block-unique.rs index eb24d70de90..2426ee5966c 100644 --- a/src/test/run-pass/expr-block-unique.rs +++ b/src/test/run-pass/expr-block-unique.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { let x: Box<_> = { box 100 }; assert_eq!(*x, 100); } diff --git a/src/test/run-pass/expr-if-unique.rs b/src/test/run-pass/expr-if-unique.rs index 12000fd54e7..a8547536603 100644 --- a/src/test/run-pass/expr-if-unique.rs +++ b/src/test/run-pass/expr-if-unique.rs @@ -8,12 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - -#![allow(unknown_features)] #![feature(box_syntax)] - // Tests for if as expressions returning boxed types fn test_box() { let rs: Box<_> = if true { box 100 } else { box 101 }; diff --git a/src/test/run-pass/expr-match-generic-unique1.rs b/src/test/run-pass/expr-match-generic-unique1.rs index 738fcecb2e0..3fce798c285 100644 --- a/src/test/run-pass/expr-match-generic-unique1.rs +++ b/src/test/run-pass/expr-match-generic-unique1.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn test_generic(expected: Box, eq: F) where F: FnOnce(Box, Box) -> bool { diff --git a/src/test/run-pass/expr-match-generic-unique2.rs b/src/test/run-pass/expr-match-generic-unique2.rs index 88ea2415241..5500edcf239 100644 --- a/src/test/run-pass/expr-match-generic-unique2.rs +++ b/src/test/run-pass/expr-match-generic-unique2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn test_generic(expected: T, eq: F) where F: FnOnce(T, T) -> bool { diff --git a/src/test/run-pass/expr-match-unique.rs b/src/test/run-pass/expr-match-unique.rs index e752c20a512..e66f09c63ea 100644 --- a/src/test/run-pass/expr-match-unique.rs +++ b/src/test/run-pass/expr-match-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] // Tests for match as expressions resulting in boxed types diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs index a27474dcf86..a29ea377947 100644 --- a/src/test/run-pass/extern-call-scrub.rs +++ b/src/test/run-pass/extern-call-scrub.rs @@ -14,7 +14,7 @@ // ignore-emscripten no threads support -#![feature(libc, std_misc)] +#![feature(libc)] extern crate libc; use std::thread; diff --git a/src/test/run-pass/foreign-fn-linkname.rs b/src/test/run-pass/foreign-fn-linkname.rs index ab8e4fbedcf..fd827efbfdd 100644 --- a/src/test/run-pass/foreign-fn-linkname.rs +++ b/src/test/run-pass/foreign-fn-linkname.rs @@ -10,7 +10,7 @@ // ignore-wasm32-bare no libc to test ffi with -#![feature(std_misc, libc)] +#![feature(libc)] extern crate libc; use std::ffi::CString; diff --git a/src/test/run-pass/fsu-moves-and-copies.rs b/src/test/run-pass/fsu-moves-and-copies.rs index e6ac8b52c51..efd7f66e93b 100644 --- a/src/test/run-pass/fsu-moves-and-copies.rs +++ b/src/test/run-pass/fsu-moves-and-copies.rs @@ -11,8 +11,6 @@ // Issue 4691: Ensure that functional-struct-updates operates // correctly and moves rather than copy when appropriate. - -#![allow(unknown_features)] #![feature(box_syntax, core)] struct ncint { v: isize } diff --git a/src/test/run-pass/func-arg-incomplete-pattern.rs b/src/test/run-pass/func-arg-incomplete-pattern.rs index 6030da44e4a..7d9501879d0 100644 --- a/src/test/run-pass/func-arg-incomplete-pattern.rs +++ b/src/test/run-pass/func-arg-incomplete-pattern.rs @@ -11,8 +11,6 @@ // Test that we do not leak when the arg pattern must drop part of the // argument (in this case, the `y` field). - -#![allow(unknown_features)] #![feature(box_syntax)] struct Foo { diff --git a/src/test/run-pass/func-arg-ref-pattern.rs b/src/test/run-pass/func-arg-ref-pattern.rs index ab565e7abca..5214f2d02f5 100644 --- a/src/test/run-pass/func-arg-ref-pattern.rs +++ b/src/test/run-pass/func-arg-ref-pattern.rs @@ -14,8 +14,6 @@ // boxes. Make sure that we don't free the box as we match the // pattern. - -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/futures-api.rs b/src/test/run-pass/futures-api.rs index 6cb975a9560..476cb48c0d2 100644 --- a/src/test/run-pass/futures-api.rs +++ b/src/test/run-pass/futures-api.rs @@ -23,7 +23,7 @@ use std::task::{ Context, Poll, Wake, Waker, LocalWaker, - Executor, SpawnObjError, + Spawn, SpawnObjError, local_waker, local_waker_from_nonlocal, }; @@ -42,9 +42,9 @@ unsafe fn wake_local(this: &Arc) { } } -struct NoopExecutor; +struct NoopSpawner; -impl Executor for NoopExecutor { +impl Spawn for NoopSpawner { fn spawn_obj(&mut self, _: FutureObj<'static, ()>) -> Result<(), SpawnObjError> { Ok(()) } @@ -59,7 +59,7 @@ fn poll(self: PinMut, cx: &mut Context) -> Poll { cx.waker().wake(); cx.waker().wake(); cx.local_waker().wake(); - cx.executor().spawn_obj(PinBox::new(MyFuture).into()).unwrap(); + cx.spawner().spawn_obj(PinBox::new(MyFuture).into()).unwrap(); Poll::Ready(()) } } @@ -70,8 +70,8 @@ fn test_local_waker() { nonlocal_wakes: AtomicUsize::new(0), }); let waker = unsafe { local_waker(counter.clone()) }; - let executor = &mut NoopExecutor; - let cx = &mut Context::new(&waker, executor); + let spawner = &mut NoopSpawner; + let cx = &mut Context::new(&waker, spawner); assert_eq!(Poll::Ready(()), PinMut::new(&mut MyFuture).poll(cx)); assert_eq!(1, counter.local_wakes.load(atomic::Ordering::SeqCst)); assert_eq!(2, counter.nonlocal_wakes.load(atomic::Ordering::SeqCst)); @@ -83,8 +83,8 @@ fn test_local_as_nonlocal_waker() { nonlocal_wakes: AtomicUsize::new(0), }); let waker: LocalWaker = local_waker_from_nonlocal(counter.clone()); - let executor = &mut NoopExecutor; - let cx = &mut Context::new(&waker, executor); + let spawner = &mut NoopSpawner; + let cx = &mut Context::new(&waker, spawner); assert_eq!(Poll::Ready(()), PinMut::new(&mut MyFuture).poll(cx)); assert_eq!(0, counter.local_wakes.load(atomic::Ordering::SeqCst)); assert_eq!(3, counter.nonlocal_wakes.load(atomic::Ordering::SeqCst)); diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index b8d7c2140be..c4fd3119615 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn id(t: T) -> T { return t; } diff --git a/src/test/run-pass/generic-exterior-unique.rs b/src/test/run-pass/generic-exterior-unique.rs index 8dbe6de8388..64091d2926c 100644 --- a/src/test/run-pass/generic-exterior-unique.rs +++ b/src/test/run-pass/generic-exterior-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Recbox {x: Box} diff --git a/src/test/run-pass/generic-extern-mangle.rs b/src/test/run-pass/generic-extern-mangle.rs index 67aea1f9f8a..debe3706891 100644 --- a/src/test/run-pass/generic-extern-mangle.rs +++ b/src/test/run-pass/generic-extern-mangle.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] - use std::ops::Add; extern "C" fn foo(a: T, b: T) -> T::Output { a + b } diff --git a/src/test/run-pass/generic-fn-unique.rs b/src/test/run-pass/generic-fn-unique.rs index 6599aa74124..3585cd2e079 100644 --- a/src/test/run-pass/generic-fn-unique.rs +++ b/src/test/run-pass/generic-fn-unique.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn f(x: Box) -> Box { return x; } diff --git a/src/test/run-pass/generic-object.rs b/src/test/run-pass/generic-object.rs index 0a59a925a5f..7e737fe00af 100644 --- a/src/test/run-pass/generic-object.rs +++ b/src/test/run-pass/generic-object.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait Foo { diff --git a/src/test/run-pass/generic-recursive-tag.rs b/src/test/run-pass/generic-recursive-tag.rs index 433bd7cd906..ca2bf0ac224 100644 --- a/src/test/run-pass/generic-recursive-tag.rs +++ b/src/test/run-pass/generic-recursive-tag.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] enum list { cons(Box, Box>), nil, } diff --git a/src/test/run-pass/generic-tag.rs b/src/test/run-pass/generic-tag.rs index 75fd9fcb7b6..a79465c8cd8 100644 --- a/src/test/run-pass/generic-tag.rs +++ b/src/test/run-pass/generic-tag.rs @@ -12,7 +12,6 @@ #![allow(dead_assignment)] #![allow(unused_variables)] -#![allow(unknown_features)] #![feature(box_syntax)] enum option { some(Box), none, } diff --git a/src/test/run-pass/generic-unique.rs b/src/test/run-pass/generic-unique.rs index 21e9a9a80d0..1b1355ea336 100644 --- a/src/test/run-pass/generic-unique.rs +++ b/src/test/run-pass/generic-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Triple { x: T, y: T, z: T } diff --git a/src/test/run-pass/hashmap-memory.rs b/src/test/run-pass/hashmap-memory.rs index bd90ce683c4..2e98e0fe5ca 100644 --- a/src/test/run-pass/hashmap-memory.rs +++ b/src/test/run-pass/hashmap-memory.rs @@ -10,9 +10,6 @@ // ignore-emscripten No support for threads -#![allow(unknown_features)] -#![feature(std_misc)] - /** A somewhat reduced test case to expose some Valgrind issues. diff --git a/src/test/run-pass/hrtb-precedence-of-plus.rs b/src/test/run-pass/hrtb-precedence-of-plus.rs index 516278df178..511d3234857 100644 --- a/src/test/run-pass/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/hrtb-precedence-of-plus.rs @@ -10,8 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] - // Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) + // 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would // cause a compilation error. Issue #18772. diff --git a/src/test/run-pass/init-large-type.rs b/src/test/run-pass/init-large-type.rs index 2ff024a693a..c8f9a0e4cab 100644 --- a/src/test/run-pass/init-large-type.rs +++ b/src/test/run-pass/init-large-type.rs @@ -15,7 +15,7 @@ // pretty-expanded FIXME #23616 // ignore-emscripten no threads support -#![feature(intrinsics, std_misc)] +#![feature(intrinsics)] use std::thread; diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs index a675528424e..4b11158e8c3 100644 --- a/src/test/run-pass/intrinsic-atomics.rs +++ b/src/test/run-pass/intrinsic-atomics.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] #![feature(intrinsics)] diff --git a/src/test/run-pass/issue-10682.rs b/src/test/run-pass/issue-10682.rs index c049bdfe83c..67b73bdadbb 100644 --- a/src/test/run-pass/issue-10682.rs +++ b/src/test/run-pass/issue-10682.rs @@ -13,7 +13,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] fn work(_: Box) {} diff --git a/src/test/run-pass/issue-10767.rs b/src/test/run-pass/issue-10767.rs index b5ef6020b57..2184aa00fa4 100644 --- a/src/test/run-pass/issue-10767.rs +++ b/src/test/run-pass/issue-10767.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/issue-10802.rs b/src/test/run-pass/issue-10802.rs index 2256315a379..1e700d4e18b 100644 --- a/src/test/run-pass/issue-10802.rs +++ b/src/test/run-pass/issue-10802.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct DroppableStruct; diff --git a/src/test/run-pass/issue-11552.rs b/src/test/run-pass/issue-11552.rs index 5193330a45a..aa980e48c5e 100644 --- a/src/test/run-pass/issue-11552.rs +++ b/src/test/run-pass/issue-11552.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issue-13259-windows-tcb-trash.rs b/src/test/run-pass/issue-13259-windows-tcb-trash.rs index cca27aebfa4..634046e86ee 100644 --- a/src/test/run-pass/issue-13259-windows-tcb-trash.rs +++ b/src/test/run-pass/issue-13259-windows-tcb-trash.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(libc, std_misc)] +#![feature(libc)] extern crate libc; diff --git a/src/test/run-pass/issue-13304.rs b/src/test/run-pass/issue-13304.rs index 264db106491..36036ae241e 100644 --- a/src/test/run-pass/issue-13304.rs +++ b/src/test/run-pass/issue-13304.rs @@ -11,8 +11,6 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(io, process_capture)] - use std::env; use std::io::prelude::*; use std::io; diff --git a/src/test/run-pass/issue-13323.rs b/src/test/run-pass/issue-13323.rs index 68c6ce7a7b7..de72d7152f8 100644 --- a/src/test/run-pass/issue-13323.rs +++ b/src/test/run-pass/issue-13323.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct StrWrap { diff --git a/src/test/run-pass/issue-14399.rs b/src/test/run-pass/issue-14399.rs index aa91f125e48..d5c67bea099 100644 --- a/src/test/run-pass/issue-14399.rs +++ b/src/test/run-pass/issue-14399.rs @@ -15,7 +15,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(Clone)] diff --git a/src/test/run-pass/issue-14456.rs b/src/test/run-pass/issue-14456.rs index c4745a6e1f1..601fafbf02e 100644 --- a/src/test/run-pass/issue-14456.rs +++ b/src/test/run-pass/issue-14456.rs @@ -11,8 +11,6 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(io, process_capture)] - use std::env; use std::io::prelude::*; use std::io; diff --git a/src/test/run-pass/issue-15571.rs b/src/test/run-pass/issue-15571.rs index 3dc76f4a089..35915a62102 100644 --- a/src/test/run-pass/issue-15571.rs +++ b/src/test/run-pass/issue-15571.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn match_on_local() { diff --git a/src/test/run-pass/issue-15734.rs b/src/test/run-pass/issue-15734.rs index daf14b4c2ff..5a35239cf72 100644 --- a/src/test/run-pass/issue-15734.rs +++ b/src/test/run-pass/issue-15734.rs @@ -11,9 +11,6 @@ // If `Index` used an associated type for its output, this test would // work more smoothly. - -#![feature(core)] - use std::ops::Index; struct Mat { data: Vec, cols: usize, } diff --git a/src/test/run-pass/issue-15763.rs b/src/test/run-pass/issue-15763.rs index 0baaaac2676..e1176d47063 100644 --- a/src/test/run-pass/issue-15763.rs +++ b/src/test/run-pass/issue-15763.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(PartialEq, Debug)] diff --git a/src/test/run-pass/issue-16668.rs b/src/test/run-pass/issue-16668.rs index 5613211b31d..7944e80a428 100644 --- a/src/test/run-pass/issue-16668.rs +++ b/src/test/run-pass/issue-16668.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] - struct Parser<'a, I, O> { parse: Box Result + 'a> } diff --git a/src/test/run-pass/issue-16739.rs b/src/test/run-pass/issue-16739.rs index ca2b9209eba..2bdedfebe3e 100644 --- a/src/test/run-pass/issue-16739.rs +++ b/src/test/run-pass/issue-16739.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] #![feature(unboxed_closures, fn_traits)] diff --git a/src/test/run-pass/issue-16774.rs b/src/test/run-pass/issue-16774.rs index 9ec5910c2f6..1309d2ffab8 100644 --- a/src/test/run-pass/issue-16774.rs +++ b/src/test/run-pass/issue-16774.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] #![feature(box_patterns)] diff --git a/src/test/run-pass/issue-17322.rs b/src/test/run-pass/issue-17322.rs index a9f5476d0f8..c94345f794d 100644 --- a/src/test/run-pass/issue-17322.rs +++ b/src/test/run-pass/issue-17322.rs @@ -10,8 +10,7 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] -#![feature(box_syntax, io)] +#![feature(box_syntax)] use std::io::{self, Write}; diff --git a/src/test/run-pass/issue-17351.rs b/src/test/run-pass/issue-17351.rs index 6e93194647a..88f83a300a7 100644 --- a/src/test/run-pass/issue-17351.rs +++ b/src/test/run-pass/issue-17351.rs @@ -10,8 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - trait Str { fn foo(&self) {} } impl Str for str {} impl<'a, S: ?Sized> Str for &'a S where S: Str {} diff --git a/src/test/run-pass/issue-20091.rs b/src/test/run-pass/issue-20091.rs index f84cfd232f2..7671b43d493 100644 --- a/src/test/run-pass/issue-20091.rs +++ b/src/test/run-pass/issue-20091.rs @@ -11,7 +11,7 @@ // ignore-cloudabi no processes // ignore-emscripten no processes -#![feature(std_misc, os)] +#![feature(os)] #[cfg(unix)] fn main() { diff --git a/src/test/run-pass/issue-20454.rs b/src/test/run-pass/issue-20454.rs index 522f544a21c..15cb79ac6a8 100644 --- a/src/test/run-pass/issue-20454.rs +++ b/src/test/run-pass/issue-20454.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] - use std::thread; fn _foo() { diff --git a/src/test/run-pass/issue-21562.rs b/src/test/run-pass/issue-21562.rs index aa784ba432c..51896786d0c 100644 --- a/src/test/run-pass/issue-21562.rs +++ b/src/test/run-pass/issue-21562.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] - extern crate core; use core::marker::Sync; diff --git a/src/test/run-pass/issue-22346.rs b/src/test/run-pass/issue-22346.rs index 8538950a895..895b9d222a8 100644 --- a/src/test/run-pass/issue-22346.rs +++ b/src/test/run-pass/issue-22346.rs @@ -10,8 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - // This used to cause an ICE because the retslot for the "return" had the wrong type fn testcase<'a>() -> Box + 'a> { return Box::new((0..3).map(|i| { return i; })); diff --git a/src/test/run-pass/issue-22577.rs b/src/test/run-pass/issue-22577.rs index ec4be812f9a..83ffdb3bf44 100644 --- a/src/test/run-pass/issue-22577.rs +++ b/src/test/run-pass/issue-22577.rs @@ -11,8 +11,6 @@ // pretty-expanded FIXME #23616 // ignore-cloudabi no std::fs -#![feature(fs, net)] - use std::{fs, net}; fn assert_both() {} diff --git a/src/test/run-pass/issue-2288.rs b/src/test/run-pass/issue-2288.rs index 379715f5390..b8353ea4413 100644 --- a/src/test/run-pass/issue-2288.rs +++ b/src/test/run-pass/issue-2288.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] trait clam { diff --git a/src/test/run-pass/issue-2633-2.rs b/src/test/run-pass/issue-2633-2.rs index 7b5a055d334..b955947c410 100644 --- a/src/test/run-pass/issue-2633-2.rs +++ b/src/test/run-pass/issue-2633-2.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issue-2708.rs b/src/test/run-pass/issue-2708.rs index d3916db3f75..cf565b9f901 100644 --- a/src/test/run-pass/issue-2708.rs +++ b/src/test/run-pass/issue-2708.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] struct Font { diff --git a/src/test/run-pass/issue-2718.rs b/src/test/run-pass/issue-2718.rs index 2da2f1e82a6..d59f2956ee4 100644 --- a/src/test/run-pass/issue-2718.rs +++ b/src/test/run-pass/issue-2718.rs @@ -9,8 +9,6 @@ // except according to those terms. // -#![feature(std_misc)] - pub type Task = isize; // tjc: I don't know why diff --git a/src/test/run-pass/issue-2734.rs b/src/test/run-pass/issue-2734.rs index 18cd9a87e6b..916e3dd689f 100644 --- a/src/test/run-pass/issue-2734.rs +++ b/src/test/run-pass/issue-2734.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] trait hax { diff --git a/src/test/run-pass/issue-2735.rs b/src/test/run-pass/issue-2735.rs index cd6c6a59e2a..af8eef557f8 100644 --- a/src/test/run-pass/issue-2735.rs +++ b/src/test/run-pass/issue-2735.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] trait hax { diff --git a/src/test/run-pass/issue-2935.rs b/src/test/run-pass/issue-2935.rs index 511344a792f..b2ea183e9f8 100644 --- a/src/test/run-pass/issue-2935.rs +++ b/src/test/run-pass/issue-2935.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] //type t = { a: isize }; diff --git a/src/test/run-pass/issue-3121.rs b/src/test/run-pass/issue-3121.rs index 6e9ee7fb15c..a0bdcf18ec5 100644 --- a/src/test/run-pass/issue-3121.rs +++ b/src/test/run-pass/issue-3121.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/issue-3290.rs b/src/test/run-pass/issue-3290.rs index b09820146f5..6c775e15fb5 100644 --- a/src/test/run-pass/issue-3290.rs +++ b/src/test/run-pass/issue-3290.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/issue-3447.rs b/src/test/run-pass/issue-3447.rs index 12c2155dd57..1558d94bae7 100644 --- a/src/test/run-pass/issue-3447.rs +++ b/src/test/run-pass/issue-3447.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::cell::RefCell; diff --git a/src/test/run-pass/issue-3563-3.rs b/src/test/run-pass/issue-3563-3.rs index ecee2fd0faa..56208d08779 100644 --- a/src/test/run-pass/issue-3563-3.rs +++ b/src/test/run-pass/issue-3563-3.rs @@ -22,8 +22,6 @@ // that are already linked in. Using WriterUtil allows us to use the write_line // method. -#![feature(core)] - use std::fmt; use std::iter::repeat; use std::slice; diff --git a/src/test/run-pass/issue-3609.rs b/src/test/run-pass/issue-3609.rs index d1bf7e066cb..f53053f2edc 100644 --- a/src/test/run-pass/issue-3609.rs +++ b/src/test/run-pass/issue-3609.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::Sender; diff --git a/src/test/run-pass/issue-3753.rs b/src/test/run-pass/issue-3753.rs index e81025d8464..e6eb8efe442 100644 --- a/src/test/run-pass/issue-3753.rs +++ b/src/test/run-pass/issue-3753.rs @@ -12,8 +12,6 @@ // Issue Name: pub method preceded by attribute can't be parsed // Abstract: Visibility parsing failed when compiler parsing -#![feature(core)] - use std::f64; #[derive(Copy, Clone)] diff --git a/src/test/run-pass/issue-3794.rs b/src/test/run-pass/issue-3794.rs index 3d5f38e38cc..badb833ee80 100644 --- a/src/test/run-pass/issue-3794.rs +++ b/src/test/run-pass/issue-3794.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] trait T { diff --git a/src/test/run-pass/issue-38226.rs b/src/test/run-pass/issue-38226.rs index 33604212af9..dd9f9be7da7 100644 --- a/src/test/run-pass/issue-38226.rs +++ b/src/test/run-pass/issue-38226.rs @@ -15,7 +15,7 @@ // Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty // code gets optimized out: -// compile-flags: -Cno-prepopulate-passes +// compile-flags: -Cno-prepopulate-passes -Cpasses=name-anon-globals extern crate issue_38226_aux; diff --git a/src/test/run-pass/issue-3878.rs b/src/test/run-pass/issue-3878.rs index 5d094af2149..e0e11b4fd86 100644 --- a/src/test/run-pass/issue-3878.rs +++ b/src/test/run-pass/issue-3878.rs @@ -11,7 +11,6 @@ // pretty-expanded FIXME #23616 #![allow(path_statements)] -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/issue-4333.rs b/src/test/run-pass/issue-4333.rs index 48753e15a70..a84d7f3fe82 100644 --- a/src/test/run-pass/issue-4333.rs +++ b/src/test/run-pass/issue-4333.rs @@ -10,8 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(io)] - use std::io; pub fn main() { diff --git a/src/test/run-pass/issue-4759.rs b/src/test/run-pass/issue-4759.rs index a26d6b05d7e..7788a8f3ec2 100644 --- a/src/test/run-pass/issue-4759.rs +++ b/src/test/run-pass/issue-4759.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] struct T { a: Box } diff --git a/src/test/run-pass/issue-5192.rs b/src/test/run-pass/issue-5192.rs index d8f7f25508d..0758ace42da 100644 --- a/src/test/run-pass/issue-5192.rs +++ b/src/test/run-pass/issue-5192.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub trait EventLoop { diff --git a/src/test/run-pass/issue-52169.rs b/src/test/run-pass/issue-52169.rs new file mode 100644 index 00000000000..f2163416922 --- /dev/null +++ b/src/test/run-pass/issue-52169.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(macro_literal_matcher)] + +macro_rules! a { + ($i:literal) => { "right" }; + ($i:tt) => { "wrong" }; +} + +macro_rules! b { + ($i:literal) => { a!($i) }; +} + +fn main() { + assert_eq!(b!(0), "right"); +} diff --git a/src/test/run-pass/issue-5666.rs b/src/test/run-pass/issue-5666.rs index e28a929d527..eba83227f44 100644 --- a/src/test/run-pass/issue-5666.rs +++ b/src/test/run-pass/issue-5666.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] struct Dog { diff --git a/src/test/run-pass/issue-5718.rs b/src/test/run-pass/issue-5718.rs index 964809631d9..0bc9a07cb00 100644 --- a/src/test/run-pass/issue-5718.rs +++ b/src/test/run-pass/issue-5718.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] struct Element; diff --git a/src/test/run-pass/issue-5884.rs b/src/test/run-pass/issue-5884.rs index 2096bebd2b2..c3247876c7a 100644 --- a/src/test/run-pass/issue-5884.rs +++ b/src/test/run-pass/issue-5884.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub struct Foo { diff --git a/src/test/run-pass/issue-6318.rs b/src/test/run-pass/issue-6318.rs index 12b71f519b1..69c7ec4cf1f 100644 --- a/src/test/run-pass/issue-6318.rs +++ b/src/test/run-pass/issue-6318.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub enum Thing { diff --git a/src/test/run-pass/issue-6557.rs b/src/test/run-pass/issue-6557.rs index eba87f418e4..109383b343b 100644 --- a/src/test/run-pass/issue-6557.rs +++ b/src/test/run-pass/issue-6557.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs index 43b5a997c19..f5acebf3a66 100644 --- a/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/run-pass/issue-7673-cast-generically-implemented-trait.rs @@ -16,7 +16,6 @@ */ -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() {} diff --git a/src/test/run-pass/issue-8827.rs b/src/test/run-pass/issue-8827.rs index 6e01131cfca..6b573698a36 100644 --- a/src/test/run-pass/issue-8827.rs +++ b/src/test/run-pass/issue-8827.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::{channel, Receiver}; diff --git a/src/test/run-pass/issue-9129.rs b/src/test/run-pass/issue-9129.rs index a9f29fdb38c..485f10357b3 100644 --- a/src/test/run-pass/issue-9129.rs +++ b/src/test/run-pass/issue-9129.rs @@ -10,7 +10,6 @@ // ignore-pretty unreported -#![allow(unknown_features)] #![feature(box_syntax)] pub trait bomb { fn boom(&self, _: Ident); } diff --git a/src/test/run-pass/issue-9382.rs b/src/test/run-pass/issue-9382.rs index fb7ffdcd515..7538e55fd95 100644 --- a/src/test/run-pass/issue-9382.rs +++ b/src/test/run-pass/issue-9382.rs @@ -11,7 +11,6 @@ // except according to those terms. #![allow(unnecessary_allocation)] -#![allow(unknown_features)] #![feature(box_syntax)] // Tests for a previous bug that occurred due to an interaction diff --git a/src/test/run-pass/ivec-tag.rs b/src/test/run-pass/ivec-tag.rs index a511db8e939..0da1d18afd8 100644 --- a/src/test/run-pass/ivec-tag.rs +++ b/src/test/run-pass/ivec-tag.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs index a81c0846a27..1c5d8a69bf3 100644 --- a/src/test/run-pass/kindck-implicit-close-over-mut-var.rs +++ b/src/test/run-pass/kindck-implicit-close-over-mut-var.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] - use std::thread; fn user(_i: isize) {} diff --git a/src/test/run-pass/kindck-owned-trait-contains-1.rs b/src/test/run-pass/kindck-owned-trait-contains-1.rs index 9df72f4760a..9b56666fd46 100644 --- a/src/test/run-pass/kindck-owned-trait-contains-1.rs +++ b/src/test/run-pass/kindck-owned-trait-contains-1.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] trait repeat { fn get(&self) -> A; } diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 35a17150787..cb2a2061406 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -10,7 +10,6 @@ // Make sure #1399 stays fixed -#![allow(unknown_features)] #![feature(box_syntax)] struct A { a: Box } diff --git a/src/test/run-pass/leak-unique-as-tydesc.rs b/src/test/run-pass/leak-unique-as-tydesc.rs index 30838b3121a..d89888927e1 100644 --- a/src/test/run-pass/leak-unique-as-tydesc.rs +++ b/src/test/run-pass/leak-unique-as-tydesc.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] fn leaky(_t: T) { } diff --git a/src/test/run-pass/let-assignability.rs b/src/test/run-pass/let-assignability.rs index c53bc83ef6b..69b0eab99f7 100644 --- a/src/test/run-pass/let-assignability.rs +++ b/src/test/run-pass/let-assignability.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn f() { diff --git a/src/test/run-pass/list.rs b/src/test/run-pass/list.rs index 8f0cbf96b60..37612415555 100644 --- a/src/test/run-pass/list.rs +++ b/src/test/run-pass/list.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] enum list { cons(isize, Box), nil, } diff --git a/src/test/run-pass/match-implicit-copy-unique.rs b/src/test/run-pass/match-implicit-copy-unique.rs index caf76b3ab2f..10de6eeabdd 100644 --- a/src/test/run-pass/match-implicit-copy-unique.rs +++ b/src/test/run-pass/match-implicit-copy-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Pair { a: Box, b: Box } diff --git a/src/test/run-pass/match-unique-bind.rs b/src/test/run-pass/match-unique-bind.rs index 78b02d709e2..ca864c05cfd 100644 --- a/src/test/run-pass/match-unique-bind.rs +++ b/src/test/run-pass/match-unique-bind.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/match-value-binding-in-guard-3291.rs b/src/test/run-pass/match-value-binding-in-guard-3291.rs index d4f4f3bb27e..ab56a8cfc93 100644 --- a/src/test/run-pass/match-value-binding-in-guard-3291.rs +++ b/src/test/run-pass/match-value-binding-in-guard-3291.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] fn foo(x: Option>, b: bool) -> isize { diff --git a/src/test/run-pass/method-self-arg-aux1.rs b/src/test/run-pass/method-self-arg-aux1.rs index e7615711b4c..2572baf68fd 100644 --- a/src/test/run-pass/method-self-arg-aux1.rs +++ b/src/test/run-pass/method-self-arg-aux1.rs @@ -10,8 +10,6 @@ // Test method calls with self as an argument (cross-crate) - -#![allow(unknown_features)] #![feature(box_syntax)] // aux-build:method_self_arg1.rs diff --git a/src/test/run-pass/method-self-arg-aux2.rs b/src/test/run-pass/method-self-arg-aux2.rs index 0a1efc96fcf..51de69ff01f 100644 --- a/src/test/run-pass/method-self-arg-aux2.rs +++ b/src/test/run-pass/method-self-arg-aux2.rs @@ -10,8 +10,6 @@ // Test method calls with self as an argument (cross-crate) - -#![allow(unknown_features)] #![feature(box_syntax)] // aux-build:method_self_arg2.rs diff --git a/src/test/run-pass/method-self-arg-trait.rs b/src/test/run-pass/method-self-arg-trait.rs index d93cf2b0983..34e849bd0d2 100644 --- a/src/test/run-pass/method-self-arg-trait.rs +++ b/src/test/run-pass/method-self-arg-trait.rs @@ -10,8 +10,6 @@ // Test method calls with self as an argument - -#![allow(unknown_features)] #![feature(box_syntax)] static mut COUNT: u64 = 1; diff --git a/src/test/run-pass/method-self-arg.rs b/src/test/run-pass/method-self-arg.rs index 4361c9b0563..b7fb2fa138d 100644 --- a/src/test/run-pass/method-self-arg.rs +++ b/src/test/run-pass/method-self-arg.rs @@ -10,8 +10,6 @@ // Test method calls with self as an argument - -#![allow(unknown_features)] #![feature(box_syntax)] static mut COUNT: usize = 1; diff --git a/src/test/run-pass/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/method-two-trait-defer-resolution-2.rs index 82d747b6c27..f403f526039 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-2.rs @@ -19,8 +19,6 @@ // codegen the call as `Foo::foo(&x)` and let the specific impl get // chosen later. - -#![allow(unknown_features)] #![feature(box_syntax)] trait Foo { diff --git a/src/test/run-pass/method-two-traits-distinguished-via-where-clause.rs b/src/test/run-pass/method-two-traits-distinguished-via-where-clause.rs index 77072bdec90..3f0f4f35745 100644 --- a/src/test/run-pass/method-two-traits-distinguished-via-where-clause.rs +++ b/src/test/run-pass/method-two-traits-distinguished-via-where-clause.rs @@ -13,8 +13,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - trait A { fn foo(self); } diff --git a/src/test/run-pass/move-1-unique.rs b/src/test/run-pass/move-1-unique.rs index 34a3bdf8765..5c8dd41c646 100644 --- a/src/test/run-pass/move-1-unique.rs +++ b/src/test/run-pass/move-1-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(Clone)] diff --git a/src/test/run-pass/move-2-unique.rs b/src/test/run-pass/move-2-unique.rs index 2babf19e164..0b67e54e234 100644 --- a/src/test/run-pass/move-2-unique.rs +++ b/src/test/run-pass/move-2-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct X { x: isize, y: isize, z: isize } diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index 926e28ed155..0fbc2de91e6 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct X { x: isize, y: isize, z: isize } diff --git a/src/test/run-pass/move-3-unique.rs b/src/test/run-pass/move-3-unique.rs index 360593ffe48..36ad3a40b3f 100644 --- a/src/test/run-pass/move-3-unique.rs +++ b/src/test/run-pass/move-3-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(Clone)] diff --git a/src/test/run-pass/move-4-unique.rs b/src/test/run-pass/move-4-unique.rs index 153da8e1339..266e34c98a4 100644 --- a/src/test/run-pass/move-4-unique.rs +++ b/src/test/run-pass/move-4-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Triple {a: isize, b: isize, c: isize} diff --git a/src/test/run-pass/move-4.rs b/src/test/run-pass/move-4.rs index 1346860d51d..481068869e3 100644 --- a/src/test/run-pass/move-4.rs +++ b/src/test/run-pass/move-4.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Triple { a: isize, b: isize, c: isize } diff --git a/src/test/run-pass/move-arg-2-unique.rs b/src/test/run-pass/move-arg-2-unique.rs index 0ff5a66adc2..b6e225cc8b7 100644 --- a/src/test/run-pass/move-arg-2-unique.rs +++ b/src/test/run-pass/move-arg-2-unique.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn test(foo: Box> ) { assert_eq!((*foo)[0], 10); } diff --git a/src/test/run-pass/move-arg-2.rs b/src/test/run-pass/move-arg-2.rs index 8de487bc363..78774854c9f 100644 --- a/src/test/run-pass/move-arg-2.rs +++ b/src/test/run-pass/move-arg-2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn test(foo: Box>) { assert_eq!((*foo)[0], 10); } diff --git a/src/test/run-pass/moves-based-on-type-capture-clause.rs b/src/test/run-pass/moves-based-on-type-capture-clause.rs index d3c028070fd..548a62f4603 100644 --- a/src/test/run-pass/moves-based-on-type-capture-clause.rs +++ b/src/test/run-pass/moves-based-on-type-capture-clause.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; pub fn main() { diff --git a/src/test/run-pass/mut-function-arguments.rs b/src/test/run-pass/mut-function-arguments.rs index 010f656d531..bf4d4ea921a 100644 --- a/src/test/run-pass/mut-function-arguments.rs +++ b/src/test/run-pass/mut-function-arguments.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn f(mut y: Box) { diff --git a/src/test/run-pass/new-box.rs b/src/test/run-pass/new-box.rs index 17f71c3de43..d6881ea90af 100644 --- a/src/test/run-pass/new-box.rs +++ b/src/test/run-pass/new-box.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn f(x: Box) { diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index 7e8d082a286..d33102a38f9 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] // Iota-reduction is a rule in the Calculus of (Co-)Inductive Constructions, diff --git a/src/test/run-pass/object-one-type-two-traits.rs b/src/test/run-pass/object-one-type-two-traits.rs index aa2dbf03bb2..284beccdb29 100644 --- a/src/test/run-pass/object-one-type-two-traits.rs +++ b/src/test/run-pass/object-one-type-two-traits.rs @@ -11,7 +11,6 @@ // Testing creating two vtables with the same self type, but different // traits. -#![allow(unknown_features)] #![feature(box_syntax)] use std::any::Any; diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs index 768f126e4ed..c27bc62ada8 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-headerless.rs @@ -12,8 +12,6 @@ // closed over do not contain managed values, and thus the boxes do // not have headers. - -#![allow(unknown_features)] #![feature(box_syntax)] diff --git a/src/test/run-pass/objects-owned-object-owned-method.rs b/src/test/run-pass/objects-owned-object-owned-method.rs index 71ed995e76c..5d9658dc15d 100644 --- a/src/test/run-pass/objects-owned-object-owned-method.rs +++ b/src/test/run-pass/objects-owned-object-owned-method.rs @@ -12,8 +12,6 @@ // closed over contain managed values. This implies that the boxes // will have headers that must be skipped over. - -#![allow(unknown_features)] #![feature(box_syntax)] trait FooTrait { diff --git a/src/test/run-pass/operator-overloading.rs b/src/test/run-pass/operator-overloading.rs index 045af79189a..c3a1164ba9c 100644 --- a/src/test/run-pass/operator-overloading.rs +++ b/src/test/run-pass/operator-overloading.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(core)] - use std::cmp; use std::ops; diff --git a/src/test/run-pass/output-slot-variants.rs b/src/test/run-pass/output-slot-variants.rs index 4c3017c066e..2171b8c481d 100644 --- a/src/test/run-pass/output-slot-variants.rs +++ b/src/test/run-pass/output-slot-variants.rs @@ -12,7 +12,6 @@ #![allow(dead_assignment)] #![allow(unused_variables)] -#![allow(unknown_features)] #![feature(box_syntax)] struct A { a: isize, b: isize } diff --git a/src/test/run-pass/overloaded-autoderef.rs b/src/test/run-pass/overloaded-autoderef.rs index d9ffbe51aa5..759e2aace61 100644 --- a/src/test/run-pass/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded-autoderef.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax, core)] use std::cell::RefCell; diff --git a/src/test/run-pass/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded-index-assoc-list.rs index e0f61fd8497..50140d1aab9 100644 --- a/src/test/run-pass/overloaded-index-assoc-list.rs +++ b/src/test/run-pass/overloaded-index-assoc-list.rs @@ -11,9 +11,6 @@ // Test overloading of the `[]` operator. In particular test that it // takes its argument *by reference*. - -#![feature(core)] - use std::ops::Index; struct AssociationList { diff --git a/src/test/run-pass/overloaded-index-autoderef.rs b/src/test/run-pass/overloaded-index-autoderef.rs index efa00514934..9988599d59d 100644 --- a/src/test/run-pass/overloaded-index-autoderef.rs +++ b/src/test/run-pass/overloaded-index-autoderef.rs @@ -10,8 +10,6 @@ // Test overloaded indexing combined with autoderef. - -#![allow(unknown_features)] #![feature(box_syntax, core)] use std::ops::{Index, IndexMut}; diff --git a/src/test/run-pass/overloaded-index-in-field.rs b/src/test/run-pass/overloaded-index-in-field.rs index ff867e76810..7e2b586631d 100644 --- a/src/test/run-pass/overloaded-index-in-field.rs +++ b/src/test/run-pass/overloaded-index-in-field.rs @@ -11,9 +11,6 @@ // Test using overloaded indexing when the "map" is stored in a // field. This caused problems at some point. - -#![feature(core)] - use std::ops::Index; struct Foo { diff --git a/src/test/run-pass/overloaded-index.rs b/src/test/run-pass/overloaded-index.rs index fa3c107697e..b54a18f722a 100644 --- a/src/test/run-pass/overloaded-index.rs +++ b/src/test/run-pass/overloaded-index.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![feature(core)] - use std::ops::{Index, IndexMut}; struct Foo { diff --git a/src/test/run-pass/panic-handler-chain.rs b/src/test/run-pass/panic-handler-chain.rs index 8d692f2241b..e2de795bdb7 100644 --- a/src/test/run-pass/panic-handler-chain.rs +++ b/src/test/run-pass/panic-handler-chain.rs @@ -10,7 +10,7 @@ // ignore-emscripten no threads support -#![feature(panic_handler, std_panic)] +#![feature(std_panic)] use std::sync::atomic::{AtomicUsize, Ordering}; use std::panic; diff --git a/src/test/run-pass/panic-handler-flail-wildly.rs b/src/test/run-pass/panic-handler-flail-wildly.rs index 311310712df..f0c50f842ab 100644 --- a/src/test/run-pass/panic-handler-flail-wildly.rs +++ b/src/test/run-pass/panic-handler-flail-wildly.rs @@ -7,10 +7,11 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(panic_handler, std_panic)] // ignore-emscripten no threads support +#![feature(std_panic)] + use std::panic; use std::thread; diff --git a/src/test/run-pass/panic-handler-set-twice.rs b/src/test/run-pass/panic-handler-set-twice.rs index 81da13afaa5..120483ab336 100644 --- a/src/test/run-pass/panic-handler-set-twice.rs +++ b/src/test/run-pass/panic-handler-set-twice.rs @@ -7,7 +7,7 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(panic_handler, std_panic)] +#![feature(std_panic)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/panic-recover-propagate.rs b/src/test/run-pass/panic-recover-propagate.rs index 0210017b47e..cc2cfb6be96 100644 --- a/src/test/run-pass/panic-recover-propagate.rs +++ b/src/test/run-pass/panic-recover-propagate.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(panic_handler)] - use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; use std::panic; use std::thread; diff --git a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs index 6917c2db3b4..731603606e4 100644 --- a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs +++ b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs @@ -13,6 +13,7 @@ // no-prefer-dynamic // ignore-cloudabi no processes // ignore-emscripten no processes +// ignore-macos extern crate exit_success_if_unwind; diff --git a/src/test/run-pass/panic-runtime/abort.rs b/src/test/run-pass/panic-runtime/abort.rs index 3a3b86aec02..4692ad3ca2f 100644 --- a/src/test/run-pass/panic-runtime/abort.rs +++ b/src/test/run-pass/panic-runtime/abort.rs @@ -12,6 +12,7 @@ // no-prefer-dynamic // ignore-cloudabi no processes // ignore-emscripten no processes +// ignore-macos use std::process::Command; use std::env; diff --git a/src/test/run-pass/panic-runtime/link-to-abort.rs b/src/test/run-pass/panic-runtime/link-to-abort.rs index 71e35e41fc0..9f5407e4526 100644 --- a/src/test/run-pass/panic-runtime/link-to-abort.rs +++ b/src/test/run-pass/panic-runtime/link-to-abort.rs @@ -10,10 +10,10 @@ // compile-flags:-C panic=abort // no-prefer-dynamic +// ignore-macos #![feature(panic_abort)] extern crate panic_abort; -fn main() { -} +fn main() {} diff --git a/src/test/run-pass/parallel-codegen-closures.rs b/src/test/run-pass/parallel-codegen-closures.rs index e3c2b448ce0..27b9eeccbeb 100644 --- a/src/test/run-pass/parallel-codegen-closures.rs +++ b/src/test/run-pass/parallel-codegen-closures.rs @@ -14,7 +14,6 @@ // ignore-bitrig // compile-flags: -C codegen_units=2 -#![feature(core)] #![feature(iter_arith)] mod a { diff --git a/src/test/run-pass/pure-sum.rs b/src/test/run-pass/pure-sum.rs index c27b95e1f13..3313196a5ec 100644 --- a/src/test/run-pass/pure-sum.rs +++ b/src/test/run-pass/pure-sum.rs @@ -12,7 +12,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] fn sums_to(v: Vec , sum: isize) -> bool { diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 6e9769ea2b9..bc869113fe9 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] trait get { diff --git a/src/test/run-pass/realloc-16687.rs b/src/test/run-pass/realloc-16687.rs index 3b4b458bb04..61ef386442b 100644 --- a/src/test/run-pass/realloc-16687.rs +++ b/src/test/run-pass/realloc-16687.rs @@ -13,7 +13,7 @@ // Ideally this would be revised to use no_std, but for now it serves // well enough to reproduce (and illustrate) the bug from #16687. -#![feature(heap_api, allocator_api)] +#![feature(allocator_api)] use std::alloc::{Global, Alloc, Layout, handle_alloc_error}; use std::ptr::{self, NonNull}; diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index 83a82041af9..abebb670e65 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn foo(x: &usize) -> usize { diff --git a/src/test/run-pass/regions-borrow-uniq.rs b/src/test/run-pass/regions-borrow-uniq.rs index 2a08940dab6..48b09b33851 100644 --- a/src/test/run-pass/regions-borrow-uniq.rs +++ b/src/test/run-pass/regions-borrow-uniq.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn foo(x: &usize) -> usize { diff --git a/src/test/run-pass/regions-close-over-type-parameter-successfully.rs b/src/test/run-pass/regions-close-over-type-parameter-successfully.rs index d048633519a..4a24e201b35 100644 --- a/src/test/run-pass/regions-close-over-type-parameter-successfully.rs +++ b/src/test/run-pass/regions-close-over-type-parameter-successfully.rs @@ -11,8 +11,6 @@ // A test where we (successfully) close over a reference into // an object. - -#![allow(unknown_features)] #![feature(box_syntax)] trait SomeTrait { fn get(&self) -> isize; } diff --git a/src/test/run-pass/regions-dependent-addr-of.rs b/src/test/run-pass/regions-dependent-addr-of.rs index e9a3e16438f..c8b39bbe749 100644 --- a/src/test/run-pass/regions-dependent-addr-of.rs +++ b/src/test/run-pass/regions-dependent-addr-of.rs @@ -11,8 +11,6 @@ // Test lifetimes are linked properly when we create dependent region pointers. // Issue #3148. - -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/regions-early-bound-trait-param.rs b/src/test/run-pass/regions-early-bound-trait-param.rs index 86fcfb9e6dd..75c209a0920 100644 --- a/src/test/run-pass/regions-early-bound-trait-param.rs +++ b/src/test/run-pass/regions-early-bound-trait-param.rs @@ -11,8 +11,6 @@ // Tests that you can use an early-bound lifetime parameter as // on of the generic parameters in a trait. - -#![allow(unknown_features)] #![feature(box_syntax)] trait Trait<'a> { diff --git a/src/test/run-pass/regions-escape-into-other-fn.rs b/src/test/run-pass/regions-escape-into-other-fn.rs index 597333482fd..7cb719cccce 100644 --- a/src/test/run-pass/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions-escape-into-other-fn.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn foo(x: &usize) -> &usize { x } diff --git a/src/test/run-pass/regions-fn-subtyping.rs b/src/test/run-pass/regions-fn-subtyping.rs index c7a4accff85..f762b4f41ed 100644 --- a/src/test/run-pass/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions-fn-subtyping.rs @@ -14,7 +14,6 @@ #![allow(dead_assignment)] #![allow(unused_variables)] -#![allow(unknown_features)] // Should pass region checking. fn ok(f: Box) { diff --git a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs index a89f6f4a7b5..a40ba8382fc 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn borrow(x: &T) -> &T {x} diff --git a/src/test/run-pass/regions-infer-borrow-scope.rs b/src/test/run-pass/regions-infer-borrow-scope.rs index 01f41637311..72208272df7 100644 --- a/src/test/run-pass/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions-infer-borrow-scope.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Point {x: isize, y: isize} diff --git a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs index a2c07d27288..2a20cd2b773 100644 --- a/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs +++ b/src/test/run-pass/regions-lifetime-nonfree-late-bound.rs @@ -24,7 +24,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs index 3162ef54f39..3322fc36fd3 100644 --- a/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/run-pass/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -17,8 +17,6 @@ // changes were caught. However, those uses in the compiler could // easily get changed or refactored away in the future. - -#![allow(unknown_features)] #![feature(box_syntax)] struct Ctxt<'tcx> { diff --git a/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs b/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs index dfa583415f7..93384b81e4a 100644 --- a/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs +++ b/src/test/run-pass/rfc-2126-extern-absolute-paths/basic.rs @@ -11,8 +11,6 @@ // aux-build:xcrate.rs // edition:2018 -#![feature(extern_absolute_paths)] - use xcrate::Z; fn f() { diff --git a/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs b/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs index 6317dc17652..cace83d6274 100644 --- a/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs +++ b/src/test/run-pass/rfc-2126-extern-absolute-paths/test.rs @@ -15,8 +15,5 @@ // edition:2018 // compile-flags: --test -#![feature(extern_absolute_paths)] - #[test] -fn test() { -} +fn test() {} diff --git a/src/test/run-pass/self-impl.rs b/src/test/run-pass/self-impl.rs index 688b66a0a87..fcd233c361b 100644 --- a/src/test/run-pass/self-impl.rs +++ b/src/test/run-pass/self-impl.rs @@ -12,7 +12,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] struct Foo; diff --git a/src/test/run-pass/self-in-mut-slot-default-method.rs b/src/test/run-pass/self-in-mut-slot-default-method.rs index 877988e60a9..905a23f22a6 100644 --- a/src/test/run-pass/self-in-mut-slot-default-method.rs +++ b/src/test/run-pass/self-in-mut-slot-default-method.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct X { diff --git a/src/test/run-pass/self-re-assign.rs b/src/test/run-pass/self-re-assign.rs index a523340784c..05295aa3309 100644 --- a/src/test/run-pass/self-re-assign.rs +++ b/src/test/run-pass/self-re-assign.rs @@ -11,8 +11,6 @@ // Ensure assigning an owned or managed variable to itself works. In particular, // that we do not glue_drop before we glue_take (#3290). - -#![allow(unknown_features)] #![feature(box_syntax)] use std::rc::Rc; diff --git a/src/test/run-pass/send-resource.rs b/src/test/run-pass/send-resource.rs index 7dd1c3c5978..59332d6b65e 100644 --- a/src/test/run-pass/send-resource.rs +++ b/src/test/run-pass/send-resource.rs @@ -11,8 +11,6 @@ // pretty-expanded FIXME #23616 // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::channel; diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index fb5877b8a48..ecd0bfb1440 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -10,7 +10,6 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] #![feature(box_syntax)] use std::thread; diff --git a/src/test/run-pass/slice.rs b/src/test/run-pass/slice.rs index 8e1d96d3669..dfd7b947c57 100644 --- a/src/test/run-pass/slice.rs +++ b/src/test/run-pass/slice.rs @@ -10,9 +10,6 @@ // Test slicing sugar. - -#![feature(core)] - extern crate core; use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull}; diff --git a/src/test/run-pass/small-enum-range-edge.rs b/src/test/run-pass/small-enum-range-edge.rs index d2283da8bdd..7b6f0a7c9ab 100644 --- a/src/test/run-pass/small-enum-range-edge.rs +++ b/src/test/run-pass/small-enum-range-edge.rs @@ -8,13 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -// this is for the wrapping_add call below. -#![feature(core)] - -/*! - * Tests the range assertion wraparound case when reading discriminants. - */ +// Tests the range assertion wraparound case when reading discriminants. #[repr(u8)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/std-sync-right-kind-impls.rs b/src/test/run-pass/std-sync-right-kind-impls.rs index 03884e8205b..1ad04493528 100644 --- a/src/test/run-pass/std-sync-right-kind-impls.rs +++ b/src/test/run-pass/std-sync-right-kind-impls.rs @@ -10,9 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(static_mutex, static_rwlock, static_condvar)] -#![feature(semaphore)] - use std::sync; fn assert_both() {} diff --git a/src/test/run-pass/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/sync-send-iterators-in-libcollections.rs index e096fb3bbae..e9584e12b2e 100644 --- a/src/test/run-pass/sync-send-iterators-in-libcollections.rs +++ b/src/test/run-pass/sync-send-iterators-in-libcollections.rs @@ -9,7 +9,7 @@ // except according to those terms. #![allow(warnings)] -#![feature(drain, collections_bound, btree_range, vecmap)] +#![feature(drain, collections_bound, btree_range)] use std::collections::BinaryHeap; use std::collections::{BTreeMap, BTreeSet}; diff --git a/src/test/run-pass/sync-send-iterators-in-libcore.rs b/src/test/run-pass/sync-send-iterators-in-libcore.rs index bb190543ecd..55269a28666 100644 --- a/src/test/run-pass/sync-send-iterators-in-libcore.rs +++ b/src/test/run-pass/sync-send-iterators-in-libcore.rs @@ -13,7 +13,6 @@ #![allow(warnings)] #![feature(iter_empty)] #![feature(iter_once)] -#![feature(iter_unfold)] #![feature(str_escape)] use std::iter::{empty, once, repeat}; diff --git a/src/test/run-pass/task-comm-0.rs b/src/test/run-pass/task-comm-0.rs index 0ac232e2e12..01e6d4cf7de 100644 --- a/src/test/run-pass/task-comm-0.rs +++ b/src/test/run-pass/task-comm-0.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/task-comm-1.rs b/src/test/run-pass/task-comm-1.rs index 9a43780f08f..3295e68ac4e 100644 --- a/src/test/run-pass/task-comm-1.rs +++ b/src/test/run-pass/task-comm-1.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; pub fn main() { test00(); } diff --git a/src/test/run-pass/task-comm-10.rs b/src/test/run-pass/task-comm-10.rs index 13b40f17292..a69bba82ff0 100644 --- a/src/test/run-pass/task-comm-10.rs +++ b/src/test/run-pass/task-comm-10.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/task-comm-11.rs b/src/test/run-pass/task-comm-11.rs index be846795962..c7beeb53850 100644 --- a/src/test/run-pass/task-comm-11.rs +++ b/src/test/run-pass/task-comm-11.rs @@ -11,8 +11,6 @@ // pretty-expanded FIXME #23616 // ignore-emscripten no threads support -#![feature(std_misc)] - use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/src/test/run-pass/task-comm-12.rs b/src/test/run-pass/task-comm-12.rs index fdf02e65d8e..23594cebf31 100644 --- a/src/test/run-pass/task-comm-12.rs +++ b/src/test/run-pass/task-comm-12.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; pub fn main() { test00(); } diff --git a/src/test/run-pass/task-comm-13.rs b/src/test/run-pass/task-comm-13.rs index 46c5d3a7ce3..b4829970376 100644 --- a/src/test/run-pass/task-comm-13.rs +++ b/src/test/run-pass/task-comm-13.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/src/test/run-pass/task-comm-14.rs b/src/test/run-pass/task-comm-14.rs index e75a6cf0c87..a03ff8719bb 100644 --- a/src/test/run-pass/task-comm-14.rs +++ b/src/test/run-pass/task-comm-14.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/src/test/run-pass/task-comm-15.rs b/src/test/run-pass/task-comm-15.rs index f2ff48ebd95..fc5a891d1d6 100644 --- a/src/test/run-pass/task-comm-15.rs +++ b/src/test/run-pass/task-comm-15.rs @@ -11,8 +11,6 @@ // ignore-emscripten no threads support // pretty-expanded FIXME #23616 -#![feature(std_misc)] - use std::sync::mpsc::{channel, Sender}; use std::thread; diff --git a/src/test/run-pass/task-comm-17.rs b/src/test/run-pass/task-comm-17.rs index fe00f1aba36..ca6f5c164ed 100644 --- a/src/test/run-pass/task-comm-17.rs +++ b/src/test/run-pass/task-comm-17.rs @@ -11,8 +11,6 @@ // ignore-emscripten no threads support // pretty-expanded FIXME #23616 -#![feature(std_misc)] - // Issue #922 // This test is specifically about spawning temporary closures. diff --git a/src/test/run-pass/task-comm-3.rs b/src/test/run-pass/task-comm-3.rs index 78f29f46edf..8d2d3afc787 100644 --- a/src/test/run-pass/task-comm-3.rs +++ b/src/test/run-pass/task-comm-3.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] - // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/task-comm-7.rs b/src/test/run-pass/task-comm-7.rs index 7b2b9fde9ee..7ab267ea66c 100644 --- a/src/test/run-pass/task-comm-7.rs +++ b/src/test/run-pass/task-comm-7.rs @@ -10,7 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] #![allow(dead_assignment)] use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/task-comm-9.rs b/src/test/run-pass/task-comm-9.rs index 75fd1826b58..1f0eebf1f71 100644 --- a/src/test/run-pass/task-comm-9.rs +++ b/src/test/run-pass/task-comm-9.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/task-life-0.rs b/src/test/run-pass/task-life-0.rs index 312a9f49925..34ea43ca827 100644 --- a/src/test/run-pass/task-life-0.rs +++ b/src/test/run-pass/task-life-0.rs @@ -11,8 +11,6 @@ // ignore-emscripten no threads support // pretty-expanded FIXME #23616 -#![feature(std_misc)] - use std::thread; pub fn main() { diff --git a/src/test/run-pass/task-spawn-move-and-copy.rs b/src/test/run-pass/task-spawn-move-and-copy.rs index 9b9081019e4..94b69a1c3e4 100644 --- a/src/test/run-pass/task-spawn-move-and-copy.rs +++ b/src/test/run-pass/task-spawn-move-and-copy.rs @@ -10,8 +10,7 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] -#![feature(box_syntax, std_misc)] +#![feature(box_syntax)] use std::thread; use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads.rs b/src/test/run-pass/threads.rs index 8c5b84b2c82..f193598975a 100644 --- a/src/test/run-pass/threads.rs +++ b/src/test/run-pass/threads.rs @@ -10,8 +10,6 @@ // ignore-emscripten no threads support -#![feature(std_misc)] - use std::thread; pub fn main() { diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index c58442aa58f..7b57d66ef21 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -12,8 +12,8 @@ // and shared between threads as long as all types fulfill Send. // ignore-emscripten no threads support -#![allow(unknown_features)] -#![feature(box_syntax, std_misc)] + +#![feature(box_syntax)] use std::sync::Arc; use std::sync::mpsc::channel; diff --git a/src/test/run-pass/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/trait-bounds-on-structs-and-enums.rs index bb8ae8247fa..6f088e15b35 100644 --- a/src/test/run-pass/trait-bounds-on-structs-and-enums.rs +++ b/src/test/run-pass/trait-bounds-on-structs-and-enums.rs @@ -10,8 +10,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - trait U {} trait T { fn get(self) -> X; } diff --git a/src/test/run-pass/trait-inheritance-num0.rs b/src/test/run-pass/trait-inheritance-num0.rs index 70515a088e2..9f5c7cf6036 100644 --- a/src/test/run-pass/trait-inheritance-num0.rs +++ b/src/test/run-pass/trait-inheritance-num0.rs @@ -12,8 +12,6 @@ // pretty-expanded FIXME #23616 -#![feature(core)] - use std::cmp::PartialOrd; pub trait NumCast: Sized { diff --git a/src/test/run-pass/trait-object-generics.rs b/src/test/run-pass/trait-object-generics.rs index 61d32bd6ffc..4b14ac2f76f 100644 --- a/src/test/run-pass/trait-object-generics.rs +++ b/src/test/run-pass/trait-object-generics.rs @@ -10,8 +10,6 @@ // test for #8664 - -#![allow(unknown_features)] #![feature(box_syntax)] use std::marker; diff --git a/src/test/run-pass/traits-conditional-dispatch.rs b/src/test/run-pass/traits-conditional-dispatch.rs index 8d2faaf418b..53457d85e01 100644 --- a/src/test/run-pass/traits-conditional-dispatch.rs +++ b/src/test/run-pass/traits-conditional-dispatch.rs @@ -12,8 +12,6 @@ // blanket impl for T:Copy coexists with an impl for Box, because // Box does not impl Copy. - -#![allow(unknown_features)] #![feature(box_syntax)] trait Get { diff --git a/src/test/run-pass/type-id-higher-rank.rs b/src/test/run-pass/type-id-higher-rank.rs index 2865b5d04e5..2a6708dc999 100644 --- a/src/test/run-pass/type-id-higher-rank.rs +++ b/src/test/run-pass/type-id-higher-rank.rs @@ -11,9 +11,6 @@ // Test that type IDs correctly account for higher-rank lifetimes // Also acts as a regression test for an ICE (issue #19791) - -#![feature(core)] - use std::any::{Any, TypeId}; struct Struct<'a>(&'a ()); diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 381f1b68257..1a3bdcca7a1 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] fn p_foo(_pinned: T) { } diff --git a/src/test/run-pass/typeclasses-eq-example-static.rs b/src/test/run-pass/typeclasses-eq-example-static.rs index 0ea7a1be432..d386f27d8c2 100644 --- a/src/test/run-pass/typeclasses-eq-example-static.rs +++ b/src/test/run-pass/typeclasses-eq-example-static.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] // Example from lkuper's intern talk, August 2012 -- now with static diff --git a/src/test/run-pass/typeclasses-eq-example.rs b/src/test/run-pass/typeclasses-eq-example.rs index 69d22cf34f1..8e8fd9bf648 100644 --- a/src/test/run-pass/typeclasses-eq-example.rs +++ b/src/test/run-pass/typeclasses-eq-example.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] // Example from lkuper's intern talk, August 2012. diff --git a/src/test/run-pass/ufcs-explicit-self.rs b/src/test/run-pass/ufcs-explicit-self.rs index bd09a311b70..b3cbd2c4eb3 100644 --- a/src/test/run-pass/ufcs-explicit-self.rs +++ b/src/test/run-pass/ufcs-explicit-self.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures-boxed.rs index 069f26841d2..72d5a1dc043 100644 --- a/src/test/run-pass/unboxed-closures-boxed.rs +++ b/src/test/run-pass/unboxed-closures-boxed.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] use std::ops::FnMut; diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs index 789d2237c54..f4453f1bb8a 100644 --- a/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs +++ b/src/test/run-pass/unboxed-closures-call-sugar-object-autoderef.rs @@ -10,8 +10,6 @@ // Test that the call operator autoderefs when calling to an object type. -#![allow(unknown_features)] - use std::ops::FnMut; fn make_adder(x: isize) -> Boxisize + 'static> { diff --git a/src/test/run-pass/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures-call-sugar-object.rs index e7307715471..2fdb9e9b346 100644 --- a/src/test/run-pass/unboxed-closures-call-sugar-object.rs +++ b/src/test/run-pass/unboxed-closures-call-sugar-object.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] - use std::ops::FnMut; fn make_adder(x: isize) -> Boxisize + 'static> { diff --git a/src/test/run-pass/uniq-self-in-mut-slot.rs b/src/test/run-pass/uniq-self-in-mut-slot.rs index 7910380abee..a4f953ceaf5 100644 --- a/src/test/run-pass/uniq-self-in-mut-slot.rs +++ b/src/test/run-pass/uniq-self-in-mut-slot.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct X { diff --git a/src/test/run-pass/unique-assign-copy.rs b/src/test/run-pass/unique-assign-copy.rs index 3323b3c046b..1e36f5287a7 100644 --- a/src/test/run-pass/unique-assign-copy.rs +++ b/src/test/run-pass/unique-assign-copy.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-assign-drop.rs b/src/test/run-pass/unique-assign-drop.rs index 37aa1f0a64b..1227c14ec02 100644 --- a/src/test/run-pass/unique-assign-drop.rs +++ b/src/test/run-pass/unique-assign-drop.rs @@ -10,7 +10,6 @@ #![allow(dead_assignment)] -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index 249b734a691..1abc8203305 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -8,11 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] - fn f(t: T) -> T { let t1 = t; t1 diff --git a/src/test/run-pass/unique-assign.rs b/src/test/run-pass/unique-assign.rs index 8e97fdd4a6a..66b78d27c59 100644 --- a/src/test/run-pass/unique-assign.rs +++ b/src/test/run-pass/unique-assign.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-autoderef-field.rs b/src/test/run-pass/unique-autoderef-field.rs index a711dbb685f..4ad465abc48 100644 --- a/src/test/run-pass/unique-autoderef-field.rs +++ b/src/test/run-pass/unique-autoderef-field.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct J { j: isize } diff --git a/src/test/run-pass/unique-autoderef-index.rs b/src/test/run-pass/unique-autoderef-index.rs index 1ef61008b3c..b0abcfab78e 100644 --- a/src/test/run-pass/unique-autoderef-index.rs +++ b/src/test/run-pass/unique-autoderef-index.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-cmp.rs b/src/test/run-pass/unique-cmp.rs index 1bd44ecb721..e949215396c 100644 --- a/src/test/run-pass/unique-cmp.rs +++ b/src/test/run-pass/unique-cmp.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-containing-tag.rs b/src/test/run-pass/unique-containing-tag.rs index ce5a2bed48d..94f523eb396 100644 --- a/src/test/run-pass/unique-containing-tag.rs +++ b/src/test/run-pass/unique-containing-tag.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-create.rs b/src/test/run-pass/unique-create.rs index 6d638bbf562..5ebabf0c29a 100644 --- a/src/test/run-pass/unique-create.rs +++ b/src/test/run-pass/unique-create.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-decl-init-copy.rs b/src/test/run-pass/unique-decl-init-copy.rs index 9d749803ffb..71197b9d02f 100644 --- a/src/test/run-pass/unique-decl-init-copy.rs +++ b/src/test/run-pass/unique-decl-init-copy.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-decl-init.rs b/src/test/run-pass/unique-decl-init.rs index a00de08998f..2501caddb46 100644 --- a/src/test/run-pass/unique-decl-init.rs +++ b/src/test/run-pass/unique-decl-init.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-decl-move.rs b/src/test/run-pass/unique-decl-move.rs index f4ff44ffff5..fc6421e2e08 100644 --- a/src/test/run-pass/unique-decl-move.rs +++ b/src/test/run-pass/unique-decl-move.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-deref.rs b/src/test/run-pass/unique-deref.rs index 70b2617797d..8c008683ef3 100644 --- a/src/test/run-pass/unique-deref.rs +++ b/src/test/run-pass/unique-deref.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-destructure.rs b/src/test/run-pass/unique-destructure.rs index b368cbee2f6..70b4af1886f 100644 --- a/src/test/run-pass/unique-destructure.rs +++ b/src/test/run-pass/unique-destructure.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique-drop-complex.rs b/src/test/run-pass/unique-drop-complex.rs index 1910d51bd0b..bcfb65769da 100644 --- a/src/test/run-pass/unique-drop-complex.rs +++ b/src/test/run-pass/unique-drop-complex.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-fn-arg-move.rs b/src/test/run-pass/unique-fn-arg-move.rs index d101cbd3129..45cc530659f 100644 --- a/src/test/run-pass/unique-fn-arg-move.rs +++ b/src/test/run-pass/unique-fn-arg-move.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn f(i: Box) { diff --git a/src/test/run-pass/unique-fn-arg-mut.rs b/src/test/run-pass/unique-fn-arg-mut.rs index ebe89b275d4..77c4fa29558 100644 --- a/src/test/run-pass/unique-fn-arg-mut.rs +++ b/src/test/run-pass/unique-fn-arg-mut.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn f(i: &mut Box) { diff --git a/src/test/run-pass/unique-fn-arg.rs b/src/test/run-pass/unique-fn-arg.rs index 97006d2a01a..20a0008ef56 100644 --- a/src/test/run-pass/unique-fn-arg.rs +++ b/src/test/run-pass/unique-fn-arg.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn f(i: Box) { diff --git a/src/test/run-pass/unique-fn-ret.rs b/src/test/run-pass/unique-fn-ret.rs index d3be0cf01f1..7d88176828e 100644 --- a/src/test/run-pass/unique-fn-ret.rs +++ b/src/test/run-pass/unique-fn-ret.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] fn f() -> Box { diff --git a/src/test/run-pass/unique-in-tag.rs b/src/test/run-pass/unique-in-tag.rs index 0762b37ff8b..517cdd02535 100644 --- a/src/test/run-pass/unique-in-tag.rs +++ b/src/test/run-pass/unique-in-tag.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] fn test1() { diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs index ece206caa02..a460aa6ec10 100644 --- a/src/test/run-pass/unique-in-vec-copy.rs +++ b/src/test/run-pass/unique-in-vec-copy.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-in-vec.rs b/src/test/run-pass/unique-in-vec.rs index bd965d41eea..a7edc9cc710 100644 --- a/src/test/run-pass/unique-in-vec.rs +++ b/src/test/run-pass/unique-in-vec.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-init.rs b/src/test/run-pass/unique-init.rs index bd7a6495260..768614b1e3c 100644 --- a/src/test/run-pass/unique-init.rs +++ b/src/test/run-pass/unique-init.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index f45b3285da7..80364114bce 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] use std::cmp::PartialEq; diff --git a/src/test/run-pass/unique-log.rs b/src/test/run-pass/unique-log.rs index 148ca4757ae..0c17acb3d89 100644 --- a/src/test/run-pass/unique-log.rs +++ b/src/test/run-pass/unique-log.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-move-drop.rs b/src/test/run-pass/unique-move-drop.rs index c2813771b7c..ba865abc371 100644 --- a/src/test/run-pass/unique-move-drop.rs +++ b/src/test/run-pass/unique-move-drop.rs @@ -10,7 +10,6 @@ #![allow(unused_variables)] -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-move-temp.rs b/src/test/run-pass/unique-move-temp.rs index 4b937625201..8c1178b9a7e 100644 --- a/src/test/run-pass/unique-move-temp.rs +++ b/src/test/run-pass/unique-move-temp.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-move.rs b/src/test/run-pass/unique-move.rs index bed1d6e171a..e731ca818fe 100644 --- a/src/test/run-pass/unique-move.rs +++ b/src/test/run-pass/unique-move.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-mutable.rs b/src/test/run-pass/unique-mutable.rs index 8beec6a4198..48006010300 100644 --- a/src/test/run-pass/unique-mutable.rs +++ b/src/test/run-pass/unique-mutable.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique-object-move.rs b/src/test/run-pass/unique-object-move.rs index 4d120e7caf3..d93df4e96f9 100644 --- a/src/test/run-pass/unique-object-move.rs +++ b/src/test/run-pass/unique-object-move.rs @@ -12,7 +12,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub trait EventLoop { fn foo(&self) {} } diff --git a/src/test/run-pass/unique-pat-2.rs b/src/test/run-pass/unique-pat-2.rs index c314b70e536..12e81a202e9 100644 --- a/src/test/run-pass/unique-pat-2.rs +++ b/src/test/run-pass/unique-pat-2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique-pat-3.rs b/src/test/run-pass/unique-pat-3.rs index 648e9599a97..9f361d460e0 100644 --- a/src/test/run-pass/unique-pat-3.rs +++ b/src/test/run-pass/unique-pat-3.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] enum bar { u(Box), w(isize), } diff --git a/src/test/run-pass/unique-pat.rs b/src/test/run-pass/unique-pat.rs index 1312ea924b5..8af160b1f56 100644 --- a/src/test/run-pass/unique-pat.rs +++ b/src/test/run-pass/unique-pat.rs @@ -9,7 +9,6 @@ // except according to those terms. -#![allow(unknown_features)] #![feature(box_patterns)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique-rec.rs b/src/test/run-pass/unique-rec.rs index 72975c27eea..aa3fc8f5bb5 100644 --- a/src/test/run-pass/unique-rec.rs +++ b/src/test/run-pass/unique-rec.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] struct X { x: isize } diff --git a/src/test/run-pass/unique-send-2.rs b/src/test/run-pass/unique-send-2.rs index 2e864797db0..7a0e585e8b0 100644 --- a/src/test/run-pass/unique-send-2.rs +++ b/src/test/run-pass/unique-send-2.rs @@ -10,7 +10,6 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] #![feature(box_syntax)] use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/unique-send.rs b/src/test/run-pass/unique-send.rs index bc0f790b2b0..7644da08e4a 100644 --- a/src/test/run-pass/unique-send.rs +++ b/src/test/run-pass/unique-send.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] use std::sync::mpsc::channel; diff --git a/src/test/run-pass/unique-swap.rs b/src/test/run-pass/unique-swap.rs index cfa076f1a07..6e6fe4e420b 100644 --- a/src/test/run-pass/unique-swap.rs +++ b/src/test/run-pass/unique-swap.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] use std::mem::swap; diff --git a/src/test/run-pass/unsized2.rs b/src/test/run-pass/unsized2.rs index 50d8d3d27f2..90b99f98533 100644 --- a/src/test/run-pass/unsized2.rs +++ b/src/test/run-pass/unsized2.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![allow(unknown_features)] #![feature(box_syntax)] // Test sized-ness checking in substitution. diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index b155620e519..e5a77d1cdbd 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index e4b9d14fb4b..9a0ea181d99 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -15,7 +15,6 @@ // pretty-expanded FIXME #23616 #![allow(path_statements)] -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index 320a11f64d8..321e8198817 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -10,7 +10,6 @@ // ignore-emscripten no threads support -#![allow(unknown_features)] #![feature(box_syntax)] use std::thread; diff --git a/src/test/run-pass/utf8_chars.rs b/src/test/run-pass/utf8_chars.rs index b54aed79665..b2550e77a8a 100644 --- a/src/test/run-pass/utf8_chars.rs +++ b/src/test/run-pass/utf8_chars.rs @@ -7,9 +7,6 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -// - -#![feature(core, str_char)] use std::str; diff --git a/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs b/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs index af06fe38136..948d68e0ccd 100644 --- a/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs +++ b/src/test/run-pass/variance-intersection-of-ref-and-opt-ref.rs @@ -13,9 +13,7 @@ // us from approximating the lifetimes of `field1` and `field2` to a // common intersection. - #![allow(dead_code)] -#![feature(core)] struct List<'l> { field1: &'l i32, diff --git a/src/test/run-pass/variance-vec-covariant.rs b/src/test/run-pass/variance-vec-covariant.rs index 89927b7b55b..caec6df5a4d 100644 --- a/src/test/run-pass/variance-vec-covariant.rs +++ b/src/test/run-pass/variance-vec-covariant.rs @@ -10,9 +10,7 @@ // Test that vec is now covariant in its argument type. - #![allow(dead_code)] -#![feature(core)] fn foo<'a,'b>(v1: Vec<&'a i32>, v2: Vec<&'b i32>) -> i32 { bar(v1, v2).cloned().unwrap_or(0) // only type checks if we can intersect 'a and 'b diff --git a/src/test/run-pass/vec-dst.rs b/src/test/run-pass/vec-dst.rs index aadbb922f67..cf4222b405e 100644 --- a/src/test/run-pass/vec-dst.rs +++ b/src/test/run-pass/vec-dst.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/vector-no-ann-2.rs b/src/test/run-pass/vector-no-ann-2.rs index 10f71b3e12c..09e70cf03ca 100644 --- a/src/test/run-pass/vector-no-ann-2.rs +++ b/src/test/run-pass/vector-no-ann-2.rs @@ -10,7 +10,6 @@ // pretty-expanded FIXME #23616 -#![allow(unknown_features)] #![feature(box_syntax)] pub fn main() { let _quux: Box> = box Vec::new(); } diff --git a/src/test/run-pass/x86stdcall2.rs b/src/test/run-pass/x86stdcall2.rs index f3bf5d9c684..bbdd65f7e5b 100644 --- a/src/test/run-pass/x86stdcall2.rs +++ b/src/test/run-pass/x86stdcall2.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(std_misc)] - pub type HANDLE = usize; pub type DWORD = u32; pub type SIZE_T = u32; diff --git a/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs b/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs index 34a1331353d..c346c7323d3 100644 --- a/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs +++ b/src/test/rustdoc/auxiliary/rustdoc-default-impl.rs @@ -9,7 +9,6 @@ // except according to those terms. #![feature(optin_builtin_traits)] -#![feature(core)] pub mod bar { use std::marker; diff --git a/src/test/rustdoc/const-evalutation-ice.rs b/src/test/rustdoc/const-evalutation-ice.rs index 9fed67ee583..000ed709a8a 100644 --- a/src/test/rustdoc/const-evalutation-ice.rs +++ b/src/test/rustdoc/const-evalutation-ice.rs @@ -10,8 +10,6 @@ // Just check if we don't get an ICE for the _S type. -#![feature(const_size_of)] - use std::cell::Cell; use std::mem; diff --git a/src/test/rustdoc/issue-51236.rs b/src/test/rustdoc/issue-51236.rs new file mode 100644 index 00000000000..541a1c5e19f --- /dev/null +++ b/src/test/rustdoc/issue-51236.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::marker::PhantomData; + +pub mod traits { + pub trait Owned<'a> { + type Reader; + } +} + +// @has issue_51236/struct.Owned.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// Owned where >::Reader: Send" +pub struct Owned where T: for<'a> ::traits::Owned<'a> { + marker: PhantomData<>::Reader>, +} diff --git a/src/test/rustdoc/synthetic_auto/static-region.rs b/src/test/rustdoc/synthetic_auto/static-region.rs new file mode 100644 index 00000000000..96e8b8ed5f6 --- /dev/null +++ b/src/test/rustdoc/synthetic_auto/static-region.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait OwnedTrait<'a> { + type Reader; +} + +// @has static_region/struct.Owned.html +// @has - '//*[@id="synthetic-implementations-list"]/*[@class="impl"]//*/code' "impl Send for \ +// Owned where >::Reader: Send" +pub struct Owned where T: OwnedTrait<'static> { + marker: >::Reader, +} diff --git a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs index db0c19e96f8..679cb772868 100644 --- a/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs +++ b/src/test/ui-fulldeps/auxiliary/attr_proc_macro.rs @@ -10,7 +10,7 @@ // force-host // no-prefer-dynamic -#![feature(proc_macro)] + #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs index 89ac11b309d..6484725814a 100644 --- a/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs +++ b/src/test/ui-fulldeps/auxiliary/bang_proc_macro.rs @@ -10,7 +10,7 @@ // force-host // no-prefer-dynamic -#![feature(proc_macro)] + #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/auxiliary/lifetimes.rs b/src/test/ui-fulldeps/auxiliary/lifetimes.rs index ecf0a56edf7..fc59a622bfa 100644 --- a/src/test/ui-fulldeps/auxiliary/lifetimes.rs +++ b/src/test/ui-fulldeps/auxiliary/lifetimes.rs @@ -10,7 +10,6 @@ // no-prefer-dynamic -#![feature(proc_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/lifetimes.rs b/src/test/ui-fulldeps/lifetimes.rs index 3200e8fb2b1..6879848d269 100644 --- a/src/test/ui-fulldeps/lifetimes.rs +++ b/src/test/ui-fulldeps/lifetimes.rs @@ -10,7 +10,7 @@ // aux-build:lifetimes.rs -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate lifetimes; diff --git a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs b/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs index 632dba42ad0..1ed8ef52027 100644 --- a/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs +++ b/src/test/ui-fulldeps/proc-macro/auxiliary/generate-mod.rs @@ -11,7 +11,6 @@ // run-pass // no-prefer-dynamic -#![feature(proc_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/generate-mod.rs b/src/test/ui-fulldeps/proc-macro/generate-mod.rs index ee0077c3ed3..b0cccd8728b 100644 --- a/src/test/ui-fulldeps/proc-macro/generate-mod.rs +++ b/src/test/ui-fulldeps/proc-macro/generate-mod.rs @@ -12,7 +12,7 @@ // aux-build:generate-mod.rs -#![feature(use_extern_macros, proc_macro_gen, proc_macro_path_invoc)] +#![feature(proc_macro_gen, proc_macro_path_invoc)] extern crate generate_mod; diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs b/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs index c06f98ed5ff..8b940a0f405 100644 --- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs +++ b/src/test/ui-fulldeps/proc-macro/invalid-attributes.rs @@ -11,7 +11,6 @@ // no-prefer-dynamic #![crate_type = "proc-macro"] -#![feature(proc_macro)] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr b/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr index c480bcb5df9..5fd87362db2 100644 --- a/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr +++ b/src/test/ui-fulldeps/proc-macro/invalid-attributes.stderr @@ -1,35 +1,35 @@ error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:20:1 + --> $DIR/invalid-attributes.rs:19:1 | LL | #[proc_macro = "test"] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^ error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:23:1 + --> $DIR/invalid-attributes.rs:22:1 | LL | #[proc_macro()] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^ error: `#[proc_macro]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:26:1 + --> $DIR/invalid-attributes.rs:25:1 | LL | #[proc_macro(x)] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^ error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:29:1 + --> $DIR/invalid-attributes.rs:28:1 | LL | #[proc_macro_attribute = "test"] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:32:1 + --> $DIR/invalid-attributes.rs:31:1 | LL | #[proc_macro_attribute()] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^ error: `#[proc_macro_attribute]` attribute does not take any arguments - --> $DIR/invalid-attributes.rs:35:1 + --> $DIR/invalid-attributes.rs:34:1 | LL | #[proc_macro_attribute(x)] //~ ERROR: does not take any arguments | ^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs index 21d625ae09d..e7bb05de88c 100644 --- a/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs +++ b/src/test/ui-fulldeps/proc-macro/macro-namespace-reserved.rs @@ -10,7 +10,7 @@ // no-prefer-dynamic -#![feature(proc_macro, decl_macro)] +#![feature(decl_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/non-root.rs b/src/test/ui-fulldeps/proc-macro/non-root.rs index 288c63b4c77..24404885788 100644 --- a/src/test/ui-fulldeps/proc-macro/non-root.rs +++ b/src/test/ui-fulldeps/proc-macro/non-root.rs @@ -10,7 +10,6 @@ // no-prefer-dynamic -#![feature(proc_macro)] #![crate_type = "proc-macro"] extern crate proc_macro; diff --git a/src/test/ui-fulldeps/proc-macro/non-root.stderr b/src/test/ui-fulldeps/proc-macro/non-root.stderr index 8c14f644d7a..23222a2b851 100644 --- a/src/test/ui-fulldeps/proc-macro/non-root.stderr +++ b/src/test/ui-fulldeps/proc-macro/non-root.stderr @@ -1,5 +1,5 @@ error: functions tagged with `#[proc_macro]` must currently reside in the root of the crate - --> $DIR/non-root.rs:21:5 + --> $DIR/non-root.rs:20:5 | LL | pub fn foo(arg: TokenStream) -> TokenStream { arg } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui-fulldeps/proc-macro/three-equals.rs b/src/test/ui-fulldeps/proc-macro/three-equals.rs index ee5f3b33a06..f6b0e90da00 100644 --- a/src/test/ui-fulldeps/proc-macro/three-equals.rs +++ b/src/test/ui-fulldeps/proc-macro/three-equals.rs @@ -11,7 +11,7 @@ // aux-build:three-equals.rs // ignore-stage1 -#![feature(use_extern_macros, proc_macro_non_items)] +#![feature(proc_macro_non_items)] extern crate three_equals; diff --git a/src/test/ui-fulldeps/resolve-error.rs b/src/test/ui-fulldeps/resolve-error.rs index df9b263534f..1940151357c 100644 --- a/src/test/ui-fulldeps/resolve-error.rs +++ b/src/test/ui-fulldeps/resolve-error.rs @@ -13,7 +13,7 @@ // aux-build:attr_proc_macro.rs // aux-build:bang_proc_macro.rs -#![feature(use_extern_macros)] +#![feature(custom_attribute)] #[macro_use] extern crate derive_foo; @@ -37,12 +37,10 @@ macro_rules! attr_proc_mac { //~^ ERROR cannot find struct Foo; -#[attr_proc_macra] -//~^ ERROR cannot find +#[attr_proc_macra] // OK, interpreted as a custom attribute struct Bar; -#[FooWithLongNan] -//~^ ERROR cannot find +#[FooWithLongNan] // OK, interpreted as a custom attribute struct Asdf; #[derive(Dlone)] diff --git a/src/test/ui-fulldeps/resolve-error.stderr b/src/test/ui-fulldeps/resolve-error.stderr index caa79664614..278409c688a 100644 --- a/src/test/ui-fulldeps/resolve-error.stderr +++ b/src/test/ui-fulldeps/resolve-error.stderr @@ -4,59 +4,47 @@ error: cannot find derive macro `FooWithLongNan` in this scope LL | #[derive(FooWithLongNan)] | ^^^^^^^^^^^^^^ help: try: `FooWithLongName` -error: cannot find attribute macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:40:3 - | -LL | #[attr_proc_macra] - | ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro` - -error: cannot find attribute macro `FooWithLongNan` in this scope - --> $DIR/resolve-error.rs:44:3 - | -LL | #[FooWithLongNan] - | ^^^^^^^^^^^^^^ - error: cannot find derive macro `Dlone` in this scope - --> $DIR/resolve-error.rs:48:10 + --> $DIR/resolve-error.rs:46:10 | LL | #[derive(Dlone)] | ^^^^^ help: try: `Clone` error: cannot find derive macro `Dlona` in this scope - --> $DIR/resolve-error.rs:52:10 + --> $DIR/resolve-error.rs:50:10 | LL | #[derive(Dlona)] | ^^^^^ help: try: `Clona` error: cannot find derive macro `attr_proc_macra` in this scope - --> $DIR/resolve-error.rs:56:10 + --> $DIR/resolve-error.rs:54:10 | LL | #[derive(attr_proc_macra)] | ^^^^^^^^^^^^^^^ error: cannot find macro `FooWithLongNama!` in this scope - --> $DIR/resolve-error.rs:61:5 + --> $DIR/resolve-error.rs:59:5 | LL | FooWithLongNama!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam` error: cannot find macro `attr_proc_macra!` in this scope - --> $DIR/resolve-error.rs:64:5 + --> $DIR/resolve-error.rs:62:5 | LL | attr_proc_macra!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac` error: cannot find macro `Dlona!` in this scope - --> $DIR/resolve-error.rs:67:5 + --> $DIR/resolve-error.rs:65:5 | LL | Dlona!(); | ^^^^^ error: cannot find macro `bang_proc_macrp!` in this scope - --> $DIR/resolve-error.rs:70:5 + --> $DIR/resolve-error.rs:68:5 | LL | bang_proc_macrp!(); | ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro` -error: aborting due to 10 previous errors +error: aborting due to 8 previous errors diff --git a/src/test/ui/E0705.rs b/src/test/ui/E0705.rs new file mode 100644 index 00000000000..a0ce95e3e02 --- /dev/null +++ b/src/test/ui/E0705.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-pass + +#![feature(rust_2018_preview)] +#![feature(raw_identifiers)] +//~^ WARN the feature `raw_identifiers` is included in the Rust 2018 edition + +fn main() { + let foo = 0; + let bar = r#foo; +} diff --git a/src/test/ui/E0705.stderr b/src/test/ui/E0705.stderr new file mode 100644 index 00000000000..ebb8dd4975d --- /dev/null +++ b/src/test/ui/E0705.stderr @@ -0,0 +1,6 @@ +warning[E0705]: the feature `raw_identifiers` is included in the Rust 2018 edition + --> $DIR/E0705.rs:14:12 + | +LL | #![feature(raw_identifiers)] + | ^^^^^^^^^^^^^^^ + diff --git a/src/test/ui/auxiliary/edition-kw-macro-2018.rs b/src/test/ui/auxiliary/edition-kw-macro-2018.rs index d42014766ec..85ef15858fe 100644 --- a/src/test/ui/auxiliary/edition-kw-macro-2018.rs +++ b/src/test/ui/auxiliary/edition-kw-macro-2018.rs @@ -10,7 +10,6 @@ // edition:2018 -#![feature(raw_identifiers)] #![allow(async_idents)] #[macro_export] diff --git a/src/test/ui/auxiliary/lint_output_format.rs b/src/test/ui/auxiliary/lint_output_format.rs index 0553b4a49b7..6ba66f3e45f 100644 --- a/src/test/ui/auxiliary/lint_output_format.rs +++ b/src/test/ui/auxiliary/lint_output_format.rs @@ -11,20 +11,20 @@ #![crate_name="lint_output_format"] #![crate_type = "lib"] #![feature(staged_api)] -#![unstable(feature = "test_feature", issue = "0")] +#![unstable(feature = "unstable_test_feature", issue = "0")] -#[stable(feature = "test_feature", since = "1.0.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 = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub fn bar() -> usize { 40 } -#[unstable(feature = "test_feature", issue = "0")] +#[unstable(feature = "unstable_test_feature", issue = "0")] pub fn baz() -> usize { 30 } diff --git a/src/test/ui/auxiliary/svh-a-change-type-static.rs b/src/test/ui/auxiliary/svh-a-change-type-static.rs index 62f7986f1c3..0d4c76abb10 100644 --- a/src/test/ui/auxiliary/svh-a-change-type-static.rs +++ b/src/test/ui/auxiliary/svh-a-change-type-static.rs @@ -14,7 +14,6 @@ //! (#14132). #![crate_name = "a"] -#![feature(core)] macro_rules! three { () => { 3 } diff --git a/src/test/ui/borrowck/issue-45983.ast.stderr b/src/test/ui/borrowck/issue-45983.ast.stderr new file mode 100644 index 00000000000..db7cedffd8f --- /dev/null +++ b/src/test/ui/borrowck/issue-45983.ast.stderr @@ -0,0 +1,12 @@ +error: borrowed data cannot be stored outside of its closure + --> $DIR/issue-45983.rs:36:27 + | +LL | let x = None; + | - borrowed data cannot be stored into here... +LL | give_any(|y| x = Some(y)); + | --- ^ cannot be stored outside of its closure + | | + | ...because it cannot outlive this closure + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/issue-45983.migrate.stderr b/src/test/ui/borrowck/issue-45983.migrate.stderr new file mode 100644 index 00000000000..db7cedffd8f --- /dev/null +++ b/src/test/ui/borrowck/issue-45983.migrate.stderr @@ -0,0 +1,12 @@ +error: borrowed data cannot be stored outside of its closure + --> $DIR/issue-45983.rs:36:27 + | +LL | let x = None; + | - borrowed data cannot be stored into here... +LL | give_any(|y| x = Some(y)); + | --- ^ cannot be stored outside of its closure + | | + | ...because it cannot outlive this closure + +error: aborting due to previous error + diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr index 64086cb0791..9d62c7dba75 100644 --- a/src/test/ui/borrowck/issue-45983.nll.stderr +++ b/src/test/ui/borrowck/issue-45983.nll.stderr @@ -1,11 +1,11 @@ warning: not reporting region error due to nll - --> $DIR/issue-45983.rs:17:27 + --> $DIR/issue-45983.rs:36:27 | LL | give_any(|y| x = Some(y)); | ^ error: borrowed data escapes outside of closure - --> $DIR/issue-45983.rs:17:18 + --> $DIR/issue-45983.rs:36:18 | LL | let x = None; | - `x` is declared here, outside of the closure body @@ -15,7 +15,7 @@ LL | give_any(|y| x = Some(y)); | `y` is a reference that is only valid in the closure body error[E0594]: cannot assign to `x`, as it is not declared as mutable - --> $DIR/issue-45983.rs:17:18 + --> $DIR/issue-45983.rs:36:18 | LL | let x = None; | - help: consider changing this to be mutable: `mut x` diff --git a/src/test/ui/borrowck/issue-45983.rs b/src/test/ui/borrowck/issue-45983.rs index a6e5067195f..bcbe0d1ffc0 100644 --- a/src/test/ui/borrowck/issue-45983.rs +++ b/src/test/ui/borrowck/issue-45983.rs @@ -8,6 +8,25 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// As documented in Issue #45983, this test is evaluating the quality +// of our diagnostics on erroneous code using higher-ranked closures. +// +// However, as documented on Issue #53026, this test also became a +// prime example of our need to test the NLL migration mode +// *separately* from the existing test suites that focus solely on +// AST-borrwock and NLL. + +// revisions: ast migrate nll + +// Since we are testing nll (and migration) explicitly as a separate +// revisions, dont worry about the --compare-mode=nll on this test. + +// ignore-compare-mode-nll + +//[ast]compile-flags: -Z borrowck=ast +//[migrate]compile-flags: -Z borrowck=migrate -Z two-phase-borrows +//[nll]compile-flags: -Z borrowck=mir -Z two-phase-borrows + fn give_any FnOnce(&'r ())>(f: F) { f(&()); } @@ -15,5 +34,9 @@ fn give_any FnOnce(&'r ())>(f: F) { fn main() { let x = None; give_any(|y| x = Some(y)); - //~^ ERROR borrowed data cannot be stored outside of its closure + //[ast]~^ ERROR borrowed data cannot be stored outside of its closure + //[migrate]~^^ ERROR borrowed data cannot be stored outside of its closure + //[nll]~^^^ WARN not reporting region error due to nll + //[nll]~| ERROR borrowed data escapes outside of closure + //[nll]~| ERROR cannot assign to `x`, as it is not declared as mutable } diff --git a/src/test/ui/borrowck/issue-45983.stderr b/src/test/ui/borrowck/issue-45983.stderr deleted file mode 100644 index 7625b9e7618..00000000000 --- a/src/test/ui/borrowck/issue-45983.stderr +++ /dev/null @@ -1,12 +0,0 @@ -error: borrowed data cannot be stored outside of its closure - --> $DIR/issue-45983.rs:17:27 - | -LL | let x = None; - | - borrowed data cannot be stored into here... -LL | give_any(|y| x = Some(y)); - | --- ^ cannot be stored outside of its closure - | | - | ...because it cannot outlive this closure - -error: aborting due to previous error - diff --git a/src/test/ui/borrowck/issue-52713-bug.rs b/src/test/ui/borrowck/issue-52713-bug.rs new file mode 100644 index 00000000000..4ecba64b271 --- /dev/null +++ b/src/test/ui/borrowck/issue-52713-bug.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Regression test for a bug in #52713: this was an optimization for +// computing liveness that wound up accidentally causing the program +// below to be accepted. + +#![feature(nll)] + +fn foo<'a>(x: &'a mut u32) -> u32 { + let mut x = 22; + let y = &x; + if false { + return x; + } + + x += 1; //~ ERROR + println!("{}", y); + return 0; +} + +fn main() { } diff --git a/src/test/ui/borrowck/issue-52713-bug.stderr b/src/test/ui/borrowck/issue-52713-bug.stderr new file mode 100644 index 00000000000..7d9b57400dd --- /dev/null +++ b/src/test/ui/borrowck/issue-52713-bug.stderr @@ -0,0 +1,14 @@ +error[E0506]: cannot assign to `x` because it is borrowed + --> $DIR/issue-52713-bug.rs:24:5 + | +LL | let y = &x; + | -- borrow of `x` occurs here +... +LL | x += 1; //~ ERROR + | ^^^^^^ assignment to borrowed `x` occurs here +LL | println!("{}", 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/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 52f1547bce6..95acdab3e80 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,24 +1,30 @@ error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:15:21 | -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... +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 error[E0597]: borrowed value does not live long enough --> $DIR/promote-ref-mut-in-let-issue-46557.rs:20:25 | -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... +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 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/codemap_tests/bad-format-args.stderr b/src/test/ui/codemap_tests/bad-format-args.stderr index d0cdeb2178f..1c801f2a790 100644 --- a/src/test/ui/codemap_tests/bad-format-args.stderr +++ b/src/test/ui/codemap_tests/bad-format-args.stderr @@ -7,20 +7,16 @@ LL | format!(); //~ ERROR requires at least a format string argument = 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: expected token: `,` - --> $DIR/bad-format-args.rs:13:5 + --> $DIR/bad-format-args.rs:13:16 | LL | format!("" 1); //~ ERROR expected token: `,` - | ^^^^^^^^^^^^^^ - | - = 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: expected token: `,` - --> $DIR/bad-format-args.rs:14:5 + --> $DIR/bad-format-args.rs:14:19 | LL | format!("", 1 1); //~ ERROR expected token: `,` - | ^^^^^^^^^^^^^^^^^ - | - = 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 3 previous errors diff --git a/src/test/ui/const-deref-ptr.rs b/src/test/ui/const-deref-ptr.rs index fa15f3e87c6..3d0477feb20 100644 --- a/src/test/ui/const-deref-ptr.rs +++ b/src/test/ui/const-deref-ptr.rs @@ -11,6 +11,7 @@ // Check that you can't dereference raw pointers in constants. fn main() { - static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 + static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; + //~^ ERROR dereferencing raw pointers in statics is unstable println!("{}", C); } diff --git a/src/test/ui/const-deref-ptr.stderr b/src/test/ui/const-deref-ptr.stderr index 61db58104d2..94a383bcf16 100644 --- a/src/test/ui/const-deref-ptr.stderr +++ b/src/test/ui/const-deref-ptr.stderr @@ -1,9 +1,11 @@ -error[E0396]: raw pointers cannot be dereferenced in statics +error[E0658]: dereferencing raw pointers in statics is unstable (see issue #51911) --> $DIR/const-deref-ptr.rs:14:29 | -LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; //~ ERROR E0396 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ dereference of raw pointer in constant +LL | static C: u64 = unsafe {*(0xdeadbeef as *const u64)}; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0396`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/const-eval/const_raw_ptr_ops.rs b/src/test/ui/const-eval/const_raw_ptr_ops.rs new file mode 100644 index 00000000000..2aff6a7c55c --- /dev/null +++ b/src/test/ui/const-eval/const_raw_ptr_ops.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_raw_ptr_to_usize_cast, const_compare_raw_pointers, const_raw_ptr_deref)] + +fn main() {} + +// unconst and bad, will thus error in miri +const X: bool = &1 as *const i32 == &2 as *const i32; //~ ERROR cannot be used +// unconst and fine +const X2: bool = 42 as *const i32 == 43 as *const i32; +// unconst and fine +const Y: usize = 42usize as *const i32 as usize + 1; +// unconst and bad, will thus error in miri +const Y2: usize = &1 as *const i32 as usize + 1; //~ ERROR cannot be used +// unconst and fine +const Z: i32 = unsafe { *(&1 as *const i32) }; +// unconst and bad, will thus error in miri +const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR cannot be used +const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR cannot be used diff --git a/src/test/ui/const-eval/const_raw_ptr_ops.stderr b/src/test/ui/const-eval/const_raw_ptr_ops.stderr new file mode 100644 index 00000000000..a9442be081d --- /dev/null +++ b/src/test/ui/const-eval/const_raw_ptr_ops.stderr @@ -0,0 +1,36 @@ +error: this constant cannot be used + --> $DIR/const_raw_ptr_ops.rs:16:1 + | +LL | const X: bool = &1 as *const i32 == &2 as *const i32; //~ ERROR cannot be used + | ^^^^^^^^^^^^^^^^------------------------------------^ + | | + | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants + | + = note: #[deny(const_err)] on by default + +error: this constant cannot be used + --> $DIR/const_raw_ptr_ops.rs:22:1 + | +LL | const Y2: usize = &1 as *const i32 as usize + 1; //~ ERROR cannot be used + | ^^^^^^^^^^^^^^^^^^-----------------------------^ + | | + | "pointer arithmetic or comparison" needs an rfc before being allowed inside constants + +error: this constant cannot be used + --> $DIR/const_raw_ptr_ops.rs:26:1 + | +LL | const Z2: i32 = unsafe { *(42 as *const i32) }; //~ ERROR cannot be used + | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ + | | + | tried to access memory with alignment 2, but alignment 4 is required + +error: this constant cannot be used + --> $DIR/const_raw_ptr_ops.rs:27:1 + | +LL | const Z3: i32 = unsafe { *(44 as *const i32) }; //~ ERROR cannot be used + | ^^^^^^^^^^^^^^^^^^^^^^^^^-------------------^^^ + | | + | a memory access tried to interpret some bytes as a pointer + +error: aborting due to 4 previous errors + diff --git a/src/test/ui/const-eval/const_transmute.rs b/src/test/ui/const-eval/const_transmute.rs index e661444a7b4..8dd1476d25a 100644 --- a/src/test/ui/const-eval/const_transmute.rs +++ b/src/test/ui/const-eval/const_transmute.rs @@ -11,6 +11,8 @@ // compile-pass // run-pass +#![feature(const_fn_union)] + union Transmute { t: T, u: U, diff --git a/src/test/ui/const-eval/feature-gate-const_fn_union.rs b/src/test/ui/const-eval/feature-gate-const_fn_union.rs new file mode 100644 index 00000000000..113046b0689 --- /dev/null +++ b/src/test/ui/const-eval/feature-gate-const_fn_union.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_fn)] + +fn main() {} + +union Foo { + u: u32, + i: i32, +} + +const unsafe fn foo(u: u32) -> i32 { + Foo { u }.i //~ ERROR unions in const fn are unstable +} diff --git a/src/test/ui/const-eval/feature-gate-const_fn_union.stderr b/src/test/ui/const-eval/feature-gate-const_fn_union.stderr new file mode 100644 index 00000000000..1e28f14165f --- /dev/null +++ b/src/test/ui/const-eval/feature-gate-const_fn_union.stderr @@ -0,0 +1,11 @@ +error[E0658]: unions in const fn are unstable (see issue #51909) + --> $DIR/feature-gate-const_fn_union.rs:21:5 + | +LL | Foo { u }.i //~ ERROR unions in const fn are unstable + | ^^^^^^^^^^^ + | + = help: add #![feature(const_fn_union)] 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/const-eval/issue-53157.rs b/src/test/ui/const-eval/issue-53157.rs new file mode 100644 index 00000000000..900847767e1 --- /dev/null +++ b/src/test/ui/const-eval/issue-53157.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-pass + +macro_rules! m { + () => {{ + fn f(_: impl Sized) {} + f + }} +} + +fn main() { + fn f() -> impl Sized {}; + m!()(f()); +} diff --git a/src/test/ui/const-eval/match-test-ptr-null.rs b/src/test/ui/const-eval/match-test-ptr-null.rs index 19b3dcc3181..81fcd23fb78 100644 --- a/src/test/ui/const-eval/match-test-ptr-null.rs +++ b/src/test/ui/const-eval/match-test-ptr-null.rs @@ -13,7 +13,7 @@ fn main() { // that pointer comparison is disallowed, not that parts of a pointer are accessed as raw // bytes. let _: [u8; 0] = [4; { //~ ERROR could not evaluate repeat length - match &1 as *const i32 as usize { //~ ERROR raw pointers cannot be cast to integers + match &1 as *const i32 as usize { //~ ERROR casting pointers to integers in constants 0 => 42, //~ ERROR constant contains unimplemented expression type //~^ NOTE "pointer arithmetic or comparison" needs an rfc before being allowed n => n, diff --git a/src/test/ui/const-eval/match-test-ptr-null.stderr b/src/test/ui/const-eval/match-test-ptr-null.stderr index 726ada9b428..26577948fae 100644 --- a/src/test/ui/const-eval/match-test-ptr-null.stderr +++ b/src/test/ui/const-eval/match-test-ptr-null.stderr @@ -1,8 +1,10 @@ -error[E0018]: raw pointers cannot be cast to integers in constants +error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/match-test-ptr-null.rs:16:15 | -LL | match &1 as *const i32 as usize { //~ ERROR raw pointers cannot be cast to integers +LL | match &1 as *const i32 as usize { //~ ERROR casting pointers to integers in constants | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error[E0019]: constant contains unimplemented expression type --> $DIR/match-test-ptr-null.rs:17:13 @@ -15,7 +17,7 @@ error[E0080]: could not evaluate repeat length | LL | let _: [u8; 0] = [4; { //~ ERROR could not evaluate repeat length | __________________________^ -LL | | match &1 as *const i32 as usize { //~ ERROR raw pointers cannot be cast to integers +LL | | match &1 as *const i32 as usize { //~ ERROR casting pointers to integers in constants LL | | 0 => 42, //~ ERROR constant contains unimplemented expression type | | - "pointer arithmetic or comparison" needs an rfc before being allowed inside constants LL | | //~^ NOTE "pointer arithmetic or comparison" needs an rfc before being allowed @@ -26,5 +28,5 @@ LL | | }]; error: aborting due to 3 previous errors -Some errors occurred: E0018, E0019, E0080. -For more information about an error, try `rustc --explain E0018`. +Some errors occurred: E0019, E0080, E0658. +For more information about an error, try `rustc --explain E0019`. diff --git a/src/test/ui/const-eval/promoted_const_fn_fail.rs b/src/test/ui/const-eval/promoted_const_fn_fail.rs index f0f35ce614e..19db07dd330 100644 --- a/src/test/ui/const-eval/promoted_const_fn_fail.rs +++ b/src/test/ui/const-eval/promoted_const_fn_fail.rs @@ -10,7 +10,7 @@ // compile-pass -#![feature(const_fn)] +#![feature(const_fn, const_fn_union)] #![deny(const_err)] diff --git a/src/test/ui/const-eval/promoted_raw_ptr_ops.rs b/src/test/ui/const-eval/promoted_raw_ptr_ops.rs new file mode 100644 index 00000000000..3b437f69d8d --- /dev/null +++ b/src/test/ui/const-eval/promoted_raw_ptr_ops.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_raw_ptr_to_usize_cast, const_compare_raw_pointers, const_raw_ptr_deref)] + +fn main() { + let x: &'static bool = &(42 as *const i32 == 43 as *const i32); + //~^ ERROR does not live long enough + let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough + let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR does not live long enough +} diff --git a/src/test/ui/const-eval/promoted_raw_ptr_ops.stderr b/src/test/ui/const-eval/promoted_raw_ptr_ops.stderr new file mode 100644 index 00000000000..90c73c095fb --- /dev/null +++ b/src/test/ui/const-eval/promoted_raw_ptr_ops.stderr @@ -0,0 +1,35 @@ +error[E0597]: borrowed value does not live long enough + --> $DIR/promoted_raw_ptr_ops.rs:14:29 + | +LL | let x: &'static bool = &(42 as *const i32 == 43 as *const i32); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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[E0597]: borrowed value does not live long enough + --> $DIR/promoted_raw_ptr_ops.rs:16:30 + | +LL | let y: &'static usize = &(&1 as *const i32 as usize + 1); //~ ERROR does not live long enough + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ temporary value does not live long enough +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ ERROR 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/promoted_raw_ptr_ops.rs:17:28 + | +LL | let z: &'static i32 = &(unsafe { *(42 as *const i32) }); //~ 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 3 previous errors + +For more information about this error, try `rustc --explain E0597`. diff --git a/src/test/ui/const-eval/ref_to_float_transmute.rs b/src/test/ui/const-eval/ref_to_float_transmute.rs index 77d5222cb9c..1758ac72b63 100644 --- a/src/test/ui/const-eval/ref_to_float_transmute.rs +++ b/src/test/ui/const-eval/ref_to_float_transmute.rs @@ -10,6 +10,8 @@ //compile-pass +#![feature(const_fn_union)] + fn main() {} static FOO: u32 = 42; diff --git a/src/test/ui/const-eval/ref_to_int_match.rs b/src/test/ui/const-eval/ref_to_int_match.rs index 8ad7f11f0ce..cb942f465e4 100644 --- a/src/test/ui/const-eval/ref_to_int_match.rs +++ b/src/test/ui/const-eval/ref_to_int_match.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(const_fn_union)] + fn main() { let n: Int = 40; match n { diff --git a/src/test/ui/const-eval/ref_to_int_match.stderr b/src/test/ui/const-eval/ref_to_int_match.stderr index 64ea57702d7..e82a16c066f 100644 --- a/src/test/ui/const-eval/ref_to_int_match.stderr +++ b/src/test/ui/const-eval/ref_to_int_match.stderr @@ -1,5 +1,5 @@ error[E0030]: lower range bound must be less than or equal to upper - --> $DIR/ref_to_int_match.rs:15:9 + --> $DIR/ref_to_int_match.rs:17:9 | LL | 10..=BAR => {}, //~ ERROR lower range bound must be less than or equal to upper | ^^ lower bound larger than upper bound diff --git a/src/test/ui/custom-attribute-multisegment.rs b/src/test/ui/custom-attribute-multisegment.rs new file mode 100644 index 00000000000..ad8e0e76e14 --- /dev/null +++ b/src/test/ui/custom-attribute-multisegment.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Unresolved multi-segment attributes are not treated as custom. + +#![feature(custom_attribute, proc_macro_path_invoc)] + +mod existent {} + +#[existent::nonexistent] //~ ERROR failed to resolve. Could not find `nonexistent` in `existent` +fn main() {} diff --git a/src/test/ui/custom-attribute-multisegment.stderr b/src/test/ui/custom-attribute-multisegment.stderr new file mode 100644 index 00000000000..ff72d1c36d8 --- /dev/null +++ b/src/test/ui/custom-attribute-multisegment.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve. Could not find `nonexistent` in `existent` + --> $DIR/custom-attribute-multisegment.rs:17:13 + | +LL | #[existent::nonexistent] //~ ERROR failed to resolve. Could not find `nonexistent` in `existent` + | ^^^^^^^^^^^ Could not find `nonexistent` in `existent` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0433`. diff --git a/src/test/ui/edition-keywords-2018-2015-expansion.rs b/src/test/ui/edition-keywords-2018-2015-expansion.rs index be22d8b9b01..911dcd855aa 100644 --- a/src/test/ui/edition-keywords-2018-2015-expansion.rs +++ b/src/test/ui/edition-keywords-2018-2015-expansion.rs @@ -12,7 +12,6 @@ // aux-build:edition-kw-macro-2015.rs // compile-pass -#![feature(raw_identifiers)] #![allow(async_idents)] #[macro_use] diff --git a/src/test/ui/edition-keywords-2018-2015-parsing.rs b/src/test/ui/edition-keywords-2018-2015-parsing.rs index 713da57f7e2..02b061f8cbc 100644 --- a/src/test/ui/edition-keywords-2018-2015-parsing.rs +++ b/src/test/ui/edition-keywords-2018-2015-parsing.rs @@ -11,8 +11,6 @@ // edition:2018 // aux-build:edition-kw-macro-2015.rs -#![feature(raw_identifiers)] - #[macro_use] extern crate edition_kw_macro_2015; diff --git a/src/test/ui/edition-keywords-2018-2015-parsing.stderr b/src/test/ui/edition-keywords-2018-2015-parsing.stderr index ceab5ea730e..02e7d5b7cd0 100644 --- a/src/test/ui/edition-keywords-2018-2015-parsing.stderr +++ b/src/test/ui/edition-keywords-2018-2015-parsing.stderr @@ -1,23 +1,23 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:20:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:18:13 | LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:30:13 + --> $DIR/edition-keywords-2018-2015-parsing.rs:28:13 | LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:24:31 + --> $DIR/edition-keywords-2018-2015-parsing.rs:22:31 | LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` | ^^^^^^^ error: no rules expected the token `async` - --> $DIR/edition-keywords-2018-2015-parsing.rs:25:35 + --> $DIR/edition-keywords-2018-2015-parsing.rs:23:35 | LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` | ^^^^^ diff --git a/src/test/ui/edition-keywords-2018-2018-expansion.rs b/src/test/ui/edition-keywords-2018-2018-expansion.rs index a1ae1b5d004..81bef913ac6 100644 --- a/src/test/ui/edition-keywords-2018-2018-expansion.rs +++ b/src/test/ui/edition-keywords-2018-2018-expansion.rs @@ -11,8 +11,6 @@ // edition:2018 // aux-build:edition-kw-macro-2018.rs -#![feature(raw_identifiers)] - #[macro_use] extern crate edition_kw_macro_2018; diff --git a/src/test/ui/edition-keywords-2018-2018-expansion.stderr b/src/test/ui/edition-keywords-2018-2018-expansion.stderr index 91d0b2d30b5..c6e0927a3a4 100644 --- a/src/test/ui/edition-keywords-2018-2018-expansion.stderr +++ b/src/test/ui/edition-keywords-2018-2018-expansion.stderr @@ -1,5 +1,5 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2018-expansion.rs:20:5 + --> $DIR/edition-keywords-2018-2018-expansion.rs:18:5 | LL | produces_async! {} //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^^^^^^^^^^^^^^ expected identifier, found reserved keyword diff --git a/src/test/ui/edition-keywords-2018-2018-parsing.rs b/src/test/ui/edition-keywords-2018-2018-parsing.rs index 263ec95caa7..565c2f2dc74 100644 --- a/src/test/ui/edition-keywords-2018-2018-parsing.rs +++ b/src/test/ui/edition-keywords-2018-2018-parsing.rs @@ -11,8 +11,6 @@ // edition:2018 // aux-build:edition-kw-macro-2018.rs -#![feature(raw_identifiers)] - #[macro_use] extern crate edition_kw_macro_2018; diff --git a/src/test/ui/edition-keywords-2018-2018-parsing.stderr b/src/test/ui/edition-keywords-2018-2018-parsing.stderr index e48aac0a2bb..435e395c291 100644 --- a/src/test/ui/edition-keywords-2018-2018-parsing.stderr +++ b/src/test/ui/edition-keywords-2018-2018-parsing.stderr @@ -1,23 +1,23 @@ error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:20:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:18:13 | LL | let mut async = 1; //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword error: expected identifier, found reserved keyword `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:30:13 + --> $DIR/edition-keywords-2018-2018-parsing.rs:28:13 | LL | module::async(); //~ ERROR expected identifier, found reserved keyword `async` | ^^^^^ expected identifier, found reserved keyword error: no rules expected the token `r#async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:24:31 + --> $DIR/edition-keywords-2018-2018-parsing.rs:22:31 | LL | r#async = consumes_async!(r#async); //~ ERROR no rules expected the token `r#async` | ^^^^^^^ error: no rules expected the token `async` - --> $DIR/edition-keywords-2018-2018-parsing.rs:25:35 + --> $DIR/edition-keywords-2018-2018-parsing.rs:23:35 | LL | r#async = consumes_async_raw!(async); //~ ERROR no rules expected the token `async` | ^^^^^ diff --git a/src/test/ui/error-codes/E0395.rs b/src/test/ui/error-codes/E0395.rs index 00008ea6b6f..617050732b7 100644 --- a/src/test/ui/error-codes/E0395.rs +++ b/src/test/ui/error-codes/E0395.rs @@ -8,9 +8,11 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// gate-test-const_compare_raw_pointers + static FOO: i32 = 42; static BAR: i32 = 42; -static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395 +static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 fn main() { } diff --git a/src/test/ui/error-codes/E0395.stderr b/src/test/ui/error-codes/E0395.stderr index ee90df79870..0fb9a9e854d 100644 --- a/src/test/ui/error-codes/E0395.stderr +++ b/src/test/ui/error-codes/E0395.stderr @@ -1,9 +1,11 @@ -error[E0395]: raw pointers cannot be compared in statics - --> $DIR/E0395.rs:14:22 +error[E0658]: comparing raw pointers inside static (see issue #53020) + --> $DIR/E0395.rs:16:22 | -LL | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR E0395 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static +LL | static BAZ: bool = { (&FOO as *const i32) == (&BAR as *const i32) }; //~ ERROR issue #53020 + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0395`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/error-codes/E0396-fixed.rs b/src/test/ui/error-codes/E0396-fixed.rs new file mode 100644 index 00000000000..08d20e7850d --- /dev/null +++ b/src/test/ui/error-codes/E0396-fixed.rs @@ -0,0 +1,19 @@ +// 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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(const_raw_ptr_deref)] + +const REG_ADDR: *const u8 = 0x5f3759df as *const u8; + +const VALUE: u8 = unsafe { *REG_ADDR }; +//~^ ERROR this constant cannot be used + +fn main() { +} diff --git a/src/test/ui/error-codes/E0396-fixed.stderr b/src/test/ui/error-codes/E0396-fixed.stderr new file mode 100644 index 00000000000..7d3c98c8ea8 --- /dev/null +++ b/src/test/ui/error-codes/E0396-fixed.stderr @@ -0,0 +1,12 @@ +error: this constant cannot be used + --> $DIR/E0396-fixed.rs:15:1 + | +LL | const VALUE: u8 = unsafe { *REG_ADDR }; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---------^^^ + | | + | a memory access tried to interpret some bytes as a pointer + | + = note: #[deny(const_err)] on by default + +error: aborting due to previous error + diff --git a/src/test/ui/error-codes/E0396.rs b/src/test/ui/error-codes/E0396.rs index 7f34acdfb90..1ee8a74a465 100644 --- a/src/test/ui/error-codes/E0396.rs +++ b/src/test/ui/error-codes/E0396.rs @@ -8,9 +8,12 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// gate-test-const_raw_ptr_deref + const REG_ADDR: *const u8 = 0x5f3759df as *const u8; -const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396 +const VALUE: u8 = unsafe { *REG_ADDR }; +//~^ ERROR dereferencing raw pointers in constants is unstable fn main() { } diff --git a/src/test/ui/error-codes/E0396.stderr b/src/test/ui/error-codes/E0396.stderr index 87dfd50dc97..a2a2e724358 100644 --- a/src/test/ui/error-codes/E0396.stderr +++ b/src/test/ui/error-codes/E0396.stderr @@ -1,9 +1,11 @@ -error[E0396]: raw pointers cannot be dereferenced in constants - --> $DIR/E0396.rs:13:28 +error[E0658]: dereferencing raw pointers in constants is unstable (see issue #51911) + --> $DIR/E0396.rs:15:28 | -LL | const VALUE: u8 = unsafe { *REG_ADDR }; //~ ERROR E0396 - | ^^^^^^^^^ dereference of raw pointer in constant +LL | const VALUE: u8 = unsafe { *REG_ADDR }; + | ^^^^^^^^^ + | + = help: add #![feature(const_raw_ptr_deref)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0396`. +For more information about this error, try `rustc --explain E0658`. 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 0ac295c54bc..3f9104373d6 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 @@ -8,11 +8,10 @@ error: unsatisfied lifetime constraints --> $DIR/E0621-does-not-trigger-for-closures.rs:25:26 | LL | invoke(&x, |a, b| if a > b { a } else { b }); //~ ERROR E0495 - | ----------^^^^^----------------- - | | | | - | | | requires that `'1` must outlive `'2` - | | has type `&'1 i32` - | lifetime `'2` appears in return type + | -- ^^^^^ 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/ui/feature-gate-impl_header_lifetime_elision-with-in_band.rs b/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.rs new file mode 100644 index 00000000000..b7e07e1dca6 --- /dev/null +++ b/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] + +// Make sure this related feature didn't accidentally enable this +#![feature(in_band_lifetimes)] + +trait MyTrait<'a> { } + +impl MyTrait<'a> for &u32 { } +//~^ ERROR missing lifetime specifier + +struct MyStruct; +trait MarkerTrait {} + +impl MarkerTrait for &'_ MyStruct { } +//~^ ERROR missing lifetime specifier + +fn main() {} diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.stderr b/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.stderr new file mode 100644 index 00000000000..9487d11d505 --- /dev/null +++ b/src/test/ui/feature-gate-impl_header_lifetime_elision-with-in_band.stderr @@ -0,0 +1,15 @@ +error[E0106]: missing lifetime specifier + --> $DIR/feature-gate-impl_header_lifetime_elision-with-in_band.rs:18:22 + | +LL | impl MyTrait<'a> for &u32 { } + | ^ expected lifetime parameter + +error[E0106]: missing lifetime specifier + --> $DIR/feature-gate-impl_header_lifetime_elision-with-in_band.rs:24:23 + | +LL | impl MarkerTrait for &'_ MyStruct { } + | ^^ expected lifetime parameter + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision.rs b/src/test/ui/feature-gate-impl_header_lifetime_elision.rs new file mode 100644 index 00000000000..3eb2ac1b008 --- /dev/null +++ b/src/test/ui/feature-gate-impl_header_lifetime_elision.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(warnings)] + +trait MyTrait<'a> { } + +impl<'a> MyTrait<'a> for &u32 { } +//~^ ERROR missing lifetime specifier + +impl<'a> MyTrait<'_> for &'a f32 { } +//~^ ERROR missing lifetime specifier + +fn main() {} diff --git a/src/test/ui/feature-gate-impl_header_lifetime_elision.stderr b/src/test/ui/feature-gate-impl_header_lifetime_elision.stderr new file mode 100644 index 00000000000..2c8a7dd4305 --- /dev/null +++ b/src/test/ui/feature-gate-impl_header_lifetime_elision.stderr @@ -0,0 +1,15 @@ +error[E0106]: missing lifetime specifier + --> $DIR/feature-gate-impl_header_lifetime_elision.rs:15:26 + | +LL | impl<'a> MyTrait<'a> for &u32 { } + | ^ expected lifetime parameter + +error[E0106]: missing lifetime specifier + --> $DIR/feature-gate-impl_header_lifetime_elision.rs:18:18 + | +LL | impl<'a> MyTrait<'_> for &'a f32 { } + | ^^ expected lifetime parameter + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/feature-gate-in_band_lifetimes-impl.rs b/src/test/ui/feature-gate-in_band_lifetimes-impl.rs deleted file mode 100644 index 3eb2ac1b008..00000000000 --- a/src/test/ui/feature-gate-in_band_lifetimes-impl.rs +++ /dev/null @@ -1,21 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(warnings)] - -trait MyTrait<'a> { } - -impl<'a> MyTrait<'a> for &u32 { } -//~^ ERROR missing lifetime specifier - -impl<'a> MyTrait<'_> for &'a f32 { } -//~^ ERROR missing lifetime specifier - -fn main() {} diff --git a/src/test/ui/feature-gate-in_band_lifetimes-impl.stderr b/src/test/ui/feature-gate-in_band_lifetimes-impl.stderr deleted file mode 100644 index 95bf81f41f8..00000000000 --- a/src/test/ui/feature-gate-in_band_lifetimes-impl.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/feature-gate-in_band_lifetimes-impl.rs:15:26 - | -LL | impl<'a> MyTrait<'a> for &u32 { } - | ^ expected lifetime parameter - -error[E0106]: missing lifetime specifier - --> $DIR/feature-gate-in_band_lifetimes-impl.rs:18:18 - | -LL | impl<'a> MyTrait<'_> for &'a f32 { } - | ^^ expected lifetime parameter - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/feature-gate-in_band_lifetimes.rs b/src/test/ui/feature-gate-in_band_lifetimes.rs index ae1f81c2f57..23b30711cf3 100644 --- a/src/test/ui/feature-gate-in_band_lifetimes.rs +++ b/src/test/ui/feature-gate-in_band_lifetimes.rs @@ -10,6 +10,9 @@ #![allow(warnings)] +// Make sure this related feature didn't accidentally enable this +#![feature(impl_header_lifetime_elision)] + fn foo(x: &'x u8) -> &'x u8 { x } //~^ ERROR use of undeclared lifetime name //~^^ ERROR use of undeclared lifetime name diff --git a/src/test/ui/feature-gate-in_band_lifetimes.stderr b/src/test/ui/feature-gate-in_band_lifetimes.stderr index cc0855306e1..5fe143959d2 100644 --- a/src/test/ui/feature-gate-in_band_lifetimes.stderr +++ b/src/test/ui/feature-gate-in_band_lifetimes.stderr @@ -1,101 +1,101 @@ error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:13:12 + --> $DIR/feature-gate-in_band_lifetimes.rs:16:12 | LL | fn foo(x: &'x u8) -> &'x u8 { x } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'x` - --> $DIR/feature-gate-in_band_lifetimes.rs:13:23 + --> $DIR/feature-gate-in_band_lifetimes.rs:16:23 | LL | fn foo(x: &'x u8) -> &'x u8 { x } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:25:12 + --> $DIR/feature-gate-in_band_lifetimes.rs:28:12 | LL | impl<'a> X<'b> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:27:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:30:27 | LL | fn inner_2(&self) -> &'b u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:33:8 + --> $DIR/feature-gate-in_band_lifetimes.rs:36:8 | LL | impl X<'b> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:35:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:38:27 | LL | fn inner_3(&self) -> &'b u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:43:9 + --> $DIR/feature-gate-in_band_lifetimes.rs:46:9 | LL | impl Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:45:25 + --> $DIR/feature-gate-in_band_lifetimes.rs:48:25 | LL | fn inner(&self) -> &'a u8 { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:53:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:56:27 | LL | fn any_lifetime() -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:55:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:58:27 | LL | fn borrowed_lifetime(&'b self) -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:55:40 + --> $DIR/feature-gate-in_band_lifetimes.rs:58:40 | LL | fn borrowed_lifetime(&'b self) -> &'b u8; | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:60:14 + --> $DIR/feature-gate-in_band_lifetimes.rs:63:14 | LL | impl MyTrait<'a> for Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:60:25 + --> $DIR/feature-gate-in_band_lifetimes.rs:63:25 | LL | impl MyTrait<'a> for Y<&'a u8> { | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'a` - --> $DIR/feature-gate-in_band_lifetimes.rs:63:31 + --> $DIR/feature-gate-in_band_lifetimes.rs:66:31 | LL | fn my_lifetime(&self) -> &'a u8 { self.0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:65:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:68:27 | LL | fn any_lifetime() -> &'b u8 { &0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:67:27 + --> $DIR/feature-gate-in_band_lifetimes.rs:70:27 | LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } | ^^ undeclared lifetime error[E0261]: use of undeclared lifetime name `'b` - --> $DIR/feature-gate-in_band_lifetimes.rs:67:40 + --> $DIR/feature-gate-in_band_lifetimes.rs:70:40 | LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 } | ^^ undeclared lifetime diff --git a/src/test/ui/feature-gate-macros_in_extern.rs b/src/test/ui/feature-gate-macros_in_extern.rs index 5271f75b632..77080e3c348 100644 --- a/src/test/ui/feature-gate-macros_in_extern.rs +++ b/src/test/ui/feature-gate-macros_in_extern.rs @@ -27,9 +27,9 @@ macro_rules! emits_nothing( #[link(name = "rust_test_helpers", kind = "static")] extern { returns_isize!(rust_get_test_int); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental takes_u32_returns_u32!(rust_dbg_extern_identity_u32); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental emits_nothing!(); - //~^ ERROR macro invocations in `extern {}` blocks are experimental. + //~^ ERROR macro invocations in `extern {}` blocks are experimental } diff --git a/src/test/ui/feature-gate-macros_in_extern.stderr b/src/test/ui/feature-gate-macros_in_extern.stderr index 5d7e01fbbb7..23b63078dbf 100644 --- a/src/test/ui/feature-gate-macros_in_extern.stderr +++ b/src/test/ui/feature-gate-macros_in_extern.stderr @@ -1,4 +1,4 @@ -error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476) +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) --> $DIR/feature-gate-macros_in_extern.rs:29:5 | LL | returns_isize!(rust_get_test_int); @@ -6,7 +6,7 @@ LL | returns_isize!(rust_get_test_int); | = help: add #![feature(macros_in_extern)] to the crate attributes to enable -error[E0658]: macro and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476) +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) --> $DIR/feature-gate-macros_in_extern.rs:31:5 | LL | takes_u32_returns_u32!(rust_dbg_extern_identity_u32); @@ -14,7 +14,7 @@ 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 and proc-macro invocations in `extern {}` blocks are experimental. (see issue #49476) +error[E0658]: macro invocations in `extern {}` blocks are experimental (see issue #49476) --> $DIR/feature-gate-macros_in_extern.rs:33:5 | LL | emits_nothing!(); diff --git a/src/test/ui/feature-gate-unwind-attributes.rs b/src/test/ui/feature-gate-unwind-attributes.rs index c8f9cd943cd..681842e30e0 100644 --- a/src/test/ui/feature-gate-unwind-attributes.rs +++ b/src/test/ui/feature-gate-unwind-attributes.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// compile-flags: -C no-prepopulate-passes +// compile-flags: -C no-prepopulate-passes -Cpasses=name-anon-globals #![crate_type = "lib"] diff --git a/src/test/ui/feature-gate/duplicate-features.rs b/src/test/ui/feature-gate/duplicate-features.rs new file mode 100644 index 00000000000..163a28772a5 --- /dev/null +++ b/src/test/ui/feature-gate/duplicate-features.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(stable_features)] + +#![feature(rust1)] +#![feature(rust1)] //~ ERROR the feature `rust1` has already been declared + +#![feature(if_let)] +#![feature(if_let)] //~ ERROR the feature `if_let` has already been declared + +fn main() {} diff --git a/src/test/ui/feature-gate/duplicate-features.stderr b/src/test/ui/feature-gate/duplicate-features.stderr new file mode 100644 index 00000000000..d55297bdd0e --- /dev/null +++ b/src/test/ui/feature-gate/duplicate-features.stderr @@ -0,0 +1,15 @@ +error[E0636]: the feature `if_let` has already been declared + --> $DIR/duplicate-features.rs:17:12 + | +LL | #![feature(if_let)] //~ ERROR the feature `if_let` has already been declared + | ^^^^^^ + +error[E0636]: the feature `rust1` has already been declared + --> $DIR/duplicate-features.rs:14:12 + | +LL | #![feature(rust1)] //~ ERROR the feature `rust1` has already been declared + | ^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0636`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs index db50b951443..dd235cb9c3a 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.rs @@ -43,6 +43,7 @@ #![feature(rustc_attrs)] // For `rustc_error`; see note below. #![warn(unused_attributes, unknown_lints)] #![allow(dead_code)] +#![allow(stable_features)] // UNGATED WHITE-LISTED BUILT-IN ATTRIBUTES @@ -100,7 +101,7 @@ // For #![crate_id], see issue #43142. (I cannot bear to enshrine current behavior in a test) // FIXME(#44232) we should warn that this isn't used. -#![feature ( x0600)] +#![feature ( rust1)] // For #![no_start], see issue #43144. (I cannot bear to enshrine current behavior in a test) diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr index 2dbe9831014..fd38fb6f976 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-builtin-attrs.stderr @@ -1,5 +1,5 @@ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:49:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:33 | LL | #![warn (x5400)] //~ WARN unknown lint: `x5400` | ^^^^^ @@ -11,175 +11,175 @@ LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:50:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:33 | LL | #![allow (x5300)] //~ WARN unknown lint: `x5300` | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:51:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:33 | LL | #![forbid (x5200)] //~ WARN unknown lint: `x5200` | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:52:33 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:53:33 | LL | #![deny (x5100)] //~ WARN unknown lint: `x5100` | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:114:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:115:8 | LL | #[warn(x5400)] | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:117:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:118:25 | LL | mod inner { #![warn(x5400)] } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:120:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:121:12 | LL | #[warn(x5400)] fn f() { } | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:123:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:124:12 | LL | #[warn(x5400)] struct S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:126:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:127:12 | LL | #[warn(x5400)] type T = S; | ^^^^^ warning: unknown lint: `x5400` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:129:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:130:12 | LL | #[warn(x5400)] impl S { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:133:9 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:134:9 | LL | #[allow(x5300)] | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:136:26 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:137:26 | LL | mod inner { #![allow(x5300)] } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:139:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:140:13 | LL | #[allow(x5300)] fn f() { } | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:142:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:143:13 | LL | #[allow(x5300)] struct S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:145:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:146:13 | LL | #[allow(x5300)] type T = S; | ^^^^^ warning: unknown lint: `x5300` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:148:13 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:149:13 | LL | #[allow(x5300)] impl S { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:152:10 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:153:10 | LL | #[forbid(x5200)] | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:155:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:156:27 | LL | mod inner { #![forbid(x5200)] } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:158:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:159:14 | LL | #[forbid(x5200)] fn f() { } | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:161:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:162:14 | LL | #[forbid(x5200)] struct S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:164:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:165:14 | LL | #[forbid(x5200)] type T = S; | ^^^^^ warning: unknown lint: `x5200` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:167:14 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:168:14 | LL | #[forbid(x5200)] impl S { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:171:8 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:172:8 | LL | #[deny(x5100)] | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:174:25 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:175:25 | LL | mod inner { #![deny(x5100)] } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:177:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:178:12 | LL | #[deny(x5100)] fn f() { } | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:180:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:181:12 | LL | #[deny(x5100)] struct S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:183:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:184:12 | LL | #[deny(x5100)] type T = S; | ^^^^^ warning: unknown lint: `x5100` - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:186:12 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:187:12 | LL | #[deny(x5100)] impl S { } | ^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:500:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:501:1 | LL | #[macro_escape] | ^^^^^^^^^^^^^^^ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:503:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:504:17 | LL | mod inner { #![macro_escape] } | ^^^^^^^^^^^^^^^^ @@ -187,7 +187,7 @@ LL | mod inner { #![macro_escape] } = help: consider an outer attribute, #[macro_use] mod ... warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:17 | LL | mod inner { #![repr="3900"] } | ^^^^^^^^^^^^^^^ needs a hint @@ -197,7 +197,7 @@ LL | mod inner { #![repr="3900"] } = note: for more information, visit warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 | LL | #[repr = "3900"] fn f() { } | ^^^^^^^^^^^^^^^^ needs a hint @@ -206,7 +206,7 @@ LL | #[repr = "3900"] fn f() { } = note: for more information, visit warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:327:5 | LL | #[repr = "3900"] type T = S; | ^^^^^^^^^^^^^^^^ needs a hint @@ -215,7 +215,7 @@ LL | #[repr = "3900"] type T = S; = note: for more information, visit warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:5 | LL | #[repr = "3900"] impl S { } | ^^^^^^^^^^^^^^^^ needs a hint @@ -224,7 +224,7 @@ LL | #[repr = "3900"] impl S { } = note: for more information, visit warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:312:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:1 | LL | #[repr = "3900"] | ^^^^^^^^^^^^^^^^ needs a hint @@ -233,7 +233,7 @@ LL | #[repr = "3900"] = note: for more information, visit warning: `repr` attribute isn't configurable with a literal - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:62:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 | LL | #![repr = "3900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ needs a hint @@ -242,7 +242,7 @@ LL | #![repr = "3900"] = note: for more information, visit warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:194:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:195:5 | LL | #[macro_use] fn f() { } | ^^^^^^^^^^^^ @@ -254,277 +254,277 @@ LL | #![warn(unused_attributes, unknown_lints)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:197:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:198:5 | LL | #[macro_use] struct S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:200:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:201:5 | LL | #[macro_use] type T = S; | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:203:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:204:5 | LL | #[macro_use] impl S { } | ^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:210:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:211:17 | LL | mod inner { #![macro_export="4800"] } | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:213:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:214:5 | LL | #[macro_export = "4800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:216:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:217:5 | LL | #[macro_export = "4800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:219:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:220:5 | LL | #[macro_export = "4800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:222:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:223:5 | LL | #[macro_export = "4800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:207:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:208:1 | LL | #[macro_export = "4800"] | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:229:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:230:17 | LL | mod inner { #![plugin_registrar="4700"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:234:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:235:5 | LL | #[plugin_registrar = "4700"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:237:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:238:5 | LL | #[plugin_registrar = "4700"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:240:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:241:5 | LL | #[plugin_registrar = "4700"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:226:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:227:1 | LL | #[plugin_registrar = "4700"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:247:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:248:17 | LL | mod inner { #![main="4300"] } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:252:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:253:5 | LL | #[main = "4400"] struct S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:255:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:256:5 | LL | #[main = "4400"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:258:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:259:5 | LL | #[main = "4400"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:244:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:245:1 | LL | #[main = "4400"] | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:265:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:266:17 | LL | mod inner { #![start="4300"] } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:270:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:271:5 | LL | #[start = "4300"] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:273:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:274:5 | LL | #[start = "4300"] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:276:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:277:5 | LL | #[start = "4300"] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:262:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:263:1 | LL | #[start = "4300"] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:316:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:317:17 | LL | mod inner { #![repr="3900"] } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:320:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:321:5 | LL | #[repr = "3900"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:326:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:327:5 | LL | #[repr = "3900"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:330:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:331:5 | LL | #[repr = "3900"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:312:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:313:1 | LL | #[repr = "3900"] | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:339:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:340:5 | LL | #[path = "3800"] fn f() { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:342:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:343:5 | LL | #[path = "3800"] struct S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:345:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:346:5 | LL | #[path = "3800"] type T = S; | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:348:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:349:5 | LL | #[path = "3800"] impl S { } | ^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:355:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:356:17 | LL | mod inner { #![abi="3700"] } | ^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:358:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:359:5 | LL | #[abi = "3700"] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:361:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:362:5 | LL | #[abi = "3700"] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:364:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:365:5 | LL | #[abi = "3700"] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:367:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:368:5 | LL | #[abi = "3700"] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:352:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:353:1 | LL | #[abi = "3700"] | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:374:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:375:17 | LL | mod inner { #![automatically_derived="3600"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:377:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:378:5 | LL | #[automatically_derived = "3600"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:380:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:381:5 | LL | #[automatically_derived = "3600"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:383:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:384:5 | LL | #[automatically_derived = "3600"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:386:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:387:5 | LL | #[automatically_derived = "3600"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:371:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:372:1 | LL | #[automatically_derived = "3600"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: function is marked #[no_mangle], but not exported - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:394:27 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:395:27 | LL | #[no_mangle = "3500"] fn f() { } | -^^^^^^^^^ @@ -534,787 +534,787 @@ LL | #[no_mangle = "3500"] fn f() { } = note: #[warn(private_no_mangle_fns)] on by default warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:407:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:408:17 | LL | mod inner { #![no_link="3400"] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:410:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:411:5 | LL | #[no_link = "3400"] fn f() { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:413:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:414:5 | LL | #[no_link = "3400"] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:416:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:417:5 | LL | #[no_link = "3400"]type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:419:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:420:5 | LL | #[no_link = "3400"] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:404:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:405:1 | LL | #[no_link = "3400"] | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:426:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:427:17 | LL | mod inner { #![should_panic="3200"] } | ^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:429:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:430:5 | LL | #[should_panic = "3200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:432:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:433:5 | LL | #[should_panic = "3200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:435:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:436:5 | LL | #[should_panic = "3200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:438:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:439:5 | LL | #[should_panic = "3200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:423:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:424:1 | LL | #[should_panic = "3200"] | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:445:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:446:17 | LL | mod inner { #![ignore="3100"] } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:448:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:449:5 | LL | #[ignore = "3100"] fn f() { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:451:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:452:5 | LL | #[ignore = "3100"] struct S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:454:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:455:5 | LL | #[ignore = "3100"] type T = S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:457:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:458:5 | LL | #[ignore = "3100"] impl S { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:442:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:443:1 | LL | #[ignore = "3100"] | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:464:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:465:17 | LL | mod inner { #![no_implicit_prelude="3000"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:467:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:468:5 | LL | #[no_implicit_prelude = "3000"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:470:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:471:5 | LL | #[no_implicit_prelude = "3000"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:473:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:474:5 | LL | #[no_implicit_prelude = "3000"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:476:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:477:5 | LL | #[no_implicit_prelude = "3000"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:461:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:462:1 | LL | #[no_implicit_prelude = "3000"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:483:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:484:17 | LL | mod inner { #![reexport_test_harness_main="2900"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:486:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:487:5 | LL | #[reexport_test_harness_main = "2900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:489:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:490:5 | LL | #[reexport_test_harness_main = "2900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:492:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:493:5 | LL | #[reexport_test_harness_main = "2900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:495:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:496:5 | LL | #[reexport_test_harness_main = "2900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:480:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:481:1 | LL | #[reexport_test_harness_main = "2900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:506:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:507:5 | LL | #[macro_escape] fn f() { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:509:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:510:5 | LL | #[macro_escape] struct S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:512:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:513:5 | LL | #[macro_escape] type T = S; | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:515:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:516:5 | LL | #[macro_escape] impl S { } | ^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:524:17 | LL | mod inner { #![no_std="2600"] } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:523:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:524:17 | LL | mod inner { #![no_std="2600"] } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:528:5 | LL | #[no_std = "2600"] fn f() { } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:527:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:528:5 | LL | #[no_std = "2600"] fn f() { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:531:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:532:5 | LL | #[no_std = "2600"] struct S; | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:531:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:532:5 | LL | #[no_std = "2600"] struct S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:536:5 | LL | #[no_std = "2600"] type T = S; | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:535:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:536:5 | LL | #[no_std = "2600"] type T = S; | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:540:5 | LL | #[no_std = "2600"] impl S { } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:539:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:540:5 | LL | #[no_std = "2600"] impl S { } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:1 | LL | #[no_std = "2600"] | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:519:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:520:1 | LL | #[no_std = "2600"] | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:678:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:679:17 | LL | mod inner { #![crate_name="0900"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:682:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:683:5 | LL | #[crate_name = "0900"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:686:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:687:5 | LL | #[crate_name = "0900"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:690:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:691:5 | LL | #[crate_name = "0900"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:694:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:695:5 | LL | #[crate_name = "0900"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:674:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:675:1 | LL | #[crate_name = "0900"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:703:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:704:17 | LL | mod inner { #![crate_type="0800"] } | ^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:707:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:708:5 | LL | #[crate_type = "0800"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:711:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:712:5 | LL | #[crate_type = "0800"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:715:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:716:5 | LL | #[crate_type = "0800"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:719:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:720:5 | LL | #[crate_type = "0800"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:699:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:700:1 | LL | #[crate_type = "0800"] | ^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:728:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:729:17 | LL | mod inner { #![feature(x0600)] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:732:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:733:5 | LL | #[feature(x0600)] fn f() { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:736:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:737:5 | LL | #[feature(x0600)] struct S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:741:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:740:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:741:5 | LL | #[feature(x0600)] type T = S; | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:744:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:745:5 | LL | #[feature(x0600)] impl S { } | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:724:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:725:1 | LL | #[feature(x0600)] | ^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:17 | LL | mod inner { #![no_main="0400"] } | ^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:754:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:755:17 | LL | mod inner { #![no_main="0400"] } | ^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 | LL | #[no_main = "0400"] fn f() { } | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:758:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:759:5 | LL | #[no_main = "0400"] fn f() { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 | LL | #[no_main = "0400"] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:762:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:763:5 | LL | #[no_main = "0400"] struct S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:5 | LL | #[no_main = "0400"] type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:766:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:767:5 | LL | #[no_main = "0400"] type T = S; | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:5 | LL | #[no_main = "0400"] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:770:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:771:5 | LL | #[no_main = "0400"] impl S { } | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:1 | LL | #[no_main = "0400"] | ^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:750:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:751:1 | LL | #[no_main = "0400"] | ^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:792:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:793:17 | LL | mod inner { #![recursion_limit="0200"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:796:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:797:5 | LL | #[recursion_limit="0200"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:800:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:801:5 | LL | #[recursion_limit="0200"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:804:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:805:5 | LL | #[recursion_limit="0200"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:809:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:808:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:809:5 | LL | #[recursion_limit="0200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:788:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:789:1 | LL | #[recursion_limit="0200"] | ^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:818:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be in the root module - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:817:17 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:818:17 | LL | mod inner { #![type_length_limit="0100"] } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:821:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:822:5 | LL | #[type_length_limit="0100"] fn f() { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:825:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:826:5 | LL | #[type_length_limit="0100"] struct S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:829:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:830:5 | LL | #[type_length_limit="0100"] type T = S; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:834:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:833:5 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:834:5 | LL | #[type_length_limit="0100"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: crate-level attribute should be an inner attribute: add an exclamation mark: #![foo] - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:813:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:814:1 | LL | #[type_length_limit="0100"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:54:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1 | LL | #![macro_export = "4800"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:55:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:56:1 | LL | #![plugin_registrar = "4700"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:58:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 | LL | #![main = "x4400"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:59:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:60:1 | LL | #![start = "x4300"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:62:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:63:1 | LL | #![repr = "3900"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:65:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 | LL | #![path = "3800"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:67:1 | LL | #![abi = "3700"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:67:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:68:1 | LL | #![automatically_derived = "3600"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:69:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:70:1 | LL | #![no_link = "3400"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:71:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 | LL | #![should_panic = "3200"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:73:1 | LL | #![ignore = "3100"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused attribute - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:78:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:79:1 | LL | #![proc_macro_derive = "2500"] //~ WARN unused attribute | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: compilation successful - --> $DIR/issue-43106-gating-of-builtin-attrs.rs:844:1 + --> $DIR/issue-43106-gating-of-builtin-attrs.rs:845:1 | LL | / fn main() { //~ ERROR compilation successful LL | | println!("Hello World"); diff --git a/src/test/ui/feature-gate/stability-attribute-consistency.rs b/src/test/ui/feature-gate/stability-attribute-consistency.rs new file mode 100644 index 00000000000..94bc57d10e5 --- /dev/null +++ b/src/test/ui/feature-gate/stability-attribute-consistency.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![stable(feature = "stable_test_feature", since = "1.0.0")] + +#![feature(staged_api)] + +#[stable(feature = "foo", since = "1.0.0")] +fn foo_stable_1_0_0() {} + +#[stable(feature = "foo", since = "1.29.0")] +//~^ ERROR feature `foo` is declared stable since 1.29.0 +fn foo_stable_1_29_0() {} + +#[unstable(feature = "foo", issue = "0")] +//~^ ERROR feature `foo` is declared unstable +fn foo_unstable() {} + +fn main() {} diff --git a/src/test/ui/feature-gate/stability-attribute-consistency.stderr b/src/test/ui/feature-gate/stability-attribute-consistency.stderr new file mode 100644 index 00000000000..1b2fdd6014e --- /dev/null +++ b/src/test/ui/feature-gate/stability-attribute-consistency.stderr @@ -0,0 +1,15 @@ +error[E0711]: feature `foo` is declared stable since 1.29.0, but was previously declared stable since 1.0.0 + --> $DIR/stability-attribute-consistency.rs:18:1 + | +LL | #[stable(feature = "foo", since = "1.29.0")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0711]: feature `foo` is declared unstable, but was previously declared stable + --> $DIR/stability-attribute-consistency.rs:22:1 + | +LL | #[unstable(feature = "foo", issue = "0")] + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0711`. diff --git a/src/test/ui/feature-gate/unknown-feature.rs b/src/test/ui/feature-gate/unknown-feature.rs new file mode 100644 index 00000000000..da1b257f634 --- /dev/null +++ b/src/test/ui/feature-gate/unknown-feature.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(unknown_rust_feature)] //~ ERROR unknown feature + +fn main() {} diff --git a/src/test/ui/feature-gate/unknown-feature.stderr b/src/test/ui/feature-gate/unknown-feature.stderr new file mode 100644 index 00000000000..f44aaeec032 --- /dev/null +++ b/src/test/ui/feature-gate/unknown-feature.stderr @@ -0,0 +1,9 @@ +error[E0635]: unknown feature `unknown_rust_feature` + --> $DIR/unknown-feature.rs:11:12 + | +LL | #![feature(unknown_rust_feature)] //~ ERROR unknown feature + | ^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0635`. diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.rs b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs new file mode 100644 index 00000000000..15cf07771f2 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.rs @@ -0,0 +1,37 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that we do not yet support elision in associated types, even +// when there is just one name we could take from the impl header. + +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +trait MyTrait { + type Output; +} + +impl MyTrait for &i32 { + type Output = &i32; + //~^ ERROR missing lifetime specifier +} + +impl MyTrait for &u32 { + type Output = &'_ i32; + //~^ ERROR missing lifetime specifier +} + +// This is what you have to do: +impl<'a> MyTrait for &'a f32 { + type Output = &'a f32; +} + +fn main() { } diff --git a/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr new file mode 100644 index 00000000000..59b2cfd2226 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/assoc-type.stderr @@ -0,0 +1,15 @@ +error[E0106]: missing lifetime specifier + --> $DIR/assoc-type.rs:23:19 + | +LL | type Output = &i32; + | ^ expected lifetime parameter + +error[E0106]: missing lifetime specifier + --> $DIR/assoc-type.rs:28:20 + | +LL | type Output = &'_ i32; + | ^^ expected lifetime parameter + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr new file mode 100644 index 00000000000..f5d98e04ad8 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.nll.stderr @@ -0,0 +1,16 @@ +warning: not reporting region error due to nll + --> $DIR/dyn-trait.rs:32:16 + | +LL | static_val(x); //~ ERROR cannot infer + | ^ + +error: borrowed data escapes outside of function + --> $DIR/dyn-trait.rs:32:5 + | +LL | fn with_dyn_debug_static<'a>(x: Box) { + | - `x` is a reference that is only valid in the function body +LL | static_val(x); //~ ERROR cannot infer + | ^^^^^^^^^^^^^ `x` escapes the function body here + +error: aborting due to previous error + diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs b/src/test/ui/impl-header-lifetime-elision/dyn-trait.rs new file mode 100644 index 00000000000..661bfa8bdcc --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, +// 'b> MyTrait<'a> for &'b i32`. + +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +use std::fmt::Debug; + +// Equivalent to `Box`: +trait StaticTrait { } +impl StaticTrait for Box { } + +// Equivalent to `Box`: +trait NotStaticTrait { } +impl NotStaticTrait for Box { } + +fn static_val(_: T) { +} + +fn with_dyn_debug_static<'a>(x: Box) { + static_val(x); //~ ERROR cannot infer +} + +fn not_static_val(_: T) { +} + +fn with_dyn_debug_not_static<'a>(x: Box) { + not_static_val(x); // OK +} + +fn main() { +} diff --git a/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr new file mode 100644 index 00000000000..3e54ebeb398 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/dyn-trait.stderr @@ -0,0 +1,22 @@ +error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements + --> $DIR/dyn-trait.rs:32:16 + | +LL | static_val(x); //~ ERROR cannot infer + | ^ + | +note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 31:26... + --> $DIR/dyn-trait.rs:31:26 + | +LL | fn with_dyn_debug_static<'a>(x: Box) { + | ^^ + = note: ...so that the expression is assignable: + expected std::boxed::Box + found std::boxed::Box<(dyn std::fmt::Debug + 'a)> + = note: but, the lifetime must be valid for the static lifetime... + = note: ...so that the types are compatible: + expected StaticTrait + found StaticTrait + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0495`. diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.rs b/src/test/ui/impl-header-lifetime-elision/path-elided.rs new file mode 100644 index 00000000000..f88c899065c --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/path-elided.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +trait MyTrait { } + +struct Foo<'a> { x: &'a u32 } + +impl MyTrait for Foo { + //~^ ERROR missing lifetime specifier +} + +fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/path-elided.stderr b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr new file mode 100644 index 00000000000..6c1d72411bf --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/path-elided.stderr @@ -0,0 +1,9 @@ +error[E0106]: missing lifetime specifier + --> $DIR/path-elided.rs:18:18 + | +LL | impl MyTrait for Foo { + | ^^^ expected lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/impl-header-lifetime-elision/path-underscore.rs b/src/test/ui/impl-header-lifetime-elision/path-underscore.rs new file mode 100644 index 00000000000..38118f0d213 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/path-underscore.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that `impl MyTrait for Foo<'_>` works. + +// run-pass + +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +trait MyTrait { } + +struct Foo<'a> { x: &'a u32 } + +impl MyTrait for Foo<'_> { +} + +fn impls_my_trait() { } + +fn impls_my_trait_val(_: T) { + impls_my_trait::(); +} + +fn random_where_clause() +where for<'a> Foo<'a>: MyTrait { } + +fn main() { + let x = 22; + let f = Foo { x: &x }; + + // This type is `Foo<'x>` for a local lifetime `'x`; so the impl + // must apply to any lifetime to apply to this. + impls_my_trait_val(f); + + impls_my_trait::>(); + + random_where_clause(); +} diff --git a/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs b/src/test/ui/impl-header-lifetime-elision/ref-underscore.rs new file mode 100644 index 00000000000..96a56aacd87 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/ref-underscore.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that `impl MyTrait for &i32` works and is equivalent to any lifetime. + +// run-pass + +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +trait MyTrait { } + +impl MyTrait for &i32 { +} + +fn impls_my_trait() { } + +fn impls_my_trait_val(_: T) { + impls_my_trait::(); +} + +fn random_where_clause() +where for<'a> &'a i32: MyTrait { } + +fn main() { + let x = 22; + let f = &x; + + impls_my_trait_val(f); + + impls_my_trait::<&'static i32>(); + + random_where_clause(); +} diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.rs b/src/test/ui/impl-header-lifetime-elision/trait-elided.rs new file mode 100644 index 00000000000..afdf2200d90 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +trait MyTrait<'a> { } + +impl MyTrait for u32 { + //~^ ERROR missing lifetime specifier +} + +fn main() {} diff --git a/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr new file mode 100644 index 00000000000..fe3ded8e04c --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/trait-elided.stderr @@ -0,0 +1,9 @@ +error[E0106]: missing lifetime specifier + --> $DIR/trait-elided.rs:16:6 + | +LL | impl MyTrait for u32 { + | ^^^^^^^ expected lifetime parameter + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs new file mode 100644 index 00000000000..98242ff6577 --- /dev/null +++ b/src/test/ui/impl-header-lifetime-elision/trait-underscore.rs @@ -0,0 +1,47 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, +// 'b> MyTrait<'a> for &'b i32`. +// +// run-pass + +#![allow(warnings)] + +#![feature(impl_header_lifetime_elision)] + +trait MyTrait<'a> { } + +// This is equivalent to `MyTrait<'a> for &'b i32`, which is proven by +// the code below. +impl MyTrait<'_> for &i32 { +} + +// When called, T will be `&'x i32` for some `'x`, so since we can +// prove that `&'x i32: for<'a> MyTrait<'a>, then we know that the +// lifetime parameter above is disconnected. +fn impls_my_trait MyTrait<'a>>() { } + +fn impls_my_trait_val MyTrait<'a>>(_: T) { + impls_my_trait::(); +} + +fn random_where_clause() +where for<'a, 'b> &'a i32: MyTrait<'b> { } + +fn main() { + let x = 22; + let f = &x; + impls_my_trait_val(f); + + impls_my_trait::<&'static i32>(); + + random_where_clause(); +} diff --git a/src/test/ui/imports/macros.rs b/src/test/ui/imports/macros.rs index 5d6a1191384..ed5907800e9 100644 --- a/src/test/ui/imports/macros.rs +++ b/src/test/ui/imports/macros.rs @@ -10,7 +10,7 @@ // aux-build:two_macros.rs -#![feature(item_like_imports, use_extern_macros)] +#![feature(use_extern_macros)] extern crate two_macros; // two identity macros `m` and `n` diff --git a/src/test/ui/in-band-lifetimes/impl/assoc-type.rs b/src/test/ui/in-band-lifetimes/impl/assoc-type.rs deleted file mode 100644 index ab35331b279..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/assoc-type.rs +++ /dev/null @@ -1,37 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that we do not yet support elision in associated types, even -// when there is just one name we could take from the impl header. - -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -trait MyTrait { - type Output; -} - -impl MyTrait for &i32 { - type Output = &i32; - //~^ ERROR missing lifetime specifier -} - -impl MyTrait for &u32 { - type Output = &'_ i32; - //~^ ERROR missing lifetime specifier -} - -// This is what you have to do: -impl MyTrait for &'a f32 { - type Output = &'a f32; -} - -fn main() { } diff --git a/src/test/ui/in-band-lifetimes/impl/assoc-type.stderr b/src/test/ui/in-band-lifetimes/impl/assoc-type.stderr deleted file mode 100644 index 59b2cfd2226..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/assoc-type.stderr +++ /dev/null @@ -1,15 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/assoc-type.rs:23:19 - | -LL | type Output = &i32; - | ^ expected lifetime parameter - -error[E0106]: missing lifetime specifier - --> $DIR/assoc-type.rs:28:20 - | -LL | type Output = &'_ i32; - | ^^ expected lifetime parameter - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr b/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr deleted file mode 100644 index f5d98e04ad8..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.nll.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning: not reporting region error due to nll - --> $DIR/dyn-trait.rs:32:16 - | -LL | static_val(x); //~ ERROR cannot infer - | ^ - -error: borrowed data escapes outside of function - --> $DIR/dyn-trait.rs:32:5 - | -LL | fn with_dyn_debug_static<'a>(x: Box) { - | - `x` is a reference that is only valid in the function body -LL | static_val(x); //~ ERROR cannot infer - | ^^^^^^^^^^^^^ `x` escapes the function body here - -error: aborting due to previous error - diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs b/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs deleted file mode 100644 index c27bbe77fbf..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.rs +++ /dev/null @@ -1,43 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, -// 'b> MyTrait<'a> for &'b i32`. - -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -use std::fmt::Debug; - -// Equivalent to `Box`: -trait StaticTrait { } -impl StaticTrait for Box { } - -// Equivalent to `Box`: -trait NotStaticTrait { } -impl NotStaticTrait for Box { } - -fn static_val(_: T) { -} - -fn with_dyn_debug_static<'a>(x: Box) { - static_val(x); //~ ERROR cannot infer -} - -fn not_static_val(_: T) { -} - -fn with_dyn_debug_not_static<'a>(x: Box) { - not_static_val(x); // OK -} - -fn main() { -} diff --git a/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr b/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr deleted file mode 100644 index 3e54ebeb398..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/dyn-trait.stderr +++ /dev/null @@ -1,22 +0,0 @@ -error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements - --> $DIR/dyn-trait.rs:32:16 - | -LL | static_val(x); //~ ERROR cannot infer - | ^ - | -note: first, the lifetime cannot outlive the lifetime 'a as defined on the function body at 31:26... - --> $DIR/dyn-trait.rs:31:26 - | -LL | fn with_dyn_debug_static<'a>(x: Box) { - | ^^ - = note: ...so that the expression is assignable: - expected std::boxed::Box - found std::boxed::Box<(dyn std::fmt::Debug + 'a)> - = note: but, the lifetime must be valid for the static lifetime... - = note: ...so that the types are compatible: - expected StaticTrait - found StaticTrait - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0495`. diff --git a/src/test/ui/in-band-lifetimes/impl/path-elided.rs b/src/test/ui/in-band-lifetimes/impl/path-elided.rs deleted file mode 100644 index 8a758b124ba..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/path-elided.rs +++ /dev/null @@ -1,22 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -trait MyTrait { } - -struct Foo<'a> { x: &'a u32 } - -impl MyTrait for Foo { - //~^ ERROR missing lifetime specifier -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/impl/path-elided.stderr b/src/test/ui/in-band-lifetimes/impl/path-elided.stderr deleted file mode 100644 index 6c1d72411bf..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/path-elided.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/path-elided.rs:18:18 - | -LL | impl MyTrait for Foo { - | ^^^ expected lifetime parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/in-band-lifetimes/impl/path-underscore.rs b/src/test/ui/in-band-lifetimes/impl/path-underscore.rs deleted file mode 100644 index 756991d97a5..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/path-underscore.rs +++ /dev/null @@ -1,46 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that `impl MyTrait for Foo<'_>` works. - -// run-pass - -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -trait MyTrait { } - -struct Foo<'a> { x: &'a u32 } - -impl MyTrait for Foo<'_> { -} - -fn impls_my_trait() { } - -fn impls_my_trait_val(_: T) { - impls_my_trait::(); -} - -fn random_where_clause() -where for<'a> Foo<'a>: MyTrait { } - -fn main() { - let x = 22; - let f = Foo { x: &x }; - - // This type is `Foo<'x>` for a local lifetime `'x`; so the impl - // must apply to any lifetime to apply to this. - impls_my_trait_val(f); - - impls_my_trait::>(); - - random_where_clause(); -} diff --git a/src/test/ui/in-band-lifetimes/impl/ref-underscore.rs b/src/test/ui/in-band-lifetimes/impl/ref-underscore.rs deleted file mode 100644 index 99708afff35..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/ref-underscore.rs +++ /dev/null @@ -1,42 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that `impl MyTrait for &i32` works and is equivalent to any lifetime. - -// run-pass - -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -trait MyTrait { } - -impl MyTrait for &i32 { -} - -fn impls_my_trait() { } - -fn impls_my_trait_val(_: T) { - impls_my_trait::(); -} - -fn random_where_clause() -where for<'a> &'a i32: MyTrait { } - -fn main() { - let x = 22; - let f = &x; - - impls_my_trait_val(f); - - impls_my_trait::<&'static i32>(); - - random_where_clause(); -} diff --git a/src/test/ui/in-band-lifetimes/impl/trait-elided.rs b/src/test/ui/in-band-lifetimes/impl/trait-elided.rs deleted file mode 100644 index e0709ab6dd0..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/trait-elided.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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -trait MyTrait<'a> { } - -impl MyTrait for u32 { - //~^ ERROR missing lifetime specifier -} - -fn main() {} diff --git a/src/test/ui/in-band-lifetimes/impl/trait-elided.stderr b/src/test/ui/in-band-lifetimes/impl/trait-elided.stderr deleted file mode 100644 index fe3ded8e04c..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/trait-elided.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0106]: missing lifetime specifier - --> $DIR/trait-elided.rs:16:6 - | -LL | impl MyTrait for u32 { - | ^^^^^^^ expected lifetime parameter - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0106`. diff --git a/src/test/ui/in-band-lifetimes/impl/trait-underscore.rs b/src/test/ui/in-band-lifetimes/impl/trait-underscore.rs deleted file mode 100644 index 971fd1fe759..00000000000 --- a/src/test/ui/in-band-lifetimes/impl/trait-underscore.rs +++ /dev/null @@ -1,47 +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 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test that `impl MyTrait<'_> for &i32` is equivalent to `impl<'a, -// 'b> MyTrait<'a> for &'b i32`. -// -// run-pass - -#![allow(warnings)] - -#![feature(in_band_lifetimes)] - -trait MyTrait<'a> { } - -// This is equivalent to `MyTrait<'a> for &'b i32`, which is proven by -// the code below. -impl MyTrait<'_> for &i32 { -} - -// When called, T will be `&'x i32` for some `'x`, so since we can -// prove that `&'x i32: for<'a> MyTrait<'a>, then we know that the -// lifetime parameter above is disconnected. -fn impls_my_trait MyTrait<'a>>() { } - -fn impls_my_trait_val MyTrait<'a>>(_: T) { - impls_my_trait::(); -} - -fn random_where_clause() -where for<'a, 'b> &'a i32: MyTrait<'b> { } - -fn main() { - let x = 22; - let f = &x; - impls_my_trait_val(f); - - impls_my_trait::<&'static i32>(); - - random_where_clause(); -} diff --git a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr index cd2ebc341ea..1470783c206 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.nll.stderr @@ -14,19 +14,19 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/mismatched.rs:14:42 | LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required - | - ^ lifetime `'a` required - | | - | consider changing the type of `y` to `&'a u32` + | ---- ^ lifetime `'a` required + | | + | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/mismatched.rs:16:46 | LL | fn foo2(x: &'a u32, y: &'b u32) -> &'a u32 { y } //~ ERROR lifetime mismatch - | ------- ------- ^ ...but data from `y` is returned here - | | - | this parameter and the return type are declared with different lifetimes... + | -- -- ^ function was supposed to return data with lifetime `'b` but it is returning data with lifetime `'a` + | | | + | | lifetime `'b` defined here + | lifetime `'a` defined here error: aborting due to 2 previous errors -Some errors occurred: E0621, E0623. -For more information about an error, try `rustc --explain E0621`. +For more information about this error, try `rustc --explain E0621`. diff --git a/src/test/ui/in-band-lifetimes/mismatched.stderr b/src/test/ui/in-band-lifetimes/mismatched.stderr index d2748b2da4b..ed932a97ba4 100644 --- a/src/test/ui/in-band-lifetimes/mismatched.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched.stderr @@ -2,9 +2,9 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/mismatched.rs:14:42 | LL | fn foo(x: &'a u32, y: &u32) -> &'a u32 { y } //~ ERROR explicit lifetime required - | - ^ lifetime `'a` required - | | - | consider changing the type of `y` to `&'a u32` + | ---- ^ lifetime `'a` required + | | + | help: add explicit lifetime `'a` to the type of `y`: `&'a u32` error[E0623]: lifetime mismatch --> $DIR/mismatched.rs:16:46 diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr index 886e3834d1d..a01f3219dc5 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.nll.stderr @@ -8,7 +8,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/mismatched_trait.rs:16:9 | LL | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { - | - consider changing the type of `y` to `&'a u32` + | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a u32` LL | y //~ ERROR explicit lifetime required | ^ lifetime `'a` required diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr index 71b46f6d4d6..745b82c20b4 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/mismatched_trait.rs:16:9 | LL | fn baz(&self, x: &'a u32, y: &u32) -> &'a u32 { - | - consider changing the type of `y` to `&'a u32` + | ---- help: add explicit lifetime `'a` to the type of `y`: `&'a u32` LL | y //~ ERROR explicit lifetime required | ^ lifetime `'a` required diff --git a/src/test/ui/issue-11692-2.rs b/src/test/ui/issue-11692-2.rs index c595b0fb2c2..50525e03acf 100644 --- a/src/test/ui/issue-11692-2.rs +++ b/src/test/ui/issue-11692-2.rs @@ -10,5 +10,5 @@ fn main() { concat!(test!()); - //~^ ERROR expected a macro, found non-macro attribute + //~^ 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 index 3d080bd46dc..0c130943fd8 100644 --- a/src/test/ui/issue-11692-2.stderr +++ b/src/test/ui/issue-11692-2.stderr @@ -1,4 +1,4 @@ -error: expected a macro, found non-macro attribute +error: expected a macro, found built-in attribute --> $DIR/issue-11692-2.rs:12:13 | LL | concat!(test!()); diff --git a/src/test/ui/issue-13058.stderr b/src/test/ui/issue-13058.stderr index cef5f5ae475..5e8319d26ad 100644 --- a/src/test/ui/issue-13058.stderr +++ b/src/test/ui/issue-13058.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `cont` --> $DIR/issue-13058.rs:24:26 | LL | fn check<'r, I: Iterator, T: Itble<'r, usize, I>>(cont: &T) -> bool - | ---- consider changing the type of `cont` to `&'r T` + | -- help: add explicit lifetime `'r` to the type of `cont`: `&'r T` LL | { LL | let cont_iter = cont.iter(); | ^^^^ lifetime `'r` required diff --git a/src/test/ui/issue-14285.nll.stderr b/src/test/ui/issue-14285.nll.stderr index 440365cae3e..c95d540b25c 100644 --- a/src/test/ui/issue-14285.nll.stderr +++ b/src/test/ui/issue-14285.nll.stderr @@ -8,7 +8,7 @@ error[E0621]: explicit lifetime required in the type of `a` --> $DIR/issue-14285.rs:22:7 | LL | fn foo<'a>(a: &Foo) -> B<'a> { - | - consider changing the type of `a` to `&'a (dyn Foo + '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 diff --git a/src/test/ui/issue-14285.stderr b/src/test/ui/issue-14285.stderr index b5ab7bdb9d1..52163f81b7b 100644 --- a/src/test/ui/issue-14285.stderr +++ b/src/test/ui/issue-14285.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `a` --> $DIR/issue-14285.rs:22:5 | LL | fn foo<'a>(a: &Foo) -> B<'a> { - | - consider changing the type of `a` to `&'a (dyn Foo + '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 diff --git a/src/test/ui/issue-15034.nll.stderr b/src/test/ui/issue-15034.nll.stderr index 19fe83f8f6c..4c8482630c5 100644 --- a/src/test/ui/issue-15034.nll.stderr +++ b/src/test/ui/issue-15034.nll.stderr @@ -8,7 +8,7 @@ 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> { - | ----- consider changing the type of `lexer` to `&'a mut Lexer<'a>` + | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` LL | Parser { lexer: lexer } | ^^^^^ lifetime `'a` required diff --git a/src/test/ui/issue-15034.stderr b/src/test/ui/issue-15034.stderr index 3bbf4235a29..c87bec00d95 100644 --- a/src/test/ui/issue-15034.stderr +++ b/src/test/ui/issue-15034.stderr @@ -2,7 +2,7 @@ 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> { - | ----- consider changing the type of `lexer` to `&'a mut Lexer<'a>` + | ------------- help: add explicit lifetime `'a` to the type of `lexer`: `&'a mut Lexer<'a>` LL | Parser { lexer: lexer } | ^^^^^ lifetime `'a` required diff --git a/src/test/ui/issue-16922.nll.stderr b/src/test/ui/issue-16922.nll.stderr index 902baaf579f..1bd26faedaa 100644 --- a/src/test/ui/issue-16922.nll.stderr +++ b/src/test/ui/issue-16922.nll.stderr @@ -8,7 +8,7 @@ error[E0621]: explicit lifetime required in the type of `value` --> $DIR/issue-16922.rs:14:5 | LL | fn foo(value: &T) -> Box { - | ----- consider changing the type of `value` to `&'static T` + | -- help: add explicit lifetime `'static` to the type of `value`: `&'static T` LL | Box::new(value) as Box | ^^^^^^^^^^^^^^^ lifetime `'static` required diff --git a/src/test/ui/issue-16922.stderr b/src/test/ui/issue-16922.stderr index cf81d4b4d08..e70869eb183 100644 --- a/src/test/ui/issue-16922.stderr +++ b/src/test/ui/issue-16922.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `value` --> $DIR/issue-16922.rs:14:5 | LL | fn foo(value: &T) -> Box { - | ----- consider changing the type of `value` to `&'static T` + | -- help: add explicit lifetime `'static` to the type of `value`: `&'static T` LL | Box::new(value) as Box | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ lifetime `'static` required diff --git a/src/test/ui/issue-17337.rs b/src/test/ui/issue-17337.rs index 1208321b529..8642396c380 100644 --- a/src/test/ui/issue-17337.rs +++ b/src/test/ui/issue-17337.rs @@ -11,12 +11,12 @@ #![feature(staged_api)] #![deny(deprecated)] -#![unstable(feature = "test_feature", issue = "0")] +#![unstable(feature = "unstable_test_feature", issue = "0")] struct Foo; impl Foo { - #[unstable(feature = "test_feature", issue = "0")] + #[unstable(feature = "unstable_test_feature", issue = "0")] #[rustc_deprecated(since = "1.0.0", reason = "text")] fn foo(self) {} } diff --git a/src/test/ui/issue-17458.rs b/src/test/ui/issue-17458.rs index f5b7a0c13b7..354d389158d 100644 --- a/src/test/ui/issue-17458.rs +++ b/src/test/ui/issue-17458.rs @@ -9,7 +9,7 @@ // except according to those terms. static X: usize = 0 as *const usize as usize; -//~^ ERROR: raw pointers cannot be cast to integers in statics +//~^ ERROR: casting pointers to integers in statics is unstable fn main() { assert_eq!(X, 0); diff --git a/src/test/ui/issue-17458.stderr b/src/test/ui/issue-17458.stderr index 7a43813fa6d..0303e4bddb5 100644 --- a/src/test/ui/issue-17458.stderr +++ b/src/test/ui/issue-17458.stderr @@ -1,9 +1,11 @@ -error[E0018]: raw pointers cannot be cast to integers in statics +error[E0658]: casting pointers to integers in statics is unstable (see issue #51910) --> $DIR/issue-17458.rs:11:19 | LL | static X: usize = 0 as *const usize as usize; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0018`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issue-18294.rs b/src/test/ui/issue-18294.rs index efc1ba1635c..28dc6846f69 100644 --- a/src/test/ui/issue-18294.rs +++ b/src/test/ui/issue-18294.rs @@ -10,6 +10,6 @@ fn main() { const X: u32 = 1; - const Y: usize = &X as *const u32 as usize; //~ ERROR E0018 + const Y: usize = &X as *const u32 as usize; //~ ERROR is unstable println!("{}", Y); } diff --git a/src/test/ui/issue-18294.stderr b/src/test/ui/issue-18294.stderr index 151deefb2b7..0b94e778d37 100644 --- a/src/test/ui/issue-18294.stderr +++ b/src/test/ui/issue-18294.stderr @@ -1,9 +1,11 @@ -error[E0018]: raw pointers cannot be cast to integers in constants +error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/issue-18294.rs:13:22 | -LL | const Y: usize = &X as *const u32 as usize; //~ ERROR E0018 +LL | const Y: usize = &X as *const u32 as usize; //~ ERROR is unstable | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0018`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issue-25826.rs b/src/test/ui/issue-25826.rs index 00e1279d58a..6b9caba0218 100644 --- a/src/test/ui/issue-25826.rs +++ b/src/test/ui/issue-25826.rs @@ -11,6 +11,6 @@ fn id(t: T) -> T { t } fn main() { const A: bool = id:: as *const () < id:: as *const (); - //~^ ERROR raw pointers cannot be compared in constants [E0395] + //~^ ERROR comparing raw pointers inside constant println!("{}", A); } diff --git a/src/test/ui/issue-25826.stderr b/src/test/ui/issue-25826.stderr index fed9e8efa84..a5ab7cfa6d3 100644 --- a/src/test/ui/issue-25826.stderr +++ b/src/test/ui/issue-25826.stderr @@ -1,9 +1,11 @@ -error[E0395]: raw pointers cannot be compared in constants +error[E0658]: comparing raw pointers inside constant (see issue #53020) --> $DIR/issue-25826.rs:13:21 | LL | const A: bool = id:: as *const () < id:: as *const (); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ comparing raw pointers in static + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_compare_raw_pointers)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0395`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/issue-3154.nll.stderr b/src/test/ui/issue-3154.nll.stderr index 4420f9dcae4..91010bd3209 100644 --- a/src/test/ui/issue-3154.nll.stderr +++ b/src/test/ui/issue-3154.nll.stderr @@ -14,7 +14,7 @@ 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> { - | - consider changing the type of `x` to `&'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 diff --git a/src/test/ui/issue-3154.stderr b/src/test/ui/issue-3154.stderr index cc0cfd768c4..01299d74808 100644 --- a/src/test/ui/issue-3154.stderr +++ b/src/test/ui/issue-3154.stderr @@ -2,7 +2,7 @@ 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> { - | - consider changing the type of `x` to `&'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 diff --git a/src/test/ui/issue-40288-2.nll.stderr b/src/test/ui/issue-40288-2.nll.stderr index 1d2b2660342..dcc9e0a8a65 100644 --- a/src/test/ui/issue-40288-2.nll.stderr +++ b/src/test/ui/issue-40288-2.nll.stderr @@ -38,7 +38,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/issue-40288-2.rs:17:9 | LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | - consider changing the type of `y` to `&'a T` + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... LL | slice[0] = y; | ^^^^^^^^^^^^ lifetime `'a` required @@ -47,7 +47,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/issue-40288-2.rs:32:9 | LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | - consider changing the type of `y` to `&'a T` + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... LL | dst.head = y; | ^^^^^^^^^^^^ lifetime `'a` required diff --git a/src/test/ui/issue-40288-2.stderr b/src/test/ui/issue-40288-2.stderr index d2313ef89a7..fd0b4c01636 100644 --- a/src/test/ui/issue-40288-2.stderr +++ b/src/test/ui/issue-40288-2.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/issue-40288-2.rs:19:5 | LL | fn lifetime_transmute_slice<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | - consider changing the type of `y` to `&'a T` + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... LL | out[0] | ^^^^^^ lifetime `'a` required @@ -11,7 +11,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/issue-40288-2.rs:34:5 | LL | fn lifetime_transmute_struct<'a, T: ?Sized>(x: &'a T, y: &T) -> &'a T { - | - consider changing the type of `y` to `&'a T` + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... LL | out.head | ^^^^^^^^ lifetime `'a` required diff --git a/src/test/ui/issue-40510-1.nll.stderr b/src/test/ui/issue-40510-1.nll.stderr index 312ec6e742e..6c77bcb2757 100644 --- a/src/test/ui/issue-40510-1.nll.stderr +++ b/src/test/ui/issue-40510-1.nll.stderr @@ -1,17 +1,15 @@ error: unsatisfied lifetime constraints --> $DIR/issue-40510-1.rs:18:9 | -LL | || { - | _____- - | |_____| - | || -LL | || &mut x - | || ^^^^^^ return requires that `'1` must outlive `'2` -LL | || }; - | || - - | ||_____| - | |______lifetime `'1` represents the closure body - | lifetime `'2` appears in return type +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 index eb44850e639..8aeef86c2e8 100644 --- a/src/test/ui/issue-40510-3.nll.stderr +++ b/src/test/ui/issue-40510-3.nll.stderr @@ -1,20 +1,17 @@ error: unsatisfied lifetime constraints --> $DIR/issue-40510-3.rs:18:9 | -LL | || { - | _____- - | |_____| - | || -LL | || || { - | ||_________^ -LL | ||| x.push(()) -LL | ||| } - | |||_________^ requires that `'1` must outlive `'2` -LL | || }; - | || - - | ||_____| - | |______lifetime `'1` represents the closure body - | lifetime `'2` appears in return type +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-46983.stderr b/src/test/ui/issue-46983.stderr index 31aeebd5a72..c4f2b3eba7d 100644 --- a/src/test/ui/issue-46983.stderr +++ b/src/test/ui/issue-46983.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/issue-46983.rs:14:5 | LL | fn foo(x: &u32) -> &'static u32 { - | - consider changing the type of `x` to `&'static u32` + | ---- help: add explicit lifetime `'static` to the type of `x`: `&'static u32` LL | &*x | ^^^ lifetime `'static` required diff --git a/src/test/ui/issue-49824.nll.stderr b/src/test/ui/issue-49824.nll.stderr index 59345754e9f..fb4bed76a71 100644 --- a/src/test/ui/issue-49824.nll.stderr +++ b/src/test/ui/issue-49824.nll.stderr @@ -1,20 +1,17 @@ error: unsatisfied lifetime constraints --> $DIR/issue-49824.rs:22:9 | -LL | || { - | _____- - | |_____| - | || -LL | || || { - | ||_________^ -LL | ||| let _y = &mut x; -LL | ||| } - | |||_________^ requires that `'1` must outlive `'2` -LL | || }; - | || - - | ||_____| - | |______lifetime `'1` represents the closure body - | lifetime `'2` appears in return type +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-52023-array-size-pointer-cast.rs b/src/test/ui/issue-52023-array-size-pointer-cast.rs index f3bee1a6315..02bed69f0d4 100644 --- a/src/test/ui/issue-52023-array-size-pointer-cast.rs +++ b/src/test/ui/issue-52023-array-size-pointer-cast.rs @@ -9,5 +9,5 @@ // except according to those terms. fn main() { - let _ = [0; (&0 as *const i32) as usize]; //~ ERROR raw pointers cannot be cast + let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants } diff --git a/src/test/ui/issue-52023-array-size-pointer-cast.stderr b/src/test/ui/issue-52023-array-size-pointer-cast.stderr index 888de82e379..74270c2bef7 100644 --- a/src/test/ui/issue-52023-array-size-pointer-cast.stderr +++ b/src/test/ui/issue-52023-array-size-pointer-cast.stderr @@ -1,9 +1,11 @@ -error[E0018]: raw pointers cannot be cast to integers in constants +error[E0658]: casting pointers to integers in constants is unstable (see issue #51910) --> $DIR/issue-52023-array-size-pointer-cast.rs:12:17 | -LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR raw pointers cannot be cast +LL | let _ = [0; (&0 as *const i32) as usize]; //~ ERROR casting pointers to integers in constants | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(const_raw_ptr_to_usize_cast)] to the crate attributes to enable error: aborting due to previous error -For more information about this error, try `rustc --explain E0018`. +For more information about this error, try `rustc --explain E0658`. 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 index d422a63bcad..89313f898d5 100644 --- 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 @@ -8,7 +8,7 @@ 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 { - | - consider changing the type of `x` to `&'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 diff --git a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr index 87cb1748913..b886450336d 100644 --- a/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr +++ b/src/test/ui/lifetime-errors/42701_one_named_and_one_anonymous.stderr @@ -2,7 +2,7 @@ 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 { - | - consider changing the type of `x` to `&'a i32` + | ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32` ... LL | &*x //~ ERROR explicit lifetime | ^^^ lifetime `'a` required 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 index e5b001def56..3976cb30426 100644 --- 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 @@ -8,7 +8,7 @@ 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> { - | ----- consider changing the type of `other` to `Foo<'a>` + | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>` LL | match *self { | ^^^^^ lifetime `'a` required diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr index 29163361e23..5847f755b3c 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-early-bound-in-struct.stderr @@ -2,7 +2,7 @@ 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> { - | ----- consider changing the type of `other` to `Foo<'a>` + | --- help: add explicit lifetime `'a` to the type of `other`: `Foo<'a>` ... LL | other //~ ERROR explicit lifetime | ^^^^^ lifetime `'a` required 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 index e1dfeb0ac6a..00eff2fe3ae 100644 --- 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 @@ -8,7 +8,7 @@ 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 { - | - consider changing the type of `x` to `&'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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr index e18156179a2..a4e1fe5e183 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-2.stderr @@ -2,7 +2,7 @@ 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 { - | - consider changing the type of `x` to `&'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 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 index 4d9517eca60..a3b46aa04a6 100644 --- 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 @@ -8,10 +8,9 @@ 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 { - | ----^- - | | | - | | lifetime `'a` required - | consider changing type to `(&'a i32, &'a i32)` + | ^ --------------- help: add explicit lifetime `'a` to type: `(&'a i32, &'a i32)` + | | + | lifetime `'a` required error: aborting due to previous error diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr index f208fb57f5b..a260c7bf7e9 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-3.stderr @@ -2,7 +2,7 @@ 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 { - | ------ consider changing type to `(&'a 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 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 index e264b3428c9..465b33be2d0 100644 --- 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 @@ -8,7 +8,7 @@ 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 { - | - consider changing the type of `x` to `&'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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr index 7604b9a9017..8eac8761bd4 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-2.stderr @@ -2,7 +2,7 @@ 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 { - | - consider changing the type of `x` to `&'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 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 index 6119f3c5605..a62d7cc5a6f 100644 --- 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 @@ -8,7 +8,7 @@ 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 { - | - consider changing the type of `x` to `&'a 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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr index 83c6ff19867..0ae98aeb843 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.stderr @@ -2,7 +2,7 @@ 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 { - | - consider changing the type of `x` to `&'a 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 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 index 71e9c34ac2b..b6bf646132e 100644 --- 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 @@ -4,17 +4,16 @@ warning: not reporting region error due to nll LL | if x > y { x } else { y } //~ ERROR lifetime mismatch | ^ -error[E0623]: 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 { - | ---- ------- - | | - | this parameter and the return type are declared with different lifetimes... + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here LL | LL | if x > y { x } else { y } //~ ERROR lifetime mismatch - | ^^^^^ ...but data from `x` is returned here + | ^^^^^ requires that `'1` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 5e49e4ec4a9..93f8254f825 100644 --- 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 @@ -8,7 +8,7 @@ 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 { - | - consider changing the type of `y` to `&'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 diff --git a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr index 9893eee77e8..b68b90e77de 100644 --- a/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr +++ b/src/test/ui/lifetime-errors/ex1-return-one-existing-name-if-else.stderr @@ -2,7 +2,7 @@ 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 { - | - consider changing the type of `y` to `&'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 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 index 6c16d6a608e..93eac05e8d2 100644 --- 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 @@ -4,17 +4,16 @@ warning: not reporting region error due to nll LL | x //~ ERROR lifetime mismatch | ^ -error[E0623]: 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 { - | ------- ---- - | | - | this parameter and the return type are declared with different lifetimes... + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here LL | LL | x //~ ERROR lifetime mismatch - | ^ ...but data from `x` is returned here + | ^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 6dc96ace4d0..c5b4fd1934b 100644 --- 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 @@ -4,17 +4,16 @@ warning: not reporting region error due to nll LL | if true { x } else { self } //~ ERROR lifetime mismatch | ^^^^ -error[E0623]: 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 { - | ----- ------- - | | - | this parameter and the return type are declared with different lifetimes... + | -- - let's call the lifetime of this reference `'1` + | | + | lifetime `'a` defined here LL | LL | if true { x } else { self } //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `self` is returned here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr index 087c9eb389b..a5fa83266a3 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.nll.stderr @@ -8,7 +8,7 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/ex2a-push-one-existing-name-2.rs:16:5 | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { - | - consider changing the type of `x` to `Ref<'a, i32>` + | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` LL | y.push(x); //~ ERROR explicit lifetime | ^^^^^^^^^ lifetime `'a` required diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr index 5c9b7666de6..6f0a5179d6b 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-2.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/ex2a-push-one-existing-name-2.rs:16:12 | LL | fn foo<'a>(x: Ref, y: &mut Vec>) { - | - consider changing the type of `x` to `Ref<'a, i32>` + | -------- help: add explicit lifetime `'a` to the type of `x`: `Ref<'a, i32>` LL | y.push(x); //~ ERROR explicit lifetime | ^ lifetime `'a` required diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr index 4cfb76f85f2..a8286ba2952 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name-early-bound.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/ex2a-push-one-existing-name-early-bound.rs:17:12 | LL | fn baz<'a, 'b, T>(x: &mut Vec<&'a T>, y: &T) - | - consider changing the type of `y` to `&'a T` + | -- help: add explicit lifetime `'a` to the type of `y`: `&'a T` ... LL | x.push(y); //~ ERROR explicit lifetime required | ^ lifetime `'a` required diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr index 80192af2217..294a9106619 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.nll.stderr @@ -8,7 +8,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/ex2a-push-one-existing-name.rs:16:5 | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { - | - consider changing the type of `y` to `Ref<'a, i32>` + | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` LL | x.push(y); //~ ERROR explicit lifetime | ^^^^^^^^^ lifetime `'a` required diff --git a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr index ede76bca2ba..ebe465aa581 100644 --- a/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr +++ b/src/test/ui/lifetime-errors/ex2a-push-one-existing-name.stderr @@ -2,7 +2,7 @@ error[E0621]: explicit lifetime required in the type of `y` --> $DIR/ex2a-push-one-existing-name.rs:16:12 | LL | fn foo<'a>(x: &mut Vec>, y: Ref) { - | - consider changing the type of `y` to `Ref<'a, i32>` + | -------- help: add explicit lifetime `'a` to the type of `y`: `Ref<'a, i32>` LL | x.push(y); //~ ERROR explicit lifetime | ^ lifetime `'a` required 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 index 4b4fdde940f..614034794bd 100644 --- 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 @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2b-push-no-existing-names.rs:16:5 | LL | fn foo(x: &mut Vec>, y: Ref) { - | -------- -------- these two types are declared with different lifetimes... + | -------- -------- lifetime `'1` appears in this type + | | + | lifetime `'2` appears in this type LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr index f55fd291249..c34278b4d9f 100644 --- a/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2c-push-inference-variable.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | let z = Ref { data: y.data }; | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2c-push-inference-variable.rs:17:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here LL | let z = Ref { data: y.data }; LL | x.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'c` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr index 85b5f3e8900..3097d18e86c 100644 --- a/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2d-push-inference-variable-2.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | let b = Ref { data: y.data }; | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2d-push-inference-variable-2.rs:18:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here ... LL | a.push(b); - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'c` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr index 7e5182a5d30..ce0e9be3006 100644 --- a/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex2e-push-inference-variable-3.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | let b = Ref { data: y.data }; | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex2e-push-inference-variable-3.rs:18:5 | LL | fn foo<'a, 'b, 'c>(x: &'a mut Vec>, y: Ref<'c, i32>) { - | ------------ ------------ these two types are declared with different lifetimes... + | -- -- lifetime `'c` defined here + | | + | lifetime `'b` defined here ... LL | Vec::push(a, b); - | ^^^^^^^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^^^^^^^ argument requires that `'c` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr index 36317c4570b..c7f1a0ede3c 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-2.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | *v = x; //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-2.rs:12:5 | LL | fn foo(&mut (ref mut v, w): &mut (&u8, &u8), x: &u8) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | *v = x; //~ ERROR lifetime mismatch - | ^^^^^^ ...but data from `x` flows here + | ^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr index c43c4ce3a0c..09980e44c52 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-3.nll.stderr @@ -10,22 +10,25 @@ warning: not reporting region error due to nll LL | z.push((x,y)); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-3.rs:12:5 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | z.push((x,y)); //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^ ...but data flows into `z` here + | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-3.rs:12:5 | LL | fn foo(z: &mut Vec<(&u8,&u8)>, (x, y): (&u8, &u8)) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | z.push((x,y)); //~ ERROR lifetime mismatch - | ^^^^^^^^^^^^^ ...but data flows into `z` here + | ^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0623`. 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 index 191389b7706..2829fbcd32a 100644 --- 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 @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.b = y.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: 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) { - | --- --- these two types are declared with different lifetimes... + | --- --- lifetime `'1` appears in this type + | | + | lifetime `'2` appears in this type LL | x.b = y.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 159367cc9d2..8171ee758b0 100644 --- 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 @@ -4,16 +4,16 @@ warning: not reporting region error due to nll LL | x.a = x.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-3.rs:16:5 | LL | fn foo(mut x: Ref) { | --- | | - | this type is declared with multiple lifetimes... + | lifetime `'1` appears in this type + | lifetime `'2` appears in this type LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data with one lifetime flows into the other here + | ^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 3bbcbdd6681..99b64605bae 100644 --- 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 @@ -4,16 +4,16 @@ warning: not reporting region error due to nll LL | x.a = x.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:5 | LL | fn foo(mut x: Ref) { | --- | | - | this type is declared with multiple lifetimes... + | lifetime `'1` appears in this type + | lifetime `'2` appears in this type LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data with one lifetime flows into the other here + | ^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr index 2a5729952e3..aed0dcc1a67 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-earlybound-regions.nll.stderr @@ -4,15 +4,16 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-earlybound-regions.rs:18:5 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) - | ------- ------- these two types are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here ... LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr index 6efc8d3da06..7790d37d1c4 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-both-are-structs-latebound-regions.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs-latebound-regions.rs:15:5 | LL | fn foo<'a, 'b>(mut x: Vec>, y: Ref<'b>) { - | ------- ------- these two types are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 0f555020822..c9542d31069 100644 --- 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 @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-both-are-structs.rs:15:5 | LL | fn foo(mut x: Vec, y: Ref) { - | --- --- these two types are declared with different lifetimes... + | --- --- lifetime `'1` appears in this type + | | + | lifetime `'2` appears in this type LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr index 4400644e7fb..459a93813a8 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-latebound-regions.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-latebound-regions.rs:12:5 | LL | fn foo<'a,'b>(x: &mut Vec<&'a u8>, y: &'b u8) { - | ------ ------ these two types are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'b` must outlive `'a` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 93f2837c0fc..459796760e1 100644 --- 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 @@ -4,15 +4,15 @@ warning: not reporting region error due to nll LL | y = x.b; //~ ERROR lifetime mismatch | ^^^ -error[E0623]: 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` | | - | these two types are declared with different lifetimes... + | lifetime `'1` appears in this type LL | y = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `x` flows into `y` here + | ^^^^^^^ 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 @@ -24,5 +24,4 @@ LL | y = x.b; //~ ERROR lifetime mismatch error: aborting due to 2 previous errors -Some errors occurred: E0384, E0623. -For more information about an error, try `rustc --explain E0384`. +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 index e7fb67f117f..5fc1755ed39 100644 --- 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 @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | y.b = x; //~ ERROR lifetime mismatch | ^ -error[E0623]: 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) { - | --- ---- these two types are declared with different lifetimes... + | --- - let's call the lifetime of this reference `'1` + | | + | lifetime `'2` appears in this type LL | y.b = x; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `x` flows into `y` here + | ^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index af9e3a42664..835f95880a7 100644 --- 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 @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | y.b = x; //~ ERROR lifetime mismatch | ^ -error[E0623]: 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) { - | --- ---- these two types are declared with different lifetimes... + | --- - let's call the lifetime of this reference `'1` + | | + | lifetime `'2` appears in this type LL | y.b = x; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `x` flows into `y` here + | ^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 5437beaab65..7aed5fe626f 100644 --- 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 @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.b = y; //~ ERROR lifetime mismatch | ^ -error[E0623]: 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) { - | --- ---- these two types are declared with different lifetimes... + | --- - let's call the lifetime of this reference `'1` + | | + | lifetime `'2` appears in this type LL | x.b = y; //~ ERROR lifetime mismatch - | ^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 42e1d42a32c..22581d9b075 100644 --- 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 @@ -4,16 +4,15 @@ warning: not reporting region error due to nll LL | x //~ ERROR lifetime mismatch | ^ -error[E0623]: 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 { - | ---- ---- - | | - | this parameter and the return type are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | x //~ ERROR lifetime mismatch - | ^ ...but data from `x` is returned here + | ^ function was supposed to return data with lifetime `'1` but it is returning data with lifetime `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. 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 index 26b0488cfdc..908526d439e 100644 --- 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 @@ -4,16 +4,15 @@ warning: not reporting region error due to nll LL | if true { x } else { self } //~ ERROR lifetime mismatch | ^ -error[E0623]: 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 { - | ---- ---- - | | - | this parameter and the return type are declared with different lifetimes... + | - - 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 - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...but data from `x` is returned here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr index a0aa1e28d9b..2829ec35000 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-fn-items.nll.stderr @@ -4,23 +4,24 @@ warning: not reporting region error due to nll LL | y.push(z); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:3 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... + | - help: consider changing this to be mutable: `mut y` LL | y.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `z` flows into `y` here + | ^ cannot borrow as mutable -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-using-fn-items.rs:11:3 | LL | fn foo(x:fn(&u8, &u8), y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | y.push(z); //~ ERROR lifetime mismatch - | ^ cannot borrow as mutable + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to 2 previous errors -Some errors occurred: E0596, E0623. -For more information about an error, try `rustc --explain E0596`. +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr index 5d4492701be..44d68df4b55 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-impl-items.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-using-impl-items.rs:15:9 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr index 37b79cee72f..5d3c6f38ad8 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions-using-trait-objects.nll.stderr @@ -4,23 +4,24 @@ warning: not reporting region error due to nll LL | y.push(z); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | --- --- these two types are declared with different lifetimes... + | - help: consider changing this to be mutable: `mut y` LL | y.push(z); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `z` flows into `y` here + | ^ cannot borrow as mutable -error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions-using-trait-objects.rs:11:3 | LL | fn foo(x:Box , y: Vec<&u8>, z: &u8) { - | - help: consider changing this to be mutable: `mut y` + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | y.push(z); //~ ERROR lifetime mismatch - | ^ cannot borrow as mutable + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to 2 previous errors -Some errors occurred: E0596, E0623. -For more information about an error, try `rustc --explain E0596`. +For more information about this error, try `rustc --explain E0596`. diff --git a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr b/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr index c11d81a4c13..6460e5d687f 100644 --- a/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr +++ b/src/test/ui/lifetime-errors/ex3-both-anon-regions.nll.stderr @@ -4,14 +4,15 @@ warning: not reporting region error due to nll LL | x.push(y); //~ ERROR lifetime mismatch | ^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/ex3-both-anon-regions.rs:12:5 | LL | fn foo(x: &mut Vec<&u8>, y: &u8) { - | --- --- these two types are declared with different lifetimes... + | - - let's call the lifetime of this reference `'1` + | | + | let's call the lifetime of this reference `'2` LL | x.push(y); //~ ERROR lifetime mismatch - | ^^^^^^^^^ ...but data from `y` flows into `x` here + | ^^^^^^^^^ argument requires that `'1` must outlive `'2` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lint-ctypes.rs b/src/test/ui/lint-ctypes.rs index 7f22dc8739e..b8b1a675c5f 100644 --- a/src/test/ui/lint-ctypes.rs +++ b/src/test/ui/lint-ctypes.rs @@ -88,6 +88,13 @@ pub fn zero_size_phantom_toplevel() pub fn good15(p: TransparentLifetime); pub fn good16(p: TransparentUnit); pub fn good17(p: TransparentCustomZst); + #[allow(improper_ctypes)] + pub fn good18(_: &String); +} + +#[allow(improper_ctypes)] +extern { + pub fn good19(_: &String); } #[cfg(not(target_arch = "wasm32"))] diff --git a/src/test/ui/lint-output-format-2.rs b/src/test/ui/lint-output-format-2.rs index 5cd0084901f..e87ddde7413 100644 --- a/src/test/ui/lint-output-format-2.rs +++ b/src/test/ui/lint-output-format-2.rs @@ -10,10 +10,7 @@ // aux-build:lint_output_format.rs -// FIXME(#44232) we should warn that this isn't used. -#![feature(foo)] - -#![feature(test_feature)] +#![feature(unstable_test_feature)] #![feature(rustc_attrs)] extern crate lint_output_format; diff --git a/src/test/ui/lint-output-format-2.stderr b/src/test/ui/lint-output-format-2.stderr index d484061ef96..8c6247688e8 100644 --- a/src/test/ui/lint-output-format-2.stderr +++ b/src/test/ui/lint-output-format-2.stderr @@ -1,5 +1,5 @@ warning: use of deprecated item 'lint_output_format::foo': text - --> $DIR/lint-output-format-2.rs:20:26 + --> $DIR/lint-output-format-2.rs:17:26 | LL | use lint_output_format::{foo, bar}; | ^^^ @@ -7,13 +7,13 @@ LL | use lint_output_format::{foo, bar}; = note: #[warn(deprecated)] on by default warning: use of deprecated item 'lint_output_format::foo': text - --> $DIR/lint-output-format-2.rs:25:14 + --> $DIR/lint-output-format-2.rs:22:14 | LL | let _x = foo(); | ^^^ error: compilation successful - --> $DIR/lint-output-format-2.rs:24:1 + --> $DIR/lint-output-format-2.rs:21:1 | LL | / fn main() { //~ ERROR: compilation successful LL | | let _x = foo(); diff --git a/src/test/ui/macro-path-prelude-fail-3.rs b/src/test/ui/macro-path-prelude-fail-3.rs index 4cf90019d40..bdbc7bd660f 100644 --- a/src/test/ui/macro-path-prelude-fail-3.rs +++ b/src/test/ui/macro-path-prelude-fail-3.rs @@ -10,9 +10,9 @@ #![feature(use_extern_macros)] -#[derive(inline)] //~ ERROR expected a macro, found non-macro attribute +#[derive(inline)] //~ ERROR expected a macro, found built-in attribute struct S; fn main() { - inline!(); //~ ERROR expected a macro, found non-macro attribute + 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 index bd1015b7ee1..396bba2408f 100644 --- a/src/test/ui/macro-path-prelude-fail-3.stderr +++ b/src/test/ui/macro-path-prelude-fail-3.stderr @@ -1,13 +1,13 @@ -error: expected a macro, found non-macro attribute +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 non-macro attribute +LL | #[derive(inline)] //~ ERROR expected a macro, found built-in attribute | ^^^^^^ -error: expected a macro, found non-macro 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 non-macro attribute +LL | inline!(); //~ ERROR expected a macro, found built-in attribute | ^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/macros/missing-comma.rs b/src/test/ui/macros/missing-comma.rs new file mode 100644 index 00000000000..ac82171a4e8 --- /dev/null +++ b/src/test/ui/macros/missing-comma.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! foo { + ($a:ident, $b:ident) => () +} + +fn main() { + println!("{}" a); + //~^ ERROR expected token: `,` + foo!(a b); + //~^ ERROR no rules expected the token `b` +} diff --git a/src/test/ui/macros/missing-comma.stderr b/src/test/ui/macros/missing-comma.stderr new file mode 100644 index 00000000000..3467032d9b5 --- /dev/null +++ b/src/test/ui/macros/missing-comma.stderr @@ -0,0 +1,16 @@ +error: expected token: `,` + --> $DIR/missing-comma.rs:16:19 + | +LL | println!("{}" a); + | ^ + +error: no rules expected the token `b` + --> $DIR/missing-comma.rs:18:12 + | +LL | foo!(a b); + | -^ + | | + | help: missing comma here + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs index da8ce55162f..d79be8b83c6 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.rs @@ -51,7 +51,7 @@ fn demand_y<'x, 'y>(_cell_x: &Cell<&'x u32>, _cell_y: &Cell<&'y u32>, _y: &'y u3 #[rustc_regions] fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { - //~^ ERROR lifetime mismatch + //~^ ERROR unsatisfied lifetime constraints // Only works if 'x: 'y: demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr index 2704a325314..fe67ca0293e 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-ref.stderr @@ -9,7 +9,7 @@ note: External requirements | LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { | _______________________________________________^ -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll @@ -23,27 +23,12 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#2r -error[E0623]: lifetime mismatch - --> $DIR/propagate-approximated-ref.rs:53:5 - | -LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { - | ------- ------- - | | - | these two types are declared with different lifetimes... -LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR lifetime mismatch -LL | | -LL | | // Only works if 'x: 'y: -LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll -LL | | }); - | |______^ ...but data from `cell_a` flows into `cell_b` here - note: No external requirements --> $DIR/propagate-approximated-ref.rs:52:1 | LL | / fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | ... | LL | | }); @@ -52,6 +37,20 @@ LL | | } | = note: defining type: DefId(0/0:6 ~ propagate_approximated_ref[317d]::supply[0]) with substs [] +error: unsatisfied lifetime constraints + --> $DIR/propagate-approximated-ref.rs:53:5 + | +LL | fn supply<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | / establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y| { +LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | +LL | | // Only works if 'x: 'y: +LL | | demand_y(x, y, x.get()) //~ WARNING not reporting region error due to nll +LL | | }); + | |______^ argument requires that `'a` must outlive `'b` + error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs index 0449dc1d1a7..bf24557398d 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.rs @@ -44,7 +44,7 @@ fn demand_y<'x, 'y>(_outlives1: Cell<&&'x u32>, _outlives2: Cell<&'y &u32>, _y: #[rustc_regions] fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { - //~^ ERROR lifetime mismatch + //~^ ERROR unsatisfied lifetime constraints // Only works if 'x: 'y: demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll diff --git a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr index 3cd9e9dd5b0..ed1fc6e1a71 100644 --- a/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr +++ b/src/test/ui/nll/closure-requirements/propagate-approximated-val.stderr @@ -9,7 +9,7 @@ note: External requirements | LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { | _____________________________________________^ -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | LL | | // Only works if 'x: 'y: LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll @@ -23,27 +23,12 @@ LL | | }); = note: number of external vids: 5 = note: where '_#1r: '_#2r -error[E0623]: lifetime mismatch - --> $DIR/propagate-approximated-val.rs:46:5 - | -LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { - | ------- ------- - | | - | these two types are declared with different lifetimes... -LL | / establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -LL | | //~^ ERROR lifetime mismatch -LL | | -LL | | // Only works if 'x: 'y: -LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll -LL | | }); - | |______^ ...but data from `cell_a` flows into `cell_b` here - note: No external requirements --> $DIR/propagate-approximated-val.rs:45:1 | LL | / fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { LL | | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { -LL | | //~^ ERROR lifetime mismatch +LL | | //~^ ERROR unsatisfied lifetime constraints LL | | ... | LL | | }); @@ -52,6 +37,20 @@ LL | | } | = note: defining type: DefId(0/0:6 ~ propagate_approximated_val[317d]::test[0]) with substs [] +error: unsatisfied lifetime constraints + --> $DIR/propagate-approximated-val.rs:46:5 + | +LL | fn test<'a, 'b>(cell_a: Cell<&'a u32>, cell_b: Cell<&'b u32>) { + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | / establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| { +LL | | //~^ ERROR unsatisfied lifetime constraints +LL | | +LL | | // Only works if 'x: 'y: +LL | | demand_y(outlives1, outlives2, x.get()) //~ WARNING not reporting region error due to nll +LL | | }); + | |______^ argument requires that `'a` must outlive `'b` + error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr index a823e62d3b8..a019a7224c6 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr +++ b/src/test/ui/nll/closure-requirements/region-lbr-anon-does-not-outlive-static.stderr @@ -8,7 +8,7 @@ error[E0621]: explicit lifetime required in the type of `x` --> $DIR/region-lbr-anon-does-not-outlive-static.rs:19:5 | LL | fn foo(x: &u32) -> &'static u32 { - | - consider changing the type of `x` to `&ReStatic u32` + | ---- help: add explicit lifetime `ReStatic` to the type of `x`: `&ReStatic u32` LL | &*x | ^^^ lifetime `ReStatic` required diff --git a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs index 8598668bef5..a883e7b1994 100644 --- a/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs +++ b/src/test/ui/nll/closure-requirements/region-lbr1-does-not-outlive-ebr2.rs @@ -18,7 +18,7 @@ fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { &*x //~^ WARN not reporting region error due to nll - //~| ERROR lifetime mismatch + //~| ERROR unsatisfied lifetime constraints } fn main() { } 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 415aefdeee9..cf3f4df19ae 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 @@ -4,16 +4,15 @@ warning: not reporting region error due to nll LL | &*x | ^^^ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/region-lbr1-does-not-outlive-ebr2.rs:19:5 | LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> &'b u32 { - | ------- ------- - | | - | this parameter and the return type are declared with different lifetimes... + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here LL | &*x - | ^^^ ...but data from `x` is returned here + | ^^^ requires that `'a` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/nll/get_default.nll.stderr b/src/test/ui/nll/get_default.nll.stderr index 580dce3c0fe..b955a51e38d 100644 --- a/src/test/ui/nll/get_default.nll.stderr +++ b/src/test/ui/nll/get_default.nll.stderr @@ -63,18 +63,9 @@ LL | match map.get() { LL | Some(v) => { LL | map.set(String::new()); // Both AST and MIR error here | ^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs 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 | | } - | |_^ +... +LL | return v; + | - borrow later used here 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 2f8eab907c7..75194bf55bc 100644 --- a/src/test/ui/nll/get_default.stderr +++ b/src/test/ui/nll/get_default.stderr @@ -63,18 +63,9 @@ LL | match map.get() { LL | Some(v) => { LL | map.set(String::new()); // Both AST and MIR error here | ^^^ mutable borrow occurs 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 | | } - | |_^ +... +LL | return v; + | - borrow later used here 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/guarantor-issue-46974.stderr b/src/test/ui/nll/guarantor-issue-46974.stderr index 3cb20cc975f..6fc48129986 100644 --- a/src/test/ui/nll/guarantor-issue-46974.stderr +++ b/src/test/ui/nll/guarantor-issue-46974.stderr @@ -13,7 +13,7 @@ error[E0621]: explicit lifetime required in the type of `s` --> $DIR/guarantor-issue-46974.rs:25:5 | LL | fn bar(s: &Box<(i32,)>) -> &'static i32 { - | - consider changing the type of `s` to `&'static std::boxed::Box<(i32,)>` + | ------------ help: add explicit lifetime `'static` to the type of `s`: `&'static std::boxed::Box<(i32,)>` LL | // FIXME(#46983): error message should be better LL | &s.0 //~ ERROR explicit lifetime required in the type of `s` [E0621] | ^^^^ lifetime `'static` required diff --git a/src/test/ui/nll/issue-48238.stderr b/src/test/ui/nll/issue-48238.stderr index 7bdac345e90..84d0730025a 100644 --- a/src/test/ui/nll/issue-48238.stderr +++ b/src/test/ui/nll/issue-48238.stderr @@ -2,11 +2,12 @@ error: unsatisfied lifetime constraints --> $DIR/issue-48238.rs:21:13 | LL | move || use_val(&orig); //~ ERROR - | --------^^^^^^^^^^^^^^ - | | | - | | argument requires that `'1` must outlive `'2` - | lifetime `'1` represents the closure body - | lifetime `'2` appears in return type + | ------- ^^^^^^^^^^^^^^ argument requires that `'1` must outlive `'2` + | | | + | | return type of closure is &'2 u8 + | lifetime `'1` represents this closure's body + | + = note: closure implements `Fn`, so references to captured variables can't escape the closure error: aborting due to previous error diff --git a/src/test/ui/nll/issue-52113.rs b/src/test/ui/nll/issue-52113.rs index 1c509c5d224..e484c249d84 100644 --- a/src/test/ui/nll/issue-52113.rs +++ b/src/test/ui/nll/issue-52113.rs @@ -40,7 +40,7 @@ fn produce3<'a, 'b: 'a>(data: &'a mut Vec<&'a u32>, value: &'b u32) -> impl Bazi } fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b { - let x = move || { //~ ERROR lifetime mismatch + let x = move || { //~ ERROR unsatisfied lifetime constraints let value: &'a u32 = value; data.push(value); }; diff --git a/src/test/ui/nll/issue-52113.stderr b/src/test/ui/nll/issue-52113.stderr index 4a7c10c3f1a..b21539361e6 100644 --- a/src/test/ui/nll/issue-52113.stderr +++ b/src/test/ui/nll/issue-52113.stderr @@ -1,11 +1,12 @@ -error[E0623]: lifetime mismatch +error: unsatisfied lifetime constraints --> $DIR/issue-52113.rs:43:9 | LL | fn produce_err<'a, 'b: 'a>(data: &'b mut Vec<&'b u32>, value: &'a u32) -> impl Bazinga + 'b { - | -------------------- ------- these two types are declared with different lifetimes... -LL | let x = move || { //~ ERROR lifetime mismatch - | ^ ...but data from `value` flows into `data` here + | -- -- lifetime `'b` defined here + | | + | lifetime `'a` defined here +LL | let x = move || { //~ ERROR unsatisfied lifetime constraints + | ^ requires that `'a` must outlive `'b` error: aborting due to previous error -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/nll/issue-53119.rs b/src/test/ui/nll/issue-53119.rs new file mode 100644 index 00000000000..bbef4cf3455 --- /dev/null +++ b/src/test/ui/nll/issue-53119.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 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-pass + +#![feature(nll)] + +use std::ops::Deref; + +pub struct TypeFieldIterator<'a, T: 'a> { + _t: &'a T, +} + +pub struct Type { + _types: Vec<(Id, T)>, +} + +impl<'a, Id: 'a, T> Iterator for TypeFieldIterator<'a, T> +where T: Deref> { + type Item = &'a (Id, T); + + fn next(&mut self) -> Option<&'a (Id, T)> { + || self.next(); + None + } +} + +fn main() { } 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 f441085f242..f40e38c63f5 100644 --- a/src/test/ui/nll/return-ref-mut-issue-46557.stderr +++ b/src/test/ui/nll/return-ref-mut-issue-46557.stderr @@ -1,13 +1,16 @@ error[E0597]: borrowed value does not live long enough --> $DIR/return-ref-mut-issue-46557.rs:17:21 | -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... +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 error: aborting due to previous error diff --git a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr index f836960a28c..a4f0e53386f 100644 --- a/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr +++ b/src/test/ui/nll/ty-outlives/impl-trait-captures.stderr @@ -7,10 +7,12 @@ LL | x error[E0621]: explicit lifetime required in the type of `x` --> $DIR/impl-trait-captures.rs:21:5 | -LL | fn foo<'a, T>(x: &T) -> impl Foo<'a> { - | - consider changing the type of `x` to `&ReEarlyBound(0, 'a) T` LL | x | ^ lifetime `ReEarlyBound(0, 'a)` required +help: add explicit lifetime `ReEarlyBound(0, 'a)` to the type of `x` + | +LL | fn foo<'a, T>(x: &ReEarlyBound(0, 'a) T) -> impl Foo<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/tool-attributes-disabled-2.rs b/src/test/ui/tool-attributes-disabled-2.rs index 160dda05b1e..2d97e160f49 100644 --- a/src/test/ui/tool-attributes-disabled-2.rs +++ b/src/test/ui/tool-attributes-disabled-2.rs @@ -11,9 +11,5 @@ // If macro modularization (`use_extern_macros`) is not enabled, // then tool attributes are treated as custom attributes. -// compile-pass - -#![feature(custom_attribute)] - -#[rustfmt::bar] +#[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 new file mode 100644 index 00000000000..b327773dd6a --- /dev/null +++ b/src/test/ui/tool-attributes-disabled-2.stderr @@ -0,0 +1,11 @@ +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-misplaced-1.rs index b3355352423..7a6b9ae9943 100644 --- a/src/test/ui/tool-attributes-misplaced-1.rs +++ b/src/test/ui/tool-attributes-misplaced-1.rs @@ -8,15 +8,15 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(tool_attributes)] +#![feature(tool_attributes, custom_attribute)] type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` -type B = rustfmt::skip; //~ ERROR expected type, found non-macro attribute `rustfmt::skip` +type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope struct S; -#[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope +#[rustfmt] // OK, interpreted as a custom attribute fn check() {} #[rustfmt::skip] // OK @@ -24,5 +24,5 @@ fn main() { rustfmt; //~ ERROR expected value, found tool module `rustfmt` rustfmt!(); //~ ERROR cannot find macro `rustfmt!` in this scope - rustfmt::skip; //~ ERROR expected value, found non-macro attribute `rustfmt::skip` + rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` } diff --git a/src/test/ui/tool-attributes-misplaced-1.stderr b/src/test/ui/tool-attributes-misplaced-1.stderr index b9e61121406..60188aebce7 100644 --- a/src/test/ui/tool-attributes-misplaced-1.stderr +++ b/src/test/ui/tool-attributes-misplaced-1.stderr @@ -4,12 +4,6 @@ error: cannot find derive macro `rustfmt` in this scope LL | #[derive(rustfmt)] //~ ERROR cannot find derive macro `rustfmt` in this scope | ^^^^^^^ -error: cannot find attribute macro `rustfmt` in this scope - --> $DIR/tool-attributes-misplaced-1.rs:19:3 - | -LL | #[rustfmt] //~ ERROR cannot find attribute macro `rustfmt` in this scope - | ^^^^^^^ - error: cannot find macro `rustfmt!` in this scope --> $DIR/tool-attributes-misplaced-1.rs:25:5 | @@ -22,10 +16,10 @@ error[E0573]: expected type, found tool module `rustfmt` LL | type A = rustfmt; //~ ERROR expected type, found tool module `rustfmt` | ^^^^^^^ not a type -error[E0573]: expected type, found non-macro attribute `rustfmt::skip` +error[E0573]: expected type, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:14:10 | -LL | type B = rustfmt::skip; //~ ERROR expected type, found non-macro attribute `rustfmt::skip` +LL | type B = rustfmt::skip; //~ ERROR expected type, found tool attribute `rustfmt::skip` | ^^^^^^^^^^^^^ not a type error[E0423]: expected value, found tool module `rustfmt` @@ -34,13 +28,13 @@ error[E0423]: expected value, found tool module `rustfmt` LL | rustfmt; //~ ERROR expected value, found tool module `rustfmt` | ^^^^^^^ not a value -error[E0423]: expected value, found non-macro attribute `rustfmt::skip` +error[E0423]: expected value, found tool attribute `rustfmt::skip` --> $DIR/tool-attributes-misplaced-1.rs:27:5 | -LL | rustfmt::skip; //~ ERROR expected value, found non-macro attribute `rustfmt::skip` +LL | rustfmt::skip; //~ ERROR expected value, found tool attribute `rustfmt::skip` | ^^^^^^^^^^^^^ not a value -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors Some errors occurred: E0423, E0573. For more information about an error, try `rustc --explain E0423`. diff --git a/src/test/ui/tool-attributes-misplaced-2.rs b/src/test/ui/tool-attributes-misplaced-2.rs index 3bb0e3dc343..102edf2813b 100644 --- a/src/test/ui/tool-attributes-misplaced-2.rs +++ b/src/test/ui/tool-attributes-misplaced-2.rs @@ -10,9 +10,9 @@ #![feature(tool_attributes)] -#[derive(rustfmt::skip)] //~ ERROR expected a macro, found non-macro attribute +#[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute struct S; fn main() { - rustfmt::skip!(); //~ ERROR expected a macro, found non-macro attribute + rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute } diff --git a/src/test/ui/tool-attributes-misplaced-2.stderr b/src/test/ui/tool-attributes-misplaced-2.stderr index 66452267e94..5b968cd6b8e 100644 --- a/src/test/ui/tool-attributes-misplaced-2.stderr +++ b/src/test/ui/tool-attributes-misplaced-2.stderr @@ -1,13 +1,13 @@ -error: expected a macro, found non-macro attribute +error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:13:10 | -LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found non-macro attribute +LL | #[derive(rustfmt::skip)] //~ ERROR expected a macro, found tool attribute | ^^^^^^^^^^^^^ -error: expected a macro, found non-macro attribute +error: expected a macro, found tool attribute --> $DIR/tool-attributes-misplaced-2.rs:17:5 | -LL | rustfmt::skip!(); //~ ERROR expected a macro, found non-macro attribute +LL | rustfmt::skip!(); //~ ERROR expected a macro, found tool attribute | ^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/union/union-const-eval.rs b/src/test/ui/union/union-const-eval.rs index 3ae76e1a82a..c640acec05e 100644 --- a/src/test/ui/union/union-const-eval.rs +++ b/src/test/ui/union/union-const-eval.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-pass +#![feature(const_fn_union)] union U { a: usize, diff --git a/src/tools/clippy b/src/tools/clippy index 7e5e4c1e7e8..99a087bea59 160000 --- a/src/tools/clippy +++ b/src/tools/clippy @@ -1 +1 @@ -Subproject commit 7e5e4c1e7e80ed689a49101569dde2c19753dc8d +Subproject commit 99a087bea59c8f808b5485c6113edf9ce774e94a diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 2bfc1ece095..c1d3df79222 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -10,7 +10,6 @@ #![crate_name = "compiletest"] #![feature(test)] -#![feature(slice_rotate)] #![deny(warnings)] extern crate diff; diff --git a/src/tools/rls b/src/tools/rls index 6d72813199d..c51e3ff2f07 160000 --- a/src/tools/rls +++ b/src/tools/rls @@ -1 +1 @@ -Subproject commit 6d72813199d24838636389c7025ce95c427692f7 +Subproject commit c51e3ff2f07f84f26f57fcb51808b1ec7cbe45a6 diff --git a/src/tools/rustfmt b/src/tools/rustfmt index da17b689595..5c9a2b6c13d 160000 --- a/src/tools/rustfmt +++ b/src/tools/rustfmt @@ -1 +1 @@ -Subproject commit da17b689595ddc863b02eb1ba6831c87cefc1e21 +Subproject commit 5c9a2b6c13d3b6f8d3f9c02b130bb4b54fd489fb diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index c41377824fe..42f4e46085e 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -10,7 +10,7 @@ //! Check license of third-party deps by inspecting src/vendor -use std::collections::{BTreeSet, HashSet}; +use std::collections::{BTreeSet, HashSet, HashMap}; use std::fs::File; use std::io::Read; use std::path::Path; @@ -242,6 +242,8 @@ pub fn check_whitelist(path: &Path, cargo: &Path, bad: &mut bool) { } *bad = true; } + + check_crate_duplicate(&resolve, bad); } fn check_license(path: &Path) -> bool { @@ -344,3 +346,30 @@ fn check_crate_whitelist<'a, 'b>( unapproved } + +fn check_crate_duplicate(resolve: &Resolve, bad: &mut bool) { + const FORBIDDEN_TO_HAVE_DUPLICATES: &[&str] = &[ + // These two crates take quite a long time to build, let's not let two + // 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) + ]; + let mut name_to_id = HashMap::new(); + for node in resolve.nodes.iter() { + name_to_id.entry(node.id.split_whitespace().next().unwrap()) + .or_insert(Vec::new()) + .push(&node.id); + } + + for name in FORBIDDEN_TO_HAVE_DUPLICATES { + if name_to_id[name].len() <= 1 { + continue + } + println!("crate `{}` is duplicated in `Cargo.lock`", name); + for id in name_to_id[name].iter() { + println!(" * {}", id); + } + *bad = true; + } +} diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index f68ba0b095b..1dc36221bd2 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -50,34 +50,6 @@ pub struct Feature { pub tracking_issue: Option, } -impl Feature { - fn check_match(&self, other: &Feature)-> Result<(), Vec<&'static str>> { - let mut mismatches = Vec::new(); - if self.level != other.level { - mismatches.push("stability level"); - } - if self.level == Status::Stable || other.level == Status::Stable { - // As long as a feature is unstable, the since field tracks - // when the given part of the feature has been implemented. - // Mismatches are tolerable as features evolve and functionality - // gets added. - // Once a feature is stable, the since field tracks the first version - // it was part of the stable distribution, and mismatches are disallowed. - if self.since != other.since { - mismatches.push("since"); - } - } - if self.tracking_issue != other.tracking_issue { - mismatches.push("tracking issue"); - } - if mismatches.is_empty() { - Ok(()) - } else { - Err(mismatches) - } - } -} - pub type Features = HashMap; pub fn check(path: &Path, bad: &mut bool, quiet: bool) { @@ -310,13 +282,12 @@ fn get_and_check_lib_features(base_src_path: &Path, Ok((name, f)) => { let mut check_features = |f: &Feature, list: &Features, display: &str| { if let Some(ref s) = list.get(name) { - if let Err(m) = (&f).check_match(s) { + if f.tracking_issue != s.tracking_issue { tidy_error!(bad, - "{}:{}: mismatches to {} in: {:?}", + "{}:{}: mismatches the `issue` in {}", file.display(), line, - display, - &m); + display); } } };