diff --git a/.gitmodules b/.gitmodules index d603e4575159d..b75e312dedf73 100644 --- a/.gitmodules +++ b/.gitmodules @@ -24,7 +24,7 @@ url = https://github.com/rust-lang-nursery/rustfmt.git [submodule "src/tools/miri"] path = src/tools/miri - url = https://github.com/solson/miri.git + url = https://github.com/rust-lang/miri.git [submodule "src/doc/rust-by-example"] path = src/doc/rust-by-example url = https://github.com/rust-lang/rust-by-example.git @@ -46,4 +46,4 @@ branch = rustc/8.0-2019-01-16 [submodule "src/doc/embedded-book"] path = src/doc/embedded-book - url = https://github.com/rust-embedded/book.git \ No newline at end of file + url = https://github.com/rust-embedded/book.git diff --git a/Cargo.lock b/Cargo.lock index 963bbcf0f0429..b93eaade65d61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,6 +56,15 @@ dependencies = [ "rustc_data_structures 0.0.0", ] +[[package]] +name = "argon2rs" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", + "scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arrayref" version = "0.3.5" @@ -69,19 +78,6 @@ dependencies = [ "nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "assert_cli" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "colored 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "atty" version = "0.2.11" @@ -138,6 +134,15 @@ name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "blake2-rfc" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", + "constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "block-buffer" version = "0.3.3" @@ -198,7 +203,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "bytecount" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "packed_simd 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -250,7 +255,7 @@ dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "ignore 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", - "im-rc 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "im-rc 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "jobserver 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -506,6 +511,11 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "constant_time_eq" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "core" version = "0.0.0" @@ -752,6 +762,16 @@ dependencies = [ "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "dirs" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "libc 0.2.46 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "dlmalloc" version = "0.1.2" @@ -813,11 +833,6 @@ dependencies = [ "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "environment" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "error-chain" version = "0.11.0" @@ -1150,7 +1165,7 @@ dependencies = [ [[package]] name = "im-rc" -version = "12.2.0" +version = "12.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1364,7 +1379,7 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.55.1" +version = "0.55.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1611,6 +1626,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "shell-escape 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "vergen 3.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2047,7 +2063,7 @@ dependencies = [ [[package]] name = "racer" -version = "2.1.17" +version = "2.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2057,8 +2073,8 @@ dependencies = [ "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (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 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2190,6 +2206,17 @@ dependencies = [ "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox_users" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "regex" version = "0.2.11" @@ -2258,31 +2285,33 @@ dependencies = [ "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", + "heck 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "home 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lsp-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "lsp-types 0.55.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lsp-types 0.55.4 (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.17 (registry+https://github.com/rust-lang/crates.io-index)", + "racer 2.1.19 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-analysis 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-analysis 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)", "rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)", "rls-rustc 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0", "rustc_tools_util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rustfmt-nightly 1.0.1", + "rustfmt-nightly 1.0.3", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_ignored 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2295,7 +2324,7 @@ dependencies = [ [[package]] name = "rls-analysis" -version = "0.16.10" +version = "0.16.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2303,8 +2332,8 @@ dependencies = [ "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", "json 0.11.13 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2315,10 +2344,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rls-data" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2331,7 +2360,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rls-span" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2345,7 +2374,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2392,20 +2421,20 @@ dependencies = [ [[package]] name = "rustc-ap-arena" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-graphviz" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rustc-ap-rustc_cratesio_shim" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2415,16 +2444,16 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_data_structures" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-graphviz 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-graphviz 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 373.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)", @@ -2434,34 +2463,34 @@ dependencies = [ [[package]] name = "rustc-ap-rustc_errors" -version = "306.0.0" +version = "373.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)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (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 = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_cratesio_shim 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-serialize" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2469,29 +2498,29 @@ dependencies = [ [[package]] name = "rustc-ap-syntax" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_errors 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_errors 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 373.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)", "smallvec 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-ap-syntax_pos" -version = "306.0.0" +version = "373.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-arena 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-arena 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_data_structures 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-serialize 373.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)", ] @@ -2907,8 +2936,8 @@ name = "rustc_save_analysis" version = "0.0.0" dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rls-span 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rls-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "rustc 0.0.0", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_codegen_utils 0.0.0", @@ -3024,24 +3053,24 @@ dependencies = [ [[package]] name = "rustfmt-nightly" -version = "1.0.1" +version = "1.0.3" dependencies = [ - "assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cargo_metadata 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "derive-new 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "diff 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", - "itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-rustc_target 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-rustc_target 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-ap-syntax_pos 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-workspace-hack 1.0.0", "serde 1.0.82 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.81 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3049,6 +3078,8 @@ dependencies = [ "term 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3089,6 +3120,11 @@ name = "scoped-tls" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "scoped_threadpool" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "scopeguard" version = "0.3.3" @@ -3748,6 +3784,11 @@ name = "unicode-xid" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unreachable" version = "1.0.0" @@ -3932,9 +3973,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ammonia 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fd4c682378117e4186a492b2252b9537990e1617f44aed9788b9a1149de45477" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum arc-swap 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1025aeae2b664ca0ea726a89d574fe8f4e77dd712d443236ad1de00379450cf6" +"checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" -"checksum assert_cli 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "98589b0e465a6c510d95fceebd365bb79bedece7f6e18a480897f2015f85ec51" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum backtrace 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "18b65ea1161bfb2dd6da6fade5edd4dbd08fba85012123dd333d2fd1b90b2782" "checksum backtrace-sys 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "6ea90dd7b012b3d1a2cb6bec16670a0db2c95d4e931e84f4047e0460c1b34c8d" @@ -3942,11 +3983,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum bit-vec 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4440d5cb623bb7390ae27fec0bb6c61111969860f8e3ae198bfa0663645e67cf" "checksum bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4efd02e230a02e18f92fc2735f44597385ed02ad8f831e7c1c1156ee5e1ab3a5" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" +"checksum blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6d530bdd2d52966a6d03b7a964add7ae1a288d25214066fd4b600f0f796400" "checksum block-buffer 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a076c298b9ecdb530ed9d967e74a6027d6a7478924520acddcddc24c1c8ab3ab" "checksum bufstream 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "40e38929add23cdf8a366df9b0e088953150724bcbe5fc330b0d8eb3b328eec8" "checksum build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39" "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" -"checksum bytecount 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b92204551573580e078dc80017f36a213eb77a0450e4ddd8cfa0f3f2d1f0178f" +"checksum bytecount 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be0fdd54b507df8f22012890aadd099979befdba27713c767993f8380112ca7c" "checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" "checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" "checksum bytesize 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "716960a18f978640f25101b5cbf1c6f6b0d3192fab36a2d98ca96f0ecbe41010" @@ -3965,6 +4007,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum commoncrypto-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fed34f46747aa73dfaa578069fd8279d2818ade2b55f38f22a9401c7f4083e2" "checksum compiler_builtins 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "6711d51cb46744dd8305293cc3fbc392aaff7a8f5095a7c4fae1e5113ef07c96" "checksum compiletest_rs 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)" = "0d76d4322a40f6b0db7259d4f2c8a65ed8b0d84fce0bbc61b98cf47f8ec6eec3" +"checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum core-foundation 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4e2640d6d0bf22e82bed1b73c6aef8d5dd31e5abe6666c57e6d45e2649f4f887" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" @@ -3989,13 +4032,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f" +"checksum dirs 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "88972de891f6118092b643d85a0b28e0678e0f948d7f879aa32f2d5aafe97d2a" "checksum dlmalloc 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d56ad71b31043818d0ee10a7fb9664882f8e45849c81647585e6a3124f185517" "checksum either 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3be565ca5c557d7f59e7cfcf1844f9e3033650c929c6566f511e8005f205c1d0" "checksum elasticlunr-rs 2.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a99a310cd1f9770e7bf8e48810c7bcbb0e078c8fb23a8c7bcf0da4c2bf61a455" "checksum ena 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f56c93cc076508c549d9bb747f79aa9b4eb098be7b8cad8830c3137ef52d1e00" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" "checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e" -"checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee" "checksum error-chain 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ff511d5dc435d703f4971bc399647c9bc38e20cb41452e3b9feb4765419ed3f3" "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" @@ -4032,7 +4075,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum if_chain 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4bac95d9aa0624e7b78187d6fb8ab012b41d9f6f54b1bcb61e61c4845f8357ec" "checksum ignore 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "36ecfc5ad80f0b1226df948c562e2cddd446096be3f644c95106400eae8a5e01" -"checksum im-rc 12.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4591152fd573cf453a890b5f9fdc5c328a751a0785539316739d5f85e5c468c" +"checksum im-rc 12.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9460397452f537fd51808056ff209f4c4c4c9d20d42ae952f517708726284972" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" "checksum is-match 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7e5b386aef33a1c677be65237cb9d32c3f3ef56bd035949710c4bb13083eb053" "checksum itertools 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)" = "f58856976b776fedd95533137617a02fb25719f40e7d9b01c7043cd65474f450" @@ -4055,7 +4098,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum log_settings 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19af41f0565d7c19b2058153ad0b42d4d5ce89ec4dbf06ed6741114a8b63e7cd" "checksum lsp-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3570f641b984e3e4613a1ca34db2ea72549bbc3c0316d33f5af91ab514dcbff" -"checksum lsp-types 0.55.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca49aeb430780992121d582520170411658b1e41bf968b917d85fd0fb6da3c5" +"checksum lsp-types 0.55.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6392b5843615b8a2adeebe87b83fdd29567c0870baba3407a67e6dbfee4712f8" "checksum lzma-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d1eaa027402541975218bb0eec67d6b0412f6233af96e0d096d31dbdfd22e614" "checksum mac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" "checksum macro-utils 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2c4deaccc2ead6a28c16c0ba82f07d52b6475397415ce40876e559b0b0ea510" @@ -4124,7 +4167,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.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" -"checksum racer 2.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "11db0de64c3eed7ee25f7b0af2109d296a67efa1efe7566ed17cc01115f961c8" +"checksum racer 2.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "d634483bed41bb116122b84ffe0ef8740345c2ceb2784ce86c33499700eb13a7" "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" "checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" "checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" @@ -4139,26 +4182,27 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum rayon-core 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9d24ad214285a7729b174ed6d3bcfcb80177807f959d95fafd5bfc5c4f201ac8" "checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" +"checksum redox_users 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "214a97e49be64fd2c86f568dd0cb2c757d2cc53de95b273b6ad0a1c908482f26" "checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" "checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum rls-analysis 0.16.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2de1187cceaf16d7642cc78835a2890b55b35ed9e8a8e3c6348a6297d8dd0fb1" +"checksum rls-analysis 0.16.12 (registry+https://github.com/rust-lang/crates.io-index)" = "ae18d8ad01dec3b2014f4d7ae3c607d7adbcff79e5d3b48ea42ea71c10d43a71" "checksum rls-blacklist 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b8ce1fdac03e138c4617ff87b194e1ff57a39bb985a044ccbd8673d30701e411" -"checksum rls-data 0.18.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a209ce46bb52813cbe0786a7baadc0c1a3f5543ef93f179eda3b841ed72cf2e" +"checksum rls-data 0.18.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f80b84551b32e26affaf7f12374913b5061730c0dcd185d9e8fa5a15e36e65c" "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-span 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "33d66f1d6c6ccd5c98029f162544131698f6ebb61d8c697681cac409dcd08805" "checksum rls-vfs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "72d56425bd5aa86d9d4372b76f0381d3b4bda9c0220e71956c9fcc929f45c1f1" -"checksum rustc-ap-arena 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cbfb540c1347a3993060896b18e0d64084203fa37aaffdc5e5c31264f275d476" -"checksum rustc-ap-graphviz 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "790ac657d5bf69be9ef56f6810e8a0238b07e8460a88526e11d41f8214eb6c4e" -"checksum rustc-ap-rustc_cratesio_shim 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b721cf32b543f3ee90240d7b757ca4a45930fe9981458a50678b4ccd75c472e2" -"checksum rustc-ap-rustc_data_structures 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4fa11df199d45ce948b07792ca593f59c1d19d2cb05d35c6b0a02271e772a416" -"checksum rustc-ap-rustc_errors 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b7ead3163ef995bbba520b88739e1d60f9ccf74fdacdda985067644c8134e827" -"checksum rustc-ap-rustc_target 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "688fef9cc27837755019b72b4f13e7a3d3e5012473475f377b75dbb1f07beb5f" -"checksum rustc-ap-serialize 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2c0e8161e956647592a737074736e6ce05ea36b70c770ea8cca3eb9cb33737" -"checksum rustc-ap-syntax 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1adc189e5e4500a4167b9afa04e67067f40d0039e0e05870c977bebb561f065a" -"checksum rustc-ap-syntax_pos 306.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4d42c430dbb0be4377bfe6aa5099074c63ac8796b24098562c2e2154aecc5652" +"checksum rustc-ap-arena 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8be999235b541fc8eb54901b66e899a06076709ac5f53d6b2c5c59d29ad54780" +"checksum rustc-ap-graphviz 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "532b5df15ca1a19a42815e37e521a20a7632b86b36868d1447932f8476f8f789" +"checksum rustc-ap-rustc_cratesio_shim 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c388afe1ef810013c878bdf9073ab1ae28dc49e9325863b351afb10acf4cc46e" +"checksum rustc-ap-rustc_data_structures 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "63a8f08b9fb6d607afb842ee7206273d09d69c9201bfc1c479a726093251a24e" +"checksum rustc-ap-rustc_errors 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6dc0df7bf31588ea67e6386f6ad19f6b9a37ba7d5726ecad1cacce22e231bd98" +"checksum rustc-ap-rustc_target 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb4623a6f6c65b928cbe8d9c52b38cf57ba1722677645dc53fb1bdadfd0e127" +"checksum rustc-ap-serialize 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c290b148c9e4e08bbcb8a313393e257c1103cedf6a038aefc9f957c8a77c755" +"checksum rustc-ap-syntax 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "526fdc5bdbaaeae3b2a9ba42e5f5f7f29cda6ce8971b607a2955b1cb4ca339b5" +"checksum rustc-ap-syntax_pos 373.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e4f88a1213562373cee9de5a1d77bbf16dd706030304af041c9733492fcc952" "checksum rustc-demangle 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "82ae957aa1b3055d8e086486723c0ccd3d7b8fa190ae8fa2e35543b6171c810e" "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" @@ -4172,6 +4216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum schannel 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "0e1a231dc10abf6749cfa5d7767f25888d484201accbd919b66ab5413c502d56" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" +"checksum scoped_threadpool 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1d51f5df5af43ab3f1360b429fa5e0152ac5ce8c0bd6485cae490332e96846a8" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" @@ -4233,6 +4278,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" +"checksum unicode_categories 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" "checksum url_serde 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "74e7d099f1ee52f823d4bdd60c93c3602043c728f5db3b97bdb548467f7bddea" diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index b60c55240140e..d7e789b5a11f7 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -42,11 +42,11 @@ This flag prints out various information about the compiler. ## `-g`: include debug information -A synonym for `-C debug-level=2`. +A synonym for `-C debuginfo=2`, for more see [here](codegen-options/index.html#debuginfo). ## `-O`: optimize your code -A synonym for `-C opt-level=2`. +A synonym for `-C opt-level=2`, for more see [here](codegen-options/index.html#opt-level). ## `-o`: filename of the output diff --git a/src/doc/rustc/src/lints/levels.md b/src/doc/rustc/src/lints/levels.md index 072c7585934e8..d315e0f8ca9e5 100644 --- a/src/doc/rustc/src/lints/levels.md +++ b/src/doc/rustc/src/lints/levels.md @@ -90,7 +90,9 @@ This lint level gives you that. 'forbid' is a special lint level that's stronger than 'deny'. It's the same as 'deny' in that a lint at this level will produce an error, but unlike the 'deny' level, the 'forbid' level can not be overridden to be anything lower -than an error. +than an error. However, lint levels may still be capped with `--cap-lints` +(see below) so `rustc --cap-lints warn` will make lints set to 'forbid' just +warn. ## Configuring warning levels diff --git a/src/doc/rustdoc/src/documentation-tests.md b/src/doc/rustdoc/src/documentation-tests.md index dcc13f53493f4..242167aa91786 100644 --- a/src/doc/rustdoc/src/documentation-tests.md +++ b/src/doc/rustdoc/src/documentation-tests.md @@ -236,6 +236,23 @@ appears to the reader as the initial idea but works with doc tests: /// ``` ``` +As of version 1.34.0, one can also omit the `fn main()`, but you will have to +disambiguate the error type: + +```ignore +/// ``` +/// use std::io; +/// let mut input = String::new(); +/// io::stdin().read_line(&mut input)?; +/// # Ok::<(), io:Error>(()) +/// ``` +``` + +This is an unfortunate consequence of the `?` operator adding an implicit +conversion, so type inference fails because the type is not unique. Please note +that you must write the `(())` in one sequence without intermediate whitespace +so that rustdoc understands you want an implicit `Result`-returning function. + ## Documenting macros Here’s an example of documenting a macro: diff --git a/src/liballoc/benches/btree/mod.rs b/src/liballoc/benches/btree/mod.rs index 4dc2dfd9153e7..095ca5dd2e21b 100644 --- a/src/liballoc/benches/btree/mod.rs +++ b/src/liballoc/benches/btree/mod.rs @@ -1 +1,2 @@ mod map; +mod set; diff --git a/src/liballoc/benches/btree/set.rs b/src/liballoc/benches/btree/set.rs new file mode 100644 index 0000000000000..08e1db5fbb74d --- /dev/null +++ b/src/liballoc/benches/btree/set.rs @@ -0,0 +1,88 @@ +use std::collections::BTreeSet; + +use rand::{thread_rng, Rng}; +use test::{black_box, Bencher}; + +fn random(n1: u32, n2: u32) -> [BTreeSet; 2] { + let mut rng = thread_rng(); + let mut set1 = BTreeSet::new(); + let mut set2 = BTreeSet::new(); + for _ in 0..n1 { + let i = rng.gen::(); + set1.insert(i); + } + for _ in 0..n2 { + let i = rng.gen::(); + set2.insert(i); + } + [set1, set2] +} + +fn staggered(n1: u32, n2: u32) -> [BTreeSet; 2] { + let mut even = BTreeSet::new(); + let mut odd = BTreeSet::new(); + for i in 0..n1 { + even.insert(i * 2); + } + for i in 0..n2 { + odd.insert(i * 2 + 1); + } + [even, odd] +} + +fn neg_vs_pos(n1: u32, n2: u32) -> [BTreeSet; 2] { + let mut neg = BTreeSet::new(); + let mut pos = BTreeSet::new(); + for i in -(n1 as i32)..=-1 { + neg.insert(i); + } + for i in 1..=(n2 as i32) { + pos.insert(i); + } + [neg, pos] +} + +fn pos_vs_neg(n1: u32, n2: u32) -> [BTreeSet; 2] { + let mut neg = BTreeSet::new(); + let mut pos = BTreeSet::new(); + for i in -(n1 as i32)..=-1 { + neg.insert(i); + } + for i in 1..=(n2 as i32) { + pos.insert(i); + } + [pos, neg] +} + +macro_rules! set_intersection_bench { + ($name: ident, $sets: expr) => { + #[bench] + pub fn $name(b: &mut Bencher) { + // setup + let sets = $sets; + + // measure + b.iter(|| { + let x = sets[0].intersection(&sets[1]).count(); + black_box(x); + }) + } + }; +} + +set_intersection_bench! {intersect_random_100, random(100, 100)} +set_intersection_bench! {intersect_random_10k, random(10_000, 10_000)} +set_intersection_bench! {intersect_random_10_vs_10k, random(10, 10_000)} +set_intersection_bench! {intersect_random_10k_vs_10, random(10_000, 10)} +set_intersection_bench! {intersect_staggered_100, staggered(100, 100)} +set_intersection_bench! {intersect_staggered_10k, staggered(10_000, 10_000)} +set_intersection_bench! {intersect_staggered_10_vs_10k, staggered(10, 10_000)} +set_intersection_bench! {intersect_staggered_10k_vs_10, staggered(10_000, 10)} +set_intersection_bench! {intersect_neg_vs_pos_100, neg_vs_pos(100, 100)} +set_intersection_bench! {intersect_neg_vs_pos_10k, neg_vs_pos(10_000, 10_000)} +set_intersection_bench! {intersect_neg_vs_pos_10_vs_10k,neg_vs_pos(10, 10_000)} +set_intersection_bench! {intersect_neg_vs_pos_10k_vs_10,neg_vs_pos(10_000, 10)} +set_intersection_bench! {intersect_pos_vs_neg_100, pos_vs_neg(100, 100)} +set_intersection_bench! {intersect_pos_vs_neg_10k, pos_vs_neg(10_000, 10_000)} +set_intersection_bench! {intersect_pos_vs_neg_10_vs_10k,pos_vs_neg(10, 10_000)} +set_intersection_bench! {intersect_pos_vs_neg_10k_vs_10,pos_vs_neg(10_000, 10)} diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs index 40c71f12cd8a6..74c80a08b12ab 100644 --- a/src/liballoc/borrow.rs +++ b/src/liballoc/borrow.rs @@ -182,8 +182,8 @@ pub enum Cow<'a, B: ?Sized + 'a> } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> { - fn clone(&self) -> Cow<'a, B> { +impl Clone for Cow<'_, B> { + fn clone(&self) -> Self { match *self { Borrowed(b) => Borrowed(b), Owned(ref o) => { @@ -193,7 +193,7 @@ impl<'a, B: ?Sized + ToOwned> Clone for Cow<'a, B> { } } - fn clone_from(&mut self, source: &Cow<'a, B>) { + fn clone_from(&mut self, source: &Self) { if let Owned(ref mut dest) = *self { if let Owned(ref o) = *source { o.borrow().clone_into(dest); @@ -296,11 +296,11 @@ impl Deref for Cow<'_, B> { impl Eq for Cow<'_, B> where B: Eq + ToOwned {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Ord for Cow<'a, B> +impl Ord for Cow<'_, B> where B: Ord + ToOwned { #[inline] - fn cmp(&self, other: &Cow<'a, B>) -> Ordering { + fn cmp(&self, other: &Self) -> Ordering { Ord::cmp(&**self, &**other) } } @@ -353,18 +353,18 @@ impl fmt::Display for Cow<'_, B> } #[stable(feature = "default", since = "1.11.0")] -impl<'a, B: ?Sized> Default for Cow<'a, B> +impl Default for Cow<'_, B> where B: ToOwned, ::Owned: Default { /// Creates an owned Cow<'a, B> with the default value for the contained owned value. - fn default() -> Cow<'a, B> { + fn default() -> Self { Owned(::Owned::default()) } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, B: ?Sized> Hash for Cow<'a, B> +impl Hash for Cow<'_, B> where B: Hash + ToOwned { #[inline] diff --git a/src/liballoc/collections/binary_heap.rs b/src/liballoc/collections/binary_heap.rs index 3b94379b58f8f..ccd4e9dbc0483 100644 --- a/src/liballoc/collections/binary_heap.rs +++ b/src/liballoc/collections/binary_heap.rs @@ -947,8 +947,8 @@ impl fmt::Debug for Iter<'_, T> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Iter<'a, T> { - fn clone(&self) -> Iter<'a, T> { +impl Clone for Iter<'_, T> { + fn clone(&self) -> Self { Iter { iter: self.iter.clone() } } } diff --git a/src/liballoc/collections/btree/map.rs b/src/liballoc/collections/btree/map.rs index 5ec5064b73515..250927138b315 100644 --- a/src/liballoc/collections/btree/map.rs +++ b/src/liballoc/collections/btree/map.rs @@ -1218,8 +1218,8 @@ impl ExactSizeIterator for Iter<'_, K, V> { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K, V> Clone for Iter<'a, K, V> { - fn clone(&self) -> Iter<'a, K, V> { +impl Clone for Iter<'_, K, V> { + fn clone(&self) -> Self { Iter { range: self.range.clone(), length: self.length, @@ -1441,8 +1441,8 @@ impl ExactSizeIterator for Keys<'_, K, V> { impl FusedIterator for Keys<'_, K, V> {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K, V> Clone for Keys<'a, K, V> { - fn clone(&self) -> Keys<'a, K, V> { +impl Clone for Keys<'_, K, V> { + fn clone(&self) -> Self { Keys { inner: self.inner.clone() } } } @@ -1478,8 +1478,8 @@ impl ExactSizeIterator for Values<'_, K, V> { impl FusedIterator for Values<'_, K, V> {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, K, V> Clone for Values<'a, K, V> { - fn clone(&self) -> Values<'a, K, V> { +impl Clone for Values<'_, K, V> { + fn clone(&self) -> Self { Values { inner: self.inner.clone() } } } @@ -1606,8 +1606,8 @@ impl<'a, K, V> Range<'a, K, V> { impl FusedIterator for Range<'_, K, V> {} #[stable(feature = "btree_range", since = "1.17.0")] -impl<'a, K, V> Clone for Range<'a, K, V> { - fn clone(&self) -> Range<'a, K, V> { +impl Clone for Range<'_, K, V> { + fn clone(&self) -> Self { Range { front: self.front, back: self.back, diff --git a/src/liballoc/collections/btree/set.rs b/src/liballoc/collections/btree/set.rs index e1a25366735bf..ff502b4c38f9d 100644 --- a/src/liballoc/collections/btree/set.rs +++ b/src/liballoc/collections/btree/set.rs @@ -941,8 +941,8 @@ impl Debug for BTreeSet { } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Iter<'a, T> { - fn clone(&self) -> Iter<'a, T> { +impl Clone for Iter<'_, T> { + fn clone(&self) -> Self { Iter { iter: self.iter.clone() } } } @@ -997,8 +997,8 @@ impl ExactSizeIterator for IntoIter { impl FusedIterator for IntoIter {} #[stable(feature = "btree_range", since = "1.17.0")] -impl<'a, T> Clone for Range<'a, T> { - fn clone(&self) -> Range<'a, T> { +impl Clone for Range<'_, T> { + fn clone(&self) -> Self { Range { iter: self.iter.clone() } } } @@ -1032,8 +1032,8 @@ fn cmp_opt(x: Option<&T>, y: Option<&T>, short: Ordering, long: Ordering } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Difference<'a, T> { - fn clone(&self) -> Difference<'a, T> { +impl Clone for Difference<'_, T> { + fn clone(&self) -> Self { Difference { a: self.a.clone(), b: self.b.clone(), @@ -1070,8 +1070,8 @@ impl<'a, T: Ord> Iterator for Difference<'a, T> { impl FusedIterator for Difference<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for SymmetricDifference<'a, T> { - fn clone(&self) -> SymmetricDifference<'a, T> { +impl Clone for SymmetricDifference<'_, T> { + fn clone(&self) -> Self { SymmetricDifference { a: self.a.clone(), b: self.b.clone(), @@ -1112,8 +1112,8 @@ impl<'a, T> Clone for IntersectionOther<'a, T> { } } #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Intersection<'a, T> { - fn clone(&self) -> Intersection<'a, T> { +impl Clone for Intersection<'_, T> { + fn clone(&self) -> Self { Intersection { a: self.a.clone(), b: self.b.clone(), @@ -1162,8 +1162,8 @@ impl<'a, T: Ord> Iterator for Intersection<'a, T> { impl FusedIterator for Intersection<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Union<'a, T> { - fn clone(&self) -> Union<'a, T> { +impl Clone for Union<'_, T> { + fn clone(&self) -> Self { Union { a: self.a.clone(), b: self.b.clone(), diff --git a/src/liballoc/collections/linked_list.rs b/src/liballoc/collections/linked_list.rs index afd8078cdd753..c2ee2e63156cf 100644 --- a/src/liballoc/collections/linked_list.rs +++ b/src/liballoc/collections/linked_list.rs @@ -1200,16 +1200,16 @@ unsafe impl Send for LinkedList {} unsafe impl Sync for LinkedList {} #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Sync> Send for Iter<'a, T> {} +unsafe impl Send for Iter<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Sync> Sync for Iter<'a, T> {} +unsafe impl Sync for Iter<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Send> Send for IterMut<'a, T> {} +unsafe impl Send for IterMut<'_, T> {} #[stable(feature = "rust1", since = "1.0.0")] -unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {} +unsafe impl Sync for IterMut<'_, T> {} #[cfg(test)] mod tests { diff --git a/src/liballoc/collections/vec_deque.rs b/src/liballoc/collections/vec_deque.rs index b6fdaa8999212..f778c4cbfde52 100644 --- a/src/liballoc/collections/vec_deque.rs +++ b/src/liballoc/collections/vec_deque.rs @@ -2132,8 +2132,8 @@ impl fmt::Debug for Iter<'_, T> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rust1", since = "1.0.0")] -impl<'a, T> Clone for Iter<'a, T> { - fn clone(&self) -> Iter<'a, T> { +impl Clone for Iter<'_, T> { + fn clone(&self) -> Self { Iter { ring: self.ring, tail: self.tail, @@ -2225,7 +2225,7 @@ pub struct IterMut<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: fmt::Debug> fmt::Debug for IterMut<'_, T> { +impl fmt::Debug for IterMut<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let (front, back) = RingSlices::ring_slices(&*self.ring, self.head, self.tail); f.debug_tuple("IterMut") diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 57723e4d21281..a351d482fedde 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -2455,7 +2455,7 @@ pub struct Drain<'a, T: 'a> { } #[stable(feature = "collection_debug", since = "1.17.0")] -impl<'a, T: 'a + fmt::Debug> fmt::Debug for Drain<'a, T> { +impl fmt::Debug for Drain<'_, T> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_tuple("Drain") .field(&self.iter.as_slice()) diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 2525b47f2bde5..45994c2b4f0f0 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -71,8 +71,10 @@ impl fmt::Write for PadAdapter<'_> { /// } /// } /// -/// // prints "Foo { bar: 10, baz: "Hello World" }" -/// println!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() }); +/// assert_eq!( +/// format!("{:?}", Foo { bar: 10, baz: "Hello World".to_string() }), +/// "Foo { bar: 10, baz: \"Hello World\" }", +/// ); /// ``` #[must_use = "must eventually call `finish()` on Debug builders"] #[allow(missing_debug_implementations)] @@ -96,6 +98,33 @@ pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, impl<'a, 'b: 'a> DebugStruct<'a, 'b> { /// Adds a new field to the generated struct output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Bar { + /// bar: i32, + /// another: String, + /// } + /// + /// impl fmt::Debug for Bar { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_struct("Bar") + /// .field("bar", &self.bar) // We add `bar` field. + /// .field("another", &self.another) // We add `another` field. + /// // We even add a field which doesn't exist (because why not?). + /// .field("not_existing_field", &1) + /// .finish() // We're good to go! + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Bar { bar: 10, another: "Hello World".to_string() }), + /// "Bar { bar: 10, another: \"Hello World\", not_existing_field: 1 }", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn field(&mut self, name: &str, value: &dyn fmt::Debug) -> &mut DebugStruct<'a, 'b> { self.result = self.result.and_then(|_| { @@ -124,6 +153,32 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { } /// Finishes output and returns any error encountered. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Bar { + /// bar: i32, + /// baz: String, + /// } + /// + /// impl fmt::Debug for Bar { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_struct("Bar") + /// .field("bar", &self.bar) + /// .field("baz", &self.baz) + /// .finish() // You need to call it to "finish" the + /// // struct formatting. + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Bar { bar: 10, baz: "Hello World".to_string() }), + /// "Bar { bar: 10, baz: \"Hello World\" }", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { if self.has_fields { @@ -168,8 +223,10 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { /// } /// } /// -/// // prints "Foo(10, "Hello World")" -/// println!("{:?}", Foo(10, "Hello World".to_string())); +/// assert_eq!( +/// format!("{:?}", Foo(10, "Hello World".to_string())), +/// "Foo(10, \"Hello World\")", +/// ); /// ``` #[must_use = "must eventually call `finish()` on Debug builders"] #[allow(missing_debug_implementations)] @@ -193,6 +250,28 @@ pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> D impl<'a, 'b: 'a> DebugTuple<'a, 'b> { /// Adds a new field to the generated tuple struct output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(i32, String); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_tuple("Foo") + /// .field(&self.0) // We add the first field. + /// .field(&self.1) // We add the second field. + /// .finish() // We're good to go! + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(10, "Hello World".to_string())), + /// "Foo(10, \"Hello World\")", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn field(&mut self, value: &dyn fmt::Debug) -> &mut DebugTuple<'a, 'b> { self.result = self.result.and_then(|_| { @@ -220,6 +299,29 @@ impl<'a, 'b: 'a> DebugTuple<'a, 'b> { } /// Finishes output and returns any error encountered. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(i32, String); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_tuple("Foo") + /// .field(&self.0) + /// .field(&self.1) + /// .finish() // You need to call it to "finish" the + /// // tuple formatting. + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(10, "Hello World".to_string())), + /// "Foo(10, \"Hello World\")", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { if self.fields > 0 { @@ -306,8 +408,10 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> { /// } /// } /// -/// // prints "{10, 11}" -/// println!("{:?}", Foo(vec![10, 11])); +/// assert_eq!( +/// format!("{:?}", Foo(vec![10, 11])), +/// "{10, 11}", +/// ); /// ``` #[must_use = "must eventually call `finish()` on Debug builders"] #[allow(missing_debug_implementations)] @@ -329,6 +433,28 @@ pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b impl<'a, 'b: 'a> DebugSet<'a, 'b> { /// Adds a new entry to the set output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec, Vec); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_set() + /// .entry(&self.0) // Adds the first "entry". + /// .entry(&self.1) // Adds the second "entry". + /// .finish() + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![10, 11], vec![12, 13])), + /// "{[10, 11], [12, 13]}", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut DebugSet<'a, 'b> { self.inner.entry(entry); @@ -336,6 +462,28 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { } /// Adds the contents of an iterator of entries to the set output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec, Vec); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_set() + /// .entries(self.0.iter()) // Adds the first "entry". + /// .entries(self.1.iter()) // Adds the second "entry". + /// .finish() + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![10, 11], vec![12, 13])), + /// "{10, 11, 12, 13}", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entries(&mut self, entries: I) -> &mut DebugSet<'a, 'b> where D: fmt::Debug, @@ -348,6 +496,27 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { } /// Finishes output and returns any error encountered. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_set() + /// .entries(self.0.iter()) + /// .finish() // Ends the struct formatting. + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![10, 11])), + /// "{10, 11}", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { self.inner.finish(); @@ -377,8 +546,10 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { /// } /// } /// -/// // prints "[10, 11]" -/// println!("{:?}", Foo(vec![10, 11])); +/// assert_eq!( +/// format!("{:?}", Foo(vec![10, 11])), +/// "[10, 11]", +/// ); /// ``` #[must_use = "must eventually call `finish()` on Debug builders"] #[allow(missing_debug_implementations)] @@ -400,6 +571,28 @@ pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, impl<'a, 'b: 'a> DebugList<'a, 'b> { /// Adds a new entry to the list output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec, Vec); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_list() + /// .entry(&self.0) // We add the first "entry". + /// .entry(&self.1) // We add the second "entry". + /// .finish() + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![10, 11], vec![12, 13])), + /// "[[10, 11], [12, 13]]", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entry(&mut self, entry: &dyn fmt::Debug) -> &mut DebugList<'a, 'b> { self.inner.entry(entry); @@ -407,6 +600,28 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> { } /// Adds the contents of an iterator of entries to the list output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec, Vec); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_list() + /// .entries(self.0.iter()) + /// .entries(self.1.iter()) + /// .finish() + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![10, 11], vec![12, 13])), + /// "[10, 11, 12, 13]", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entries(&mut self, entries: I) -> &mut DebugList<'a, 'b> where D: fmt::Debug, @@ -419,6 +634,27 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> { } /// Finishes output and returns any error encountered. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_list() + /// .entries(self.0.iter()) + /// .finish() // Ends the struct formatting. + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![10, 11])), + /// "[10, 11]", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { self.inner.finish(); @@ -448,8 +684,10 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> { /// } /// } /// -/// // prints "{"A": 10, "B": 11}" -/// println!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])); +/// assert_eq!( +/// format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])), +/// "{\"A\": 10, \"B\": 11}", +/// ); /// ``` #[must_use = "must eventually call `finish()` on Debug builders"] #[allow(missing_debug_implementations)] @@ -471,6 +709,27 @@ pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b impl<'a, 'b: 'a> DebugMap<'a, 'b> { /// Adds a new entry to the map output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec<(String, i32)>); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_map() + /// .entry(&"whole", &self.0) // We add the "whole" entry. + /// .finish() + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])), + /// "{\"whole\": [(\"A\", 10), (\"B\", 11)]}", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entry(&mut self, key: &dyn fmt::Debug, value: &dyn fmt::Debug) -> &mut DebugMap<'a, 'b> { self.result = self.result.and_then(|_| { @@ -500,6 +759,29 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { } /// Adds the contents of an iterator of entries to the map output. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec<(String, i32)>); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_map() + /// // We map our vec so each entries' first field will become + /// // the "key". + /// .entries(self.0.iter().map(|&(ref k, ref v)| (k, v))) + /// .finish() + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])), + /// "{\"A\": 10, \"B\": 11}", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn entries(&mut self, entries: I) -> &mut DebugMap<'a, 'b> where K: fmt::Debug, @@ -513,6 +795,27 @@ impl<'a, 'b: 'a> DebugMap<'a, 'b> { } /// Finishes output and returns any error encountered. + /// + /// # Examples + /// + /// ``` + /// use std::fmt; + /// + /// struct Foo(Vec<(String, i32)>); + /// + /// impl fmt::Debug for Foo { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { + /// fmt.debug_map() + /// .entries(self.0.iter().map(|&(ref k, ref v)| (k, v))) + /// .finish() // Ends the struct formatting. + /// } + /// } + /// + /// assert_eq!( + /// format!("{:?}", Foo(vec![("A".to_string(), 10), ("B".to_string(), 11)])), + /// "{\"A\": 10, \"B\": 11}", + /// ); + /// ``` #[stable(feature = "debug_builders", since = "1.2.0")] pub fn finish(&mut self) -> fmt::Result { let prefix = if self.is_pretty() && self.has_fields { diff --git a/src/libcore/future/future.rs b/src/libcore/future/future.rs index 02457e00054c8..84e7147153e9e 100644 --- a/src/libcore/future/future.rs +++ b/src/libcore/future/future.rs @@ -81,7 +81,7 @@ pub trait Future { /// /// Once a future has completed (returned `Ready` from `poll`), /// then any future calls to `poll` may panic, block forever, or otherwise - /// cause any kind of bad behavior expect causing memory unsafety. + /// cause any kind of bad behavior except causing memory unsafety. /// The `Future` trait itself provides no guarantees about the behavior /// of `poll` after a future has completed. /// @@ -92,7 +92,7 @@ pub trait Future { fn poll(self: Pin<&mut Self>, waker: &Waker) -> Poll; } -impl<'a, F: ?Sized + Future + Unpin> Future for &'a mut F { +impl Future for &mut F { type Output = F::Output; fn poll(mut self: Pin<&mut Self>, waker: &Waker) -> Poll { diff --git a/src/libcore/internal_macros.rs b/src/libcore/internal_macros.rs index 9f0f6fd49fba1..faca785e488c3 100644 --- a/src/libcore/internal_macros.rs +++ b/src/libcore/internal_macros.rs @@ -7,7 +7,7 @@ macro_rules! forward_ref_unop { }; (impl $imp:ident, $method:ident for $t:ty, #[$attr:meta]) => { #[$attr] - impl<'a> $imp for &'a $t { + impl $imp for &$t { type Output = <$t as $imp>::Output; #[inline] diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 4e1dc108cc9bd..5dcca7ee0ca01 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -326,8 +326,10 @@ pub use self::sources::{Empty, empty}; pub use self::sources::{Once, once}; #[unstable(feature = "iter_once_with", issue = "57581")] pub use self::sources::{OnceWith, once_with}; -#[unstable(feature = "iter_unfold", issue = "55977")] -pub use self::sources::{FromFn, from_fn, Successors, successors}; +#[stable(feature = "iter_from_fn", since = "1.34.0")] +pub use self::sources::{FromFn, from_fn}; +#[stable(feature = "iter_successors", since = "1.34.0")] +pub use self::sources::{Successors, successors}; #[stable(feature = "rust1", since = "1.0.0")] pub use self::traits::{FromIterator, IntoIterator, DoubleEndedIterator, Extend}; diff --git a/src/libcore/iter/sources.rs b/src/libcore/iter/sources.rs index 6f45f082d6a37..74ff7f41d76fa 100644 --- a/src/libcore/iter/sources.rs +++ b/src/libcore/iter/sources.rs @@ -514,7 +514,6 @@ pub fn once_with A>(gen: F) -> OnceWith { /// [module-level documentation]: index.html /// /// ``` -/// #![feature(iter_unfold)] /// let mut count = 0; /// let counter = std::iter::from_fn(move || { /// // Increment our count. This is why we started at zero. @@ -530,7 +529,7 @@ pub fn once_with A>(gen: F) -> OnceWith { /// assert_eq!(counter.collect::>(), &[1, 2, 3, 4, 5]); /// ``` #[inline] -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_from_fn", since = "1.34.0")] pub fn from_fn(f: F) -> FromFn where F: FnMut() -> Option { @@ -544,10 +543,10 @@ pub fn from_fn(f: F) -> FromFn /// /// [`iter::from_fn`]: fn.from_fn.html #[derive(Clone)] -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_from_fn", since = "1.34.0")] pub struct FromFn(F); -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_from_fn", since = "1.34.0")] impl Iterator for FromFn where F: FnMut() -> Option { @@ -559,7 +558,7 @@ impl Iterator for FromFn } } -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_from_fn", since = "1.34.0")] impl fmt::Debug for FromFn { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("FromFn").finish() @@ -572,13 +571,12 @@ impl fmt::Debug for FromFn { /// and calls the given `FnMut(&T) -> Option` closure to compute each item’s successor. /// /// ``` -/// #![feature(iter_unfold)] /// use std::iter::successors; /// /// let powers_of_10 = successors(Some(1_u16), |n| n.checked_mul(10)); /// assert_eq!(powers_of_10.collect::>(), &[1, 10, 100, 1_000, 10_000]); /// ``` -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_successors", since = "1.34.0")] pub fn successors(first: Option, succ: F) -> Successors where F: FnMut(&T) -> Option { @@ -598,13 +596,13 @@ pub fn successors(first: Option, succ: F) -> Successors /// /// [`successors`]: fn.successors.html #[derive(Clone)] -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_successors", since = "1.34.0")] pub struct Successors { next: Option, succ: F, } -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_successors", since = "1.34.0")] impl Iterator for Successors where F: FnMut(&T) -> Option { @@ -628,12 +626,12 @@ impl Iterator for Successors } } -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_successors", since = "1.34.0")] impl FusedIterator for Successors where F: FnMut(&T) -> Option {} -#[unstable(feature = "iter_unfold", issue = "55977")] +#[stable(feature = "iter_successors", since = "1.34.0")] impl fmt::Debug for Successors { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("Successors") diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 6fb67ea9c9acb..5b7d5f45d9246 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -1215,7 +1215,7 @@ $EndFeature, " ```"), #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline] - pub fn wrapping_neg(self) -> Self { + pub const fn wrapping_neg(self) -> Self { self.overflowing_neg().0 } } @@ -1569,12 +1569,8 @@ assert_eq!(", stringify!($SelfT), "::MIN.overflowing_neg(), (", stringify!($Self ```"), #[inline] #[stable(feature = "wrapping", since = "1.7.0")] - pub fn overflowing_neg(self) -> (Self, bool) { - if self == Self::min_value() { - (Self::min_value(), true) - } else { - (-self, false) - } + pub const fn overflowing_neg(self) -> (Self, bool) { + ((!self).wrapping_add(1), self == Self::min_value()) } } @@ -3092,7 +3088,7 @@ assert_eq!(100", stringify!($SelfT), ".wrapping_rem_euclid(10), 0); /// ``` #[stable(feature = "num_wrapping", since = "1.2.0")] #[inline] - pub fn wrapping_neg(self) -> Self { + pub const fn wrapping_neg(self) -> Self { self.overflowing_neg().0 } @@ -3397,7 +3393,7 @@ assert_eq!(2", stringify!($SelfT), ".overflowing_neg(), (-2i32 as ", stringify!( ```"), #[inline] #[stable(feature = "wrapping", since = "1.7.0")] - pub fn overflowing_neg(self) -> (Self, bool) { + pub const fn overflowing_neg(self) -> (Self, bool) { ((!self).wrapping_add(1), self != 0) } } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 76ef36ac30962..60aed7ce09d7f 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -874,7 +874,7 @@ impl Option { } } -impl<'a, T: Copy> Option<&'a T> { +impl Option<&T> { /// Maps an `Option<&T>` to an `Option` by copying the contents of the /// option. /// @@ -895,7 +895,7 @@ impl<'a, T: Copy> Option<&'a T> { } } -impl<'a, T: Copy> Option<&'a mut T> { +impl Option<&mut T> { /// Maps an `Option<&mut T>` to an `Option` by copying the contents of the /// option. /// @@ -916,7 +916,7 @@ impl<'a, T: Copy> Option<&'a mut T> { } } -impl<'a, T: Clone> Option<&'a T> { +impl Option<&T> { /// Maps an `Option<&T>` to an `Option` by cloning the contents of the /// option. /// @@ -935,7 +935,7 @@ impl<'a, T: Clone> Option<&'a T> { } } -impl<'a, T: Clone> Option<&'a mut T> { +impl Option<&mut T> { /// Maps an `Option<&mut T>` to an `Option` by cloning the contents of the /// option. /// diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index a628fd0cfa4b2..d89443662df87 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2903,7 +2903,7 @@ macro_rules! iterator { } #[stable(feature = "rust1", since = "1.0.0")] - impl<'a, T> ExactSizeIterator for $name<'a, T> { + impl ExactSizeIterator for $name<'_, T> { #[inline(always)] fn len(&self) -> usize { len!(self) @@ -3098,10 +3098,10 @@ macro_rules! iterator { } #[stable(feature = "fused", since = "1.26.0")] - impl<'a, T> FusedIterator for $name<'a, T> {} + impl FusedIterator for $name<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] - unsafe impl<'a, T> TrustedLen for $name<'a, T> {} + unsafe impl TrustedLen for $name<'_, T> {} } } @@ -4365,8 +4365,8 @@ pub struct RChunks<'a, T:'a> { // FIXME(#26925) Remove in favor of `#[derive(Clone)]` #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> Clone for RChunks<'a, T> { - fn clone(&self) -> RChunks<'a, T> { +impl Clone for RChunks<'_, T> { + fn clone(&self) -> Self { RChunks { v: self.v, chunk_size: self.chunk_size, @@ -4455,13 +4455,13 @@ impl<'a, T> DoubleEndedIterator for RChunks<'a, T> { } #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> ExactSizeIterator for RChunks<'a, T> {} +impl ExactSizeIterator for RChunks<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for RChunks<'a, T> {} +unsafe impl TrustedLen for RChunks<'_, T> {} #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> FusedIterator for RChunks<'a, T> {} +impl FusedIterator for RChunks<'_, T> {} #[doc(hidden)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -4580,13 +4580,13 @@ impl<'a, T> DoubleEndedIterator for RChunksMut<'a, T> { } #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> ExactSizeIterator for RChunksMut<'a, T> {} +impl ExactSizeIterator for RChunksMut<'_, T> {} #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for RChunksMut<'a, T> {} +unsafe impl TrustedLen for RChunksMut<'_, T> {} #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> FusedIterator for RChunksMut<'a, T> {} +impl FusedIterator for RChunksMut<'_, T> {} #[doc(hidden)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -4711,10 +4711,10 @@ impl<'a, T> ExactSizeIterator for RChunksExact<'a, T> { } #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for RChunksExact<'a, T> {} +unsafe impl TrustedLen for RChunksExact<'_, T> {} #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> FusedIterator for RChunksExact<'a, T> {} +impl FusedIterator for RChunksExact<'_, T> {} #[doc(hidden)] #[stable(feature = "rchunks", since = "1.31.0")] @@ -4822,17 +4822,17 @@ impl<'a, T> DoubleEndedIterator for RChunksExactMut<'a, T> { } #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> ExactSizeIterator for RChunksExactMut<'a, T> { +impl ExactSizeIterator for RChunksExactMut<'_, T> { fn is_empty(&self) -> bool { self.v.is_empty() } } #[unstable(feature = "trusted_len", issue = "37572")] -unsafe impl<'a, T> TrustedLen for RChunksExactMut<'a, T> {} +unsafe impl TrustedLen for RChunksExactMut<'_, T> {} #[stable(feature = "rchunks", since = "1.31.0")] -impl<'a, T> FusedIterator for RChunksExactMut<'a, T> {} +impl FusedIterator for RChunksExactMut<'_, T> {} #[doc(hidden)] #[stable(feature = "rchunks", since = "1.31.0")] diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 76a45e53684bd..8b51d8465141a 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -823,7 +823,7 @@ impl FusedIterator for Bytes<'_> {} unsafe impl TrustedLen for Bytes<'_> {} #[doc(hidden)] -unsafe impl<'a> TrustedRandomAccess for Bytes<'a> { +unsafe impl TrustedRandomAccess for Bytes<'_> { unsafe fn get_unchecked(&mut self, i: usize) -> u8 { self.0.get_unchecked(i) } diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 3e8549f8ae366..4cd734bad90a4 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -14,7 +14,6 @@ #![feature(iter_copied)] #![feature(iter_nth_back)] #![feature(iter_once_with)] -#![feature(iter_unfold)] #![feature(pattern)] #![feature(range_is_empty)] #![feature(raw)] diff --git a/src/libcore/tests/ptr.rs b/src/libcore/tests/ptr.rs index 2c53e4832a8cc..03fe1fe5a7cf8 100644 --- a/src/libcore/tests/ptr.rs +++ b/src/libcore/tests/ptr.rs @@ -40,18 +40,17 @@ fn test() { } #[test] -#[cfg(not(miri))] // This test performs invalid OOB pointer arithmetic fn test_is_null() { let p: *const isize = null(); assert!(p.is_null()); - let q = unsafe { p.offset(1) }; + let q = p.wrapping_offset(1); assert!(!q.is_null()); let mp: *mut isize = null_mut(); assert!(mp.is_null()); - let mq = unsafe { mp.offset(1) }; + let mq = mp.wrapping_offset(1); assert!(!mq.is_null()); // Pointers to unsized types -- slices @@ -208,7 +207,6 @@ fn test_ptr_addition() { } #[test] -#[cfg(not(miri))] // This test performs invalid OOB pointer arithmetic fn test_ptr_subtraction() { unsafe { let xs = vec![0,1,2,3,4,5,6,7,8,9]; @@ -224,8 +222,11 @@ fn test_ptr_subtraction() { let m_start = xs_mut.as_mut_ptr(); let mut m_ptr = m_start.offset(9); - while m_ptr >= m_start { + loop { *m_ptr += *m_ptr; + if m_ptr == m_start { + break; + } m_ptr = m_ptr.offset(-1); } diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index f7ffbe8c65833..9eeae6eeb5f34 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -150,9 +150,11 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> { } } - fn pats_all<'b, I: Iterator>>(&mut self, - pats: I, - pred: CFGIndex) -> CFGIndex { + fn pats_all<'b, I: Iterator>>( + &mut self, + pats: I, + pred: CFGIndex + ) -> CFGIndex { //! Handles case where all of the patterns must match. pats.fold(pred, |pred, pat| self.pat(&pat, pred)) } diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index f46ff6f6062c2..00f9fa3a938d6 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -408,11 +408,7 @@ fn bar(x: &str, y: &str) -> &str { } fn baz<'a>(x: &'a str, y: &str) -> &str { } ``` -Lifetime elision in implementation headers was part of the lifetime elision -RFC. It is, however, [currently unimplemented][iss15872]. - [book-le]: https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html#lifetime-elision -[iss15872]: https://github.com/rust-lang/rust/issues/15872 "##, E0119: r##" diff --git a/src/librustc/hir/intravisit.rs b/src/librustc/hir/intravisit.rs index 94b036fded5a1..4a2bc213fea80 100644 --- a/src/librustc/hir/intravisit.rs +++ b/src/librustc/hir/intravisit.rs @@ -953,7 +953,7 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt) { visitor.visit_id(statement.id); match statement.node { StmtKind::Local(ref local) => visitor.visit_local(local), - StmtKind::Item(ref item) => visitor.visit_nested_item(**item), + StmtKind::Item(item) => visitor.visit_nested_item(item), StmtKind::Expr(ref expression) | StmtKind::Semi(ref expression) => { visitor.visit_expr(expression) diff --git a/src/librustc/hir/lowering.rs b/src/librustc/hir/lowering.rs index 52c3eb26d6180..9f48a628274db 100644 --- a/src/librustc/hir/lowering.rs +++ b/src/librustc/hir/lowering.rs @@ -4656,7 +4656,7 @@ impl<'a> LoweringContext<'a> { hir::Stmt { id: node_id, hir_id, - node: hir::StmtKind::Item(P(item_id)), + node: hir::StmtKind::Item(item_id), span: s.span, } }) @@ -4686,7 +4686,7 @@ impl<'a> LoweringContext<'a> { hir::Stmt { id: node_id, hir_id, - node: hir::StmtKind::Item(P(item_id)), + node: hir::StmtKind::Item(item_id), span: s.span, } }) diff --git a/src/librustc/hir/mod.rs b/src/librustc/hir/mod.rs index d7d56ef659afb..d0b92587b59f0 100644 --- a/src/librustc/hir/mod.rs +++ b/src/librustc/hir/mod.rs @@ -964,14 +964,19 @@ pub enum PatKind { /// If the `..` pattern fragment is present, then `Option` denotes its position. /// `0 <= position <= subpats.len()` Tuple(HirVec>, Option), + /// A `box` pattern. Box(P), + /// A reference pattern (e.g., `&mut (a, b)`). Ref(P, Mutability), + /// A literal. Lit(P), + /// A range pattern (e.g., `1...2` or `1..2`). Range(P, P, RangeEnd), + /// `[a, b, ..i, y, z]` is represented as: /// `PatKind::Slice(box [a, b], Some(i), box [y, z])`. Slice(HirVec>, Option>, HirVec>), @@ -1175,8 +1180,9 @@ impl fmt::Debug for Stmt { pub enum StmtKind { /// A local (`let`) binding. Local(P), + /// An item binding. - Item(P), + Item(ItemId), /// An expression without a trailing semi-colon (must have unit type). Expr(P), diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 031b3a3233d6f..ece649cf1b882 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -1007,8 +1007,8 @@ impl<'a> State<'a> { } self.end()? } - hir::StmtKind::Item(ref item) => { - self.ann.nested(self, Nested::Item(**item))? + hir::StmtKind::Item(item) => { + self.ann.nested(self, Nested::Item(item))? } hir::StmtKind::Expr(ref expr) => { self.space_if_not_bol()?; diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 6f04a68a6ed61..53ed0bfb12ee9 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -237,6 +237,11 @@ impl_stable_hash_for!(struct ty::FnSig<'tcx> { abi }); +impl_stable_hash_for!(struct ty::ResolvedOpaqueTy<'tcx> { + concrete_type, + substs +}); + impl<'a, 'gcx, T> HashStable> for ty::Binder where T: HashStable> { diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 361fbfea09798..9cd5a844f1590 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -255,10 +255,24 @@ impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> { RelationDir::SupertypeOf => ty::Contravariant, }; + debug!("generalize: ambient_variance = {:?}", ambient_variance); + + let for_universe = match self.infcx.type_variables.borrow_mut().probe(for_vid) { + v @ TypeVariableValue::Known { .. } => panic!( + "instantiating {:?} which has a known value {:?}", + for_vid, + v, + ), + TypeVariableValue::Unknown { universe } => universe, + }; + + debug!("generalize: for_universe = {:?}", for_universe); + let mut generalize = Generalizer { infcx: self.infcx, span: self.trace.cause.span, for_vid_sub_root: self.infcx.type_variables.borrow_mut().sub_root_var(for_vid), + for_universe, ambient_variance, needs_wf: false, root_ty: ty, @@ -288,6 +302,11 @@ struct Generalizer<'cx, 'gcx: 'cx+'tcx, 'tcx: 'cx> { /// that means we would have created a cyclic type. for_vid_sub_root: ty::TyVid, + /// The universe of the type variable that is in the process of + /// being instantiated. Any fresh variables that we create in this + /// process should be in that same universe. + for_universe: ty::UniverseIndex, + /// Track the variance as we descend into the type. ambient_variance: ty::Variance, @@ -386,6 +405,8 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' fn tys(&mut self, t: Ty<'tcx>, t2: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> { assert_eq!(t, t2); // we are abusing TypeRelation here; both LHS and RHS ought to be == + debug!("generalize: t={:?}", t); + // Check to see whether the type we are genealizing references // any other type variable related to `vid` via // subtyping. This is basically our "occurs check", preventing @@ -403,12 +424,17 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' match variables.probe(vid) { TypeVariableValue::Known { value: u } => { drop(variables); + debug!("generalize: known value {:?}", u); self.relate(&u, &u) } TypeVariableValue::Unknown { universe } => { match self.ambient_variance { // Invariant: no need to make a fresh type variable. - ty::Invariant => return Ok(t), + ty::Invariant => { + if self.for_universe.can_name(universe) { + return Ok(t); + } + } // Bivariant: make a fresh var, but we // may need a WF predicate. See @@ -422,7 +448,7 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' } let origin = *variables.var_origin(vid); - let new_var_id = variables.new_var(universe, false, origin); + let new_var_id = variables.new_var(self.for_universe, false, origin); let u = self.tcx().mk_var(new_var_id); debug!("generalize: replacing original vid={:?} with new={:?}", vid, u); @@ -448,6 +474,8 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' -> RelateResult<'tcx, ty::Region<'tcx>> { assert_eq!(r, r2); // we are abusing TypeRelation here; both LHS and RHS ought to be == + debug!("generalize: regions r={:?}", r); + match *r { // Never make variables for regions bound within the type itself, // nor for erased regions. @@ -456,37 +484,40 @@ impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, ' return Ok(r); } - // Always make a fresh region variable for placeholder - // regions; the higher-ranked decision procedures rely on - // this. - ty::RePlaceholder(..) => { } + ty::ReClosureBound(..) => { + span_bug!( + self.span, + "encountered unexpected ReClosureBound: {:?}", + r, + ); + } - // For anything else, we make a region variable, unless we - // are *equating*, in which case it's just wasteful. + ty::RePlaceholder(..) | + ty::ReVar(..) | ty::ReEmpty | ty::ReStatic | ty::ReScope(..) | - ty::ReVar(..) | ty::ReEarlyBound(..) | ty::ReFree(..) => { - match self.ambient_variance { - ty::Invariant => return Ok(r), - ty::Bivariant | ty::Covariant | ty::Contravariant => (), - } + // see common code below } + } - ty::ReClosureBound(..) => { - span_bug!( - self.span, - "encountered unexpected ReClosureBound: {:?}", - r, - ); + // If we are in an invariant context, we can re-use the region + // as is, unless it happens to be in some universe that we + // can't name. (In the case of a region *variable*, we could + // use it if we promoted it into our universe, but we don't + // bother.) + if let ty::Invariant = self.ambient_variance { + let r_universe = self.infcx.universe_of_region(r); + if self.for_universe.can_name(r_universe) { + return Ok(r); } } // FIXME: This is non-ideal because we don't give a // very descriptive origin for this region variable. - Ok(self.infcx.next_region_var(MiscVariable(self.span))) + Ok(self.infcx.next_region_var_in_universe(MiscVariable(self.span), self.for_universe)) } } diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs index 7f01078737d73..c864349019b88 100644 --- a/src/librustc/infer/higher_ranked/mod.rs +++ b/src/librustc/infer/higher_ranked/mod.rs @@ -96,10 +96,15 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { let (result, map) = self.tcx.replace_bound_vars(binder, fld_r, fld_t); debug!( - "replace_bound_vars_with_placeholders(binder={:?}, result={:?}, map={:?})", + "replace_bound_vars_with_placeholders(\ + next_universe={:?}, \ + binder={:?}, \ + result={:?}, \ + map={:?})", + next_universe, binder, result, - map + map, ); (result, map) diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index a61771b2a4eea..04d08c199802e 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -1018,6 +1018,18 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { self.tcx.mk_region(ty::ReVar(region_var)) } + /// Return the universe that the region `r` was created in. For + /// most regions (e.g., `'static`, named regions from the user, + /// etc) this is the root universe U0. For inference variables or + /// placeholders, however, it will return the universe which which + /// they are associated. + fn universe_of_region( + &self, + r: ty::Region<'tcx>, + ) -> ty::UniverseIndex { + self.borrow_region_constraints().universe(r) + } + /// Number of region variables created so far. pub fn num_region_vars(&self) -> usize { self.borrow_region_constraints().num_region_vars() diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index 1f81321d22d6e..e75446b01c11e 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -26,7 +26,7 @@ pub struct OpaqueTypeDecl<'tcx> { /// /// winds up desugared to: /// - /// abstract type Foo<'x, T>: Trait<'x> + /// abstract type Foo<'x, X>: Trait<'x> /// fn foo<'a, 'b, T>() -> Foo<'a, T> /// /// then `substs` would be `['a, T]`. diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index 65d25333c7179..45d614167ea91 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -514,8 +514,8 @@ impl<'tcx> RegionConstraintCollector<'tcx> { self.undo_log.push(AddVar(vid)); } debug!( - "created new region variable {:?} with origin {:?}", - vid, origin + "created new region variable {:?} in {:?} with origin {:?}", + vid, universe, origin ); return vid; } @@ -671,6 +671,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { self.make_subregion(origin, sup, sub); if let (ty::ReVar(sub), ty::ReVar(sup)) = (*sub, *sup) { + debug!("make_eqregion: uniying {:?} with {:?}", sub, sup); self.unification_table.union(sub, sup); self.any_unifications = true; } @@ -823,7 +824,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { new_r } - fn universe(&self, region: Region<'tcx>) -> ty::UniverseIndex { + pub fn universe(&self, region: Region<'tcx>) -> ty::UniverseIndex { match *region { ty::ReScope(..) | ty::ReStatic diff --git a/src/librustc/infer/type_variable.rs b/src/librustc/infer/type_variable.rs index 09a0a6ce9c97c..4c76818346b43 100644 --- a/src/librustc/infer/type_variable.rs +++ b/src/librustc/infer/type_variable.rs @@ -188,7 +188,13 @@ impl<'tcx> TypeVariableTable<'tcx> { }); assert_eq!(eq_key.vid.index, index as u32); - debug!("new_var(index={:?}, diverging={:?}, origin={:?}", eq_key.vid, diverging, origin); + debug!( + "new_var(index={:?}, universe={:?}, diverging={:?}, origin={:?}", + eq_key.vid, + universe, + diverging, + origin, + ); eq_key.vid } diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 56e7d78935698..f65c09e31343c 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -1311,12 +1311,12 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { Def::Err => { debug!("access to unresolvable pattern {:?}", pat); return Err(()) - }, + } Def::Variant(variant_did) | Def::VariantCtor(variant_did, ..) => { self.cat_downcast_if_needed(pat, cmt, variant_did) - }, - _ => cmt + } + _ => cmt, }; for fp in field_pats { @@ -1347,7 +1347,7 @@ impl<'a, 'gcx, 'tcx> MemCategorizationContext<'a, 'gcx, 'tcx> { } } - PatKind::Box(ref subpat) | PatKind::Ref(ref subpat, _) => { + PatKind::Box(ref subpat) | PatKind::Ref(ref subpat, _) => { // box p1, &p1, &mut p1. we can ignore the mutability of // PatKind::Ref since that information is already contained // in the type. diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 18b0afe1fd91e..6bb3222512565 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -317,6 +317,17 @@ impl<'a, V> LocalTableInContextMut<'a, V> { } } +/// All information necessary to validate and reveal an `impl Trait` or `existential Type` +#[derive(RustcEncodable, RustcDecodable, Debug)] +pub struct ResolvedOpaqueTy<'tcx> { + /// The revealed type as seen by this function. + pub concrete_type: Ty<'tcx>, + /// Generic parameters on the opaque type as passed by this function. + /// For `existential type Foo; fn foo() -> Foo { .. }` this is `[T, U]`, not + /// `[A, B]` + pub substs: &'tcx Substs<'tcx>, +} + #[derive(RustcEncodable, RustcDecodable, Debug)] pub struct TypeckTables<'tcx> { /// The HirId::owner all ItemLocalIds in this table are relative to. @@ -419,7 +430,7 @@ pub struct TypeckTables<'tcx> { /// All the existential types that are restricted to concrete types /// by this function - pub concrete_existential_types: FxHashMap>, + pub concrete_existential_types: FxHashMap>, /// Given the closure ID this map provides the list of UpvarIDs used by it. /// The upvarID contains the HIR node ID and it also contains the full path diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 18dba3092ad5a..02e4fb12af5c9 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -74,7 +74,7 @@ pub use self::context::{TyCtxt, FreeRegionInfo, GlobalArenas, AllArenas, tls, ke pub use self::context::{Lift, TypeckTables, CtxtInterners}; pub use self::context::{ UserTypeAnnotationIndex, UserType, CanonicalUserType, - CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, + CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, ResolvedOpaqueTy, }; pub use self::instance::{Instance, InstanceDef}; diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 66efd2aea155a..350bc45026322 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -1167,13 +1167,13 @@ pub type Region<'tcx> = &'tcx RegionKind; /// [rustc guide]: https://rust-lang.github.io/rustc-guide/traits/hrtb.html #[derive(Clone, PartialEq, Eq, Hash, Copy, RustcEncodable, RustcDecodable, PartialOrd, Ord)] pub enum RegionKind { - // Region bound in a type or fn declaration which will be - // substituted 'early' -- that is, at the same time when type - // parameters are substituted. + /// Region bound in a type or fn declaration which will be + /// substituted 'early' -- that is, at the same time when type + /// parameters are substituted. ReEarlyBound(EarlyBoundRegion), - // Region bound in a function scope, which will be substituted when the - // function is called. + /// Region bound in a function scope, which will be substituted when the + /// function is called. ReLateBound(DebruijnIndex, BoundRegion), /// When checking a function body, the types of all arguments and so forth diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 1cb9f47bb31f1..768fd02e8238a 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -1430,6 +1430,15 @@ define_print! { } } + if cx.is_verbose { + write!( + f, + " closure_kind_ty={:?} closure_sig_ty={:?}", + substs.closure_kind_ty(did, tcx), + substs.closure_sig_ty(did, tcx), + )?; + } + write!(f, "]") }), Array(ty, sz) => { diff --git a/src/librustc_codegen_llvm/Cargo.toml b/src/librustc_codegen_llvm/Cargo.toml index b711502b14b7f..841cf98164eb4 100644 --- a/src/librustc_codegen_llvm/Cargo.toml +++ b/src/librustc_codegen_llvm/Cargo.toml @@ -2,6 +2,7 @@ authors = ["The Rust Project Developers"] name = "rustc_codegen_llvm" version = "0.0.0" +edition = "2018" [lib] name = "rustc_codegen_llvm" @@ -10,7 +11,7 @@ crate-type = ["dylib"] test = false [dependencies] -cc = "1.0.1" +cc = "1.0.1" # Used to locate MSVC num_cpus = "1.0" rustc-demangle = "0.1.4" rustc_llvm = { path = "../librustc_llvm" } diff --git a/src/librustc_codegen_llvm/abi.rs b/src/librustc_codegen_llvm/abi.rs index f7d2699a27e3f..992149f7a47b5 100644 --- a/src/librustc_codegen_llvm/abi.rs +++ b/src/librustc_codegen_llvm/abi.rs @@ -1,12 +1,12 @@ -use llvm::{self, AttributePlace}; +use crate::llvm::{self, AttributePlace}; +use crate::builder::Builder; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::type_of::{LayoutLlvmExt, PointerKind}; +use crate::value::Value; use rustc_codegen_ssa::MemFlags; -use builder::Builder; -use context::CodegenCx; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::mir::operand::OperandValue; -use type_::Type; -use type_of::{LayoutLlvmExt, PointerKind}; -use value::Value; use rustc_target::abi::call::ArgType; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 56bbaf55f75b4..7430cd3f70961 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -1,13 +1,13 @@ use std::ffi::CString; -use attributes; +use crate::attributes; use libc::c_uint; use rustc::middle::allocator::AllocatorKind; use rustc::ty::TyCtxt; use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy}; -use ModuleLlvm; -use llvm::{self, False, True}; +use crate::ModuleLlvm; +use crate::llvm::{self, False, True}; pub(crate) unsafe fn codegen(tcx: TyCtxt, mods: &ModuleLlvm, kind: AllocatorKind) { let llcx = &*mods.llcx; diff --git a/src/librustc_codegen_llvm/asm.rs b/src/librustc_codegen_llvm/asm.rs index 5c1a8b070c993..4427308f4155d 100644 --- a/src/librustc_codegen_llvm/asm.rs +++ b/src/librustc_codegen_llvm/asm.rs @@ -1,8 +1,8 @@ -use llvm; -use context::CodegenCx; -use type_of::LayoutLlvmExt; -use builder::Builder; -use value::Value; +use crate::llvm; +use crate::context::CodegenCx; +use crate::type_of::LayoutLlvmExt; +use crate::builder::Builder; +use crate::value::Value; use rustc::hir; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index e6bc7bca46bc9..827ebff10f51c 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -15,15 +15,15 @@ use rustc_data_structures::fx::FxHashMap; use rustc_target::spec::PanicStrategy; use rustc_codegen_ssa::traits::*; -use abi::Abi; -use attributes; -use llvm::{self, Attribute}; -use llvm::AttributePlace::Function; -use llvm_util; +use crate::abi::Abi; +use crate::attributes; +use crate::llvm::{self, Attribute}; +use crate::llvm::AttributePlace::Function; +use crate::llvm_util; pub use syntax::attr::{self, InlineAttr, OptimizeAttr}; -use context::CodegenCx; -use value::Value; +use crate::context::CodegenCx; +use crate::value::Value; /// Mark LLVM function to use provided inline heuristic. #[inline] diff --git a/src/librustc_codegen_llvm/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs index e02f7df2efcc9..1c090f1446965 100644 --- a/src/librustc_codegen_llvm/back/archive.rs +++ b/src/librustc_codegen_llvm/back/archive.rs @@ -7,12 +7,11 @@ use std::path::{Path, PathBuf}; use std::ptr; use std::str; -use back::bytecode::RLIB_BYTECODE_EXTENSION; +use crate::back::bytecode::RLIB_BYTECODE_EXTENSION; +use crate::llvm::archive_ro::{ArchiveRO, Child}; +use crate::llvm::{self, ArchiveKind}; +use crate::metadata::METADATA_FILENAME; use rustc_codegen_ssa::back::archive::find_library; -use libc; -use llvm::archive_ro::{ArchiveRO, Child}; -use llvm::{self, ArchiveKind}; -use metadata::METADATA_FILENAME; use rustc::session::Session; pub struct ArchiveConfig<'a> { diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index 548c94abc076f..a3b34485715a7 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -1,13 +1,15 @@ -use back::wasm; use super::archive::{ArchiveBuilder, ArchiveConfig}; use super::bytecode::RLIB_BYTECODE_EXTENSION; +use super::rpath::RPathConfig; +use super::rpath; +use crate::back::wasm; +use crate::metadata::METADATA_FILENAME; +use crate::context::get_reloc_model; +use crate::llvm; use rustc_codegen_ssa::back::linker::Linker; use rustc_codegen_ssa::back::link::{remove, ignored_for_lto, each_linked_rlib, linker_and_flavor, get_linker}; use rustc_codegen_ssa::back::command::Command; -use super::rpath::RPathConfig; -use super::rpath; -use metadata::METADATA_FILENAME; use rustc::session::config::{self, DebugInfo, OutputFilenames, OutputType, PrintRequest}; use rustc::session::config::{RUST_CGU_EXT, Lto, Sanitizer}; use rustc::session::filesearch; @@ -22,8 +24,6 @@ use rustc::hir::def_id::CrateNum; use tempfile::{Builder as TempFileBuilder, TempDir}; use rustc_target::spec::{PanicStrategy, RelroLevel, LinkerFlavor}; use rustc_data_structures::fx::FxHashSet; -use context::get_reloc_model; -use llvm; use std::ascii; use std::char; @@ -523,7 +523,7 @@ fn link_natively(sess: &Session, } { - let target_cpu = ::llvm_util::target_cpu(sess); + let target_cpu = crate::llvm_util::target_cpu(sess); let mut linker = codegen_results.linker_info.to_linker(cmd, &sess, flavor, target_cpu); link_args(&mut *linker, flavor, sess, crate_type, tmpdir, out_filename, codegen_results); diff --git a/src/librustc_codegen_llvm/back/lto.rs b/src/librustc_codegen_llvm/back/lto.rs index fc3ab7f734a79..944569c8b744b 100644 --- a/src/librustc_codegen_llvm/back/lto.rs +++ b/src/librustc_codegen_llvm/back/lto.rs @@ -1,12 +1,15 @@ -use back::bytecode::{DecodedBytecode, RLIB_BYTECODE_EXTENSION}; +use crate::back::bytecode::{DecodedBytecode, RLIB_BYTECODE_EXTENSION}; +use crate::back::write::{self, DiagnosticHandlers, with_llvm_pmb, save_temp_bitcode, + to_llvm_opt_settings}; +use crate::llvm::archive_ro::ArchiveRO; +use crate::llvm::{self, True, False}; +use crate::time_graph::Timeline; +use crate::{ModuleLlvm, LlvmCodegenBackend}; use rustc_codegen_ssa::back::symbol_export; use rustc_codegen_ssa::back::write::{ModuleConfig, CodegenContext, FatLTOInput}; use rustc_codegen_ssa::back::lto::{SerializedModule, LtoModuleCodegen, ThinShared, ThinModule}; use rustc_codegen_ssa::traits::*; -use back::write::{self, DiagnosticHandlers, with_llvm_pmb, save_temp_bitcode, to_llvm_opt_settings}; use errors::{FatalError, Handler}; -use llvm::archive_ro::ArchiveRO; -use llvm::{self, True, False}; use rustc::dep_graph::WorkProduct; use rustc::dep_graph::cgu_reuse_tracker::CguReuse; use rustc::hir::def_id::LOCAL_CRATE; @@ -14,12 +17,8 @@ use rustc::middle::exported_symbols::SymbolExportLevel; use rustc::session::config::{self, Lto}; use rustc::util::common::time_ext; use rustc_data_structures::fx::FxHashMap; -use time_graph::Timeline; -use {ModuleLlvm, LlvmCodegenBackend}; use rustc_codegen_ssa::{ModuleCodegen, ModuleKind}; -use libc; - use std::ffi::{CStr, CString}; use std::ptr; use std::slice; diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index e78715319727b..1b16080515235 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -1,28 +1,27 @@ -use attributes; -use back::bytecode::{self, RLIB_BYTECODE_EXTENSION}; -use back::lto::ThinBuffer; +use crate::attributes; +use crate::back::bytecode::{self, RLIB_BYTECODE_EXTENSION}; +use crate::back::lto::ThinBuffer; +use crate::base; +use crate::consts; +use crate::time_graph::Timeline; +use crate::llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic}; +use crate::llvm_util; +use crate::ModuleLlvm; +use crate::type_::Type; +use crate::context::{is_pie_binary, get_reloc_model}; +use crate::common; +use crate::LlvmCodegenBackend; use rustc_codegen_ssa::back::write::{CodegenContext, ModuleConfig, run_assembler}; use rustc_codegen_ssa::traits::*; -use base; -use consts; use rustc::hir::def_id::LOCAL_CRATE; use rustc::session::config::{self, OutputType, Passes, Lto}; use rustc::session::Session; use rustc::ty::TyCtxt; -use time_graph::Timeline; -use llvm::{self, DiagnosticInfo, PassManager, SMDiagnostic}; -use llvm_util; -use ModuleLlvm; use rustc_codegen_ssa::{ModuleCodegen, CompiledModule}; use rustc::util::common::time_ext; use rustc_fs_util::{path_to_c_string, link_or_copy}; use rustc_data_structures::small_c_str::SmallCStr; -use errors::{self, Handler, FatalError}; -use type_::Type; -use context::{is_pie_binary, get_reloc_model}; -use common; -use LlvmCodegenBackend; -use rustc_demangle; +use errors::{Handler, FatalError}; use std::ffi::{CString, CStr}; use std::fs; diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index 70986a4e17941..33531bb69485b 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -18,18 +18,18 @@ use rustc_codegen_ssa::{ModuleCodegen, ModuleKind}; use rustc_codegen_ssa::base::maybe_create_entry_wrapper; use super::LlvmCodegenBackend; -use llvm; -use metadata; +use crate::llvm; +use crate::metadata; +use crate::builder::Builder; +use crate::common; +use crate::context::CodegenCx; +use crate::monomorphize::partitioning::CodegenUnitExt; use rustc::dep_graph; use rustc::mir::mono::{Linkage, Visibility, Stats}; use rustc::middle::cstore::{EncodedMetadata}; use rustc::ty::TyCtxt; use rustc::middle::exported_symbols; use rustc::session::config::{self, DebugInfo}; -use builder::Builder; -use common; -use context::CodegenCx; -use monomorphize::partitioning::CodegenUnitExt; use rustc_codegen_ssa::mono_item::MonoItemExt; use rustc_data_structures::small_c_str::SmallCStr; @@ -41,7 +41,7 @@ use std::time::Instant; use syntax_pos::symbol::InternedString; use rustc::hir::CodegenFnAttrs; -use value::Value; +use crate::value::Value; pub fn write_metadata<'a, 'gcx>( diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index b79d0da0bcd06..39c8f8a09400b 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -1,12 +1,12 @@ -use llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; -use llvm::{self, False, BasicBlock}; +use crate::llvm::{AtomicRmwBinOp, AtomicOrdering, SynchronizationScope, AsmDialect}; +use crate::llvm::{self, False, BasicBlock}; +use crate::common::Funclet; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use rustc_codegen_ssa::common::{IntPredicate, TypeKind, RealPredicate}; -use rustc_codegen_ssa::{self, MemFlags}; -use common::Funclet; -use context::CodegenCx; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; +use rustc_codegen_ssa::MemFlags; use libc::{c_uint, c_char}; use rustc::ty::{self, Ty, TyCtxt}; use rustc::ty::layout::{self, Align, Size, TyLayout}; @@ -14,7 +14,6 @@ use rustc::hir::def_id::DefId; use rustc::session::config; use rustc_data_structures::small_c_str::SmallCStr; use rustc_codegen_ssa::traits::*; -use syntax; use rustc_codegen_ssa::base::to_immediate; use rustc_codegen_ssa::mir::operand::{OperandValue, OperandRef}; use rustc_codegen_ssa::mir::place::PlaceRef; diff --git a/src/librustc_codegen_llvm/callee.rs b/src/librustc_codegen_llvm/callee.rs index 9426328da327d..43a5767e5c68d 100644 --- a/src/librustc_codegen_llvm/callee.rs +++ b/src/librustc_codegen_llvm/callee.rs @@ -4,11 +4,11 @@ //! and methods are represented as just a fn ptr and not a full //! closure. -use attributes; -use llvm; -use monomorphize::Instance; -use context::CodegenCx; -use value::Value; +use crate::attributes; +use crate::llvm; +use crate::monomorphize::Instance; +use crate::context::CodegenCx; +use crate::value::Value; use rustc_codegen_ssa::traits::*; use rustc::ty::TypeFoldable; diff --git a/src/librustc_codegen_llvm/common.rs b/src/librustc_codegen_llvm/common.rs index 675d6ccb5041d..4bd036ea3b17a 100644 --- a/src/librustc_codegen_llvm/common.rs +++ b/src/librustc_codegen_llvm/common.rs @@ -2,17 +2,17 @@ //! Code that is useful in various codegen modules. -use llvm::{self, True, False, Bool, BasicBlock, OperandBundleDef}; -use abi; -use consts; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; +use crate::llvm::{self, True, False, Bool, BasicBlock, OperandBundleDef}; +use crate::abi; +use crate::consts; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use rustc_codegen_ssa::traits::*; +use crate::consts::const_alloc_to_llvm; use rustc::ty::layout::{HasDataLayout, LayoutOf, self, TyLayout, Size}; use rustc::mir::interpret::{Scalar, AllocKind, Allocation}; -use consts::const_alloc_to_llvm; use rustc_codegen_ssa::mir::place::PlaceRef; use libc::{c_uint, c_char}; @@ -20,7 +20,7 @@ use libc::{c_uint, c_char}; use syntax::symbol::LocalInternedString; use syntax::ast::Mutability; -pub use context::CodegenCx; +pub use crate::context::CodegenCx; /* * A note on nomenclature of linking: "extern", "foreign", and "upcall". diff --git a/src/librustc_codegen_llvm/consts.rs b/src/librustc_codegen_llvm/consts.rs index ca9e2c87be237..6232d44df5e4e 100644 --- a/src/librustc_codegen_llvm/consts.rs +++ b/src/librustc_codegen_llvm/consts.rs @@ -1,20 +1,20 @@ +use crate::llvm::{self, SetUnnamedAddr, True}; +use crate::debuginfo; +use crate::monomorphize::MonoItem; +use crate::common::CodegenCx; +use crate::monomorphize::Instance; +use crate::base; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use libc::c_uint; -use llvm::{self, SetUnnamedAddr, True}; use rustc::hir::def_id::DefId; use rustc::mir::interpret::{ConstValue, Allocation, read_target_uint, Pointer, ErrorHandled, GlobalId}; use rustc::hir::Node; -use debuginfo; -use monomorphize::MonoItem; -use common::CodegenCx; -use monomorphize::Instance; use syntax_pos::Span; use rustc_target::abi::HasDataLayout; use syntax_pos::symbol::LocalInternedString; -use base; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; use rustc::ty::{self, Ty}; use rustc_codegen_ssa::traits::*; diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index 8144132832e50..d9c4d22b41100 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -1,14 +1,14 @@ -use attributes; -use llvm; +use crate::attributes; +use crate::llvm; +use crate::debuginfo; +use crate::monomorphize::Instance; +use crate::value::Value; use rustc::dep_graph::DepGraphSafe; use rustc::hir; -use debuginfo; -use monomorphize::Instance; -use value::Value; -use monomorphize::partitioning::CodegenUnit; -use type_::Type; -use type_of::PointeeInfo; +use crate::monomorphize::partitioning::CodegenUnit; +use crate::type_::Type; +use crate::type_of::PointeeInfo; use rustc_codegen_ssa::traits::*; use libc::c_uint; @@ -23,7 +23,7 @@ use rustc::util::nodemap::FxHashMap; use rustc_target::spec::{HasTargetSpec, Target}; use rustc_codegen_ssa::callee::resolve_and_get_fn; use rustc_codegen_ssa::base::wants_msvc_seh; -use callee::get_fn; +use crate::callee::get_fn; use std::ffi::CStr; use std::cell::{Cell, RefCell}; @@ -31,7 +31,7 @@ use std::iter; use std::str; use std::sync::Arc; use syntax::symbol::LocalInternedString; -use abi::Abi; +use crate::abi::Abi; /// There is one `CodegenCx` per compilation unit. Each one has its own LLVM /// `llvm::Context` so that several compilation units may be optimized in parallel. @@ -103,7 +103,7 @@ pub fn get_reloc_model(sess: &Session) -> llvm::RelocMode { None => &sess.target.target.options.relocation_model[..], }; - match ::back::write::RELOC_MODEL_ARGS.iter().find( + match crate::back::write::RELOC_MODEL_ARGS.iter().find( |&&arg| arg.0 == reloc_model_arg) { Some(x) => x.1, _ => { @@ -121,7 +121,7 @@ fn get_tls_model(sess: &Session) -> llvm::ThreadLocalMode { None => &sess.target.target.options.tls_model[..], }; - match ::back::write::TLS_MODEL_ARGS.iter().find( + match crate::back::write::TLS_MODEL_ARGS.iter().find( |&&arg| arg.0 == tls_model_arg) { Some(x) => x.1, _ => { @@ -154,7 +154,7 @@ pub unsafe fn create_module( // Ensure the data-layout values hardcoded remain the defaults. if sess.target.target.options.is_builtin { - let tm = ::back::write::create_target_machine(tcx, false); + let tm = crate::back::write::create_target_machine(tcx, false); llvm::LLVMRustSetDataLayoutFromTargetMachine(llmod, tm); llvm::LLVMRustDisposeTargetMachine(tm); @@ -212,7 +212,7 @@ pub unsafe fn create_module( impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { crate fn new(tcx: TyCtxt<'ll, 'tcx, 'tcx>, codegen_unit: Arc>, - llvm_module: &'ll ::ModuleLlvm) + llvm_module: &'ll crate::ModuleLlvm) -> Self { // An interesting part of Windows which MSVC forces our hand on (and // apparently MinGW didn't) is the usage of `dllimport` and `dllexport` @@ -377,7 +377,7 @@ impl MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> { // Returns a Value of the "eh_unwind_resume" lang item if one is defined, // otherwise declares it as an external function. fn eh_unwind_resume(&self) -> &'ll Value { - use attributes; + use crate::attributes; let unwresume = &self.eh_unwind_resume; if let Some(llfn) = unwresume.get() { return llfn; diff --git a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs index 791526c98c85c..3ba05bf1b5c91 100644 --- a/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs +++ b/src/librustc_codegen_llvm/debuginfo/create_scope_map.rs @@ -2,9 +2,9 @@ use rustc_codegen_ssa::debuginfo::{FunctionDebugContext, FunctionDebugContextDat use super::metadata::file_metadata; use super::utils::{DIB, span_start}; -use llvm; -use llvm::debuginfo::{DIScope, DISubprogram}; -use common::CodegenCx; +use crate::llvm; +use crate::llvm::debuginfo::{DIScope, DISubprogram}; +use crate::common::CodegenCx; use rustc::mir::{Mir, SourceScope}; use libc::c_uint; diff --git a/src/librustc_codegen_llvm/debuginfo/gdb.rs b/src/librustc_codegen_llvm/debuginfo/gdb.rs index c883d6030951d..2555c92fb7c32 100644 --- a/src/librustc_codegen_llvm/debuginfo/gdb.rs +++ b/src/librustc_codegen_llvm/debuginfo/gdb.rs @@ -1,11 +1,11 @@ // .debug_gdb_scripts binary section. -use llvm; +use crate::llvm; -use common::CodegenCx; -use builder::Builder; +use crate::common::CodegenCx; +use crate::builder::Builder; +use crate::value::Value; use rustc::session::config::DebugInfo; -use value::Value; use rustc_codegen_ssa::traits::*; use syntax::attr; diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 3a7864cb7a5a8..da9ff54b0626c 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -7,15 +7,16 @@ use super::utils::{debug_context, DIB, span_start, use super::namespace::mangled_name_of_instance; use super::type_names::compute_debuginfo_type_name; use super::{CrateDebugContext}; +use crate::abi; +use crate::value::Value; use rustc_codegen_ssa::traits::*; -use abi; -use value::Value; -use llvm; -use llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor, +use crate::llvm; +use crate::llvm::debuginfo::{DIArray, DIType, DIFile, DIScope, DIDescriptor, DICompositeType, DILexicalBlock, DIFlags, DebugEmissionKind}; -use llvm_util; +use crate::llvm_util; +use crate::common::CodegenCx; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def::CtorKind; @@ -23,7 +24,6 @@ use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; use rustc::ich::NodeIdHashingMode; use rustc_data_structures::fingerprint::Fingerprint; use rustc::ty::Instance; -use common::CodegenCx; use rustc::ty::{self, AdtKind, ParamEnv, Ty, TyCtxt}; use rustc::ty::layout::{self, Align, Integer, IntegerExt, LayoutOf, PrimitiveExt, Size, TyLayout}; diff --git a/src/librustc_codegen_llvm/debuginfo/mod.rs b/src/librustc_codegen_llvm/debuginfo/mod.rs index 625f6cd45fb3e..664ca2533878d 100644 --- a/src/librustc_codegen_llvm/debuginfo/mod.rs +++ b/src/librustc_codegen_llvm/debuginfo/mod.rs @@ -10,24 +10,24 @@ use self::type_names::compute_debuginfo_type_name; use self::metadata::{type_metadata, file_metadata, TypeMap}; use self::source_loc::InternalDebugLocation::{self, UnknownLocation}; -use llvm; -use llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags, +use crate::llvm; +use crate::llvm::debuginfo::{DIFile, DIType, DIScope, DIBuilder, DISubprogram, DIArray, DIFlags, DISPFlags, DILexicalBlock}; use rustc::hir::CodegenFnAttrFlags; use rustc::hir::def_id::{DefId, CrateNum, LOCAL_CRATE}; use rustc::ty::subst::{Substs, UnpackedKind}; -use abi::Abi; -use common::CodegenCx; -use builder::Builder; -use monomorphize::Instance; +use crate::abi::Abi; +use crate::common::CodegenCx; +use crate::builder::Builder; +use crate::monomorphize::Instance; +use crate::value::Value; use rustc::ty::{self, ParamEnv, Ty, InstanceDef}; use rustc::mir; use rustc::session::config::{self, DebugInfo}; use rustc::util::nodemap::{DefIdMap, FxHashMap, FxHashSet}; use rustc_data_structures::small_c_str::SmallCStr; use rustc_data_structures::indexed_vec::IndexVec; -use value::Value; use rustc_codegen_ssa::debuginfo::{FunctionDebugContext, MirDebugScope, VariableAccess, VariableKind, FunctionDebugContextData}; diff --git a/src/librustc_codegen_llvm/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs index 36188b8fc4797..f7c377adf3529 100644 --- a/src/librustc_codegen_llvm/debuginfo/namespace.rs +++ b/src/librustc_codegen_llvm/debuginfo/namespace.rs @@ -2,14 +2,14 @@ use super::metadata::{unknown_file_metadata, UNKNOWN_LINE_NUMBER}; use super::utils::{DIB, debug_context}; -use monomorphize::Instance; +use crate::monomorphize::Instance; use rustc::ty; -use llvm; -use llvm::debuginfo::DIScope; +use crate::llvm; +use crate::llvm::debuginfo::DIScope; +use crate::common::CodegenCx; use rustc::hir::def_id::DefId; use rustc::hir::map::DefPathData; -use common::CodegenCx; use rustc_data_structures::small_c_str::SmallCStr; diff --git a/src/librustc_codegen_llvm/debuginfo/source_loc.rs b/src/librustc_codegen_llvm/debuginfo/source_loc.rs index ccf56c11e735d..f7620e11c233d 100644 --- a/src/librustc_codegen_llvm/debuginfo/source_loc.rs +++ b/src/librustc_codegen_llvm/debuginfo/source_loc.rs @@ -4,9 +4,9 @@ use super::utils::{debug_context, span_start}; use super::metadata::UNKNOWN_COLUMN_NUMBER; use rustc_codegen_ssa::debuginfo::FunctionDebugContext; -use llvm; -use llvm::debuginfo::DIScope; -use builder::Builder; +use crate::llvm; +use crate::llvm::debuginfo::DIScope; +use crate::builder::Builder; use rustc_codegen_ssa::traits::*; use libc::c_uint; diff --git a/src/librustc_codegen_llvm/debuginfo/type_names.rs b/src/librustc_codegen_llvm/debuginfo/type_names.rs index 32432f7e4ec10..1697bb7b52dbd 100644 --- a/src/librustc_codegen_llvm/debuginfo/type_names.rs +++ b/src/librustc_codegen_llvm/debuginfo/type_names.rs @@ -1,6 +1,6 @@ // Type Names for Debug Info. -use common::CodegenCx; +use crate::common::CodegenCx; use rustc::hir::def_id::DefId; use rustc::ty::subst::Substs; use rustc::ty::{self, Ty}; @@ -125,7 +125,7 @@ pub fn push_debuginfo_type_name<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>, } let abi = sig.abi(); - if abi != ::abi::Abi::Rust { + if abi != crate::abi::Abi::Rust { output.push_str("extern \""); output.push_str(abi.name()); output.push_str("\" "); diff --git a/src/librustc_codegen_llvm/debuginfo/utils.rs b/src/librustc_codegen_llvm/debuginfo/utils.rs index f2d92eefad3e3..e1b299df6c312 100644 --- a/src/librustc_codegen_llvm/debuginfo/utils.rs +++ b/src/librustc_codegen_llvm/debuginfo/utils.rs @@ -6,12 +6,12 @@ use super::namespace::item_namespace; use rustc::hir::def_id::DefId; use rustc::ty::DefIdTree; -use llvm; -use llvm::debuginfo::{DIScope, DIBuilder, DIDescriptor, DIArray}; -use common::{CodegenCx}; +use crate::llvm; +use crate::llvm::debuginfo::{DIScope, DIBuilder, DIDescriptor, DIArray}; +use crate::common::{CodegenCx}; use rustc_codegen_ssa::traits::*; -use syntax_pos::{self, Span}; +use syntax_pos::Span; pub fn is_node_local_to_unit(cx: &CodegenCx, def_id: DefId) -> bool { diff --git a/src/librustc_codegen_llvm/declare.rs b/src/librustc_codegen_llvm/declare.rs index 6b7ee16cb71b4..3febcb019ce29 100644 --- a/src/librustc_codegen_llvm/declare.rs +++ b/src/librustc_codegen_llvm/declare.rs @@ -11,18 +11,18 @@ //! * Use define_* family of methods when you might be defining the Value. //! * When in doubt, define. -use llvm; -use llvm::AttributePlace::Function; +use crate::llvm; +use crate::llvm::AttributePlace::Function; +use crate::abi::{FnType, FnTypeExt}; +use crate::attributes; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::value::Value; use rustc::ty::{self, PolyFnSig}; use rustc::ty::layout::LayoutOf; use rustc::session::config::Sanitizer; use rustc_data_structures::small_c_str::SmallCStr; -use abi::{FnType, FnTypeExt}; -use attributes; -use context::CodegenCx; -use type_::Type; use rustc_codegen_ssa::traits::*; -use value::Value; /// Declare a function. /// diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index 58b466dbe6faa..3785e19af970f 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -1,26 +1,26 @@ #![allow(non_upper_case_globals)] -use attributes; -use llvm; -use llvm_util; -use abi::{Abi, FnType, LlvmType, PassMode}; +use crate::attributes; +use crate::llvm; +use crate::llvm_util; +use crate::abi::{Abi, FnType, LlvmType, PassMode}; +use crate::context::CodegenCx; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::builder::Builder; +use crate::value::Value; +use crate::va_arg::emit_va_arg; use rustc_codegen_ssa::MemFlags; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::mir::operand::{OperandRef, OperandValue}; use rustc_codegen_ssa::glue; use rustc_codegen_ssa::base::{to_immediate, wants_msvc_seh, compare_simd_types}; -use context::CodegenCx; -use type_::Type; -use type_of::LayoutLlvmExt; use rustc::ty::{self, Ty}; use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, Primitive}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc::hir; use syntax::ast::{self, FloatTy}; use syntax::symbol::Symbol; -use builder::Builder; -use value::Value; -use va_arg::emit_va_arg; use rustc_codegen_ssa::traits::*; @@ -192,8 +192,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { "size_of_val" => { let tp_ty = substs.type_at(0); if let OperandValue::Pair(_, meta) = args[0].val { - let (llsize, _) = - glue::size_and_align_of_dst(self, tp_ty, Some(meta)); + let (llsize, _) = glue::size_and_align_of_dst(self, tp_ty, Some(meta)); llsize } else { self.const_usize(self.size_of(tp_ty).bytes()) @@ -206,8 +205,7 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { "min_align_of_val" => { let tp_ty = substs.type_at(0); if let OperandValue::Pair(_, meta) = args[0].val { - let (_, llalign) = - glue::size_and_align_of_dst(self, tp_ty, Some(meta)); + let (_, llalign) = glue::size_and_align_of_dst(self, tp_ty, Some(meta)); llalign } else { self.const_usize(self.align_of(tp_ty).bytes()) diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index e344f8732f820..9219f42d69235 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -21,6 +21,9 @@ #![feature(concat_idents)] #![feature(link_args)] #![feature(static_nobundle)] +#![deny(rust_2018_idioms)] +#![allow(explicit_outlives_requirements)] +#![allow(elided_lifetimes_in_paths)] use back::write::create_target_machine; use syntax_pos::symbol::Symbol; @@ -29,16 +32,11 @@ extern crate flate2; #[macro_use] extern crate bitflags; extern crate libc; #[macro_use] extern crate rustc; -extern crate jobserver; -extern crate num_cpus; extern crate rustc_mir; extern crate rustc_allocator; -extern crate rustc_apfloat; extern crate rustc_target; #[macro_use] extern crate rustc_data_structures; -extern crate rustc_demangle; extern crate rustc_incremental; -extern crate rustc_llvm; extern crate rustc_codegen_utils; extern crate rustc_codegen_ssa; extern crate rustc_fs_util; @@ -48,9 +46,7 @@ extern crate rustc_fs_util; extern crate syntax_pos; extern crate rustc_errors as errors; extern crate serialize; -extern crate cc; // Used to locate MSVC extern crate tempfile; -extern crate memmap; use rustc_codegen_ssa::traits::*; use rustc_codegen_ssa::back::write::{CodegenContext, ModuleConfig, FatLTOInput}; diff --git a/src/librustc_codegen_llvm/llvm/diagnostic.rs b/src/librustc_codegen_llvm/llvm/diagnostic.rs index 0f5d28f9fec5e..a8d272f157ce3 100644 --- a/src/librustc_codegen_llvm/llvm/diagnostic.rs +++ b/src/librustc_codegen_llvm/llvm/diagnostic.rs @@ -4,7 +4,7 @@ pub use self::OptimizationDiagnosticKind::*; pub use self::Diagnostic::*; use libc::c_uint; -use value::Value; +use crate::value::Value; use super::{DiagnosticInfo, Twine}; diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs index 52292f67b331d..e761d2247a757 100644 --- a/src/librustc_codegen_llvm/llvm/ffi.rs +++ b/src/librustc_codegen_llvm/llvm/ffi.rs @@ -9,8 +9,6 @@ use libc::{c_uint, c_int, size_t, c_char}; use libc::{c_ulonglong, c_void}; use std::marker::PhantomData; -use syntax; -use rustc_codegen_ssa; use super::RustString; diff --git a/src/librustc_codegen_llvm/llvm/mod.rs b/src/librustc_codegen_llvm/llvm/mod.rs index 6a596d78da285..543cc912930fd 100644 --- a/src/librustc_codegen_llvm/llvm/mod.rs +++ b/src/librustc_codegen_llvm/llvm/mod.rs @@ -16,7 +16,7 @@ use std::string::FromUtf8Error; use std::slice; use std::ffi::CStr; use std::cell::RefCell; -use libc::{self, c_uint, c_char, size_t}; +use libc::{c_uint, c_char, size_t}; use rustc_data_structures::small_c_str::SmallCStr; pub mod archive_ro; diff --git a/src/librustc_codegen_llvm/llvm_util.rs b/src/librustc_codegen_llvm/llvm_util.rs index ecca45a4d4281..5fea9c8747e0f 100644 --- a/src/librustc_codegen_llvm/llvm_util.rs +++ b/src/librustc_codegen_llvm/llvm_util.rs @@ -1,6 +1,6 @@ +use crate::back::write::create_informational_target_machine; +use crate::llvm; use syntax_pos::symbol::Symbol; -use back::write::create_informational_target_machine; -use llvm; use rustc::session::Session; use rustc::session::config::PrintRequest; use rustc_target::spec::MergeFunctions; diff --git a/src/librustc_codegen_llvm/metadata.rs b/src/librustc_codegen_llvm/metadata.rs index 6e77768b558d4..a2df687d58f5a 100644 --- a/src/librustc_codegen_llvm/metadata.rs +++ b/src/librustc_codegen_llvm/metadata.rs @@ -1,8 +1,8 @@ +use crate::llvm; +use crate::llvm::{False, ObjectFile, mk_section_iter}; +use crate::llvm::archive_ro::ArchiveRO; use rustc::middle::cstore::MetadataLoader; use rustc_target::spec::Target; -use llvm; -use llvm::{False, ObjectFile, mk_section_iter}; -use llvm::archive_ro::ArchiveRO; use rustc_data_structures::owning_ref::OwningRef; use std::path::Path; diff --git a/src/librustc_codegen_llvm/mono_item.rs b/src/librustc_codegen_llvm/mono_item.rs index 69fc8783dc8d2..4fe6a1f4f4b1c 100644 --- a/src/librustc_codegen_llvm/mono_item.rs +++ b/src/librustc_codegen_llvm/mono_item.rs @@ -1,9 +1,9 @@ -use attributes; -use base; -use context::CodegenCx; -use llvm; -use monomorphize::Instance; -use type_of::LayoutLlvmExt; +use crate::attributes; +use crate::base; +use crate::context::CodegenCx; +use crate::llvm; +use crate::monomorphize::Instance; +use crate::type_of::LayoutLlvmExt; use rustc::hir::def_id::{DefId, LOCAL_CRATE}; use rustc::mir::mono::{Linkage, Visibility}; use rustc::ty::TypeFoldable; diff --git a/src/librustc_codegen_llvm/type_.rs b/src/librustc_codegen_llvm/type_.rs index 958e00506d62a..ca61987e12f7a 100644 --- a/src/librustc_codegen_llvm/type_.rs +++ b/src/librustc_codegen_llvm/type_.rs @@ -1,22 +1,22 @@ #![allow(non_upper_case_globals)] -pub use llvm::Type; +pub use crate::llvm::Type; -use llvm; -use llvm::{Bool, False, True}; -use context::CodegenCx; +use crate::llvm; +use crate::llvm::{Bool, False, True}; +use crate::context::CodegenCx; +use crate::value::Value; use rustc_codegen_ssa::traits::*; -use value::Value; +use crate::common; +use crate::type_of::LayoutLlvmExt; +use crate::abi::{LlvmType, FnTypeExt}; use rustc::util::nodemap::FxHashMap; use rustc::ty::Ty; use rustc::ty::layout::TyLayout; use rustc_target::abi::call::{CastTarget, FnType, Reg}; use rustc_data_structures::small_c_str::SmallCStr; -use common; use rustc_codegen_ssa::common::TypeKind; -use type_of::LayoutLlvmExt; -use abi::{LlvmType, FnTypeExt}; use std::fmt; use std::cell::RefCell; @@ -82,7 +82,6 @@ impl BaseTypeMethods<'tcx> for CodegenCx<'ll, 'tcx> { fn type_i16(&self) -> &'ll Type { unsafe { - llvm::LLVMInt16TypeInContext(self.llcx) } } diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index 39f48b266c219..fb5624d56078e 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -1,12 +1,12 @@ -use abi::{FnType, FnTypeExt}; -use common::*; +use crate::abi::{FnType, FnTypeExt}; +use crate::common::*; +use crate::type_::Type; use rustc::hir; use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, Align, LayoutOf, Size, TyLayout}; use rustc_target::abi::FloatTy; use rustc_mir::monomorphize::item::DefPathBasedNames; use rustc_codegen_ssa::traits::*; -use type_::Type; use std::fmt::Write; diff --git a/src/librustc_codegen_llvm/va_arg.rs b/src/librustc_codegen_llvm/va_arg.rs index 9239f85a8f230..8719390b51aca 100644 --- a/src/librustc_codegen_llvm/va_arg.rs +++ b/src/librustc_codegen_llvm/va_arg.rs @@ -1,11 +1,11 @@ -use builder::Builder; +use crate::builder::Builder; +use crate::type_::Type; +use crate::type_of::LayoutLlvmExt; +use crate::value::Value; use rustc_codegen_ssa::mir::operand::OperandRef; use rustc_codegen_ssa::traits::{BaseTypeMethods, BuilderMethods, ConstMethods, DerivedTypeMethods}; use rustc::ty::layout::{Align, HasDataLayout, HasTyCtxt, LayoutOf, Size}; use rustc::ty::Ty; -use type_::Type; -use type_of::LayoutLlvmExt; -use value::Value; #[allow(dead_code)] fn round_pointer_up_to_alignment( diff --git a/src/librustc_codegen_llvm/value.rs b/src/librustc_codegen_llvm/value.rs index 3ad1521be9393..68809284bb726 100644 --- a/src/librustc_codegen_llvm/value.rs +++ b/src/librustc_codegen_llvm/value.rs @@ -1,6 +1,6 @@ -pub use llvm::Value; +pub use crate::llvm::Value; -use llvm; +use crate::llvm; use std::fmt; use std::hash::{Hash, Hasher}; diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index e5b290b55c22e..b998b77a76b9c 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1172,7 +1172,7 @@ pub fn default_provide_extern(providers: &mut ty::query::Providers) { cstore::provide_extern(providers); } -/// Runs the resolution, typec-hecking, region checking and other +/// Runs the resolution, type-checking, region checking and other /// miscellaneous analysis passes on the crate. Return various /// structures carrying the results of the analysis. pub fn phase_3_run_analysis_passes<'tcx, F, R>( diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index 28d2a397f3ed6..96d2c90345933 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -338,6 +338,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.schedule_drop_for_binding(var, irrefutable_pat.span, OutsideGuard); block.unit() } + _ => { let place = unpack!(block = self.as_place(block, initializer)); self.place_into_pattern(block, irrefutable_pat, &place, true) @@ -534,6 +535,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.visit_bindings(subpattern, pattern_user_ty, f); } } + PatternKind::Array { ref prefix, ref slice, @@ -556,10 +558,13 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.visit_bindings(subpattern, pattern_user_ty.clone().index(), f); } } + PatternKind::Constant { .. } | PatternKind::Range { .. } | PatternKind::Wild => {} + PatternKind::Deref { ref subpattern } => { self.visit_bindings(subpattern, pattern_user_ty.deref(), f); } + PatternKind::AscribeUserType { ref subpattern, ascription: hair::pattern::Ascription { diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index b8e38e40b6347..01f8cbfbe8e2b 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -45,10 +45,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } - /// Tries to simplify `match_pair`, returning true if + /// Tries to simplify `match_pair`, returning `Ok(())` if /// successful. If successful, new match pairs and bindings will /// have been pushed into the candidate. If no simplification is - /// possible, Err is returned and no changes are made to + /// possible, `Err` is returned and no changes are made to /// candidate. fn simplify_match_pair<'pat>(&mut self, match_pair: MatchPair<'pat, 'tcx>, @@ -174,7 +174,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } else { Err(match_pair) } - }, + } PatternKind::Array { ref prefix, ref slice, ref suffix } => { self.prefix_slice_suffix(&mut candidate.match_pairs, diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index 75189777aa311..a41d3895d6d3c 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -35,10 +35,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { } } - PatternKind::Constant { .. } - if is_switch_ty(match_pair.pattern.ty) => { - // for integers, we use a SwitchInt match, which allows - // us to handle more cases + PatternKind::Constant { .. } if is_switch_ty(match_pair.pattern.ty) => { + // For integers, we use a `SwitchInt` match, which allows + // us to handle more cases. Test { span: match_pair.pattern.span, kind: TestKind::SwitchInt { @@ -253,12 +252,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { TestKind::Eq { value, mut ty } => { let val = Operand::Copy(place.clone()); let mut expect = self.literal_operand(test.span, ty, value); - // Use PartialEq::eq instead of BinOp::Eq + // Use `PartialEq::eq` instead of `BinOp::Eq` // (the binop can only handle primitives) let fail = self.cfg.start_new_block(); if !ty.is_scalar() { - // If we're using b"..." as a pattern, we need to insert an - // unsizing coercion, as the byte string has the type &[u8; N]. + // If we're using `b"..."` as a pattern, we need to insert an + // unsizing coercion, as the byte string has the type `&[u8; N]`. // // We want to do this even when the scrutinee is a reference to an // array, so we can call `<[u8]>::eq` rather than having to find an @@ -503,6 +502,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { resulting_candidates[variant_index.as_usize()].push(new_candidate); true } + (&TestKind::Switch { .. }, _) => false, // If we are performing a switch over integers, then this informs integer @@ -539,7 +539,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { (&TestKind::SwitchInt { .. }, _) => false, - (&TestKind::Len { len: test_len, op: BinOp::Eq }, &PatternKind::Slice { ref prefix, ref slice, ref suffix }) => { let pat_len = (prefix.len() + suffix.len()) as u64; diff --git a/src/librustc_mir/build/matches/util.rs b/src/librustc_mir/build/matches/util.rs index ed12c1b3bc9c1..b583b184a4103 100644 --- a/src/librustc_mir/build/matches/util.rs +++ b/src/librustc_mir/build/matches/util.rs @@ -13,7 +13,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { subpatterns.iter() .map(|fieldpat| { let place = place.clone().field(fieldpat.field, - fieldpat.pattern.ty); + fieldpat.pattern.ty); MatchPair::new(place, &fieldpat.pattern) }) .collect() diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 1c7e1aa4d71e0..6910fb7e988bb 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -634,8 +634,8 @@ impl<'tcx> Witness<'tcx> { /// but is instead bounded by the maximum fixed length of slice patterns in /// the column of patterns being analyzed. /// -/// We make sure to omit constructors that are statically impossible. eg for -/// Option we do not include Some(_) in the returned list of constructors. +/// We make sure to omit constructors that are statically impossible. E.g., for +/// `Option`, we do not include `Some(_)` in the returned list of constructors. fn all_constructors<'a, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, pcx: PatternContext<'tcx>) -> Vec> @@ -1347,7 +1347,7 @@ fn pat_constructors<'tcx>(cx: &mut MatchCheckCtxt<'_, 'tcx>, /// This computes the arity of a constructor. The arity of a constructor /// is how many subpattern patterns of that constructor should be expanded to. /// -/// For instance, a tuple pattern (_, 42, Some([])) has the arity of 3. +/// For instance, a tuple pattern `(_, 42, Some([]))` has the arity of 3. /// A struct pattern's arity is the number of fields it contains, etc. fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty: Ty<'tcx>) -> u64 { debug!("constructor_arity({:#?}, {:?})", ctor, ty); @@ -1357,7 +1357,7 @@ fn constructor_arity(cx: &MatchCheckCtxt<'a, 'tcx>, ctor: &Constructor<'tcx>, ty Slice(length) => length, ConstantValue(_) => 0, _ => bug!("bad slice pattern {:?} {:?}", ctor, ty) - }, + } ty::Ref(..) => 1, ty::Adt(adt, _) => { adt.variants[ctor.variant_index_for_adt(cx, adt)].fields.len() as u64 @@ -1381,7 +1381,7 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, Slice(length) => (0..length).map(|_| ty).collect(), ConstantValue(_) => vec![], _ => bug!("bad slice pattern {:?} {:?}", ctor, ty) - }, + } ty::Ref(_, rty, _) => vec![rty], ty::Adt(adt, substs) => { if adt.is_box() { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 8c2ab6437f9a2..7c44d1bf2c936 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -375,7 +375,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, }, _ => bug!(), } - }, + } hir::MatchSource::ForLoopDesugar | hir::MatchSource::Normal => { @@ -391,7 +391,7 @@ fn check_arms<'a, 'tcx>(cx: &mut MatchCheckCtxt<'a, 'tcx>, err.span_label(catchall, "matches any value"); } err.emit(); - }, + } // Unreachable patterns in try expressions occur when one of the arms // are an uninhabited type. Which is OK. @@ -436,7 +436,7 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, let (tail, head) = witnesses.split_last().unwrap(); let head: Vec<_> = head.iter().map(|w| w.to_string()).collect(); format!("`{}` and `{}`", head.join("`, `"), tail) - }, + } _ => { let (head, tail) = witnesses.split_at(LIMIT); let head: Vec<_> = head.iter().map(|w| w.to_string()).collect(); @@ -446,7 +446,7 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, let label_text = match witnesses.len() { 1 => format!("pattern {} not covered", joined_patterns), - _ => format!("patterns {} not covered", joined_patterns) + _ => format!("patterns {} not covered", joined_patterns), }; create_e0004(cx.tcx.sess, sp, format!("non-exhaustive patterns: {} not covered", @@ -456,7 +456,7 @@ fn check_exhaustive<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>, } NotUseful => { // This is good, wildcard pattern isn't reachable - }, + } _ => bug!() } } diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 2012086ea6649..4d571f4f78296 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -965,7 +965,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Constant { value: cv, } - }, + } ty::Adt(adt_def, _) if adt_def.is_union() => { // Matching on union fields is unsafe, we can't hide it in constants self.tcx.sess.span_err(span, "cannot use unions in constant patterns"); @@ -978,7 +978,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { self.tcx.item_path_str(adt_def.did)); self.tcx.sess.span_err(span, &msg); PatternKind::Wild - }, + } ty::Adt(adt_def, substs) if adt_def.is_enum() => { let variant_index = const_variant_index( self.tcx, self.param_env, cv @@ -993,7 +993,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { variant_index, subpatterns, } - }, + } ty::Adt(adt_def, _) => { let struct_var = adt_def.non_enum_variant(); PatternKind::Leaf { @@ -1018,7 +1018,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { PatternKind::Constant { value: cv, } - }, + } }; Pattern { @@ -1252,19 +1252,19 @@ pub fn compare_const_vals<'a, 'gcx, 'tcx>( let l = ::rustc_apfloat::ieee::Single::from_bits(a); let r = ::rustc_apfloat::ieee::Single::from_bits(b); l.partial_cmp(&r) - }, + } ty::Float(ast::FloatTy::F64) => { let l = ::rustc_apfloat::ieee::Double::from_bits(a); let r = ::rustc_apfloat::ieee::Double::from_bits(b); l.partial_cmp(&r) - }, + } ty::Int(_) => { let layout = tcx.layout_of(ty).ok()?; assert!(layout.abi.is_signed()); let a = sign_extend(a, layout.size); let b = sign_extend(b, layout.size); Some((a as i128).cmp(&(b as i128))) - }, + } _ => Some(a.cmp(&b)), } } diff --git a/src/librustc_mir/interpret/operand.rs b/src/librustc_mir/interpret/operand.rs index 7da907028eebf..c6902ddb3c6a6 100644 --- a/src/librustc_mir/interpret/operand.rs +++ b/src/librustc_mir/interpret/operand.rs @@ -10,6 +10,7 @@ use rustc::mir::interpret::{ GlobalId, AllocId, InboundsCheck, ConstValue, Pointer, Scalar, EvalResult, EvalErrorKind, + sign_extend, truncate, }; use super::{ EvalContext, Machine, AllocMap, Allocation, AllocationExtra, @@ -633,20 +634,17 @@ impl<'a, 'mir, 'tcx, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> Err(_) => return err!(InvalidDiscriminant(raw_discr.erase_tag())), }; let real_discr = if discr_val.layout.ty.is_signed() { - let i = bits_discr as i128; // going from layout tag type to typeck discriminant type // requires first sign extending with the layout discriminant - let shift = 128 - discr_val.layout.size.bits(); - let sexted = (i << shift) >> shift; + let sexted = sign_extend(bits_discr, discr_val.layout.size) as i128; // and then zeroing with the typeck discriminant type let discr_ty = rval.layout.ty .ty_adt_def().expect("tagged layout corresponds to adt") .repr .discr_type(); - let discr_ty = layout::Integer::from_attr(self, discr_ty); - let shift = 128 - discr_ty.size().bits(); + let size = layout::Integer::from_attr(self, discr_ty).size(); let truncatee = sexted as u128; - (truncatee << shift) >> shift + truncate(truncatee, size) } else { bits_discr }; diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 91e44a1588268..10f234fd3ca6a 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -1386,10 +1386,7 @@ pub fn check_item_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Ite } hir::ItemKind::Existential(..) => { let def_id = tcx.hir().local_def_id(it.id); - let pty_ty = tcx.type_of(def_id); - let generics = tcx.generics_of(def_id); - check_bounds_are_used(tcx, &generics, pty_ty); let substs = Substs::identity_for_item(tcx, def_id); check_opaque(tcx, def_id, substs, it.span); } diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index e68c50d752bd5..e4c0e3bd54d5d 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -560,21 +560,29 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { if def_id == defin_ty_def_id { // Concrete type resolved to the existential type itself // Force a cycle error + // FIXME(oli-obk): we could just not insert it into `concrete_existential_types` + // which simply would make this use not a defining use. self.tcx().at(span).type_of(defin_ty_def_id); } } + let new = ty::ResolvedOpaqueTy { + concrete_type: definition_ty, + substs: self.tcx().lift_to_global(&opaque_defn.substs).unwrap(), + }; + let old = self.tables .concrete_existential_types - .insert(def_id, definition_ty); + .insert(def_id, new); if let Some(old) = old { - if old != definition_ty { + if old.concrete_type != definition_ty || old.substs != opaque_defn.substs { span_bug!( span, "visit_opaque_types tried to write \ - different types for the same existential type: {:?}, {:?}, {:?}", + different types for the same existential type: {:?}, {:?}, {:?}, {:?}", def_id, definition_ty, + opaque_defn, old, ); } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 84de38beafad9..ec1d9d24730ed 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -23,9 +23,10 @@ use crate::middle::resolve_lifetime as rl; use crate::middle::weak_lang_items; use rustc::mir::mono::Linkage; use rustc::ty::query::Providers; -use rustc::ty::subst::Substs; +use rustc::ty::subst::{Subst, Substs}; use rustc::ty::util::Discr; use rustc::ty::util::IntTypeExt; +use rustc::ty::subst::UnpackedKind; use rustc::ty::{self, AdtKind, ToPolyTraitRef, Ty, TyCtxt}; use rustc::ty::{ReprOptions, ToPredicate}; use rustc::util::captures::Captures; @@ -1211,7 +1212,7 @@ fn type_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.typeck_tables_of(owner) .concrete_existential_types .get(&def_id) - .cloned() + .map(|opaque| opaque.concrete_type) .unwrap_or_else(|| { // This can occur if some error in the // owner fn prevented us from populating @@ -1343,7 +1344,13 @@ fn find_existential_constraints<'a, 'tcx>( struct ConstraintLocator<'a, 'tcx: 'a> { tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId, - found: Option<(Span, ty::Ty<'tcx>)>, + // First found type span, actual type, mapping from the existential type's generic + // parameters to the concrete type's generic parameters + // + // The mapping is an index for each use site of a generic parameter in the concrete type + // + // The indices index into the generic parameters on the existential type. + found: Option<(Span, ty::Ty<'tcx>, Vec)>, } impl<'a, 'tcx> ConstraintLocator<'a, 'tcx> { @@ -1358,23 +1365,106 @@ fn find_existential_constraints<'a, 'tcx>( .tcx .typeck_tables_of(def_id) .concrete_existential_types - .get(&self.def_id) - .cloned(); - if let Some(ty) = ty { + .get(&self.def_id); + if let Some(ty::ResolvedOpaqueTy { concrete_type, substs }) = ty { // FIXME(oli-obk): trace the actual span from inference to improve errors let span = self.tcx.def_span(def_id); - if let Some((prev_span, prev_ty)) = self.found { - if ty != prev_ty { + // used to quickly look up the position of a generic parameter + let mut index_map: FxHashMap = FxHashMap::default(); + // skip binder is ok, since we only use this to find generic parameters and their + // positions. + for (idx, subst) in substs.iter().enumerate() { + if let UnpackedKind::Type(ty) = subst.unpack() { + if let ty::Param(p) = ty.sty { + if index_map.insert(p, idx).is_some() { + // there was already an entry for `p`, meaning a generic parameter + // was used twice + self.tcx.sess.span_err( + span, + &format!("defining existential type use restricts existential \ + type by using the generic parameter `{}` twice", p.name), + ); + return; + } + } else { + self.tcx.sess.delay_span_bug( + span, + &format!( + "non-defining exist ty use in defining scope: {:?}, {:?}", + concrete_type, substs, + ), + ); + } + } + } + // compute the index within the existential type for each generic parameter used in + // the concrete type + let indices = concrete_type + .subst(self.tcx, substs) + .walk() + .filter_map(|t| match &t.sty { + ty::Param(p) => Some(*index_map.get(p).unwrap()), + _ => None, + }).collect(); + let is_param = |ty: ty::Ty| match ty.sty { + ty::Param(_) => true, + _ => false, + }; + if !substs.types().all(is_param) { + self.tcx.sess.span_err( + span, + "defining existential type use does not fully define existential type", + ); + } else if let Some((prev_span, prev_ty, ref prev_indices)) = self.found { + let mut ty = concrete_type.walk().fuse(); + let mut p_ty = prev_ty.walk().fuse(); + let iter_eq = (&mut ty).zip(&mut p_ty).all(|(t, p)| match (&t.sty, &p.sty) { + // type parameters are equal to any other type parameter for the purpose of + // concrete type equality, as it is possible to obtain the same type just + // by passing matching parameters to a function. + (ty::Param(_), ty::Param(_)) => true, + _ => t == p, + }); + if !iter_eq || ty.next().is_some() || p_ty.next().is_some() { // found different concrete types for the existential type let mut err = self.tcx.sess.struct_span_err( span, - "defining existential type use differs from previous", + "concrete type differs from previous defining existential type use", + ); + err.span_label( + span, + format!("expected `{}`, got `{}`", prev_ty, concrete_type), + ); + err.span_note(prev_span, "previous use here"); + err.emit(); + } else if indices != *prev_indices { + // found "same" concrete types, but the generic parameter order differs + let mut err = self.tcx.sess.struct_span_err( + span, + "concrete type's generic parameters differ from previous defining use", ); + use std::fmt::Write; + let mut s = String::new(); + write!(s, "expected [").unwrap(); + let list = |s: &mut String, indices: &Vec| { + let mut indices = indices.iter().cloned(); + if let Some(first) = indices.next() { + write!(s, "`{}`", substs[first]).unwrap(); + for i in indices { + write!(s, ", `{}`", substs[i]).unwrap(); + } + } + }; + list(&mut s, prev_indices); + write!(s, "], got [").unwrap(); + list(&mut s, &indices); + write!(s, "]").unwrap(); + err.span_label(span, s); err.span_note(prev_span, "previous use here"); err.emit(); } } else { - self.found = Some((span, ty)); + self.found = Some((span, concrete_type, indices)); } } } @@ -1433,7 +1523,7 @@ fn find_existential_constraints<'a, 'tcx>( } match locator.found { - Some((_, ty)) => ty, + Some((_, ty, _)) => ty, None => { let span = tcx.def_span(def_id); tcx.sess.span_err(span, "could not find defining uses"); diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 4fbbaf0f2e183..df7835214ebb6 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -49,8 +49,11 @@ pub struct AbiSpace(pub Abi); pub struct Function<'a> { /// The declaration to emit. pub decl: &'a clean::FnDecl, - /// The length of the function's "name", used to determine line-wrapping. - pub name_len: usize, + /// The length of the function header and name. In other words, the number of characters in the + /// function declaration up to but not including the parentheses. + /// + /// Used to determine line-wrapping. + pub header_len: usize, /// The number of spaces to indent each successive line with, if line-wrapping is necessary. pub indent: usize, /// Whether the function is async or not. @@ -675,7 +678,11 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt: } } clean::ImplTrait(ref bounds) => { - write!(f, "impl {}", GenericBounds(bounds)) + if f.alternate() { + write!(f, "impl {:#}", GenericBounds(bounds)) + } else { + write!(f, "impl {}", GenericBounds(bounds)) + } } clean::QPath { ref name, ref self_type, ref trait_ } => { let should_show_cast = match *trait_ { @@ -844,7 +851,7 @@ impl fmt::Display for clean::FnDecl { impl<'a> fmt::Display for Function<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let &Function { decl, name_len, indent, asyncness } = self; + let &Function { decl, header_len, indent, asyncness } = self; let amp = if f.alternate() { "&" } else { "&" }; let mut args = String::new(); let mut args_plain = String::new(); @@ -899,6 +906,8 @@ impl<'a> fmt::Display for Function<'a> { } } + let mut args_plain = format!("({})", args_plain); + if decl.variadic { args.push_str(",
..."); args_plain.push_str(", ..."); @@ -917,13 +926,8 @@ impl<'a> fmt::Display for Function<'a> { output.to_string() }; - let pad = " ".repeat(name_len); - let plain = format!("{pad}({args}){arrow}", - pad = pad, - args = args_plain, - arrow = arrow_plain); - - let output = if plain.len() > 80 { + let declaration_len = header_len + args_plain.len() + arrow_plain.len(); + let output = if declaration_len > 80 { let full_pad = format!("
{}", " ".repeat(indent + 4)); let close_pad = format!("
{}", " ".repeat(indent)); format!("({args}{close}){arrow}", diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 91ec88652cfe9..d037154272db6 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -2787,8 +2787,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, \ {name}{unsafety_flag}\ - {stab_tags}{docs}\ - \ + {stab_tags}{docs}\ ", name = *myitem.name.as_ref().unwrap(), stab_tags = stability_tags(myitem), @@ -2985,14 +2984,16 @@ fn item_static(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, f: &clean::Function) -> fmt::Result { - let name_len = format!("{}{}{}{}{:#}fn {}{:#}", - VisSpace(&it.visibility), - ConstnessSpace(f.header.constness), - UnsafetySpace(f.header.unsafety), - AsyncSpace(f.header.asyncness), - AbiSpace(f.header.abi), - it.name.as_ref().unwrap(), - f.generics).len(); + let header_len = format!( + "{}{}{}{}{:#}fn {}{:#}", + VisSpace(&it.visibility), + ConstnessSpace(f.header.constness), + UnsafetySpace(f.header.unsafety), + AsyncSpace(f.header.asyncness), + AbiSpace(f.header.abi), + it.name.as_ref().unwrap(), + f.generics + ).len(); write!(w, "{}
", render_spotlight_traits(it)?)?;
     render_attributes(w, it)?;
     write!(w,
@@ -3008,7 +3009,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
            where_clause = WhereClause { gens: &f.generics, indent: 0, end_newline: true },
            decl = Function {
               decl: &f.decl,
-              name_len,
+              header_len,
               indent: 0,
               asyncness: f.header.asyncness,
            })?;
@@ -3423,16 +3424,18 @@ fn render_assoc_item(w: &mut fmt::Formatter,
                 href(did).map(|p| format!("{}#{}.{}", p.0, ty, name)).unwrap_or(anchor)
             }
         };
-        let mut head_len = format!("{}{}{}{}{:#}fn {}{:#}",
-                                   VisSpace(&meth.visibility),
-                                   ConstnessSpace(header.constness),
-                                   UnsafetySpace(header.unsafety),
-                                   AsyncSpace(header.asyncness),
-                                   AbiSpace(header.abi),
-                                   name,
-                                   *g).len();
+        let mut header_len = format!(
+            "{}{}{}{}{:#}fn {}{:#}",
+            VisSpace(&meth.visibility),
+            ConstnessSpace(header.constness),
+            UnsafetySpace(header.unsafety),
+            AsyncSpace(header.asyncness),
+            AbiSpace(header.abi),
+            name,
+            *g
+        ).len();
         let (indent, end_newline) = if parent == ItemType::Trait {
-            head_len += 4;
+            header_len += 4;
             (4, false)
         } else {
             (0, true)
@@ -3450,7 +3453,7 @@ fn render_assoc_item(w: &mut fmt::Formatter,
                generics = *g,
                decl = Function {
                    decl: d,
-                   name_len: head_len,
+                   header_len,
                    indent,
                    asyncness: header.asyncness,
                },
diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index ff28c4f40bcae..1849e53d937ad 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -1196,7 +1196,7 @@ if (!DOMTokenList.prototype.remove) {
                 var actives = [[], [], []];
                 // "current" is used to know which tab we're looking into.
                 var current = 0;
-                onEachLazy(document.getElementsByClassName("search-results"), function(e) {
+                onEachLazy(document.getElementById("results").childNodes, function(e) {
                     onEachLazy(e.getElementsByClassName("highlighted"), function(e) {
                         actives[current].push(e);
                     });
@@ -1213,7 +1213,7 @@ if (!DOMTokenList.prototype.remove) {
                     removeClass(actives[currentTab][0], "highlighted");
                 } else if (e.which === 40) { // down
                     if (!actives[currentTab].length) {
-                        var results = document.getElementsByClassName("search-results");
+                        var results = document.getElementById("results").childNodes;
                         if (results.length > 0) {
                             var res = results[currentTab].getElementsByClassName("result");
                             if (res.length > 0) {
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 4ec8637cc71f6..787f3c7f48004 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -424,7 +424,8 @@ h4 > code, h3 > code, .invisible > code {
 
 .docblock table {
 	margin: .5em 0;
-	width: 100%;
+	width: calc(100% - 2px);
+	border: 1px dashed;
 }
 
 .docblock table td {
@@ -657,7 +658,7 @@ a {
 	transition: border-color 300ms ease;
 	transition: border-radius 300ms ease-in-out;
 	transition: box-shadow 300ms ease-in-out;
-	width: 100%;
+	width: calc(100% - 32px);
 }
 
 #crate-search + .search-input {
diff --git a/src/librustdoc/html/static/themes/dark.css b/src/librustdoc/html/static/themes/dark.css
index 333fe76a8a4a9..e756ab60ccc6d 100644
--- a/src/librustdoc/html/static/themes/dark.css
+++ b/src/librustdoc/html/static/themes/dark.css
@@ -68,20 +68,10 @@ pre {
 	border-bottom-color: #DDD;
 }
 
-.docblock table {
+.docblock table, .docblock table td, .docblock table th {
 	border-color: #ddd;
 }
 
-.docblock table td {
-	border-top-color: #ddd;
-	border-bottom-color: #ddd;
-}
-
-.docblock table th {
-	border-top-color: #ddd;
-	border-bottom-color: #ddd;
-}
-
 .content .method .where,
 .content .fn .where,
 .content .where.fmt-newline {
@@ -190,15 +180,15 @@ a.test-arrow {
 	box-shadow: 1px 0 0 1px #000, 0 0 0 2px transparent;
 }
 
-.stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #404040; }
-.stab.internal { background: #FFB9B3; border-color: #B71C1C; color: #404040; }
-.stab.deprecated { background: #F3DFFF; border-color: #7F0087;  color: #404040; }
-.stab.portability { background: #C4ECFF; border-color: #7BA5DB;  color: #404040; }
-
 .module-item .stab {
 	color: #ddd;
 }
 
+.stab.unstable {background: #FFF5D6; border-color: #FFC600; color: #2f2f2f; }
+.stab.internal { background: #FFB9B3; border-color: #B71C1C; color: #2f2f2f; }
+.stab.deprecated { background: #F3DFFF; border-color: #7F0087; color: #2f2f2f; }
+.stab.portability { background: #C4ECFF; border-color: #7BA5DB; color: #2f2f2f; }
+
 #help > div {
 	background: #4d4d4d;
 	border-color: #bfbfbf;
diff --git a/src/librustdoc/html/static/themes/light.css b/src/librustdoc/html/static/themes/light.css
index 19ae67b29881f..a294f6f2ff123 100644
--- a/src/librustdoc/html/static/themes/light.css
+++ b/src/librustdoc/html/static/themes/light.css
@@ -67,21 +67,11 @@ pre {
 }
 
 .docblock h1, .docblock h2, .docblock h3, .docblock h4, .docblock h5 {
-	border-bottom-color: #DDD;
-}
-
-.docblock table {
-	border-color: #ddd;
-}
-
-.docblock table td {
-	border-top-color: #ddd;
 	border-bottom-color: #ddd;
 }
 
-.docblock table th {
-	border-top-color: #ddd;
-	border-bottom-color: #ddd;
+.docblock table, .docblock table td, .docblock table th {
+	border-color: #ddd;
 }
 
 .content .method .where,
@@ -191,15 +181,15 @@ a.test-arrow {
 	box-shadow: 1px 0 0 1px #e0e0e0, 0 0 0 2px transparent;
 }
 
+.module-item .stab {
+	color: #000;
+}
+
 .stab.unstable { background: #FFF5D6; border-color: #FFC600; }
 .stab.internal { background: #FFB9B3; border-color: #B71C1C; }
 .stab.deprecated { background: #F3DFFF; border-color: #7F0087; }
 .stab.portability { background: #C4ECFF; border-color: #7BA5DB; }
 
-.module-item .stab {
-	color: #000;
-}
-
 #help > div {
 	background: #e9e9e9;
 	border-color: #bfbfbf;
diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs
index f4b67771c1663..2195b90e1dc16 100644
--- a/src/librustdoc/test.rs
+++ b/src/librustdoc/test.rs
@@ -517,13 +517,19 @@ pub fn make_test(s: &str,
         }
     }
 
-    if dont_insert_main || already_has_main {
+    // FIXME: This code cannot yet handle no_std test cases yet
+    if dont_insert_main || already_has_main || prog.contains("![no_std]") {
         prog.push_str(everything_else);
     } else {
-        prog.push_str("fn main() {\n");
+        let returns_result = everything_else.trim_end().ends_with("(())");
+        let (main_pre, main_post) = if returns_result {
+            ("fn main() { fn _inner() -> Result<(), impl core::fmt::Debug> {",
+             "}\n_inner().unwrap() }")
+        } else {
+            ("fn main() {\n", "\n}")
+        };
+        prog.extend([main_pre, everything_else, main_post].iter().cloned());
         line_offset += 1;
-        prog.push_str(everything_else);
-        prog.push_str("\n}");
     }
 
     debug!("final doctest:\n{}", prog);
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index beecfb1aa295f..a82b9498074c2 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -1641,7 +1641,7 @@ impl Default for HashMap
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, Q: ?Sized, V, S> Index<&'a Q> for HashMap
+impl Index<&Q> for HashMap
     where K: Eq + Hash + Borrow,
           Q: Eq + Hash,
           S: BuildHasher
@@ -1673,14 +1673,14 @@ pub struct Iter<'a, K: 'a, V: 'a> {
 
 // FIXME(#26925) Remove in favor of `#[derive(Clone)]`
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> Clone for Iter<'a, K, V> {
-    fn clone(&self) -> Iter<'a, K, V> {
+impl Clone for Iter<'_, K, V> {
+    fn clone(&self) -> Self {
         Iter { inner: self.inner.clone() }
     }
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K: Debug, V: Debug> fmt::Debug for Iter<'a, K, V> {
+impl fmt::Debug for Iter<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
             .entries(self.clone())
@@ -1726,14 +1726,14 @@ pub struct Keys<'a, K: 'a, V: 'a> {
 
 // FIXME(#26925) Remove in favor of `#[derive(Clone)]`
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> Clone for Keys<'a, K, V> {
-    fn clone(&self) -> Keys<'a, K, V> {
+impl Clone for Keys<'_, K, V> {
+    fn clone(&self) -> Self {
         Keys { inner: self.inner.clone() }
     }
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K: Debug, V> fmt::Debug for Keys<'a, K, V> {
+impl fmt::Debug for Keys<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
             .entries(self.clone())
@@ -1755,14 +1755,14 @@ pub struct Values<'a, K: 'a, V: 'a> {
 
 // FIXME(#26925) Remove in favor of `#[derive(Clone)]`
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> Clone for Values<'a, K, V> {
-    fn clone(&self) -> Values<'a, K, V> {
+impl Clone for Values<'_, K, V> {
+    fn clone(&self) -> Self {
         Values { inner: self.inner.clone() }
     }
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K, V: Debug> fmt::Debug for Values<'a, K, V> {
+impl fmt::Debug for Values<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list()
             .entries(self.clone())
@@ -2241,7 +2241,7 @@ impl<'a, K, V, S> RawVacantEntryMut<'a, K, V, S> {
 }
 
 #[unstable(feature = "hash_raw_entry", issue = "56167")]
-impl<'a, K, V, S> Debug for RawEntryBuilderMut<'a, K, V, S> {
+impl Debug for RawEntryBuilderMut<'_, K, V, S> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RawEntryBuilder")
          .finish()
@@ -2249,7 +2249,7 @@ impl<'a, K, V, S> Debug for RawEntryBuilderMut<'a, K, V, S> {
 }
 
 #[unstable(feature = "hash_raw_entry", issue = "56167")]
-impl<'a, K: Debug, V: Debug, S> Debug for RawEntryMut<'a, K, V, S> {
+impl Debug for RawEntryMut<'_, K, V, S> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             RawEntryMut::Vacant(ref v) => {
@@ -2267,7 +2267,7 @@ impl<'a, K: Debug, V: Debug, S> Debug for RawEntryMut<'a, K, V, S> {
 }
 
 #[unstable(feature = "hash_raw_entry", issue = "56167")]
-impl<'a, K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'a, K, V> {
+impl Debug for RawOccupiedEntryMut<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RawOccupiedEntryMut")
          .field("key", self.key())
@@ -2277,7 +2277,7 @@ impl<'a, K: Debug, V: Debug> Debug for RawOccupiedEntryMut<'a, K, V> {
 }
 
 #[unstable(feature = "hash_raw_entry", issue = "56167")]
-impl<'a, K, V, S> Debug for RawVacantEntryMut<'a, K, V, S> {
+impl Debug for RawVacantEntryMut<'_, K, V, S> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RawVacantEntryMut")
          .finish()
@@ -2285,7 +2285,7 @@ impl<'a, K, V, S> Debug for RawVacantEntryMut<'a, K, V, S> {
 }
 
 #[unstable(feature = "hash_raw_entry", issue = "56167")]
-impl<'a, K, V, S> Debug for RawEntryBuilder<'a, K, V, S> {
+impl Debug for RawEntryBuilder<'_, K, V, S> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RawEntryBuilder")
          .finish()
@@ -2312,7 +2312,7 @@ pub enum Entry<'a, K: 'a, V: 'a> {
 }
 
 #[stable(feature= "debug_hash_map", since = "1.12.0")]
-impl<'a, K: 'a + Debug, V: 'a + Debug> Debug for Entry<'a, K, V> {
+impl Debug for Entry<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
             Vacant(ref v) => {
@@ -2340,7 +2340,7 @@ pub struct OccupiedEntry<'a, K: 'a, V: 'a> {
 }
 
 #[stable(feature= "debug_hash_map", since = "1.12.0")]
-impl<'a, K: 'a + Debug, V: 'a + Debug> Debug for OccupiedEntry<'a, K, V> {
+impl Debug for OccupiedEntry<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("OccupiedEntry")
             .field("key", self.key())
@@ -2361,7 +2361,7 @@ pub struct VacantEntry<'a, K: 'a, V: 'a> {
 }
 
 #[stable(feature= "debug_hash_map", since = "1.12.0")]
-impl<'a, K: 'a + Debug, V: 'a> Debug for VacantEntry<'a, K, V> {
+impl Debug for VacantEntry<'_, K, V> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_tuple("VacantEntry")
             .field(self.key())
@@ -2448,7 +2448,7 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
+impl ExactSizeIterator for Iter<'_, K, V> {
     #[inline]
     fn len(&self) -> usize {
         self.inner.len()
@@ -2456,7 +2456,7 @@ impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K, V> FusedIterator for Iter<'a, K, V> {}
+impl FusedIterator for Iter<'_, K, V> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, V> Iterator for IterMut<'a, K, V> {
@@ -2472,17 +2472,17 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {
+impl ExactSizeIterator for IterMut<'_, K, V> {
     #[inline]
     fn len(&self) -> usize {
         self.inner.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K, V> FusedIterator for IterMut<'a, K, V> {}
+impl FusedIterator for IterMut<'_, K, V> {}
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K, V> fmt::Debug for IterMut<'a, K, V>
+impl fmt::Debug for IterMut<'_, K, V>
     where K: fmt::Debug,
           V: fmt::Debug,
 {
@@ -2539,14 +2539,14 @@ impl<'a, K, V> Iterator for Keys<'a, K, V> {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> ExactSizeIterator for Keys<'a, K, V> {
+impl ExactSizeIterator for Keys<'_, K, V> {
     #[inline]
     fn len(&self) -> usize {
         self.inner.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K, V> FusedIterator for Keys<'a, K, V> {}
+impl FusedIterator for Keys<'_, K, V> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a, K, V> Iterator for Values<'a, K, V> {
@@ -2562,14 +2562,14 @@ impl<'a, K, V> Iterator for Values<'a, K, V> {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K, V> ExactSizeIterator for Values<'a, K, V> {
+impl ExactSizeIterator for Values<'_, K, V> {
     #[inline]
     fn len(&self) -> usize {
         self.inner.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K, V> FusedIterator for Values<'a, K, V> {}
+impl FusedIterator for Values<'_, K, V> {}
 
 #[stable(feature = "map_values_mut", since = "1.10.0")]
 impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
@@ -2585,17 +2585,17 @@ impl<'a, K, V> Iterator for ValuesMut<'a, K, V> {
     }
 }
 #[stable(feature = "map_values_mut", since = "1.10.0")]
-impl<'a, K, V> ExactSizeIterator for ValuesMut<'a, K, V> {
+impl ExactSizeIterator for ValuesMut<'_, K, V> {
     #[inline]
     fn len(&self) -> usize {
         self.inner.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K, V> FusedIterator for ValuesMut<'a, K, V> {}
+impl FusedIterator for ValuesMut<'_, K, V> {}
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K, V> fmt::Debug for ValuesMut<'a, K, V>
+impl fmt::Debug for ValuesMut<'_, K, V>
     where K: fmt::Debug,
           V: fmt::Debug,
 {
@@ -2620,17 +2620,17 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
     }
 }
 #[stable(feature = "drain", since = "1.6.0")]
-impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
+impl ExactSizeIterator for Drain<'_, K, V> {
     #[inline]
     fn len(&self) -> usize {
         self.inner.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K, V> FusedIterator for Drain<'a, K, V> {}
+impl FusedIterator for Drain<'_, K, V> {}
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K, V> fmt::Debug for Drain<'a, K, V>
+impl fmt::Debug for Drain<'_, K, V>
     where K: fmt::Debug,
           V: fmt::Debug,
 {
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index 92e63df7c682e..bfd36a8456363 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -1112,8 +1112,8 @@ impl IntoIterator for HashSet
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K> Clone for Iter<'a, K> {
-    fn clone(&self) -> Iter<'a, K> {
+impl Clone for Iter<'_, K> {
+    fn clone(&self) -> Self {
         Iter { iter: self.iter.clone() }
     }
 }
@@ -1129,16 +1129,16 @@ impl<'a, K> Iterator for Iter<'a, K> {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K> ExactSizeIterator for Iter<'a, K> {
+impl ExactSizeIterator for Iter<'_, K> {
     fn len(&self) -> usize {
         self.iter.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K> FusedIterator for Iter<'a, K> {}
+impl FusedIterator for Iter<'_, K> {}
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K: fmt::Debug> fmt::Debug for Iter<'a, K> {
+impl fmt::Debug for Iter<'_, K> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_list().entries(self.clone()).finish()
     }
@@ -1187,16 +1187,16 @@ impl<'a, K> Iterator for Drain<'a, K> {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, K> ExactSizeIterator for Drain<'a, K> {
+impl ExactSizeIterator for Drain<'_, K> {
     fn len(&self) -> usize {
         self.iter.len()
     }
 }
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, K> FusedIterator for Drain<'a, K> {}
+impl FusedIterator for Drain<'_, K> {}
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, K: fmt::Debug> fmt::Debug for Drain<'a, K> {
+impl fmt::Debug for Drain<'_, K> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         let entries_iter = self.iter
             .inner
@@ -1207,8 +1207,8 @@ impl<'a, K: fmt::Debug> fmt::Debug for Drain<'a, K> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T, S> Clone for Intersection<'a, T, S> {
-    fn clone(&self) -> Intersection<'a, T, S> {
+impl Clone for Intersection<'_, T, S> {
+    fn clone(&self) -> Self {
         Intersection { iter: self.iter.clone(), ..*self }
     }
 }
@@ -1236,7 +1236,7 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T, S> fmt::Debug for Intersection<'a, T, S>
+impl fmt::Debug for Intersection<'_, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher
 {
@@ -1246,15 +1246,15 @@ impl<'a, T, S> fmt::Debug for Intersection<'a, T, S>
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, T, S> FusedIterator for Intersection<'a, T, S>
+impl FusedIterator for Intersection<'_, T, S>
     where T: Eq + Hash,
           S: BuildHasher
 {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T, S> Clone for Difference<'a, T, S> {
-    fn clone(&self) -> Difference<'a, T, S> {
+impl Clone for Difference<'_, T, S> {
+    fn clone(&self) -> Self {
         Difference { iter: self.iter.clone(), ..*self }
     }
 }
@@ -1282,14 +1282,14 @@ impl<'a, T, S> Iterator for Difference<'a, T, S>
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, T, S> FusedIterator for Difference<'a, T, S>
+impl FusedIterator for Difference<'_, T, S>
     where T: Eq + Hash,
           S: BuildHasher
 {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T, S> fmt::Debug for Difference<'a, T, S>
+impl fmt::Debug for Difference<'_, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher
 {
@@ -1299,8 +1299,8 @@ impl<'a, T, S> fmt::Debug for Difference<'a, T, S>
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T, S> Clone for SymmetricDifference<'a, T, S> {
-    fn clone(&self) -> SymmetricDifference<'a, T, S> {
+impl Clone for SymmetricDifference<'_, T, S> {
+    fn clone(&self) -> Self {
         SymmetricDifference { iter: self.iter.clone() }
     }
 }
@@ -1321,14 +1321,14 @@ impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, T, S> FusedIterator for SymmetricDifference<'a, T, S>
+impl FusedIterator for SymmetricDifference<'_, T, S>
     where T: Eq + Hash,
           S: BuildHasher
 {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T, S> fmt::Debug for SymmetricDifference<'a, T, S>
+impl fmt::Debug for SymmetricDifference<'_, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher
 {
@@ -1338,21 +1338,21 @@ impl<'a, T, S> fmt::Debug for SymmetricDifference<'a, T, S>
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T, S> Clone for Union<'a, T, S> {
-    fn clone(&self) -> Union<'a, T, S> {
+impl Clone for Union<'_, T, S> {
+    fn clone(&self) -> Self {
         Union { iter: self.iter.clone() }
     }
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a, T, S> FusedIterator for Union<'a, T, S>
+impl FusedIterator for Union<'_, T, S>
     where T: Eq + Hash,
           S: BuildHasher
 {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T, S> fmt::Debug for Union<'a, T, S>
+impl fmt::Debug for Union<'_, T, S>
     where T: fmt::Debug + Eq + Hash,
           S: BuildHasher
 {
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index 9446a80a55cd2..865431252acf6 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -296,7 +296,7 @@ pub trait Put {
 }
 
 
-impl<'t, K, V> Put for &'t mut RawTable {
+impl Put for &mut RawTable {
     unsafe fn borrow_table_mut(&mut self) -> &mut RawTable {
         *self
     }
@@ -865,8 +865,8 @@ struct RawBuckets<'a, K, V> {
 }
 
 // FIXME(#26925) Remove in favor of `#[derive(Clone)]`
-impl<'a, K, V> Clone for RawBuckets<'a, K, V> {
-    fn clone(&self) -> RawBuckets<'a, K, V> {
+impl Clone for RawBuckets<'_, K, V> {
+    fn clone(&self) -> Self {
         RawBuckets {
             raw: self.raw,
             elems_left: self.elems_left,
@@ -901,7 +901,7 @@ impl<'a, K, V> Iterator for RawBuckets<'a, K, V> {
     }
 }
 
-impl<'a, K, V> ExactSizeIterator for RawBuckets<'a, K, V> {
+impl ExactSizeIterator for RawBuckets<'_, K, V> {
     fn len(&self) -> usize {
         self.elems_left
     }
@@ -912,12 +912,12 @@ pub struct Iter<'a, K: 'a, V: 'a> {
     iter: RawBuckets<'a, K, V>,
 }
 
-unsafe impl<'a, K: Sync, V: Sync> Sync for Iter<'a, K, V> {}
-unsafe impl<'a, K: Sync, V: Sync> Send for Iter<'a, K, V> {}
+unsafe impl Sync for Iter<'_, K, V> {}
+unsafe impl Send for Iter<'_, K, V> {}
 
 // FIXME(#26925) Remove in favor of `#[derive(Clone)]`
-impl<'a, K, V> Clone for Iter<'a, K, V> {
-    fn clone(&self) -> Iter<'a, K, V> {
+impl Clone for Iter<'_, K, V> {
+    fn clone(&self) -> Self {
         Iter {
             iter: self.iter.clone(),
         }
@@ -931,10 +931,10 @@ pub struct IterMut<'a, K: 'a, V: 'a> {
     _marker: marker::PhantomData<&'a mut V>,
 }
 
-unsafe impl<'a, K: Sync, V: Sync> Sync for IterMut<'a, K, V> {}
+unsafe impl Sync for IterMut<'_, K, V> {}
 // Both K: Sync and K: Send are correct for IterMut's Send impl,
 // but Send is the more useful bound
-unsafe impl<'a, K: Send, V: Send> Send for IterMut<'a, K, V> {}
+unsafe impl Send for IterMut<'_, K, V> {}
 
 impl<'a, K: 'a, V: 'a> IterMut<'a, K, V> {
     pub fn iter(&self) -> Iter {
@@ -968,8 +968,8 @@ pub struct Drain<'a, K: 'a, V: 'a> {
     marker: marker::PhantomData<&'a RawTable>,
 }
 
-unsafe impl<'a, K: Sync, V: Sync> Sync for Drain<'a, K, V> {}
-unsafe impl<'a, K: Send, V: Send> Send for Drain<'a, K, V> {}
+unsafe impl Sync for Drain<'_, K, V> {}
+unsafe impl Send for Drain<'_, K, V> {}
 
 impl<'a, K, V> Drain<'a, K, V> {
     pub fn iter(&self) -> Iter {
@@ -994,7 +994,7 @@ impl<'a, K, V> Iterator for Iter<'a, K, V> {
     }
 }
 
-impl<'a, K, V> ExactSizeIterator for Iter<'a, K, V> {
+impl ExactSizeIterator for Iter<'_, K, V> {
     fn len(&self) -> usize {
         self.iter.len()
     }
@@ -1015,7 +1015,7 @@ impl<'a, K, V> Iterator for IterMut<'a, K, V> {
     }
 }
 
-impl<'a, K, V> ExactSizeIterator for IterMut<'a, K, V> {
+impl ExactSizeIterator for IterMut<'_, K, V> {
     fn len(&self) -> usize {
         self.iter.len()
     }
@@ -1064,13 +1064,13 @@ impl<'a, K, V> Iterator for Drain<'a, K, V> {
     }
 }
 
-impl<'a, K, V> ExactSizeIterator for Drain<'a, K, V> {
+impl ExactSizeIterator for Drain<'_, K, V> {
     fn len(&self) -> usize {
         self.iter.len()
     }
 }
 
-impl<'a, K: 'a, V: 'a> Drop for Drain<'a, K, V> {
+impl Drop for Drain<'_, K, V> {
     fn drop(&mut self) {
         self.for_each(drop);
     }
diff --git a/src/libstd/env.rs b/src/libstd/env.rs
index 1f3b264c414a2..543973ab991df 100644
--- a/src/libstd/env.rs
+++ b/src/libstd/env.rs
@@ -399,7 +399,7 @@ impl<'a> Iterator for SplitPaths<'a> {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a> fmt::Debug for SplitPaths<'a> {
+impl fmt::Debug for SplitPaths<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("SplitPaths { .. }")
     }
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index caf490a02777e..0ef7224282782 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -659,8 +659,8 @@ impl fmt::Debug for CStr {
 }
 
 #[stable(feature = "cstr_default", since = "1.10.0")]
-impl<'a> Default for &'a CStr {
-    fn default() -> &'a CStr {
+impl Default for &CStr {
+    fn default() -> Self {
         const SLICE: &[c_char] = &[0];
         unsafe { CStr::from_ptr(SLICE.as_ptr()) }
     }
diff --git a/src/libstd/ffi/os_str.rs b/src/libstd/ffi/os_str.rs
index 7dbf15cdc90ab..81433832ffc7e 100644
--- a/src/libstd/ffi/os_str.rs
+++ b/src/libstd/ffi/os_str.rs
@@ -778,10 +778,10 @@ impl Default for Box {
 }
 
 #[stable(feature = "osstring_default", since = "1.9.0")]
-impl<'a> Default for &'a OsStr {
+impl Default for &OsStr {
     /// Creates an empty `OsStr`.
     #[inline]
-    fn default() -> &'a OsStr {
+    fn default() -> Self {
         OsStr::new("")
     }
 }
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index f1e8619fc8ffc..79b5686faac60 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -254,10 +254,13 @@ fn initial_buffer_size(file: &File) -> usize {
 /// ```
 #[stable(feature = "fs_read_write_bytes", since = "1.26.0")]
 pub fn read>(path: P) -> io::Result> {
-    let mut file = File::open(path)?;
-    let mut bytes = Vec::with_capacity(initial_buffer_size(&file));
-    file.read_to_end(&mut bytes)?;
-    Ok(bytes)
+    fn inner(path: &Path) -> io::Result> {
+        let mut file = File::open(path)?;
+        let mut bytes = Vec::with_capacity(initial_buffer_size(&file));
+        file.read_to_end(&mut bytes)?;
+        Ok(bytes)
+    }
+    inner(path.as_ref())
 }
 
 /// Read the entire contents of a file into a string.
@@ -296,10 +299,13 @@ pub fn read>(path: P) -> io::Result> {
 /// ```
 #[stable(feature = "fs_read_write", since = "1.26.0")]
 pub fn read_to_string>(path: P) -> io::Result {
-    let mut file = File::open(path)?;
-    let mut string = String::with_capacity(initial_buffer_size(&file));
-    file.read_to_string(&mut string)?;
-    Ok(string)
+    fn inner(path: &Path) -> io::Result {
+        let mut file = File::open(path)?;
+        let mut string = String::with_capacity(initial_buffer_size(&file));
+        file.read_to_string(&mut string)?;
+        Ok(string)
+    }
+    inner(path.as_ref())
 }
 
 /// Write a slice as the entire contents of a file.
@@ -326,7 +332,10 @@ pub fn read_to_string>(path: P) -> io::Result {
 /// ```
 #[stable(feature = "fs_read_write_bytes", since = "1.26.0")]
 pub fn write, C: AsRef<[u8]>>(path: P, contents: C) -> io::Result<()> {
-    File::create(path)?.write_all(contents.as_ref())
+    fn inner(path: &Path, contents: &[u8]) -> io::Result<()> {
+        File::create(path)?.write_all(contents)
+    }
+    inner(path.as_ref(), contents.as_ref())
 }
 
 impl File {
@@ -618,7 +627,7 @@ impl Seek for File {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Read for &'a File {
+impl Read for &File {
     fn read(&mut self, buf: &mut [u8]) -> io::Result {
         self.inner.read(buf)
     }
@@ -629,14 +638,14 @@ impl<'a> Read for &'a File {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Write for &'a File {
+impl Write for &File {
     fn write(&mut self, buf: &[u8]) -> io::Result {
         self.inner.write(buf)
     }
     fn flush(&mut self) -> io::Result<()> { self.inner.flush() }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Seek for &'a File {
+impl Seek for &File {
     fn seek(&mut self, pos: SeekFrom) -> io::Result {
         self.inner.seek(pos)
     }
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index 0615cd59db4eb..0c1d155a91688 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -1174,7 +1174,7 @@ mod tests {
         // Issue #32085
         struct FailFlushWriter<'a>(&'a mut Vec);
 
-        impl<'a> Write for FailFlushWriter<'a> {
+        impl Write for FailFlushWriter<'_> {
             fn write(&mut self, buf: &[u8]) -> io::Result {
                 self.0.extend_from_slice(buf);
                 Ok(buf.len())
diff --git a/src/libstd/io/cursor.rs b/src/libstd/io/cursor.rs
index b205f7888389f..758d856867291 100644
--- a/src/libstd/io/cursor.rs
+++ b/src/libstd/io/cursor.rs
@@ -279,7 +279,7 @@ fn vec_write(pos_mut: &mut u64, vec: &mut Vec, buf: &[u8]) -> io::Result Write for Cursor<&'a mut [u8]> {
+impl Write for Cursor<&mut [u8]> {
     #[inline]
     fn write(&mut self, buf: &[u8]) -> io::Result {
         slice_write(&mut self.pos, self.inner, buf)
@@ -288,7 +288,7 @@ impl<'a> Write for Cursor<&'a mut [u8]> {
 }
 
 #[stable(feature = "cursor_mut_vec", since = "1.25.0")]
-impl<'a> Write for Cursor<&'a mut Vec> {
+impl Write for Cursor<&mut Vec> {
     fn write(&mut self, buf: &[u8]) -> io::Result {
         vec_write(&mut self.pos, self.inner, buf)
     }
diff --git a/src/libstd/io/impls.rs b/src/libstd/io/impls.rs
index ec75a87aec34f..2577b284714ab 100644
--- a/src/libstd/io/impls.rs
+++ b/src/libstd/io/impls.rs
@@ -7,7 +7,7 @@ use mem;
 // Forwarding implementations
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, R: Read + ?Sized> Read for &'a mut R {
+impl Read for &mut R {
     #[inline]
     fn read(&mut self, buf: &mut [u8]) -> io::Result {
         (**self).read(buf)
@@ -34,7 +34,7 @@ impl<'a, R: Read + ?Sized> Read for &'a mut R {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, W: Write + ?Sized> Write for &'a mut W {
+impl Write for &mut W {
     #[inline]
     fn write(&mut self, buf: &[u8]) -> io::Result { (**self).write(buf) }
 
@@ -52,12 +52,12 @@ impl<'a, W: Write + ?Sized> Write for &'a mut W {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, S: Seek + ?Sized> Seek for &'a mut S {
+impl Seek for &mut S {
     #[inline]
     fn seek(&mut self, pos: SeekFrom) -> io::Result { (**self).seek(pos) }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, B: BufRead + ?Sized> BufRead for &'a mut B {
+impl BufRead for &mut B {
     #[inline]
     fn fill_buf(&mut self) -> io::Result<&[u8]> { (**self).fill_buf() }
 
@@ -152,7 +152,7 @@ impl BufRead for Box {
 /// Note that reading updates the slice to point to the yet unread part.
 /// The slice will be empty when EOF is reached.
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Read for &'a [u8] {
+impl Read for &[u8] {
     #[inline]
     fn read(&mut self, buf: &mut [u8]) -> io::Result {
         let amt = cmp::min(buf.len(), self.len());
@@ -207,7 +207,7 @@ impl<'a> Read for &'a [u8] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> BufRead for &'a [u8] {
+impl BufRead for &[u8] {
     #[inline]
     fn fill_buf(&mut self) -> io::Result<&[u8]> { Ok(*self) }
 
@@ -221,7 +221,7 @@ impl<'a> BufRead for &'a [u8] {
 /// Note that writing updates the slice to point to the yet unwritten part.
 /// The slice will be empty when it has been completely overwritten.
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Write for &'a mut [u8] {
+impl Write for &mut [u8] {
     #[inline]
     fn write(&mut self, data: &[u8]) -> io::Result {
         let amt = cmp::min(data.len(), self.len());
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index c0570ae60a19c..b634ea43e34e5 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -299,7 +299,7 @@ const DEFAULT_BUF_SIZE: usize = ::sys_common::io::DEFAULT_BUF_SIZE;
 
 struct Guard<'a> { buf: &'a mut Vec, len: usize }
 
-impl<'a> Drop for Guard<'a> {
+impl Drop for Guard<'_> {
     fn drop(&mut self) {
         unsafe { self.buf.set_len(self.len); }
     }
@@ -1114,7 +1114,7 @@ pub trait Write {
             error: Result<()>,
         }
 
-        impl<'a, T: Write + ?Sized> fmt::Write for Adaptor<'a, T> {
+        impl fmt::Write for Adaptor<'_, T> {
             fn write_str(&mut self, s: &str) -> fmt::Result {
                 match self.inner.write_all(s.as_bytes()) {
                     Ok(()) => Ok(()),
diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs
index 4068c0f9c7de5..0324568e6fb52 100644
--- a/src/libstd/io/stdio.rs
+++ b/src/libstd/io/stdio.rs
@@ -312,7 +312,7 @@ impl Read for Stdin {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Read for StdinLock<'a> {
+impl Read for StdinLock<'_> {
     fn read(&mut self, buf: &mut [u8]) -> io::Result {
         self.inner.read(buf)
     }
@@ -323,13 +323,13 @@ impl<'a> Read for StdinLock<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> BufRead for StdinLock<'a> {
+impl BufRead for StdinLock<'_> {
     fn fill_buf(&mut self) -> io::Result<&[u8]> { self.inner.fill_buf() }
     fn consume(&mut self, n: usize) { self.inner.consume(n) }
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a> fmt::Debug for StdinLock<'a> {
+impl fmt::Debug for StdinLock<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("StdinLock { .. }")
     }
@@ -485,7 +485,7 @@ impl Write for Stdout {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Write for StdoutLock<'a> {
+impl Write for StdoutLock<'_> {
     fn write(&mut self, buf: &[u8]) -> io::Result {
         self.inner.borrow_mut().write(buf)
     }
@@ -495,7 +495,7 @@ impl<'a> Write for StdoutLock<'a> {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a> fmt::Debug for StdoutLock<'a> {
+impl fmt::Debug for StdoutLock<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("StdoutLock { .. }")
     }
@@ -638,7 +638,7 @@ impl Write for Stderr {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Write for StderrLock<'a> {
+impl Write for StderrLock<'_> {
     fn write(&mut self, buf: &[u8]) -> io::Result {
         self.inner.borrow_mut().write(buf)
     }
@@ -648,7 +648,7 @@ impl<'a> Write for StderrLock<'a> {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a> fmt::Debug for StderrLock<'a> {
+impl fmt::Debug for StderrLock<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.pad("StderrLock { .. }")
     }
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs
index 654ad64d97b36..4b60ee8e6dadd 100644
--- a/src/libstd/net/addr.rs
+++ b/src/libstd/net/addr.rs
@@ -861,7 +861,7 @@ fn resolve_socket_addr(lh: LookupHost) -> io::Result>
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> ToSocketAddrs for (&'a str, u16) {
+impl ToSocketAddrs for (&str, u16) {
     type Iter = vec::IntoIter;
     fn to_socket_addrs(&self) -> io::Result> {
         let (host, port) = *self;
@@ -904,7 +904,7 @@ impl<'a> ToSocketAddrs for &'a [SocketAddr] {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ToSocketAddrs + ?Sized> ToSocketAddrs for &'a T {
+impl ToSocketAddrs for &T {
     type Iter = T::Iter;
     fn to_socket_addrs(&self) -> io::Result {
         (**self).to_socket_addrs()
diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs
index d19cc482c15f9..c856129016814 100644
--- a/src/libstd/net/ip.rs
+++ b/src/libstd/net/ip.rs
@@ -329,6 +329,8 @@ impl Ipv4Addr {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub const fn new(a: u8, b: u8, c: u8, d: u8) -> Ipv4Addr {
+        // FIXME: should just be u32::from_be_bytes([a, b, c, d]),
+        // once that method is no longer rustc_const_unstable
         Ipv4Addr {
             inner: c::in_addr {
                 s_addr: u32::to_be(
@@ -392,6 +394,7 @@ impl Ipv4Addr {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn octets(&self) -> [u8; 4] {
+        // This returns the order we want because s_addr is stored in big-endian.
         self.inner.s_addr.to_ne_bytes()
     }
 
@@ -618,9 +621,13 @@ impl Ipv4Addr {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_ipv6_compatible(&self) -> Ipv6Addr {
-        Ipv6Addr::new(0, 0, 0, 0, 0, 0,
-                      ((self.octets()[0] as u16) << 8) | self.octets()[1] as u16,
-                      ((self.octets()[2] as u16) << 8) | self.octets()[3] as u16)
+        let octets = self.octets();
+        Ipv6Addr::from([
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            octets[0], octets[1], octets[2], octets[3],
+        ])
     }
 
     /// Converts this address to an IPv4-mapped [IPv6 address].
@@ -639,9 +646,13 @@ impl Ipv4Addr {
     /// ```
     #[stable(feature = "rust1", since = "1.0.0")]
     pub fn to_ipv6_mapped(&self) -> Ipv6Addr {
-        Ipv6Addr::new(0, 0, 0, 0, 0, 0xffff,
-                      ((self.octets()[0] as u16) << 8) | self.octets()[1] as u16,
-                      ((self.octets()[2] as u16) << 8) | self.octets()[3] as u16)
+        let octets = self.octets();
+        Ipv6Addr::from([
+            0, 0, 0, 0,
+            0, 0, 0, 0,
+            0, 0, 0xFF, 0xFF,
+            octets[0], octets[1], octets[2], octets[3],
+        ])
     }
 }
 
@@ -784,7 +795,7 @@ impl From for u32 {
     /// ```
     fn from(ip: Ipv4Addr) -> u32 {
         let ip = ip.octets();
-        ((ip[0] as u32) << 24) + ((ip[1] as u32) << 16) + ((ip[2] as u32) << 8) + (ip[3] as u32)
+        u32::from_be_bytes(ip)
     }
 }
 
@@ -801,7 +812,7 @@ impl From for Ipv4Addr {
     /// assert_eq!(Ipv4Addr::new(13, 12, 11, 10), addr);
     /// ```
     fn from(ip: u32) -> Ipv4Addr {
-        Ipv4Addr::new((ip >> 24) as u8, (ip >> 16) as u8, (ip >> 8) as u8, ip as u8)
+        Ipv4Addr::from(ip.to_be_bytes())
     }
 }
 
@@ -909,14 +920,14 @@ impl Ipv6Addr {
     pub fn segments(&self) -> [u16; 8] {
         let arr = &self.inner.s6_addr;
         [
-            (arr[0] as u16) << 8 | (arr[1] as u16),
-            (arr[2] as u16) << 8 | (arr[3] as u16),
-            (arr[4] as u16) << 8 | (arr[5] as u16),
-            (arr[6] as u16) << 8 | (arr[7] as u16),
-            (arr[8] as u16) << 8 | (arr[9] as u16),
-            (arr[10] as u16) << 8 | (arr[11] as u16),
-            (arr[12] as u16) << 8 | (arr[13] as u16),
-            (arr[14] as u16) << 8 | (arr[15] as u16),
+            u16::from_be_bytes([arr[0], arr[1]]),
+            u16::from_be_bytes([arr[2], arr[3]]),
+            u16::from_be_bytes([arr[4], arr[5]]),
+            u16::from_be_bytes([arr[6], arr[7]]),
+            u16::from_be_bytes([arr[8], arr[9]]),
+            u16::from_be_bytes([arr[10], arr[11]]),
+            u16::from_be_bytes([arr[12], arr[13]]),
+            u16::from_be_bytes([arr[14], arr[15]]),
         ]
     }
 
@@ -1382,21 +1393,43 @@ impl FromInner for Ipv6Addr {
 
 #[stable(feature = "i128", since = "1.26.0")]
 impl From for u128 {
+    /// Convert an `Ipv6Addr` into a host byte order `u128`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::net::Ipv6Addr;
+    ///
+    /// let addr = Ipv6Addr::new(
+    ///     0x1020, 0x3040, 0x5060, 0x7080,
+    ///     0x90A0, 0xB0C0, 0xD0E0, 0xF00D,
+    /// );
+    /// assert_eq!(0x102030405060708090A0B0C0D0E0F00D_u128, u128::from(addr));
+    /// ```
     fn from(ip: Ipv6Addr) -> u128 {
-        let ip = ip.segments();
-        ((ip[0] as u128) << 112) + ((ip[1] as u128) << 96) + ((ip[2] as u128) << 80) +
-            ((ip[3] as u128) << 64) + ((ip[4] as u128) << 48) + ((ip[5] as u128) << 32) +
-            ((ip[6] as u128) << 16) + (ip[7] as u128)
+        let ip = ip.octets();
+        u128::from_be_bytes(ip)
     }
 }
 #[stable(feature = "i128", since = "1.26.0")]
 impl From for Ipv6Addr {
+    /// Convert a host byte order `u128` into an `Ipv6Addr`.
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// use std::net::Ipv6Addr;
+    ///
+    /// let addr = Ipv6Addr::from(0x102030405060708090A0B0C0D0E0F00D_u128);
+    /// assert_eq!(
+    ///     Ipv6Addr::new(
+    ///         0x1020, 0x3040, 0x5060, 0x7080,
+    ///         0x90A0, 0xB0C0, 0xD0E0, 0xF00D,
+    ///     ),
+    ///     addr);
+    /// ```
     fn from(ip: u128) -> Ipv6Addr {
-        Ipv6Addr::new(
-            (ip >> 112) as u16, (ip >> 96) as u16, (ip >> 80) as u16,
-            (ip >> 64) as u16, (ip >> 48) as u16, (ip >> 32) as u16,
-            (ip >> 16) as u16, ip as u16,
-        )
+        Ipv6Addr::from(ip.to_be_bytes())
     }
 }
 
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index c4b0cd0f17c34..51bd76ae4363e 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -580,7 +580,7 @@ impl Write for TcpStream {
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Read for &'a TcpStream {
+impl Read for &TcpStream {
     fn read(&mut self, buf: &mut [u8]) -> io::Result { self.0.read(buf) }
 
     #[inline]
@@ -589,7 +589,7 @@ impl<'a> Read for &'a TcpStream {
     }
 }
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Write for &'a TcpStream {
+impl Write for &TcpStream {
     fn write(&mut self, buf: &[u8]) -> io::Result { self.0.write(buf) }
     fn flush(&mut self) -> io::Result<()> { Ok(()) }
 }
@@ -1187,9 +1187,13 @@ mod tests {
     #[test]
     fn double_bind() {
         each_ip(&mut |addr| {
-            let _listener = t!(TcpListener::bind(&addr));
+            let listener1 = t!(TcpListener::bind(&addr));
             match TcpListener::bind(&addr) {
-                Ok(..) => panic!(),
+                Ok(listener2) => panic!(
+                    "This system (perhaps due to options set by TcpListener::bind) \
+                     permits double binding: {:?} and {:?}",
+                    listener1, listener2
+                ),
                 Err(e) => {
                     assert!(e.kind() == ErrorKind::ConnectionRefused ||
                             e.kind() == ErrorKind::Other ||
diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs
index 862fdf051ccd1..daeac7107a56c 100644
--- a/src/libstd/panic.rs
+++ b/src/libstd/panic.rs
@@ -199,9 +199,9 @@ pub struct AssertUnwindSafe(
 // * Our custom AssertUnwindSafe wrapper is indeed unwind safe
 
 #[stable(feature = "catch_unwind", since = "1.9.0")]
-impl<'a, T: ?Sized> !UnwindSafe for &'a mut T {}
+impl !UnwindSafe for &mut T {}
 #[stable(feature = "catch_unwind", since = "1.9.0")]
-impl<'a, T: RefUnwindSafe + ?Sized> UnwindSafe for &'a T {}
+impl UnwindSafe for &T {}
 #[stable(feature = "catch_unwind", since = "1.9.0")]
 impl UnwindSafe for *const T {}
 #[stable(feature = "catch_unwind", since = "1.9.0")]
@@ -320,7 +320,7 @@ impl fmt::Debug for AssertUnwindSafe {
 }
 
 #[unstable(feature = "futures_api", issue = "50547")]
-impl<'a, F: Future> Future for AssertUnwindSafe {
+impl Future for AssertUnwindSafe {
     type Output = F::Output;
 
     fn poll(self: Pin<&mut Self>, waker: &Waker) -> Poll {
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 0a9796d1a9c20..240b92a17db4c 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -457,14 +457,14 @@ impl<'a> cmp::PartialOrd for PrefixComponent<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> cmp::Ord for PrefixComponent<'a> {
-    fn cmp(&self, other: &PrefixComponent<'a>) -> cmp::Ordering {
+impl cmp::Ord for PrefixComponent<'_> {
+    fn cmp(&self, other: &Self) -> cmp::Ordering {
         cmp::Ord::cmp(&self.parsed, &other.parsed)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> Hash for PrefixComponent<'a> {
+impl Hash for PrefixComponent<'_> {
     fn hash(&self, h: &mut H) {
         self.parsed.hash(h);
     }
@@ -561,14 +561,14 @@ impl<'a> Component<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> AsRef for Component<'a> {
+impl AsRef for Component<'_> {
     fn as_ref(&self) -> &OsStr {
         self.as_os_str()
     }
 }
 
 #[stable(feature = "path_component_asref", since = "1.25.0")]
-impl<'a> AsRef for Component<'a> {
+impl AsRef for Component<'_> {
     fn as_ref(&self) -> &Path {
         self.as_os_str().as_ref()
     }
@@ -630,11 +630,11 @@ pub struct Iter<'a> {
 }
 
 #[stable(feature = "path_components_debug", since = "1.13.0")]
-impl<'a> fmt::Debug for Components<'a> {
+impl fmt::Debug for Components<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         struct DebugHelper<'a>(&'a Path);
 
-        impl<'a> fmt::Debug for DebugHelper<'a> {
+        impl fmt::Debug for DebugHelper<'_> {
             fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 f.debug_list()
                     .entries(self.0.components())
@@ -814,25 +814,25 @@ impl<'a> Components<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> AsRef for Components<'a> {
+impl AsRef for Components<'_> {
     fn as_ref(&self) -> &Path {
         self.as_path()
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> AsRef for Components<'a> {
+impl AsRef for Components<'_> {
     fn as_ref(&self) -> &OsStr {
         self.as_path().as_os_str()
     }
 }
 
 #[stable(feature = "path_iter_debug", since = "1.13.0")]
-impl<'a> fmt::Debug for Iter<'a> {
+impl fmt::Debug for Iter<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         struct DebugHelper<'a>(&'a Path);
 
-        impl<'a> fmt::Debug for DebugHelper<'a> {
+        impl fmt::Debug for DebugHelper<'_> {
             fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 f.debug_list()
                     .entries(self.0.iter())
@@ -867,14 +867,14 @@ impl<'a> Iter<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> AsRef for Iter<'a> {
+impl AsRef for Iter<'_> {
     fn as_ref(&self) -> &Path {
         self.as_path()
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> AsRef for Iter<'a> {
+impl AsRef for Iter<'_> {
     fn as_ref(&self) -> &OsStr {
         self.as_path().as_os_str()
     }
@@ -897,7 +897,7 @@ impl<'a> DoubleEndedIterator for Iter<'a> {
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a> FusedIterator for Iter<'a> {}
+impl FusedIterator for Iter<'_> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> Iterator for Components<'a> {
@@ -1000,7 +1000,7 @@ impl<'a> DoubleEndedIterator for Components<'a> {
 }
 
 #[stable(feature = "fused", since = "1.26.0")]
-impl<'a> FusedIterator for Components<'a> {}
+impl FusedIterator for Components<'_> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> cmp::PartialEq for Components<'a> {
@@ -1010,7 +1010,7 @@ impl<'a> cmp::PartialEq for Components<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> cmp::Eq for Components<'a> {}
+impl cmp::Eq for Components<'_> {}
 
 #[stable(feature = "rust1", since = "1.0.0")]
 impl<'a> cmp::PartialOrd for Components<'a> {
@@ -1020,8 +1020,8 @@ impl<'a> cmp::PartialOrd for Components<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> cmp::Ord for Components<'a> {
-    fn cmp(&self, other: &Components<'a>) -> cmp::Ordering {
+impl cmp::Ord for Components<'_> {
+    fn cmp(&self, other: &Self) -> cmp::Ordering {
         Iterator::cmp(self.clone(), other.clone())
     }
 }
@@ -1063,7 +1063,7 @@ impl<'a> Iterator for Ancestors<'a> {
 }
 
 #[stable(feature = "path_ancestors", since = "1.28.0")]
-impl<'a> FusedIterator for Ancestors<'a> {}
+impl FusedIterator for Ancestors<'_> {}
 
 ////////////////////////////////////////////////////////////////////////////////
 // Basic types and traits
@@ -1145,6 +1145,33 @@ impl PathBuf {
         PathBuf { inner: OsString::new() }
     }
 
+    /// Creates a new `PathBuf` with a given capacity used to create the
+    /// internal [`OsString`]. See [`with_capacity`] defined on [`OsString`].
+    ///
+    /// # Examples
+    ///
+    /// ```
+    /// #![feature(path_buf_capacity)]
+    /// use std::path::PathBuf;
+    ///
+    /// let mut path = PathBuf::with_capacity(10);
+    /// let capacity = path.capacity();
+    ///
+    /// // This push is done without reallocating
+    /// path.push(r"C:\");
+    ///
+    /// assert_eq!(capacity, path.capacity());
+    /// ```
+    ///
+    /// [`with_capacity`]: ../ffi/struct.OsString.html#method.with_capacity
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn with_capacity(capacity: usize) -> PathBuf {
+        PathBuf {
+            inner: OsString::with_capacity(capacity)
+        }
+    }
+
     /// Coerces to a [`Path`] slice.
     ///
     /// [`Path`]: struct.Path.html
@@ -1373,6 +1400,60 @@ impl PathBuf {
         let rw = Box::into_raw(self.inner.into_boxed_os_str()) as *mut Path;
         unsafe { Box::from_raw(rw) }
     }
+
+    /// Invokes [`capacity`] on the underlying instance of [`OsString`].
+    ///
+    /// [`capacity`]: ../ffi/struct.OsString.html#method.capacity
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn capacity(&self) -> usize {
+        self.inner.capacity()
+    }
+
+    /// Invokes [`clear`] on the underlying instance of [`OsString`].
+    ///
+    /// [`clear`]: ../ffi/struct.OsString.html#method.clear
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn clear(&mut self) {
+        self.inner.clear()
+    }
+
+    /// Invokes [`reserve`] on the underlying instance of [`OsString`].
+    ///
+    /// [`reserve`]: ../ffi/struct.OsString.html#method.reserve
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn reserve(&mut self, additional: usize) {
+        self.inner.reserve(additional)
+    }
+
+    /// Invokes [`reserve_exact`] on the underlying instance of [`OsString`].
+    ///
+    /// [`reserve_exact`]: ../ffi/struct.OsString.html#method.reserve_exact
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn reserve_exact(&mut self, additional: usize) {
+        self.inner.reserve_exact(additional)
+    }
+
+    /// Invokes [`shrink_to_fit`] on the underlying instance of [`OsString`].
+    ///
+    /// [`shrink_to_fit`]: ../ffi/struct.OsString.html#method.shrink_to_fit
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn shrink_to_fit(&mut self) {
+        self.inner.shrink_to_fit()
+    }
+
+    /// Invokes [`shrink_to`] on the underlying instance of [`OsString`].
+    ///
+    /// [`shrink_to`]: ../ffi/struct.OsString.html#method.shrink_to
+    /// [`OsString`]: ../ffi/struct.OsString.html
+    #[unstable(feature = "path_buf_capacity", issue = "58234")]
+    pub fn shrink_to(&mut self, min_capacity: usize) {
+        self.inner.shrink_to(min_capacity)
+    }
 }
 
 #[stable(feature = "box_from_path", since = "1.17.0")]
@@ -2529,14 +2610,14 @@ pub struct Display<'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> fmt::Debug for Display<'a> {
+impl fmt::Debug for Display<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Debug::fmt(&self.path, f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a> fmt::Display for Display<'a> {
+impl fmt::Display for Display<'_> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         self.path.inner.display(f)
     }
@@ -2590,7 +2671,7 @@ impl AsRef for OsStr {
 }
 
 #[stable(feature = "cow_os_str_as_ref_path", since = "1.8.0")]
-impl<'a> AsRef for Cow<'a, OsStr> {
+impl AsRef for Cow<'_, OsStr> {
     fn as_ref(&self) -> &Path {
         Path::new(self)
     }
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index 8f6f9818d5c76..8591b55dc58ee 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -321,7 +321,7 @@ impl Drop for Select {
     }
 }
 
-impl<'rx, T: Send> Drop for Handle<'rx, T> {
+impl Drop for Handle<'_, T> {
     fn drop(&mut self) {
         unsafe { self.remove() }
     }
@@ -347,7 +347,7 @@ impl fmt::Debug for Select {
     }
 }
 
-impl<'rx, T:Send+'rx> fmt::Debug for Handle<'rx, T> {
+impl fmt::Debug for Handle<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("Handle").finish()
     }
diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs
index 340dca7ce73b8..954867911a031 100644
--- a/src/libstd/sync/mutex.rs
+++ b/src/libstd/sync/mutex.rs
@@ -150,9 +150,9 @@ pub struct MutexGuard<'a, T: ?Sized + 'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> !Send for MutexGuard<'a, T> { }
+impl !Send for MutexGuard<'_, T> { }
 #[stable(feature = "mutexguard", since = "1.19.0")]
-unsafe impl<'a, T: ?Sized + Sync> Sync for MutexGuard<'a, T> { }
+unsafe impl Sync for MutexGuard<'_, T> { }
 
 impl Mutex {
     /// Creates a new mutex in an unlocked state ready for use.
@@ -421,7 +421,7 @@ impl<'mutex, T: ?Sized> MutexGuard<'mutex, T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'mutex, T: ?Sized> Deref for MutexGuard<'mutex, T> {
+impl Deref for MutexGuard<'_, T> {
     type Target = T;
 
     fn deref(&self) -> &T {
@@ -430,14 +430,14 @@ impl<'mutex, T: ?Sized> Deref for MutexGuard<'mutex, T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'mutex, T: ?Sized> DerefMut for MutexGuard<'mutex, T> {
+impl DerefMut for MutexGuard<'_, T> {
     fn deref_mut(&mut self) -> &mut T {
         unsafe { &mut *self.__lock.data.get() }
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> Drop for MutexGuard<'a, T> {
+impl Drop for MutexGuard<'_, T> {
     #[inline]
     fn drop(&mut self) {
         unsafe {
@@ -448,14 +448,14 @@ impl<'a, T: ?Sized> Drop for MutexGuard<'a, T> {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T: ?Sized + fmt::Debug> fmt::Debug for MutexGuard<'a, T> {
+impl fmt::Debug for MutexGuard<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         fmt::Debug::fmt(&**self, f)
     }
 }
 
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
-impl<'a, T: ?Sized + fmt::Display> fmt::Display for MutexGuard<'a, T> {
+impl fmt::Display for MutexGuard<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         (**self).fmt(f)
     }
diff --git a/src/libstd/sync/once.rs b/src/libstd/sync/once.rs
index 656389789d771..e207d0170d7b8 100644
--- a/src/libstd/sync/once.rs
+++ b/src/libstd/sync/once.rs
@@ -436,7 +436,7 @@ impl fmt::Debug for Once {
     }
 }
 
-impl<'a> Drop for Finish<'a> {
+impl Drop for Finish<'_> {
     fn drop(&mut self) {
         // Swap out our state with however we finished. We should only ever see
         // an old state which was RUNNING.
diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs
index 730362e2ac86a..7f3cb4f72c7b5 100644
--- a/src/libstd/sync/rwlock.rs
+++ b/src/libstd/sync/rwlock.rs
@@ -91,10 +91,10 @@ pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> !Send for RwLockReadGuard<'a, T> {}
+impl !Send for RwLockReadGuard<'_, T> {}
 
 #[stable(feature = "rwlock_guard_sync", since = "1.23.0")]
-unsafe impl<'a, T: ?Sized + Sync> Sync for RwLockReadGuard<'a, T> {}
+unsafe impl Sync for RwLockReadGuard<'_, T> {}
 
 /// RAII structure used to release the exclusive write access of a lock when
 /// dropped.
@@ -113,10 +113,10 @@ pub struct RwLockWriteGuard<'a, T: ?Sized + 'a> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> !Send for RwLockWriteGuard<'a, T> {}
+impl !Send for RwLockWriteGuard<'_, T> {}
 
 #[stable(feature = "rwlock_guard_sync", since = "1.23.0")]
-unsafe impl<'a, T: ?Sized + Sync> Sync for RwLockWriteGuard<'a, T> {}
+unsafe impl Sync for RwLockWriteGuard<'_, T> {}
 
 impl RwLock {
     /// Creates a new instance of an `RwLock` which is unlocked.
@@ -480,7 +480,7 @@ impl<'rwlock, T: ?Sized> RwLockWriteGuard<'rwlock, T> {
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T: fmt::Debug> fmt::Debug for RwLockReadGuard<'a, T> {
+impl fmt::Debug for RwLockReadGuard<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RwLockReadGuard")
             .field("lock", &self.__lock)
@@ -489,14 +489,14 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockReadGuard<'a, T> {
 }
 
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
-impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockReadGuard<'a, T> {
+impl fmt::Display for RwLockReadGuard<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         (**self).fmt(f)
     }
 }
 
 #[stable(feature = "std_debug", since = "1.16.0")]
-impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> {
+impl fmt::Debug for RwLockWriteGuard<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.debug_struct("RwLockWriteGuard")
             .field("lock", &self.__lock)
@@ -505,14 +505,14 @@ impl<'a, T: fmt::Debug> fmt::Debug for RwLockWriteGuard<'a, T> {
 }
 
 #[stable(feature = "std_guard_impls", since = "1.20.0")]
-impl<'a, T: ?Sized + fmt::Display> fmt::Display for RwLockWriteGuard<'a, T> {
+impl fmt::Display for RwLockWriteGuard<'_, T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         (**self).fmt(f)
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'rwlock, T: ?Sized> Deref for RwLockReadGuard<'rwlock, T> {
+impl Deref for RwLockReadGuard<'_, T> {
     type Target = T;
 
     fn deref(&self) -> &T {
@@ -521,7 +521,7 @@ impl<'rwlock, T: ?Sized> Deref for RwLockReadGuard<'rwlock, T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'rwlock, T: ?Sized> Deref for RwLockWriteGuard<'rwlock, T> {
+impl Deref for RwLockWriteGuard<'_, T> {
     type Target = T;
 
     fn deref(&self) -> &T {
@@ -530,21 +530,21 @@ impl<'rwlock, T: ?Sized> Deref for RwLockWriteGuard<'rwlock, T> {
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'rwlock, T: ?Sized> DerefMut for RwLockWriteGuard<'rwlock, T> {
+impl DerefMut for RwLockWriteGuard<'_, T> {
     fn deref_mut(&mut self) -> &mut T {
         unsafe { &mut *self.__lock.data.get() }
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> Drop for RwLockReadGuard<'a, T> {
+impl Drop for RwLockReadGuard<'_, T> {
     fn drop(&mut self) {
         unsafe { self.__lock.inner.read_unlock(); }
     }
 }
 
 #[stable(feature = "rust1", since = "1.0.0")]
-impl<'a, T: ?Sized> Drop for RwLockWriteGuard<'a, T> {
+impl Drop for RwLockWriteGuard<'_, T> {
     fn drop(&mut self) {
         self.__lock.poison.done(&self.__poison);
         unsafe { self.__lock.inner.write_unlock(); }
diff --git a/src/libstd/sys_common/bytestring.rs b/src/libstd/sys_common/bytestring.rs
index df57fae428167..915c17374ca02 100644
--- a/src/libstd/sys_common/bytestring.rs
+++ b/src/libstd/sys_common/bytestring.rs
@@ -31,7 +31,7 @@ mod tests {
     fn smoke() {
         struct Helper<'a>(&'a [u8]);
 
-        impl<'a> Debug for Helper<'a> {
+        impl Debug for Helper<'_> {
             fn fmt(&self, f: &mut Formatter) -> Result {
                 debug_fmt_bytestring(self.0, f)
             }
diff --git a/src/libstd/sys_common/mutex.rs b/src/libstd/sys_common/mutex.rs
index 536f1c70db23a..b47d8698c605b 100644
--- a/src/libstd/sys_common/mutex.rs
+++ b/src/libstd/sys_common/mutex.rs
@@ -76,7 +76,7 @@ pub fn raw(mutex: &Mutex) -> &imp::Mutex { &mutex.0 }
 /// A simple RAII utility for the above Mutex without the poisoning semantics.
 pub struct MutexGuard<'a>(&'a imp::Mutex);
 
-impl<'a> Drop for MutexGuard<'a> {
+impl Drop for MutexGuard<'_> {
     #[inline]
     fn drop(&mut self) {
         unsafe { self.0.unlock(); }
diff --git a/src/libstd/sys_common/remutex.rs b/src/libstd/sys_common/remutex.rs
index 9ef24433f1360..596e5d534c293 100644
--- a/src/libstd/sys_common/remutex.rs
+++ b/src/libstd/sys_common/remutex.rs
@@ -43,7 +43,7 @@ pub struct ReentrantMutexGuard<'a, T: 'a> {
     __poison: poison::Guard,
 }
 
-impl<'a, T> !marker::Send for ReentrantMutexGuard<'a, T> {}
+impl !marker::Send for ReentrantMutexGuard<'_, T> {}
 
 
 impl ReentrantMutex {
@@ -138,7 +138,7 @@ impl<'mutex, T> ReentrantMutexGuard<'mutex, T> {
     }
 }
 
-impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> {
+impl Deref for ReentrantMutexGuard<'_, T> {
     type Target = T;
 
     fn deref(&self) -> &T {
@@ -146,7 +146,7 @@ impl<'mutex, T> Deref for ReentrantMutexGuard<'mutex, T> {
     }
 }
 
-impl<'a, T> Drop for ReentrantMutexGuard<'a, T> {
+impl Drop for ReentrantMutexGuard<'_, T> {
     #[inline]
     fn drop(&mut self) {
         unsafe {
@@ -212,7 +212,7 @@ mod tests {
     }
 
     pub struct Answer<'a>(pub ReentrantMutexGuard<'a, RefCell>);
-    impl<'a> Drop for Answer<'a> {
+    impl Drop for Answer<'_> {
         fn drop(&mut self) {
             *self.0.borrow_mut() = 42;
         }
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index ab62dd2bc9b01..9c4945d74dbfe 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -640,19 +640,26 @@ pub enum PatKind {
     /// If the `..` pattern fragment is present, then `Option` denotes its position.
     /// `0 <= position <= subpats.len()`.
     Tuple(Vec>, Option),
+
     /// A `box` pattern.
     Box(P),
+
     /// A reference pattern (e.g., `&mut (a, b)`).
     Ref(P, Mutability),
+
     /// A literal.
     Lit(P),
+
     /// A range pattern (e.g., `1...2`, `1..=2` or `1..2`).
     Range(P, P, Spanned),
+
     /// `[a, b, ..i, y, z]` is represented as:
     ///     `PatKind::Slice(box [a, b], Some(i), box [y, z])`
     Slice(Vec>, Option>, Vec>),
+
     /// Parentheses in patterns used for grouping (i.e., `(PAT)`).
     Paren(P),
+
     /// A macro pattern; pre-expansion.
     Mac(Mac),
 }
diff --git a/src/libsyntax/mut_visit.rs b/src/libsyntax/mut_visit.rs
index 1e5eb0992bd1b..fd7003d30a1dc 100644
--- a/src/libsyntax/mut_visit.rs
+++ b/src/libsyntax/mut_visit.rs
@@ -1037,7 +1037,7 @@ pub fn noop_visit_pat(pat: &mut P, vis: &mut T) {
             vis.visit_expr(e1);
             vis.visit_expr(e2);
             vis.visit_span(span);
-        },
+        }
         PatKind::Slice(before, slice, after) => {
             visit_vec(before, |pat| vis.visit_pat(pat));
             visit_opt(slice, |slice| vis.visit_pat(slice));
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index e22047938e518..b1fb38d8eafb4 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -4173,7 +4173,8 @@ impl<'a> Parser<'a> {
                 err.emit();
                 self.bump();
             } else if self.eat(&token::BinOp(token::Or)) {
-                // No op.
+                // This is a No-op. Continue the loop to parse the next
+                // pattern.
             } else {
                 return Ok(pats);
             }
diff --git a/src/test/run-pass/const-int-overflowing.rs b/src/test/run-pass/const-int-overflowing.rs
index 289b1236cf1e2..82057868b73bb 100644
--- a/src/test/run-pass/const-int-overflowing.rs
+++ b/src/test/run-pass/const-int-overflowing.rs
@@ -13,6 +13,9 @@ const SHL_B: (u32, bool) = 0x1u32.overflowing_shl(132);
 const SHR_A: (u32, bool) = 0x10u32.overflowing_shr(4);
 const SHR_B: (u32, bool) = 0x10u32.overflowing_shr(132);
 
+const NEG_A: (u32, bool) = 0u32.overflowing_neg();
+const NEG_B: (u32, bool) = core::u32::MAX.overflowing_neg();
+
 fn ident(ident: T) -> T {
     ident
 }
@@ -32,4 +35,7 @@ fn main() {
 
     assert_eq!(SHR_A, ident((0x1, false)));
     assert_eq!(SHR_B, ident((0x1, true)));
+
+    assert_eq!(NEG_A, ident((0, false)));
+    assert_eq!(NEG_B, ident((1, true)));
 }
diff --git a/src/test/run-pass/const-int-wrapping.rs b/src/test/run-pass/const-int-wrapping.rs
index 5ab712015dfc3..140fd57ecb802 100644
--- a/src/test/run-pass/const-int-wrapping.rs
+++ b/src/test/run-pass/const-int-wrapping.rs
@@ -13,6 +13,9 @@ const SHL_B: u32 = 1u32.wrapping_shl(128);
 const SHR_A: u32 = 128u32.wrapping_shr(7);
 const SHR_B: u32 = 128u32.wrapping_shr(128);
 
+const NEG_A: u32 = 5u32.wrapping_neg();
+const NEG_B: u32 = 1234567890u32.wrapping_neg();
+
 fn ident(ident: T) -> T {
     ident
 }
@@ -32,4 +35,7 @@ fn main() {
 
     assert_eq!(SHR_A, ident(1));
     assert_eq!(SHR_B, ident(128));
+
+    assert_eq!(NEG_A, ident(4294967291));
+    assert_eq!(NEG_B, ident(3060399406));
 }
diff --git a/src/test/rustdoc/process-termination.rs b/src/test/rustdoc/process-termination.rs
new file mode 100644
index 0000000000000..32258792b6e8b
--- /dev/null
+++ b/src/test/rustdoc/process-termination.rs
@@ -0,0 +1,24 @@
+// compile-flags:--test
+
+/// A check of using various process termination strategies
+///
+/// # Examples
+///
+/// ```rust
+/// assert!(true); // this returns `()`, all is well
+/// ```
+///
+/// You can also simply return `Ok(())`, but you'll need to disambiguate the
+/// type using turbofish, because we cannot infer the type:
+///
+/// ```rust
+/// Ok::<(), &'static str>(())
+/// ```
+///
+/// You can err with anything that implements `Debug`:
+///
+/// ```rust,should_panic
+/// Err("This is returned from `main`, leading to panic")?;
+/// Ok::<(), &'static str>(())
+/// ```
+pub fn check_process_termination() {}
diff --git a/src/test/rustdoc/wrapping.rs b/src/test/rustdoc/wrapping.rs
new file mode 100644
index 0000000000000..8d8221bcdf293
--- /dev/null
+++ b/src/test/rustdoc/wrapping.rs
@@ -0,0 +1,5 @@
+use std::fmt::Debug;
+
+// @has 'wrapping/fn.foo.html' '//pre[@class="rust fn"]' 'pub fn foo() -> impl Debug'
+// @count - '//pre[@class="rust fn"]/br' 0
+pub fn foo() -> impl Debug {}
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr
index 46901b44c4b6d..fa831ea81dcfb 100644
--- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.krisskross.stderr
@@ -9,15 +9,15 @@ LL |    let a = bar(foo, y); //[krisskross]~ ERROR E0623
    |                     ^ ...but data from `x` is returned here
 
 error[E0623]: lifetime mismatch
-  --> $DIR/project-fn-ret-invariant.rs:55:8
+  --> $DIR/project-fn-ret-invariant.rs:54:21
    |
 LL | fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
-   |                                     --------     --------------------
-   |                                     |
-   |                                     this parameter and the return type are declared with different lifetimes...
-...
-LL |    (a, b) //[krisskross]~ ERROR E0623
-   |        ^ ...but data from `x` is returned here
+   |                        --------                  --------------------
+   |                        |
+   |                        this parameter and the return type are declared with different lifetimes...
+LL |    let a = bar(foo, y); //[krisskross]~ ERROR E0623
+LL |    let b = bar(foo, x); //[krisskross]~ ERROR E0623
+   |                     ^ ...but data from `y` is returned here
 
 error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs b/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs
index dfcf31b3b1f26..54b6e3642c2ea 100644
--- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.rs
@@ -51,8 +51,8 @@ fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
 #[cfg(krisskross)] // two instantiations, mixing and matching: BAD
 fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
    let a = bar(foo, y); //[krisskross]~ ERROR E0623
-   let b = bar(foo, x);
-   (a, b) //[krisskross]~ ERROR E0623
+   let b = bar(foo, x); //[krisskross]~ ERROR E0623
+   (a, b)
 }
 
 #[rustc_error]
diff --git a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
index 947844c45c408..dd1212eaac91d 100644
--- a/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
+++ b/src/test/ui/associated-types/cache/project-fn-ret-invariant.transmute.stderr
@@ -1,4 +1,4 @@
-error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
+error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
   --> $DIR/project-fn-ret-invariant.rs:48:8
    |
 LL |    bar(foo, x) //[transmute]~ ERROR E0495
diff --git a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr
index 3bbf48cb37f58..811c9a8f5e12b 100644
--- a/src/test/ui/associated-types/higher-ranked-projection.bad.stderr
+++ b/src/test/ui/associated-types/higher-ranked-projection.bad.stderr
@@ -1,12 +1,12 @@
-error: implementation of `Mirror` is not general enough
+error[E0308]: mismatched types
   --> $DIR/higher-ranked-projection.rs:25:5
    |
 LL |     foo(());
-   |     ^^^
+   |     ^^^ one type is more general than the other
    |
-   = note: Due to a where-clause on `foo`,
-   = note: `Mirror` would have to be implemented for the type `&'0 ()`, for any lifetime `'0`
-   = note: but `Mirror` is actually implemented for the type `&'1 ()`, for some specific lifetime `'1`
+   = note: expected type `&'a ()`
+              found type `&()`
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/associated-types/higher-ranked-projection.good.stderr b/src/test/ui/associated-types/higher-ranked-projection.good.stderr
index c5c8451a5a9db..92fd256285852 100644
--- a/src/test/ui/associated-types/higher-ranked-projection.good.stderr
+++ b/src/test/ui/associated-types/higher-ranked-projection.good.stderr
@@ -3,7 +3,7 @@ error: compilation successful
    |
 LL | / fn main() { //[good]~ ERROR compilation successful
 LL | |     foo(());
-LL | |     //[bad]~^ ERROR not general enough
+LL | |     //[bad]~^ ERROR mismatched types
 LL | | }
    | |_^
 
diff --git a/src/test/ui/associated-types/higher-ranked-projection.rs b/src/test/ui/associated-types/higher-ranked-projection.rs
index 1280c8cb4cb09..fd7252f9e2253 100644
--- a/src/test/ui/associated-types/higher-ranked-projection.rs
+++ b/src/test/ui/associated-types/higher-ranked-projection.rs
@@ -23,5 +23,5 @@ fn foo(_t: T)
 #[rustc_error]
 fn main() { //[good]~ ERROR compilation successful
     foo(());
-    //[bad]~^ ERROR not general enough
+    //[bad]~^ ERROR mismatched types
 }
diff --git a/src/test/ui/existential_types/bound_reduction2.rs b/src/test/ui/existential_types/bound_reduction2.rs
index d8ade50c79c82..542e076d88d64 100644
--- a/src/test/ui/existential_types/bound_reduction2.rs
+++ b/src/test/ui/existential_types/bound_reduction2.rs
@@ -8,11 +8,12 @@ trait TraitWithAssoc {
 }
 
 existential type Foo: Trait;
+//~^ ERROR could not find defining uses
 
 trait Trait {}
 
 impl Trait for () {}
 
-fn foo_desugared(_: T) -> Foo { //~ ERROR non-defining
+fn foo_desugared(_: T) -> Foo { //~ ERROR does not fully define
     ()
 }
diff --git a/src/test/ui/existential_types/bound_reduction2.stderr b/src/test/ui/existential_types/bound_reduction2.stderr
index 8e822ca6d8bc7..f51f1c9a4e563 100644
--- a/src/test/ui/existential_types/bound_reduction2.stderr
+++ b/src/test/ui/existential_types/bound_reduction2.stderr
@@ -1,16 +1,16 @@
-error: non-defining existential type use in defining scope
-  --> $DIR/bound_reduction2.rs:16:1
+error: defining existential type use does not fully define existential type
+  --> $DIR/bound_reduction2.rs:17:1
    |
-LL | / fn foo_desugared(_: T) -> Foo { //~ ERROR non-defining
+LL | / fn foo_desugared(_: T) -> Foo { //~ ERROR does not fully define
 LL | |     ()
 LL | | }
    | |_^
-   |
-note: used non-generic type ::Assoc for generic parameter
-  --> $DIR/bound_reduction2.rs:10:22
+
+error: could not find defining uses
+  --> $DIR/bound_reduction2.rs:10:1
    |
 LL | existential type Foo: Trait;
-   |                      ^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/existential_types/different_defining_uses.rs b/src/test/ui/existential_types/different_defining_uses.rs
index c51fca75a24e9..a8670cc07f2e1 100644
--- a/src/test/ui/existential_types/different_defining_uses.rs
+++ b/src/test/ui/existential_types/different_defining_uses.rs
@@ -9,6 +9,6 @@ fn foo() -> Foo {
     ""
 }
 
-fn bar() -> Foo { //~ ERROR defining existential type use differs from previous
+fn bar() -> Foo { //~ ERROR concrete type differs from previous
     42i32
 }
diff --git a/src/test/ui/existential_types/different_defining_uses.stderr b/src/test/ui/existential_types/different_defining_uses.stderr
index f782a00229732..3f9ed96400b54 100644
--- a/src/test/ui/existential_types/different_defining_uses.stderr
+++ b/src/test/ui/existential_types/different_defining_uses.stderr
@@ -1,10 +1,10 @@
-error: defining existential type use differs from previous
+error: concrete type differs from previous defining existential type use
   --> $DIR/different_defining_uses.rs:12:1
    |
-LL | / fn bar() -> Foo { //~ ERROR defining existential type use differs from previous
+LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous
 LL | |     42i32
 LL | | }
-   | |_^
+   | |_^ expected `&'static str`, got `i32`
    |
 note: previous use here
   --> $DIR/different_defining_uses.rs:8:1
diff --git a/src/test/ui/existential_types/different_defining_uses_never_type.rs b/src/test/ui/existential_types/different_defining_uses_never_type.rs
index c6c6ae8d2dccf..13ada63e4bc45 100644
--- a/src/test/ui/existential_types/different_defining_uses_never_type.rs
+++ b/src/test/ui/existential_types/different_defining_uses_never_type.rs
@@ -9,10 +9,10 @@ fn foo() -> Foo {
     ""
 }
 
-fn bar() -> Foo { //~ ERROR defining existential type use differs from previous
+fn bar() -> Foo { //~ ERROR concrete type differs from previous
     panic!()
 }
 
-fn boo() -> Foo { //~ ERROR defining existential type use differs from previous
+fn boo() -> Foo { //~ ERROR concrete type differs from previous
     loop {}
 }
diff --git a/src/test/ui/existential_types/different_defining_uses_never_type.stderr b/src/test/ui/existential_types/different_defining_uses_never_type.stderr
index 04b0cf2778455..e29256a5014f9 100644
--- a/src/test/ui/existential_types/different_defining_uses_never_type.stderr
+++ b/src/test/ui/existential_types/different_defining_uses_never_type.stderr
@@ -1,10 +1,10 @@
-error: defining existential type use differs from previous
+error: concrete type differs from previous defining existential type use
   --> $DIR/different_defining_uses_never_type.rs:12:1
    |
-LL | / fn bar() -> Foo { //~ ERROR defining existential type use differs from previous
+LL | / fn bar() -> Foo { //~ ERROR concrete type differs from previous
 LL | |     panic!()
 LL | | }
-   | |_^
+   | |_^ expected `&'static str`, got `()`
    |
 note: previous use here
   --> $DIR/different_defining_uses_never_type.rs:8:1
@@ -14,13 +14,13 @@ LL | |     ""
 LL | | }
    | |_^
 
-error: defining existential type use differs from previous
+error: concrete type differs from previous defining existential type use
   --> $DIR/different_defining_uses_never_type.rs:16:1
    |
-LL | / fn boo() -> Foo { //~ ERROR defining existential type use differs from previous
+LL | / fn boo() -> Foo { //~ ERROR concrete type differs from previous
 LL | |     loop {}
 LL | | }
-   | |_^
+   | |_^ expected `&'static str`, got `()`
    |
 note: previous use here
   --> $DIR/different_defining_uses_never_type.rs:8:1
diff --git a/src/test/ui/existential_types/generic_different_defining_uses.rs b/src/test/ui/existential_types/generic_different_defining_uses.rs
index 3bd104251fb70..ce3ab88a1c0bb 100644
--- a/src/test/ui/existential_types/generic_different_defining_uses.rs
+++ b/src/test/ui/existential_types/generic_different_defining_uses.rs
@@ -8,6 +8,6 @@ fn my_iter(t: T) -> MyIter {
     std::iter::once(t)
 }
 
-fn my_iter2(t: T) -> MyIter { //~ ERROR defining existential type use differs from previous
+fn my_iter2(t: T) -> MyIter { //~ ERROR concrete type differs from previous
     Some(t).into_iter()
 }
diff --git a/src/test/ui/existential_types/generic_different_defining_uses.stderr b/src/test/ui/existential_types/generic_different_defining_uses.stderr
index 234bcf232ae79..3f129658b8fd0 100644
--- a/src/test/ui/existential_types/generic_different_defining_uses.stderr
+++ b/src/test/ui/existential_types/generic_different_defining_uses.stderr
@@ -1,10 +1,10 @@
-error: defining existential type use differs from previous
+error: concrete type differs from previous defining existential type use
   --> $DIR/generic_different_defining_uses.rs:11:1
    |
-LL | / fn my_iter2(t: T) -> MyIter { //~ ERROR defining existential type use differs from previous
+LL | / fn my_iter2(t: T) -> MyIter { //~ ERROR concrete type differs from previous
 LL | |     Some(t).into_iter()
 LL | | }
-   | |_^
+   | |_^ expected `std::iter::Once`, got `std::option::IntoIter`
    |
 note: previous use here
   --> $DIR/generic_different_defining_uses.rs:7:1
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use.rs b/src/test/ui/existential_types/generic_duplicate_param_use.rs
index 380fbdeb8c27c..3f8753333aa7a 100644
--- a/src/test/ui/existential_types/generic_duplicate_param_use.rs
+++ b/src/test/ui/existential_types/generic_duplicate_param_use.rs
@@ -1,9 +1,14 @@
 #![feature(existential_type)]
 
+use std::fmt::Debug;
+
 fn main() {}
 
-existential type Two: 'static; //~ ERROR type parameter `U` is unused
+// test that unused generic parameters are ok
+existential type Two: Debug;
+//~^ could not find defining uses
 
-fn one(t: T) -> Two {
+fn one(t: T) -> Two {
+//~^ ERROR defining existential type use restricts existential type
     t
 }
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use.stderr b/src/test/ui/existential_types/generic_duplicate_param_use.stderr
index 66706c210541c..d4deda999da16 100644
--- a/src/test/ui/existential_types/generic_duplicate_param_use.stderr
+++ b/src/test/ui/existential_types/generic_duplicate_param_use.stderr
@@ -1,9 +1,17 @@
-error[E0091]: type parameter `U` is unused
-  --> $DIR/generic_duplicate_param_use.rs:5:25
+error: defining existential type use restricts existential type by using the generic parameter `T` twice
+  --> $DIR/generic_duplicate_param_use.rs:11:1
    |
-LL | existential type Two: 'static; //~ ERROR type parameter `U` is unused
-   |                         ^ unused type parameter
+LL | / fn one(t: T) -> Two {
+LL | | //~^ ERROR defining existential type use restricts existential type
+LL | |     t
+LL | | }
+   | |_^
 
-error: aborting due to previous error
+error: could not find defining uses
+  --> $DIR/generic_duplicate_param_use.rs:8:1
+   |
+LL | existential type Two: Debug;
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0091`.
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use10.rs b/src/test/ui/existential_types/generic_duplicate_param_use10.rs
new file mode 100644
index 0000000000000..10f2c630582fc
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use10.rs
@@ -0,0 +1,12 @@
+// compile-pass
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+existential type Two: Debug;
+
+fn two(t: T, _: U) -> Two {
+    (t, 4u32)
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use2.rs b/src/test/ui/existential_types/generic_duplicate_param_use2.rs
new file mode 100644
index 0000000000000..3842292decd57
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use2.rs
@@ -0,0 +1,17 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+// test that unused generic parameters are ok
+existential type Two: Debug;
+
+fn one(t: T) -> Two {
+//~^ defining existential type use restricts existential type
+    t
+}
+
+fn two(t: T, _: U) -> Two {
+    t
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use2.stderr b/src/test/ui/existential_types/generic_duplicate_param_use2.stderr
new file mode 100644
index 0000000000000..0a8be3218c759
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use2.stderr
@@ -0,0 +1,11 @@
+error: defining existential type use restricts existential type by using the generic parameter `T` twice
+  --> $DIR/generic_duplicate_param_use2.rs:10:1
+   |
+LL | / fn one(t: T) -> Two {
+LL | | //~^ defining existential type use restricts existential type
+LL | |     t
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use3.rs b/src/test/ui/existential_types/generic_duplicate_param_use3.rs
new file mode 100644
index 0000000000000..05c77c8947333
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use3.rs
@@ -0,0 +1,22 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+// test that unused generic parameters are ok
+existential type Two: Debug;
+
+fn one(t: T) -> Two {
+//~^ defining existential type use restricts existential type
+    t
+}
+
+fn two(t: T, _: U) -> Two {
+    t
+}
+
+fn three(_: T, u: U) -> Two {
+//~^ concrete type's generic parameters differ from previous defining use
+    u
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use3.stderr b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr
new file mode 100644
index 0000000000000..1c96c15a76919
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use3.stderr
@@ -0,0 +1,28 @@
+error: defining existential type use restricts existential type by using the generic parameter `T` twice
+  --> $DIR/generic_duplicate_param_use3.rs:10:1
+   |
+LL | / fn one(t: T) -> Two {
+LL | | //~^ defining existential type use restricts existential type
+LL | |     t
+LL | | }
+   | |_^
+
+error: concrete type's generic parameters differ from previous defining use
+  --> $DIR/generic_duplicate_param_use3.rs:19:1
+   |
+LL | / fn three(_: T, u: U) -> Two {
+LL | | //~^ concrete type's generic parameters differ from previous defining use
+LL | |     u
+LL | | }
+   | |_^ expected [`T`], got [`U`]
+   |
+note: previous use here
+  --> $DIR/generic_duplicate_param_use3.rs:15:1
+   |
+LL | / fn two(t: T, _: U) -> Two {
+LL | |     t
+LL | | }
+   | |_^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use4.rs b/src/test/ui/existential_types/generic_duplicate_param_use4.rs
new file mode 100644
index 0000000000000..609dbe06cd733
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use4.rs
@@ -0,0 +1,17 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+// test that unused generic parameters are ok
+existential type Two: Debug;
+
+fn one(t: T) -> Two {
+//~^ ERROR defining existential type use restricts existential type
+    t
+}
+
+fn three(_: T, u: U) -> Two {
+    u
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use4.stderr b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr
new file mode 100644
index 0000000000000..24b1caf7c1bfe
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use4.stderr
@@ -0,0 +1,11 @@
+error: defining existential type use restricts existential type by using the generic parameter `T` twice
+  --> $DIR/generic_duplicate_param_use4.rs:10:1
+   |
+LL | / fn one(t: T) -> Two {
+LL | | //~^ ERROR defining existential type use restricts existential type
+LL | |     t
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.rs b/src/test/ui/existential_types/generic_duplicate_param_use5.rs
new file mode 100644
index 0000000000000..3f4a23b8b41fa
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use5.rs
@@ -0,0 +1,17 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+// test that unused generic parameters are ok
+existential type Two: Debug;
+
+fn two(t: T, u: U) -> Two {
+    (t, u)
+}
+
+fn three(t: T, u: U) -> Two {
+//~^ concrete type differs from previous
+    (u, t)
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use5.stderr b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr
new file mode 100644
index 0000000000000..166623801c246
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use5.stderr
@@ -0,0 +1,19 @@
+error: concrete type differs from previous defining existential type use
+  --> $DIR/generic_duplicate_param_use5.rs:14:1
+   |
+LL | / fn three(t: T, u: U) -> Two {
+LL | | //~^ concrete type differs from previous
+LL | |     (u, t)
+LL | | }
+   | |_^ expected `(T, U)`, got `(U, T)`
+   |
+note: previous use here
+  --> $DIR/generic_duplicate_param_use5.rs:10:1
+   |
+LL | / fn two(t: T, u: U) -> Two {
+LL | |     (t, u)
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use6.rs b/src/test/ui/existential_types/generic_duplicate_param_use6.rs
new file mode 100644
index 0000000000000..3b8c56352bda4
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use6.rs
@@ -0,0 +1,17 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+// test that unused generic parameters are ok
+existential type Two: Debug;
+
+fn two(t: T, u: U) -> Two {
+    (t, t)
+}
+
+fn three(t: T, u: U) -> Two {
+//~^ concrete type differs from previous
+    (u, t)
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use6.stderr b/src/test/ui/existential_types/generic_duplicate_param_use6.stderr
new file mode 100644
index 0000000000000..da49a83be1f70
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use6.stderr
@@ -0,0 +1,19 @@
+error: concrete type differs from previous defining existential type use
+  --> $DIR/generic_duplicate_param_use6.rs:14:1
+   |
+LL | / fn three(t: T, u: U) -> Two {
+LL | | //~^ concrete type differs from previous
+LL | |     (u, t)
+LL | | }
+   | |_^ expected `(T, T)`, got `(U, T)`
+   |
+note: previous use here
+  --> $DIR/generic_duplicate_param_use6.rs:10:1
+   |
+LL | / fn two(t: T, u: U) -> Two {
+LL | |     (t, t)
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use7.rs b/src/test/ui/existential_types/generic_duplicate_param_use7.rs
new file mode 100644
index 0000000000000..2bcac315f5a96
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use7.rs
@@ -0,0 +1,25 @@
+// compile-pass
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+existential type Two: Debug;
+
+fn two(t: T, u: U) -> Two {
+    (t, t)
+}
+
+fn three(t: T, t2: T, u: U) -> Two {
+    (t, t2)
+}
+
+fn four(t: T, t2: T, u: U, v: V) -> Two {
+    (t, t2)
+}
+
+fn five(x: X, y: Y, y2: Y) -> Two {
+    (y, y2)
+}
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use8.rs b/src/test/ui/existential_types/generic_duplicate_param_use8.rs
new file mode 100644
index 0000000000000..83501ad8c41a7
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use8.rs
@@ -0,0 +1,16 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+existential type Two: Debug;
+
+fn two(t: T, _: U) -> Two {
+    (t, 4u32)
+}
+
+fn three(_: T, u: U) -> Two {
+//~^ concrete type differs from previous
+    (u, 4u32)
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use8.stderr b/src/test/ui/existential_types/generic_duplicate_param_use8.stderr
new file mode 100644
index 0000000000000..80c7441c857d1
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use8.stderr
@@ -0,0 +1,19 @@
+error: concrete type differs from previous defining existential type use
+  --> $DIR/generic_duplicate_param_use8.rs:13:1
+   |
+LL | / fn three(_: T, u: U) -> Two {
+LL | | //~^ concrete type differs from previous
+LL | |     (u, 4u32)
+LL | | }
+   | |_^ expected `(T, u32)`, got `(U, u32)`
+   |
+note: previous use here
+  --> $DIR/generic_duplicate_param_use8.rs:9:1
+   |
+LL | / fn two(t: T, _: U) -> Two {
+LL | |     (t, 4u32)
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use9.rs b/src/test/ui/existential_types/generic_duplicate_param_use9.rs
new file mode 100644
index 0000000000000..4c6897298c44f
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use9.rs
@@ -0,0 +1,20 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+existential type Two: Debug;
+
+trait Foo {
+    type Bar: Debug;
+    const BAR: Self::Bar;
+}
+
+fn two(t: T, u: U) -> Two {
+    (t, u, T::BAR)
+}
+
+fn three(t: T, u: U) -> Two {
+    (t, u, 42) //~^ ERROR concrete type differs from previous
+}
diff --git a/src/test/ui/existential_types/generic_duplicate_param_use9.stderr b/src/test/ui/existential_types/generic_duplicate_param_use9.stderr
new file mode 100644
index 0000000000000..a3ce480d66dcd
--- /dev/null
+++ b/src/test/ui/existential_types/generic_duplicate_param_use9.stderr
@@ -0,0 +1,18 @@
+error: concrete type differs from previous defining existential type use
+  --> $DIR/generic_duplicate_param_use9.rs:18:1
+   |
+LL | / fn three(t: T, u: U) -> Two {
+LL | |     (t, u, 42) //~^ ERROR concrete type differs from previous
+LL | | }
+   | |_^ expected `(A, B, ::Bar)`, got `(A, B, i32)`
+   |
+note: previous use here
+  --> $DIR/generic_duplicate_param_use9.rs:14:1
+   |
+LL | / fn two(t: T, u: U) -> Two {
+LL | |     (t, u, T::BAR)
+LL | | }
+   | |_^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/existential_types/generic_nondefining_use.rs b/src/test/ui/existential_types/generic_nondefining_use.rs
index caa8f0f2ee1bc..75af5d9570ff2 100644
--- a/src/test/ui/existential_types/generic_nondefining_use.rs
+++ b/src/test/ui/existential_types/generic_nondefining_use.rs
@@ -3,8 +3,9 @@
 fn main() {}
 
 existential type Cmp: 'static;
+//~^ ERROR could not find defining uses
 
 // not a defining use, because it doesn't define *all* possible generics
-fn cmp() -> Cmp { //~ ERROR non-defining existential type use in defining scope
+fn cmp() -> Cmp { //~ ERROR defining existential type use does not fully define
     5u32
 }
diff --git a/src/test/ui/existential_types/generic_nondefining_use.stderr b/src/test/ui/existential_types/generic_nondefining_use.stderr
index 41877791e9ae9..8dd88006be9c6 100644
--- a/src/test/ui/existential_types/generic_nondefining_use.stderr
+++ b/src/test/ui/existential_types/generic_nondefining_use.stderr
@@ -1,16 +1,16 @@
-error: non-defining existential type use in defining scope
-  --> $DIR/generic_nondefining_use.rs:8:1
+error: defining existential type use does not fully define existential type
+  --> $DIR/generic_nondefining_use.rs:9:1
    |
-LL | / fn cmp() -> Cmp { //~ ERROR non-defining existential type use in defining scope
+LL | / fn cmp() -> Cmp { //~ ERROR defining existential type use does not fully define
 LL | |     5u32
 LL | | }
    | |_^
-   |
-note: used non-generic type u32 for generic parameter
-  --> $DIR/generic_nondefining_use.rs:5:22
+
+error: could not find defining uses
+  --> $DIR/generic_nondefining_use.rs:5:1
    |
 LL | existential type Cmp: 'static;
-   |                      ^
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to previous error
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/existential_types/not_a_defining_use.rs b/src/test/ui/existential_types/not_a_defining_use.rs
new file mode 100644
index 0000000000000..3f81f5177d0a4
--- /dev/null
+++ b/src/test/ui/existential_types/not_a_defining_use.rs
@@ -0,0 +1,40 @@
+#![feature(existential_type)]
+
+use std::fmt::Debug;
+
+fn main() {}
+
+existential type Two: Debug;
+
+fn two(t: T) -> Two {
+    //~^ ERROR defining existential type use does not fully define existential type
+    (t, 4i8)
+}
+
+fn three(t: T) -> Two {
+    (t, 5i8)
+}
+
+trait Bar {
+    type Blub: Debug;
+    const FOO: Self::Blub;
+}
+
+impl Bar for u32 {
+    type Blub = i32;
+    const FOO: i32 = 42;
+}
+
+// this should work! But it requires `two` and `three` not to be defining uses,
+// just restricting uses
+fn four(t: T) -> Two { //~ concrete type differs from previous
+    (t, ::FOO)
+}
+
+fn is_sync() {}
+
+fn asdfl() {
+    //FIXME(oli-obk): these currently cause cycle errors
+    //is_sync::>();
+    //is_sync::>();
+}
diff --git a/src/test/ui/existential_types/not_a_defining_use.stderr b/src/test/ui/existential_types/not_a_defining_use.stderr
new file mode 100644
index 0000000000000..288a32fc14edd
--- /dev/null
+++ b/src/test/ui/existential_types/not_a_defining_use.stderr
@@ -0,0 +1,27 @@
+error: defining existential type use does not fully define existential type
+  --> $DIR/not_a_defining_use.rs:9:1
+   |
+LL | / fn two(t: T) -> Two {
+LL | |     //~^ ERROR defining existential type use does not fully define existential type
+LL | |     (t, 4i8)
+LL | | }
+   | |_^
+
+error: concrete type differs from previous defining existential type use
+  --> $DIR/not_a_defining_use.rs:30:1
+   |
+LL | / fn four(t: T) -> Two { //~ concrete type differs from previous
+LL | |     (t, ::FOO)
+LL | | }
+   | |_^ expected `(T, i8)`, got `(T, ::Blub)`
+   |
+note: previous use here
+  --> $DIR/not_a_defining_use.rs:14:1
+   |
+LL | / fn three(t: T) -> Two {
+LL | |     (t, 5i8)
+LL | | }
+   | |_^
+
+error: aborting due to 2 previous errors
+
diff --git a/src/test/ui/existential_types/unused_generic_param.rs b/src/test/ui/existential_types/unused_generic_param.rs
index bd7b343b402f5..7af6508788129 100644
--- a/src/test/ui/existential_types/unused_generic_param.rs
+++ b/src/test/ui/existential_types/unused_generic_param.rs
@@ -1,15 +1,18 @@
+// compile-pass
 #![feature(existential_type)]
 
 fn main() {
 }
 
-existential type PartiallyDefined: 'static; //~ `T` is unused
+// test that unused generic parameters are ok
+existential type PartiallyDefined: 'static;
 
 fn partially_defined(_: T) -> PartiallyDefined {
     4u32
 }
 
-existential type PartiallyDefined2: 'static; //~ `T` is unused
+// test that unused generic parameters are ok
+existential type PartiallyDefined2: 'static;
 
 fn partially_defined2(_: T) -> PartiallyDefined2 {
     4u32
diff --git a/src/test/ui/existential_types/unused_generic_param.stderr b/src/test/ui/existential_types/unused_generic_param.stderr
deleted file mode 100644
index 348aed3c43914..0000000000000
--- a/src/test/ui/existential_types/unused_generic_param.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0091]: type parameter `T` is unused
-  --> $DIR/unused_generic_param.rs:6:35
-   |
-LL | existential type PartiallyDefined: 'static; //~ `T` is unused
-   |                                   ^ unused type parameter
-
-error[E0091]: type parameter `T` is unused
-  --> $DIR/unused_generic_param.rs:12:36
-   |
-LL | existential type PartiallyDefined2: 'static; //~ `T` is unused
-   |                                    ^ unused type parameter
-
-error: aborting due to 2 previous errors
-
-For more information about this error, try `rustc --explain E0091`.
diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs
index 0094091c6bd76..63db695f7e67c 100644
--- a/src/test/ui/hrtb/hrtb-perfect-forwarding.rs
+++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.rs
@@ -43,7 +43,7 @@ fn foo_hrtb_bar_not<'b,T>(mut t: T)
     // be implemented. Thus to satisfy `&mut T : for<'a> Foo<&'a
     // isize>`, we require `T : for<'a> Bar<&'a isize>`, but the where
     // clause only specifies `T : Bar<&'b isize>`.
-    foo_hrtb_bar_not(&mut t); //~ ERROR not general enough
+    foo_hrtb_bar_not(&mut t); //~ ERROR mismatched types
 }
 
 fn foo_hrtb_bar_hrtb(mut t: T)
diff --git a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr
index c7be3790aa1c8..ea08af0164061 100644
--- a/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr
+++ b/src/test/ui/hrtb/hrtb-perfect-forwarding.stderr
@@ -1,12 +1,12 @@
-error: implementation of `Foo` is not general enough
+error[E0308]: mismatched types
   --> $DIR/hrtb-perfect-forwarding.rs:46:5
    |
-LL |     foo_hrtb_bar_not(&mut t); //~ ERROR not general enough
-   |     ^^^^^^^^^^^^^^^^
+LL |     foo_hrtb_bar_not(&mut t); //~ ERROR mismatched types
+   |     ^^^^^^^^^^^^^^^^ one type is more general than the other
    |
-   = note: Due to a where-clause on `foo_hrtb_bar_not`,
-   = note: `&mut T` must implement `Foo<&'0 isize>`, for any lifetime `'0`
-   = note: but `&mut T` actually implements `Foo<&'1 isize>`, for some specific lifetime `'1`
+   = note: expected type `Bar<&'a isize>`
+              found type `Bar<&'b isize>`
 
 error: aborting due to previous error
 
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/issues/issue-57843.rs b/src/test/ui/issues/issue-57843.rs
new file mode 100644
index 0000000000000..466082552667b
--- /dev/null
+++ b/src/test/ui/issues/issue-57843.rs
@@ -0,0 +1,24 @@
+// Regression test for an ICE that occurred with the universes code:
+//
+// The signature of the closure `|_|` was being inferred to
+// `exists<'r> fn(&'r u8)`. This should result in a type error since
+// the signature `for<'r> fn(&'r u8)` is required. However, due to a
+// bug in the type variable generalization code, the placeholder for
+// `'r` was leaking out into the writeback phase, causing an ICE.
+
+trait ClonableFn {
+    fn clone(&self) -> Box;
+}
+
+impl ClonableFn for F
+where F: Fn(T) + Clone {
+    fn clone(&self) -> Box {
+        Box::new(self.clone())
+    }
+}
+
+struct Foo(Box ClonableFn<&'a bool>>);
+
+fn main() {
+    Foo(Box::new(|_| ())); //~ ERROR mismatched types
+}
diff --git a/src/test/ui/issues/issue-57843.stderr b/src/test/ui/issues/issue-57843.stderr
new file mode 100644
index 0000000000000..4ef884cb3f589
--- /dev/null
+++ b/src/test/ui/issues/issue-57843.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-57843.rs:23:9
+   |
+LL |     Foo(Box::new(|_| ())); //~ ERROR mismatched types
+   |         ^^^^^^^^^^^^^^^^ one type is more general than the other
+   |
+   = note: expected type `std::ops::FnOnce<(&'a bool,)>`
+              found type `std::ops::FnOnce<(&bool,)>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/src/test/ui/specialization/issue-39448.rs b/src/test/ui/specialization/issue-39448.rs
new file mode 100644
index 0000000000000..8ac6d8e9311fc
--- /dev/null
+++ b/src/test/ui/specialization/issue-39448.rs
@@ -0,0 +1,50 @@
+#![feature(specialization)]
+
+// Regression test for a specialization-related ICE (#39448).
+
+trait A: Sized {
+    fn foo(self, _: Self) -> Self {
+        self
+    }
+}
+
+impl A for u8 {}
+impl A for u16 {}
+
+impl FromA for u16 {
+    fn from(x: u8) -> u16 {
+        x as u16
+    }
+}
+
+trait FromA {
+    fn from(T) -> Self;
+}
+
+impl> FromA for U {
+    default fn from(x: T) -> Self {
+        ToA::to(x)
+    }
+}
+
+trait ToA {
+    fn to(self) -> T;
+}
+
+impl ToA for T
+where
+    U: FromA,
+{
+    fn to(self) -> U {
+        U::from(self)
+    }
+}
+
+#[allow(dead_code)]
+fn foo(x: T, y: U) -> U {
+    x.foo(y.to()).to() //~ ERROR overflow evaluating the requirement
+}
+
+fn main() {
+    let z = foo(8u8, 1u16);
+}
diff --git a/src/test/ui/specialization/issue-39448.stderr b/src/test/ui/specialization/issue-39448.stderr
new file mode 100644
index 0000000000000..0b0fd2c4af591
--- /dev/null
+++ b/src/test/ui/specialization/issue-39448.stderr
@@ -0,0 +1,12 @@
+error[E0275]: overflow evaluating the requirement `T: FromA`
+  --> $DIR/issue-39448.rs:45:13
+   |
+LL |     x.foo(y.to()).to() //~ ERROR overflow evaluating the requirement
+   |             ^^
+   |
+   = note: required because of the requirements on the impl of `FromA` for `T`
+   = note: required because of the requirements on the impl of `ToA` for `U`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0275`.
diff --git a/src/tools/clippy b/src/tools/clippy
index 3bda548f81bc2..d61b25419bec5 160000
--- a/src/tools/clippy
+++ b/src/tools/clippy
@@ -1 +1 @@
-Subproject commit 3bda548f81bc268a2e9813ce9168d2e40e8a11bd
+Subproject commit d61b25419bec5a3e839fdb16f720cfb12e52ddf1
diff --git a/src/tools/miri b/src/tools/miri
index a9505a8fb89ec..76138c56575c3 160000
--- a/src/tools/miri
+++ b/src/tools/miri
@@ -1 +1 @@
-Subproject commit a9505a8fb89ece7fa514cf3c70f1ada3e39baeec
+Subproject commit 76138c56575c347207039bdeafb8456bd72116ad
diff --git a/src/tools/rls b/src/tools/rls
index f331ff713917f..0d6f53e1a4adb 160000
--- a/src/tools/rls
+++ b/src/tools/rls
@@ -1 +1 @@
-Subproject commit f331ff713917f6edb044c7e5c6c28c3845afebe7
+Subproject commit 0d6f53e1a4adbaf7d83cdc0cb54720203fcb522e
diff --git a/src/tools/rustc-workspace-hack/Cargo.toml b/src/tools/rustc-workspace-hack/Cargo.toml
index f943ac9815ac6..157b731170738 100644
--- a/src/tools/rustc-workspace-hack/Cargo.toml
+++ b/src/tools/rustc-workspace-hack/Cargo.toml
@@ -60,7 +60,7 @@ parking_lot = { version = "0.6", features = ['nightly'] }
 rand = { version = "0.5.5", features = ["i128_support"] }
 serde = { version = "1.0.82", features = ['derive'] }
 serde_json = { version = "1.0.31", features = ["raw_value"] }
-smallvec = { version = "0.6", features = ['union'] }
+smallvec = { version = "0.6", features = ['union', 'may_dangle'] }
 scopeguard = { version = "0.3.3", features = ["use_std", "default"]}
 byteorder = { version = "1.2.7", features = ["i128"]}
 
diff --git a/src/tools/rustfmt b/src/tools/rustfmt
index be135599ef5e5..d6829d62dca64 160000
--- a/src/tools/rustfmt
+++ b/src/tools/rustfmt
@@ -1 +1 @@
-Subproject commit be135599ef5e54b5219f9adec68e1ee267ea0584
+Subproject commit d6829d62dca64dfe7ceaa96d1a9c1cd36428221d
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 17c36b80f3a7c..94dd5478e5297 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -45,6 +45,7 @@ const EXCEPTIONS: &[&str] = &[
     "im-rc",              // MPL-2.0+, cargo
     "adler32",            // BSD-3-Clause AND Zlib, cargo dep that isn't used
     "fortanix-sgx-abi",   // MPL-2.0+, libstd but only for `sgx` target
+    "constant_time_eq",   // CC0-1.0, rustfmt
 ];
 
 /// Which crates to check against the whitelist?